use of com.android.gallery3d.filtershow.editors.EditorPanel in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method loadEditorPanel.
public void loadEditorPanel(final FilterRepresentation representation) {
final int currentId = representation.getEditorId();
// show representation
if (mCurrentEditor != null) {
mCurrentEditor.detach();
}
mCurrentEditor = mEditorPlaceHolder.showEditor(currentId);
if (mCurrentEditor.showsActionBar()) {
setActionBar();
showActionBar(true);
} else {
// showActionBar(false);
}
if (representation.getFilterType() == FilterRepresentation.TYPE_WATERMARK_CATEGORY) {
loadWaterMarkPanel((FilterWatermarkRepresentation) representation);
return;
}
if (currentId == ImageOnlyEditor.ID) {
mCurrentEditor.reflectCurrentFilter();
return;
}
if (currentId == EditorTruePortraitImageOnly.ID) {
mCurrentEditor.reflectCurrentFilter();
setActionBarForEffects(mCurrentEditor);
return;
}
if (currentId == EditorCrop.ID) {
loadEditorCropPanel();
return;
}
if (useStraightenPanel(currentId)) {
new Runnable() {
@Override
public void run() {
StraightenPanel panel = new StraightenPanel();
Bundle bundle = new Bundle();
bundle.putInt(StraightenPanel.EDITOR_ID, currentId);
bundle.putString(StraightenPanel.EDITOR_NAME, representation.getName());
panel.setArguments(bundle);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.remove(getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG));
transaction.replace(R.id.main_panel_container, panel, MainPanel.FRAGMENT_TAG);
transaction.commit();
}
}.run();
return;
}
if (currentId == TrueScannerEditor.ID) {
new Runnable() {
@Override
public void run() {
TrueScannerPanel panel = new TrueScannerPanel();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.remove(getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG));
transaction.replace(R.id.main_panel_container, panel, MainPanel.FRAGMENT_TAG);
transaction.commit();
}
}.run();
return;
}
if (currentId == EditorTruePortraitMask.ID) {
new Runnable() {
@Override
public void run() {
setActionBarForEffects(mCurrentEditor);
TruePortraitMaskEditorPanel panel = new TruePortraitMaskEditorPanel();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.remove(getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG));
transaction.replace(R.id.main_panel_container, panel, MainPanel.FRAGMENT_TAG);
transaction.commit();
}
}.run();
return;
}
Runnable showEditor = new Runnable() {
@Override
public void run() {
EditorPanel panel = new EditorPanel();
panel.setEditor(currentId);
setActionBarForEffects(mCurrentEditor);
Fragment main = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
if (main instanceof MainPanel) {
((MainPanel) main).setEditorPanelFragment(panel);
}
}
};
Fragment main = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
boolean doAnimation = false;
if (mShowingImageStatePanel && getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
doAnimation = true;
}
if (doAnimation && main != null && main instanceof MainPanel) {
MainPanel mainPanel = (MainPanel) main;
View container = mainPanel.getView().findViewById(R.id.category_panel_container);
View bottom = mainPanel.getView().findViewById(R.id.bottom_panel);
int panelHeight = container.getHeight() + bottom.getHeight();
ViewPropertyAnimator anim = mainPanel.getView().animate();
anim.translationY(panelHeight).start();
final Handler handler = new Handler();
handler.postDelayed(showEditor, anim.getDuration());
} else {
showEditor.run();
}
}
use of com.android.gallery3d.filtershow.editors.EditorPanel in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method toggleImageStatePanel.
// //////////////////////////////////////////////////////////////////////////////
// imageState panel...
public void toggleImageStatePanel() {
invalidateOptionsMenu();
mShowingImageStatePanel = !mShowingImageStatePanel;
Fragment panel = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
if (panel != null) {
if (panel instanceof EditorPanel) {
EditorPanel editorPanel = (EditorPanel) panel;
editorPanel.showImageStatePanel(mShowingImageStatePanel);
} else if (panel instanceof MainPanel) {
MainPanel mainPanel = (MainPanel) panel;
mainPanel.showImageStatePanel(mShowingImageStatePanel);
}
}
}
Aggregations