<color name="timelapse_mode_color">#88695e</color>
<color name="panorama_mode_color">#f1c938</color>
<color name="settings_mode_color">#58595b</color>
+ <color name="mode_cover_default_color">#191919</color>
<color name="bottombar_unpressed">#191919</color>
<color name="bottombar_pressed">#262626</color>
<dimen name="photoeditor_original_text_margin">4dp</dimen>
<!-- Mode selector icon width -->
- <dimen name="mode_selector_icon_block_width">48dp</dimen>
- <dimen name="mode_selector_icon_drawable_size">32dp</dimen>
+ <dimen name="mode_selector_icon_block_width">56dp</dimen>
+ <dimen name="mode_selector_icon_drawable_size">48dp</dimen>
<dimen name="mode_selector_item_height">60dp</dimen>
<!-- Filmstrip bottom controls -->
if (currentModuleIndex != moduleToTransitionTo) {
mAppRootView.redirectTouchEventsTo(mModeTransitionView);
- int shadeColorId = CameraUtil.getCameraThemeColorId(moduleToTransitionTo,
- mController.getAndroidContext());
+ int shadeColorId = R.color.mode_cover_default_color;
int iconRes = CameraUtil.getCameraModeIconResId(moduleToTransitionTo,
mController.getAndroidContext());
*/
private void showModeCoverUntilPreviewReady() {
int modeId = mController.getCurrentModuleIndex();
- int colorId = CameraUtil.getCameraThemeColorId(modeId, mController.getAndroidContext());
+ int colorId = R.color.mode_cover_default_color;;
int iconId = CameraUtil.getCameraModeIconResId(modeId, mController.getAndroidContext());
mModeTransitionView.setupModeCover(colorId, iconId);
mHideCoverRunnable = new Runnable() {
import android.content.Context;
import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
+import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
-import android.widget.ImageView;
+import android.view.View;
import com.android.camera2.R;
* multiple states can be rendered using the same drawable with some color modification,
* whereas a state list drawable would require a different drawable for each state.
*/
-public class ModeIconView extends ImageView {
+public class ModeIconView extends View {
private boolean mHighlightIsOn = false;
private final GradientDrawable mBackground;
private final int mIconBackgroundSize;
private int mHighlightColor;
private final int mBackgroundDefaultColor;
+ private final int mIconDrawableSize;
+ private Drawable mIconDrawable = null;
public ModeIconView(Context context, AttributeSet attrs) {
super(context, attrs);
mHighlightDrawable = (GradientDrawable) getResources()
.getDrawable(R.drawable.mode_icon_highlight).mutate();
mHighlightDrawable.setBounds(0, 0, mIconBackgroundSize, mIconBackgroundSize);
+ mIconDrawableSize = getResources().getDimensionPixelSize(
+ R.dimen.mode_selector_icon_drawable_size);
+ }
+
+ /**
+ * Sets the drawable that shows the icon of the mode.
+ *
+ * @param drawable drawable of the mode icon
+ */
+ public void setIconDrawable(Drawable drawable) {
+ mIconDrawable = drawable;
+ // Center icon in the background.
+ if (mIconDrawable != null) {
+ mIconDrawable.setBounds(mIconBackgroundSize / 2 - mIconDrawableSize / 2,
+ mIconBackgroundSize / 2 - mIconDrawableSize / 2,
+ mIconBackgroundSize / 2 + mIconDrawableSize / 2,
+ mIconBackgroundSize / 2 + mIconDrawableSize / 2);
+ invalidate();
+ }
}
@Override
public void draw(Canvas canvas) {
+ super.draw(canvas);
mBackground.draw(canvas);
if (mHighlightIsOn) {
mHighlightDrawable.draw(canvas);
}
- super.draw(canvas);
+ if (mIconDrawable != null) {
+ mIconDrawable.draw(canvas);
+ }
+
}
/**
// Validate the selection
if (index != NO_ITEM_SELECTED) {
final int modeId = getModeIndex(index);
- // Select the focused item.
- mModeSelectorItems[index].setSelected(true);
// Un-highlight all the modes.
for (int i = 0; i < mModeSelectorItems.length; i++) {
mModeSelectorItems[i].setHighlighted(false);
}
+ // Select the focused item.
+ mModeSelectorItems[index].setSelected(true);
mState = MODE_SELECTED;
PeepholeAnimationEffect effect = new PeepholeAnimationEffect();
effect.setSize(mWidth, mHeight);
mIcon = (ModeIconView) findViewById(R.id.selector_icon);
mText = (TextView) findViewById(R.id.selector_text);
Typeface typeface;
- if (ApiHelper.HAS_ROBOTO_LIGHT_FONT) {
- typeface = Typeface.create("sans-serif-light", Typeface.NORMAL);
+ if (ApiHelper.HAS_ROBOTO_MEDIUM_FONT) {
+ typeface = Typeface.create("sans-serif-medium", Typeface.NORMAL);
} else {
// Load roboto_light typeface from assets.
typeface = Typeface.createFromAsset(getResources().getAssets(),
- "Roboto-Light.ttf");
+ "Roboto-Medium.ttf");
}
mText.setTypeface(typeface);
mDefaultTextColor = mText.getCurrentTextColor();
}
public void setHighlighted(boolean highlighted) {
- mIcon.setHighlighted(highlighted);
+ // TODO: Remove the highlight logic if UX design on selection doesn't change
+ // within a week.
+ mIcon.setSelected(highlighted);
}
public void setSelected(boolean selected) {
if (drawableIcon != null) {
drawableIcon = drawableIcon.mutate();
}
- mIcon.setImageDrawable(drawableIcon);
+ mIcon.setIconDrawable(drawableIcon);
}
/**
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
public static final boolean HAS_SURFACE_TEXTURE_RECORDING =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
- public static final boolean HAS_ROBOTO_LIGHT_FONT =
+ public static final boolean HAS_ROBOTO_MEDIUM_FONT =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
public static final boolean HAS_CAMERA_HDR_PLUS = isKitKatOrHigher();