use of com.android.camera.ui.DotsView in project android_packages_apps_Snap by LineageOS.
the class GridAdapter method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final boolean isSecureCamera = getIntent().getBooleanExtra(CameraUtil.KEY_IS_SECURE_CAMERA, false);
if (isSecureCamera) {
setShowInLockScreen();
}
setContentView(R.layout.scene_mode_menu_layout);
mSettingsManager = SettingsManager.getInstance();
mCurrentScene = mSettingsManager.getValueIndex(SettingsManager.KEY_SCENE_MODE);
mEntries = mSettingsManager.getEntries(SettingsManager.KEY_SCENE_MODE);
mThumbnails = mSettingsManager.getResource(SettingsManager.KEY_SCENE_MODE, SettingsManager.RESOURCE_TYPE_THUMBNAIL);
mNumElement = mThumbnails.length;
int pages = mNumElement / mElemPerPage;
if (mNumElement % mElemPerPage != 0)
pages++;
mNumPage = pages;
mAdapter = new MyPagerAdapter(this);
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setOverScrollMode(ViewPager.OVER_SCROLL_NEVER);
mPager.setAdapter(mAdapter);
mCloseButton = findViewById(R.id.close_button);
mCloseButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
int pageCount = mAdapter.getCount();
mDotsView = (DotsView) findViewById(R.id.page_indicator);
mPager.setCurrentItem(mCurrentScene / mElemPerPage);
mDotsView.update(mCurrentScene / mElemPerPage, 0f);
if (pageCount > 1) {
mDotsView.setItems(new PageItems(pageCount));
mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
mDotsView.update(position, positionOffset);
}
});
} else {
mDotsView.setVisibility(View.GONE);
}
mButton = (RotateImageView) findViewById(R.id.setting_button);
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getBaseContext(), SettingsActivity.class);
intent.putExtra(CameraUtil.KEY_IS_SECURE_CAMERA, isSecureCamera);
startActivity(intent);
finish();
}
});
}
use of com.android.camera.ui.DotsView in project android_packages_apps_Snap by LineageOS.
the class BestpictureActivity method onCreate.
@Override
public void onCreate(Bundle state) {
super.onCreate(state);
mActivity = this;
Intent intent = getIntent();
String action = intent.getAction();
if (INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE.equals(action) || ACTION_IMAGE_CAPTURE_SECURE.equals(action)) {
mSecureCamera = true;
} else {
mSecureCamera = intent.getBooleanExtra(SECURE_CAMERA_EXTRA, false);
}
if (mSecureCamera) {
// Change the window flags so that secure camera can show when locked
Window win = getWindow();
WindowManager.LayoutParams params = win.getAttributes();
params.flags |= WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
win.setAttributes(params);
}
mFilesPath = getFilesDir() + "/Bestpicture";
setContentView(R.layout.bestpicture_editor);
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
mWidth = size.x / 4;
mHeight = size.y / 4;
mNamedImages = new PhotoModule.NamedImages();
mImageItems = new ImageItems(mActivity);
mDotsView = (DotsView) findViewById(R.id.dots_view);
mDotsView.setItems(mImageItems);
mPlaceHolderUri = getIntent().getData();
mImagePager = (ViewPager) findViewById(R.id.bestpicture_pager);
mImagePagerAdapter = new ImagePagerAdapter(getFragmentManager());
mImagePager.setAdapter(mImagePagerAdapter);
mImagePager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
mDotsView.update(position, positionOffset);
}
@Override
public void onPageSelected(int position) {
}
});
findViewById(R.id.bestpicture_done).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
int choosenCount = 0;
for (int i = 0; i < mImageItems.mChosen.length; i++) {
if (mImageItems.mChosen[i]) {
choosenCount++;
}
}
boolean showSaveDialog = CameraUtil.loadDialogShowConfig(BestpictureActivity.this, CameraUtil.KEY_SAVE);
if (showSaveDialog) {
// add save dialog
initSaveDialog(CameraUtil.MODE_TWO_BT, choosenCount);
mDialog.show();
setDialogLayoutPararms();
} else {
saveImages(choosenCount, false);
}
}
});
findViewById(R.id.delete_best).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
boolean showDeleteDialog = CameraUtil.loadDialogShowConfig(BestpictureActivity.this, CameraUtil.KEY_DELETE);
if (showDeleteDialog) {
initDeleteDialog(CameraUtil.MODE_TWO_BT);
mDialog.show();
setDialogLayoutPararms();
} else {
backToViewfinder();
}
}
});
RotateImageView moreView = (RotateImageView) findViewById(R.id.best_more);
Bitmap mMoreBp = BitmapFactory.decodeResource(getResources(), R.drawable.more_options);
mMoreBp = CameraUtil.adjustPhotoRotation(mMoreBp, 90);
moreView.setImageBitmap(mMoreBp);
moreView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
initOverFlow(v);
}
});
}
Aggregations