use of com.android.camera.ui.RotateLayout in project android_packages_apps_Snap by LineageOS.
the class CaptureUI method setOrientation.
public void setOrientation(int orientation, boolean animation) {
mOrientation = orientation;
mCameraControls.setOrientation(orientation, animation);
if (mFilterLayout != null) {
ViewGroup vg = (ViewGroup) mFilterLayout.getChildAt(0);
if (vg != null)
vg = (ViewGroup) vg.getChildAt(0);
if (vg != null) {
for (int i = vg.getChildCount() - 1; i >= 0; --i) {
RotateLayout l = (RotateLayout) vg.getChildAt(i);
l.setOrientation(orientation, animation);
}
}
}
if (mRecordingTimeRect != null) {
mRecordingTimeView.setRotation(-orientation);
}
if (mFaceView != null) {
mFaceView.setDisplayRotation(orientation);
}
if (mCountDownView != null)
mCountDownView.setOrientation(orientation);
RotateTextToast.setOrientation(orientation);
if (mZoomRenderer != null) {
mZoomRenderer.setOrientation(orientation);
}
if (mSceneModeLabelRect != null) {
if (orientation == 180) {
mSceneModeName.setRotation(180);
mSceneModeLabelCloseIcon.setRotation(180);
mSceneModeLabelRect.setOrientation(0, false);
} else {
mSceneModeName.setRotation(0);
mSceneModeLabelCloseIcon.setRotation(0);
mSceneModeLabelRect.setOrientation(orientation, false);
}
}
if (mSceneModeInstructionalDialog != null && mSceneModeInstructionalDialog.isShowing()) {
mSceneModeInstructionalDialog.dismiss();
mSceneModeInstructionalDialog = null;
showSceneInstructionalDialog(orientation);
}
}
use of com.android.camera.ui.RotateLayout in project android_packages_apps_Snap by LineageOS.
the class VideoMenu method addFilterMode.
public void addFilterMode() {
final IconListPreference pref = (IconListPreference) mPreferenceGroup.findPreference(CameraSettings.KEY_VIDEOCAMERA_COLOR_EFFECT);
if (pref == null)
return;
int rotation = CameraUtil.getDisplayRotation(mActivity);
boolean mIsDefaultToPortrait = CameraUtil.isDefaultToPortrait(mActivity);
if (!mIsDefaultToPortrait) {
rotation = (rotation + 90) % 360;
}
WindowManager wm = (WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
CharSequence[] entries = pref.getEntries();
Resources r = mActivity.getResources();
int height = (int) (r.getDimension(R.dimen.filter_mode_height) + 2 * r.getDimension(R.dimen.filter_mode_padding) + 1);
int width = (int) (r.getDimension(R.dimen.filter_mode_width) + 2 * r.getDimension(R.dimen.filter_mode_padding) + 1);
int gridRes = 0;
boolean portrait = (rotation == 0) || (rotation == 180);
int size = height;
if (portrait) {
gridRes = R.layout.vertical_grid;
size = width;
} else {
gridRes = R.layout.horiz_grid;
}
previewMenuSize = size;
mUI.hideUI();
mPreviewMenuStatus = PREVIEW_MENU_ON;
mSceneStatus = MODE_FILTER;
int[] thumbnails = pref.getThumbnailIds();
LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
FrameLayout basic = (FrameLayout) inflater.inflate(gridRes, null, false);
mUI.dismissSceneModeMenu();
LinearLayout previewMenuLayout = new LinearLayout(mActivity);
mUI.setPreviewMenuLayout(previewMenuLayout);
ViewGroup.LayoutParams params = null;
if (portrait) {
params = new ViewGroup.LayoutParams(size, LayoutParams.MATCH_PARENT);
previewMenuLayout.setLayoutParams(params);
((ViewGroup) mUI.getRootView()).addView(previewMenuLayout);
} else {
params = new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, size);
previewMenuLayout.setLayoutParams(params);
((ViewGroup) mUI.getRootView()).addView(previewMenuLayout);
previewMenuLayout.setY(display.getHeight() - size);
}
basic.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
LinearLayout layout = (LinearLayout) basic.findViewById(R.id.layout);
final View[] views = new View[entries.length];
int init = pref.getCurrentIndex();
for (int i = 0; i < entries.length; i++) {
RotateLayout layout2 = (RotateLayout) inflater.inflate(R.layout.filter_mode_view, null, false);
ImageView imageView = (ImageView) layout2.findViewById(R.id.image);
final int j = i;
layout2.setOnTouchListener(new View.OnTouchListener() {
private long startTime;
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
startTime = System.currentTimeMillis();
} else if (event.getAction() == MotionEvent.ACTION_UP) {
if (System.currentTimeMillis() - startTime < CLICK_THRESHOLD) {
pref.setValueIndex(j);
changeFilterModeControlIcon(pref.getValue());
for (View v1 : views) {
v1.setActivated(v1 == v);
}
onSettingChanged(pref);
}
}
return true;
}
});
views[j] = layout2;
layout2.setActivated(i == init);
TextView label = (TextView) layout2.findViewById(R.id.label);
imageView.setImageResource(thumbnails[i]);
label.setText(entries[i]);
layout.addView(layout2);
}
previewMenuLayout.addView(basic);
mPreviewMenu = basic;
}
use of com.android.camera.ui.RotateLayout in project android_packages_apps_Snap by LineageOS.
the class VideoUI method setOrientation.
public void setOrientation(int orientation, boolean animation) {
mCameraControls.setOrientation(orientation, animation);
if (mMenuLayout != null)
mMenuLayout.setOrientation(orientation, animation);
if (mSubMenuLayout != null)
mSubMenuLayout.setOrientation(orientation, animation);
if (mRecordingTimeRect != null) {
if (orientation == 180) {
mRecordingTimeRect.setOrientation(0, false);
mRecordingTimeView.setRotation(180);
} else {
mRecordingTimeView.setRotation(0);
mRecordingTimeRect.setOrientation(orientation, false);
}
}
if (mPreviewMenuLayout != null) {
ViewGroup vg = (ViewGroup) mPreviewMenuLayout.getChildAt(0);
if (vg != null)
vg = (ViewGroup) vg.getChildAt(0);
if (vg != null) {
for (int i = vg.getChildCount() - 1; i >= 0; --i) {
RotateLayout l = (RotateLayout) vg.getChildAt(i);
l.setOrientation(orientation, animation);
}
}
}
if (mZoomRenderer != null) {
mZoomRenderer.setOrientation(orientation);
}
RotateTextToast.setOrientation(orientation);
mOrientation = orientation;
}
use of com.android.camera.ui.RotateLayout in project android_packages_apps_Snap by LineageOS.
the class PhotoUI method setOrientation.
public void setOrientation(int orientation, boolean animation) {
mOrientation = orientation;
mCameraControls.setOrientation(orientation, animation);
if (mMenuLayout != null)
mMenuLayout.setOrientation(orientation, animation);
if (mSubMenuLayout != null)
mSubMenuLayout.setOrientation(orientation, animation);
if (mPreviewMenuLayout != null) {
ViewGroup vg = (ViewGroup) mPreviewMenuLayout.getChildAt(0);
if (vg != null)
vg = (ViewGroup) vg.getChildAt(0);
if (vg != null) {
for (int i = vg.getChildCount() - 1; i >= 0; --i) {
RotateLayout l = (RotateLayout) vg.getChildAt(i);
l.setOrientation(orientation, animation);
}
}
}
if (mMakeupMenuLayout != null) {
View view = mMakeupMenuLayout.getChildAt(0);
if (view instanceof RotateLayout) {
for (int i = mMakeupMenuLayout.getChildCount() - 1; i >= 0; --i) {
RotateLayout l = (RotateLayout) mMakeupMenuLayout.getChildAt(i);
l.setOrientation(orientation, animation);
}
} else {
ViewGroup vg = (ViewGroup) mMakeupMenuLayout.getChildAt(1);
if (vg != null) {
for (int i = vg.getChildCount() - 1; i >= 0; --i) {
ViewGroup vewiGroup = (ViewGroup) vg.getChildAt(i);
if (vewiGroup instanceof RotateLayout) {
RotateLayout l = (RotateLayout) vewiGroup;
l.setOrientation(orientation, animation);
}
}
}
}
}
if (mCountDownView != null)
mCountDownView.setOrientation(orientation);
RotateTextToast.setOrientation(orientation);
if (mFaceView != null) {
mFaceView.setDisplayRotation(orientation);
}
if (mZoomRenderer != null) {
mZoomRenderer.setOrientation(orientation);
}
if (mReviewImage != null) {
RotateImageView v = (RotateImageView) mReviewImage;
v.setOrientation(orientation, animation);
}
mOrientation = orientation;
}
use of com.android.camera.ui.RotateLayout in project android_packages_apps_Snap by LineageOS.
the class PhotoMenu method addFilterMode.
public void addFilterMode() {
final IconListPreference pref = (IconListPreference) mPreferenceGroup.findPreference(CameraSettings.KEY_COLOR_EFFECT);
if (pref == null)
return;
int rotation = CameraUtil.getDisplayRotation(mActivity);
boolean mIsDefaultToPortrait = CameraUtil.isDefaultToPortrait(mActivity);
if (!mIsDefaultToPortrait) {
rotation = (rotation + 90) % 360;
}
WindowManager wm = (WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
CharSequence[] entries = pref.getEntries();
Resources r = mActivity.getResources();
int height = (int) (r.getDimension(R.dimen.filter_mode_height) + 2 * r.getDimension(R.dimen.filter_mode_padding) + 1);
int width = (int) (r.getDimension(R.dimen.filter_mode_width) + 2 * r.getDimension(R.dimen.filter_mode_padding) + 1);
int gridRes = 0;
boolean portrait = (rotation == 0) || (rotation == 180);
int size = height;
if (portrait) {
gridRes = R.layout.vertical_grid;
size = width;
} else {
gridRes = R.layout.horiz_grid;
}
previewMenuSize = size;
mUI.hideUI();
mPreviewMenuStatus = PREVIEW_MENU_ON;
mSceneStatus = MODE_FILTER;
int[] thumbnails = pref.getThumbnailIds();
LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
FrameLayout basic = (FrameLayout) inflater.inflate(gridRes, null, false);
mUI.dismissSceneModeMenu();
LinearLayout previewMenuLayout = new LinearLayout(mActivity);
mUI.setPreviewMenuLayout(previewMenuLayout);
ViewGroup.LayoutParams params = null;
if (portrait) {
params = new ViewGroup.LayoutParams(size, LayoutParams.MATCH_PARENT);
previewMenuLayout.setLayoutParams(params);
((ViewGroup) mUI.getRootView()).addView(previewMenuLayout);
} else {
params = new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, size);
previewMenuLayout.setLayoutParams(params);
((ViewGroup) mUI.getRootView()).addView(previewMenuLayout);
previewMenuLayout.setY(display.getHeight() - size);
}
basic.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
LinearLayout layout = (LinearLayout) basic.findViewById(R.id.layout);
final View[] views = new View[entries.length];
int init = pref.getCurrentIndex();
for (int i = 0; i < entries.length; i++) {
RotateLayout layout2 = (RotateLayout) inflater.inflate(R.layout.filter_mode_view, null, false);
ImageView imageView = (ImageView) layout2.findViewById(R.id.image);
final int j = i;
layout2.setOnTouchListener(new View.OnTouchListener() {
private long startTime;
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
startTime = System.currentTimeMillis();
} else if (event.getAction() == MotionEvent.ACTION_UP) {
if (System.currentTimeMillis() - startTime < CLICK_THRESHOLD) {
pref.setValueIndex(j);
changeFilterModeControlIcon(pref.getValue());
onSettingChanged(pref);
for (View v1 : views) {
v1.setActivated(v1 == v);
}
}
}
return true;
}
});
views[j] = layout2;
layout2.setActivated(i == init);
TextView label = (TextView) layout2.findViewById(R.id.label);
imageView.setImageResource(thumbnails[i]);
label.setText(entries[i]);
layout.addView(layout2);
}
previewMenuLayout.addView(basic);
mPreviewMenu = basic;
}
Aggregations