use of com.ichi2.anki.multimediacard.fields.IFieldController in project AnkiChinaAndroid by ankichinateam.
the class MultimediaEditFieldActivity method recreateEditingUi.
private void recreateEditingUi(ChangeUIRequest newUI, @Nullable Bundle savedInstanceState) {
Timber.d("recreateEditingUi()");
// Permissions are checked async, save our current state to allow continuation
mCurrentChangeRequest = newUI;
// As we only get here a second time if we have the required permissions
if (newUI.getRequiresPermissionCheck() && performPermissionRequest(newUI.getField())) {
newUI.markAsPermissionRequested();
return;
}
IControllerFactory controllerFactory = BasicControllerFactory.getInstance(getCol().getTime());
IFieldController fieldController = controllerFactory.createControllerForField(newUI.getField());
if (fieldController == null) {
Timber.w("Field controller creation failed");
UIRecreationHandler.onControllerCreationFailed(newUI, this);
return;
}
UIRecreationHandler.onPreFieldControllerReplacement(mFieldController);
mFieldController = fieldController;
mField = newUI.getField();
setupUIController(mFieldController, savedInstanceState);
LinearLayout linearLayout = findViewById(R.id.LinearLayoutInScrollViewFieldEdit);
linearLayout.removeAllViews();
mFieldController.createUI(this, linearLayout);
UIRecreationHandler.onPostUICreation(newUI, this);
}
use of com.ichi2.anki.multimediacard.fields.IFieldController in project Anki-Android by ankidroid.
the class MultimediaEditFieldActivity method recreateEditingUi.
private void recreateEditingUi(ChangeUIRequest newUI, @Nullable Bundle savedInstanceState) {
Timber.d("recreateEditingUi()");
// Permissions are checked async, save our current state to allow continuation
mCurrentChangeRequest = newUI;
// As we only get here a second time if we have the required permissions
if (newUI.getRequiresPermissionCheck() && performPermissionRequest(newUI.getField())) {
newUI.markAsPermissionRequested();
return;
}
IControllerFactory controllerFactory = BasicControllerFactory.getInstance();
IFieldController fieldController = controllerFactory.createControllerForField(newUI.getField());
if (fieldController == null) {
Timber.w("Field controller creation failed");
UIRecreationHandler.onControllerCreationFailed(newUI, this);
return;
}
UIRecreationHandler.onPreFieldControllerReplacement(mFieldController);
mFieldController = fieldController;
mField = newUI.getField();
setupUIController(mFieldController, savedInstanceState);
LinearLayout linearLayout = findViewById(R.id.LinearLayoutInScrollViewFieldEdit);
linearLayout.removeAllViews();
mFieldController.createUI(this, linearLayout);
UIRecreationHandler.onPostUICreation(newUI, this);
}
Aggregations