List of usage examples for android.view ViewPropertyAnimator getDuration
public long getDuration()
From source file:com.android.gallery3d.filtershow.FilterShowActivity.java
public void loadEditorPanel(FilterRepresentation representation, final Editor currentEditor) { if (representation.getEditorId() == ImageOnlyEditor.ID) { currentEditor.reflectCurrentFilter(); return;/* w w w .j ava 2s. c om*/ } final int currentId = currentEditor.getID(); Runnable showEditor = new Runnable() { @Override public void run() { EditorPanel panel = new EditorPanel(); panel.setEditor(currentId); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.remove(getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG)); transaction.replace(R.id.main_panel_container, panel, MainPanel.FRAGMENT_TAG); transaction.commit(); } }; 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(); } }
From source file:com.android.gallery3d.v5.filtershow.FilterShowActivity.java
public void loadEditorPanel(FilterRepresentation representation, final Editor currentEditor) { if (representation.getEditorId() == ImageOnlyEditor.ID) { currentEditor.reflectCurrentFilter(); return;//from w w w .j a v a2 s . c o m } final int currentId = currentEditor.getID(); Runnable showEditor = new Runnable() { @Override public void run() { Log.i("Test", "showEditor"); EditorPanel panel = new EditorPanel(); panel.setEditor(currentId); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.remove(getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG)); transaction.replace(R.id.main_panel_container, panel, MainPanel.FRAGMENT_TAG); transaction.commit(); } }; 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(); } }