public static final int BORDERS = 1;
public static final int GEOMETRY = 2;
public static final int FILTERS = 3;
+ public static final int VERSIONS = 4;
private int mCurrentSelected = -1;
+ private int mPreviousToggleVersions = -1;
private void selection(int position, boolean value) {
if (value) {
public void loadCategoryLookPanel() {
if (mCurrentSelected == LOOKS) {
+
return;
}
boolean fromRight = isRightAnimation(LOOKS);
selection(mCurrentSelected, true);
}
+ public void loadCategoryVersionsPanel() {
+ if (mCurrentSelected == VERSIONS) {
+ return;
+ }
+ FilterShowActivity activity = (FilterShowActivity) getActivity();
+ activity.updateVersions();
+ boolean fromRight = isRightAnimation(VERSIONS);
+ selection(mCurrentSelected, false);
+ CategoryPanel categoryPanel = new CategoryPanel();
+ categoryPanel.setAdapter(VERSIONS);
+ setCategoryFragment(categoryPanel, fromRight);
+ mCurrentSelected = VERSIONS;
+ selection(mCurrentSelected, true);
+ }
+
public void showPanel(int currentPanel) {
switch (currentPanel) {
case LOOKS: {
loadCategoryFiltersPanel();
break;
}
+ case VERSIONS: {
+ loadCategoryVersionsPanel();
+ break;
+ }
}
}
+ public void setToggleVersionsPanelButton(ImageButton button) {
+ if (button == null) {
+ return;
+ }
+ button.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mCurrentSelected == VERSIONS) {
+ showPanel(mPreviousToggleVersions);
+ } else {
+ mPreviousToggleVersions = mCurrentSelected;
+ showPanel(VERSIONS);
+ }
+ }
+ });
+ }
+
public void showImageStatePanel(boolean show) {
if (mMainView.findViewById(R.id.state_panel_container) == null) {
return;
}
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
final View container = mMainView.findViewById(R.id.state_panel_container);
+ int currentPanel = mCurrentSelected;
if (show) {
container.setVisibility(View.VISIBLE);
StatePanel statePanel = new StatePanel();
+ statePanel.setMainPanel(this);
+ FilterShowActivity activity = (FilterShowActivity) getActivity();
+ activity.updateVersions();
transaction.replace(R.id.state_panel_container, statePanel, StatePanel.FRAGMENT_TAG);
} else {
container.setVisibility(View.GONE);
if (statePanel != null) {
transaction.remove(statePanel);
}
+ if (currentPanel == VERSIONS) {
+ currentPanel = LOOKS;
+ }
}
+ mCurrentSelected = -1;
+ showPanel(currentPanel);
transaction.commit();
}
}