Search in sources :

Example 1 with DoNotShowAgainDialog

use of com.android.gallery3d.filtershow.ui.DoNotShowAgainDialog in project android_packages_apps_Gallery2 by LineageOS.

the class TruePortraitMaskEditorPanel method onResume.

@Override
public void onResume() {
    super.onResume();
    Context context = getActivity();
    boolean skipIntro = GalleryUtils.getBooleanPref(context, context.getString(R.string.pref_trueportrait_edit_intro_show_key), false);
    if (!skipIntro) {
        FragmentManager fm = getFragmentManager();
        DoNotShowAgainDialog dialog = (DoNotShowAgainDialog) fm.findFragmentByTag("trueportrait_edit_intro");
        if (dialog == null) {
            dialog = new DoNotShowAgainDialog(R.string.trueportrait_touch_up, R.string.trueportrait_edit_intro, R.string.pref_trueportrait_edit_intro_show_key);
            dialog.setCancelable(false);
            dialog.show(fm, "trueportrait_edit_intro");
        } else if (dialog.isDetached()) {
            FragmentTransaction ft = fm.beginTransaction();
            ft.attach(dialog);
            ft.commit();
        } else if (dialog.isHidden()) {
            FragmentTransaction ft = fm.beginTransaction();
            ft.show(dialog);
            ft.commit();
        }
    }
}
Also used : Context(android.content.Context) FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction) DoNotShowAgainDialog(com.android.gallery3d.filtershow.ui.DoNotShowAgainDialog)

Example 2 with DoNotShowAgainDialog

use of com.android.gallery3d.filtershow.ui.DoNotShowAgainDialog in project android_packages_apps_Gallery2 by LineageOS.

the class EditorTruePortraitFusion method resume.

@Override
public void resume() {
    if (mUnderlayUri.equals(Uri.EMPTY) && !pickDialogHasShown) {
        // No underlay set.
        boolean skipIntro = GalleryUtils.getBooleanPref(mContext, mContext.getString(R.string.pref_trueportrait_fusion_intro_show_key), false);
        if (!skipIntro) {
            FragmentManager fm = ((FilterShowActivity) mContext).getSupportFragmentManager();
            DoNotShowAgainDialog dialog = (DoNotShowAgainDialog) fm.findFragmentByTag("trueportrait_fusion_intro");
            if (dialog == null) {
                dialog = new DoNotShowAgainDialog(R.string.fusion_pick_background, R.string.trueportrait_fusion_intro, R.string.pref_trueportrait_fusion_intro_show_key);
                dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {

                    @Override
                    public void onCancel(DialogInterface dialog) {
                        FilterShowActivity activity = (FilterShowActivity) mContext;
                        activity.cancelCurrentFilter();
                        activity.leaveSeekBarPanel();
                    }
                });
                dialog.setOnOkButtonClickListener(new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        pickDialogHasShown = true;
                        MasterImage.getImage().getActivity().pickImage(FilterShowActivity.SELECT_FUSION_UNDERLAY);
                    }
                });
                dialog.setCancelable(true);
                dialog.show(fm, "trueportrait_fusion_intro");
            } else if (dialog.isDetached()) {
                FragmentTransaction ft = fm.beginTransaction();
                ft.attach(dialog);
                ft.commit();
            } else if (dialog.isHidden()) {
                FragmentTransaction ft = fm.beginTransaction();
                ft.show(dialog);
                ft.commit();
            }
        }
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction) DialogInterface(android.content.DialogInterface) DoNotShowAgainDialog(com.android.gallery3d.filtershow.ui.DoNotShowAgainDialog) FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity)

Example 3 with DoNotShowAgainDialog

use of com.android.gallery3d.filtershow.ui.DoNotShowAgainDialog in project android_packages_apps_Gallery2 by LineageOS.

the class EditorDualCamFusion method resume.

@Override
public void resume() {
    if (mUnderlayUri.equals(Uri.EMPTY)) {
        // No underlay set.
        boolean skipIntro = GalleryUtils.getBooleanPref(mContext, mContext.getString(R.string.pref_dualcam_fusion_intro_show_key), false);
        if (!skipIntro) {
            FragmentManager fm = ((FilterShowActivity) mContext).getSupportFragmentManager();
            DoNotShowAgainDialog dialog = (DoNotShowAgainDialog) fm.findFragmentByTag("dualcam_fusion_intro");
            if (dialog == null) {
                dialog = new DoNotShowAgainDialog(R.string.fusion_pick_background, R.string.dualcam_fusion_intro, R.string.pref_dualcam_fusion_intro_show_key);
                dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {

                    @Override
                    public void onCancel(DialogInterface dialog) {
                        FilterShowActivity activity = (FilterShowActivity) mContext;
                        activity.cancelCurrentFilter();
                        activity.leaveSeekBarPanel();
                    }
                });
                dialog.setOnOkButtonClickListener(new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        MasterImage.getImage().getActivity().pickImage(FilterShowActivity.SELECT_FUSION_UNDERLAY);
                    }
                });
                dialog.setCancelable(true);
                dialog.show(fm, "dualcam_fusion_intro");
            } else if (dialog.isDetached()) {
                FragmentTransaction ft = fm.beginTransaction();
                ft.attach(dialog);
                ft.commit();
            } else if (dialog.isHidden()) {
                FragmentTransaction ft = fm.beginTransaction();
                ft.show(dialog);
                ft.commit();
            }
        }
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction) DialogInterface(android.content.DialogInterface) DoNotShowAgainDialog(com.android.gallery3d.filtershow.ui.DoNotShowAgainDialog) FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity)

Example 4 with DoNotShowAgainDialog

use of com.android.gallery3d.filtershow.ui.DoNotShowAgainDialog in project android_packages_apps_Gallery2 by LineageOS.

the class MainPanel method getBottomPanelView.

@Override
public View getBottomPanelView(LayoutInflater inflater) {
    if (mBottomPanelView != null) {
        return mBottomPanelView;
    }
    LinearLayout bottomPanel = (LinearLayout) inflater.inflate(R.layout.filtershow_bottom_panel, null, false);
    looksButton = (ImageButton) bottomPanel.findViewById(R.id.fxButton);
    bordersButton = (ImageButton) bottomPanel.findViewById(R.id.borderButton);
    geometryButton = (ImageButton) bottomPanel.findViewById(R.id.geometryButton);
    filtersButton = (ImageButton) bottomPanel.findViewById(R.id.colorsButton);
    dualCamButton = (ImageButton) bottomPanel.findViewById(R.id.dualCamButton);
    if (SimpleMakeupImageFilter.HAS_TS_MAKEUP) {
        makeupButton = (ImageButton) bottomPanel.findViewById(R.id.makeupButton);
        makeupButton.setVisibility(View.VISIBLE);
    }
    if (makeupButton != null) {
        makeupButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                showPanel(MAKEUP);
            }
        });
    }
    trueScannerButton = (ImageButton) bottomPanel.findViewById(R.id.trueScannerButton);
    if (!TrueScannerActs.isTrueScannerEnabled()) {
        trueScannerButton.setVisibility(View.GONE);
    }
    hazeBusterButton = (ImageButton) bottomPanel.findViewById(R.id.hazeBusterButton);
    if (!HazeBusterActs.isHazeBusterEnabled()) {
        hazeBusterButton.setVisibility(View.GONE);
    }
    seeStraightButton = (ImageButton) bottomPanel.findViewById(R.id.seeStraightButton);
    if (!SeeStraightActs.isSeeStraightEnabled()) {
        seeStraightButton.setVisibility(View.GONE);
    }
    truePortraitButton = (ImageButton) bottomPanel.findViewById(R.id.truePortraitButton);
    if (!TruePortraitNativeEngine.getInstance().isLibLoaded()) {
        truePortraitButton.setVisibility(View.GONE);
    }
    waterMarkButton = (ImageButton) bottomPanel.findViewById(R.id.waterMarkButton);
    waterMarkButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            showPanel(WATERMARK);
        }
    });
    looksButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showPanel(LOOKS);
        }
    });
    bordersButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showPanel(BORDERS);
        }
    });
    geometryButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showPanel(GEOMETRY);
        }
    });
    filtersButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showPanel(FILTERS);
        }
    });
    dualCamButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Context context = getActivity();
            boolean skipIntro = GalleryUtils.getBooleanPref(context, context.getString(R.string.pref_dualcam_intro_show_key), false);
            if (skipIntro) {
                showPanel(DUALCAM);
            } else {
                DoNotShowAgainDialog dialog = new DoNotShowAgainDialog(R.string.dual_camera_effects, R.string.dual_camera_effects_intro, R.string.pref_dualcam_intro_show_key);
                dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {

                    @Override
                    public void onDismiss(DialogInterface dialog) {
                        showPanel(DUALCAM);
                    }
                });
                dialog.show(getFragmentManager(), "dualcam_intro");
            }
        }
    });
    truePortraitButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            Context context = getActivity();
            boolean skipIntro = GalleryUtils.getBooleanPref(context, context.getString(R.string.pref_trueportrait_intro_show_key), false);
            final boolean facesDetected = TruePortraitNativeEngine.getInstance().facesDetected();
            if (skipIntro && facesDetected) {
                showPanel(TRUEPORTRAIT);
            } else if (!skipIntro) {
                DoNotShowAgainDialog dialog = new DoNotShowAgainDialog(R.string.trueportrait, R.string.trueportrait_intro, R.string.pref_trueportrait_intro_show_key);
                dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {

                    @Override
                    public void onDismiss(DialogInterface dialog) {
                        if (facesDetected) {
                            showPanel(TRUEPORTRAIT);
                        } else {
                            v.setEnabled(false);
                            TruePortraitNativeEngine.getInstance().showNoFaceDetectedDialog(getFragmentManager());
                        }
                    }
                });
                dialog.show(getFragmentManager(), "trueportrait_intro");
            } else {
                v.setEnabled(false);
                TruePortraitNativeEngine.getInstance().showNoFaceDetectedDialog(getFragmentManager());
            }
        }
    });
    trueScannerButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showPanel(TRUESCANNER);
        }
    });
    hazeBusterButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showPanel(HAZEBUSTER);
        }
    });
    seeStraightButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showPanel(SEESTRAIGHT);
        }
    });
    mBottomPanelView = bottomPanel;
    return bottomPanel;
}
Also used : Context(android.content.Context) DialogInterface(android.content.DialogInterface) DoNotShowAgainDialog(com.android.gallery3d.filtershow.ui.DoNotShowAgainDialog) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Aggregations

DoNotShowAgainDialog (com.android.gallery3d.filtershow.ui.DoNotShowAgainDialog)4 DialogInterface (android.content.DialogInterface)3 FragmentManager (android.support.v4.app.FragmentManager)3 FragmentTransaction (android.support.v4.app.FragmentTransaction)3 Context (android.content.Context)2 FilterShowActivity (com.android.gallery3d.filtershow.FilterShowActivity)2 View (android.view.View)1 LinearLayout (android.widget.LinearLayout)1