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();
}
}
}
}
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();
}
});
}
}
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;
}
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;
}
}
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);
}
}
Aggregations