src/main/java/de/blau/android/easyedit/EasyEditManager.java
/**
     * Edit currently selected elements, tries to restart a previous mode if it has been saved
     */
Edit currently selected elements, tries to restart a previous mode if it has been saved
Edit currently selected elements tries to restart a previous mode if it has been saved
public void restart() {
        synchronized (actionModeCallbackLock) {
            if (currentActionModeCallback == null) {
                Log.d(DEBUG_TAG, "Trying to restart " + restartActionModeCallbackName);
                if (isRestartable(restartActionModeCallbackName)) {
                    new ExecutorTask<Void, Void, SerializableState>(logic.getExecutorService(), logic.getHandler()) {
                        @Override
                        protected SerializableState doInBackground(Void param) {
                            return savingHelper.load(main, FILENAME, false, true, true);
                        }
                        @Override
                        protected void onPostExecute(SerializableState state) {
                            try {
                                if (state != null) {
                                    try {
                                        Class<?> clazz = Class.forName(restartActionModeCallbackName);
                                        Constructor<?> constructor = clazz.getConstructor(EasyEditManager.class, SerializableState.class);
                                        ActionMode.Callback cb = (ActionMode.Callback) constructor.newInstance(EasyEditManager.this, state);
                                        getMain().startSupportActionMode(cb);
                                        return;
                                    } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException
                                            | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) {
                                        Log.e(DEBUG_TAG, "Restarting " + restartActionModeCallbackName + " received " + exception.getClass().getCanonicalName()
                                                + " " + exception.getMessage());
                                    }
                                }
                                Log.e(DEBUG_TAG, "restart, saved state is null");
                                startElementSelectionMode();
                            } finally {
                                restartActionModeCallbackName = null;
                            }
                        }
                    }.execute();
                } else {
                    startElementSelectionMode();
                }
            }
        }
    }
public void restart ( ) { synchronized ( actionModeCallbackLock ) { if ( currentActionModeCallback == null ) { Log . d ( DEBUG_TAG , "Trying to restart " + restartActionModeCallbackName ) ; if ( isRestartable ( restartActionModeCallbackName ) ) { new ExecutorTask < Void , Void , SerializableState > ( logic . getExecutorService ( ) , logic . getHandler ( ) ) { @ Override protected SerializableState doInBackground ( Void param ) { return savingHelper . load ( main , FILENAME , false , true , true ) ; } @ Override protected void onPostExecute ( SerializableState state ) { try { if ( state != null ) { try { Class < ? > clazz = Class . forName ( restartActionModeCallbackName ) ; Constructor < ? > constructor = clazz . getConstructor ( EasyEditManager . class , SerializableState . class ) ; ActionMode . Callback cb = ( ActionMode . Callback ) constructor . newInstance ( EasyEditManager . this , state ) ; getMain ( ) . startSupportActionMode ( cb ) ; return ; } catch ( ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception ) { Log . e ( DEBUG_TAG , "Restarting " + restartActionModeCallbackName + " received " + exception . getClass ( ) . getCanonicalName ( ) + " " + exception . getMessage ( ) ) ; } } Log . e ( DEBUG_TAG , "restart, saved state is null" ) ; startElementSelectionMode ( ) ; } finally { restartActionModeCallbackName = null ; } } } . execute ( ) ; } else { startElementSelectionMode ( ) ; } } } }
Edit currently selected elements, tries to restart a previous mode if it has been saved
Edit currently selected elements tries to restart a previous mode if it has been saved