Search in sources :

Example 21 with FilterShowActivity

use of com.android.gallery3d.filtershow.FilterShowActivity 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 22 with FilterShowActivity

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

the class EditorDualCamFusion method setEditPanelUI.

@Override
public void setEditPanelUI(View editControl) {
    ViewGroup controlContainer = (ViewGroup) editControl;
    controlContainer.removeAllViews();
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View controls = inflater.inflate(R.layout.filtershow_seekbar, controlContainer);
    View seekbar = controls.findViewById(R.id.primarySeekBar);
    seekbar.setVisibility(View.GONE);
    View saveButton = controls.findViewById(R.id.slider_save);
    if (saveButton != null) {
        saveButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                FilterShowActivity activity = (FilterShowActivity) mContext;
                finalApplyCalled();
                activity.leaveSeekBarPanel();
            }
        });
    }
    View cancelButton = controls.findViewById(R.id.slider_cancel);
    if (cancelButton != null) {
        cancelButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                FilterShowActivity activity = (FilterShowActivity) mContext;
                activity.cancelCurrentFilter();
                activity.leaveSeekBarPanel();
            }
        });
    }
}
Also used : ViewGroup(android.view.ViewGroup) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.view.View.OnClickListener) FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity) View(android.view.View)

Example 23 with FilterShowActivity

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

the class StatePanelTrack method onTouchEvent.

@Override
public boolean onTouchEvent(MotionEvent event) {
    if (mCurrentView == null) {
        return false;
    }
    if (mTouchTime == 0) {
        mTouchTime = System.currentTimeMillis();
    }
    mGestureDetector.onTouchEvent(event);
    if (mTouchPoint == null) {
        mTouchPoint = new Point();
        mTouchPoint.x = (int) event.getX();
        mTouchPoint.y = (int) event.getY();
    }
    if (event.getActionMasked() == MotionEvent.ACTION_MOVE) {
        float translation = event.getY() - mTouchPoint.y;
        float alpha = 1.0f - (Math.abs(translation) / mCurrentView.getHeight());
        if (getOrientation() == LinearLayout.VERTICAL) {
            translation = event.getX() - mTouchPoint.x;
            alpha = 1.0f - (Math.abs(translation) / mCurrentView.getWidth());
            mCurrentView.setTranslationX(translation);
        } else {
            mCurrentView.setTranslationY(translation);
        }
        mCurrentView.setBackgroundAlpha(alpha);
        if (ALLOWS_DRAG && alpha < 0.7) {
            setOnDragListener(mDragListener);
            DragShadowBuilder shadowBuilder = new DragShadowBuilder(mCurrentView);
            mCurrentView.startDrag(null, shadowBuilder, mCurrentView, 0);
            mStartedDrag = true;
        }
    }
    if (!mExited && mCurrentView != null && mCurrentView.getBackgroundAlpha() > mDeleteSlope && event.getActionMasked() == MotionEvent.ACTION_UP && System.currentTimeMillis() - mTouchTime < mMaxTouchDelay) {
        FilterRepresentation representation = mCurrentView.getState().getFilterRepresentation();
        mCurrentView.setSelected(true);
        if (representation != MasterImage.getImage().getCurrentFilterRepresentation()) {
            FilterShowActivity activity = (FilterShowActivity) getContext();
            activity.showRepresentation(representation);
            mCurrentView.setSelected(false);
        }
    }
    if (event.getActionMasked() == MotionEvent.ACTION_UP || (!mStartedDrag && event.getActionMasked() == MotionEvent.ACTION_CANCEL)) {
        checkEndState();
        if (mCurrentView != null) {
            FilterRepresentation representation = mCurrentView.getState().getFilterRepresentation();
            if (representation.getEditorId() == ImageOnlyEditor.ID) {
                mCurrentView.setSelected(false);
            }
        }
    }
    return true;
}
Also used : FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity) Point(android.graphics.Point)

Example 24 with FilterShowActivity

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

the class CategoryPanel method onClick.

@Override
public void onClick(View v) {
    switch(v.getId()) {
        case R.id.addButton:
            FilterShowActivity activity = (FilterShowActivity) getActivity();
            activity.addCurrentVersion();
            break;
    }
}
Also used : FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity)

Example 25 with FilterShowActivity

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

the class MainPanel method loadCategorySeeStraightPanel.

public void loadCategorySeeStraightPanel() {
    final FilterShowActivity activity = (FilterShowActivity) getActivity();
    CategoryAdapter adapter = activity.getCategorySeeStraightAdapter();
    if (adapter.getCount() == 1) {
        activity.showRepresentation(adapter.getItem(0).getRepresentation());
    } else {
        boolean fromRight = isRightAnimation(SEESTRAIGHT);
        selection(mCurrentSelected, false);
        CategoryPanel categoryPanel = new CategoryPanel();
        categoryPanel.setAdapter(SEESTRAIGHT);
        setCategoryFragment(categoryPanel, fromRight);
        mCurrentSelected = SEESTRAIGHT;
        selection(mCurrentSelected, true);
    }
}
Also used : FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity)

Aggregations

FilterShowActivity (com.android.gallery3d.filtershow.FilterShowActivity)48 View (android.view.View)11 Button (android.widget.Button)6 FragmentTransaction (android.support.v4.app.FragmentTransaction)5 TextView (android.widget.TextView)5 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)5 MenuItem (android.view.MenuItem)4 PopupMenu (android.widget.PopupMenu)4 DialogInterface (android.content.DialogInterface)3 LayoutInflater (android.view.LayoutInflater)3 ViewGroup (android.view.ViewGroup)3 Point (android.graphics.Point)2 Fragment (android.support.v4.app.Fragment)2 FragmentManager (android.support.v4.app.FragmentManager)2 OnClickListener (android.view.View.OnClickListener)2 ImageButton (android.widget.ImageButton)2 MasterImage (com.android.gallery3d.filtershow.imageshow.MasterImage)2 StatePanel (com.android.gallery3d.filtershow.state.StatePanel)2 DoNotShowAgainDialog (com.android.gallery3d.filtershow.ui.DoNotShowAgainDialog)2 AlertDialog (android.app.AlertDialog)1