SetupWizard: Fix locale picker styling
Change-Id: If336a8321b09513ec8b22f8138a47fb4d94e5913
This commit is contained in:
parent
41801b0ca2
commit
b64d5e7676
|
@ -19,24 +19,26 @@
|
||||||
|
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<ImageButton android:id="@+id/increment"
|
<ImageButton android:id="@+id/lp__increment"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="22dip"
|
android:paddingTop="22dip"
|
||||||
android:paddingBottom="22dip"/>
|
android:paddingBottom="22dip"/>
|
||||||
|
|
||||||
<EditText
|
<view class="com.cyanogenmod.setupwizard.ui.LocalePicker$CustomEditText"
|
||||||
android:id="@+id/numberpicker_input"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:layout_width="fill_parent"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/localepicker_input"
|
||||||
android:textAppearance="?android:attr/textAppearanceMediumInverse"
|
android:layout_width="fill_parent"
|
||||||
android:gravity="center"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true" />
|
android:gravity="center"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:background="@null" />
|
||||||
|
|
||||||
<ImageButton android:id="@+id/decrement"
|
<ImageButton android:id="@+id/lp__decrement"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="22dip"
|
android:paddingTop="22dip"
|
||||||
android:paddingBottom="22dip"/>
|
android:paddingBottom="22dip"/>
|
||||||
|
|
||||||
</merge>
|
</merge>
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
android:id="@+id/locale_list"
|
android:id="@+id/locale_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="@dimen/min_locale_picker_height"
|
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:focusableInTouchMode="true"
|
android:focusableInTouchMode="true"
|
||||||
android:layout_centerInParent="true"/>
|
android:layout_centerInParent="true"/>
|
||||||
|
|
|
@ -17,4 +17,19 @@
|
||||||
<declare-styleable name="ScrimInsetsView">
|
<declare-styleable name="ScrimInsetsView">
|
||||||
<attr name="insetForeground" format="reference|color" />
|
<attr name="insetForeground" format="reference|color" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
|
<attr name="localePickerStyle" format="reference" />
|
||||||
|
|
||||||
|
<declare-styleable name="LocalePicker">
|
||||||
|
<attr name="solidColor" format="color|reference" />
|
||||||
|
<attr name="selectionDivider" format="reference" />
|
||||||
|
<attr name="selectionDividerHeight" format="dimension" />
|
||||||
|
<attr name="selectionDividersDistance" format="dimension" />
|
||||||
|
<attr name="internalMinHeight" format="dimension" />
|
||||||
|
<attr name="internalMaxHeight" format="dimension" />
|
||||||
|
<attr name="internalMinWidth" format="dimension" />
|
||||||
|
<attr name="internalMaxWidth" format="dimension" />
|
||||||
|
<attr name="internalLayout" format="reference" />
|
||||||
|
<attr name="virtualButtonPressedDrawable" format="reference"/>
|
||||||
|
</declare-styleable>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<item name="localepicker_input" type="id" />
|
||||||
|
<item name="lp__increment" type="id" />
|
||||||
|
<item name="lp__decrement" type="id" />
|
||||||
|
|
||||||
|
</resources>
|
|
@ -26,6 +26,7 @@
|
||||||
<item name="android:textColorLink">@color/accent</item>
|
<item name="android:textColorLink">@color/accent</item>
|
||||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
<item name="android:windowAnimationStyle">@style/ActivityAnimations</item>
|
<item name="android:windowAnimationStyle">@style/ActivityAnimations</item>
|
||||||
|
<item name="localePickerStyle">@style/LocaleWidget.Material.LocalePicker</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ActivityAnimations" parent="@android:style/Animation.Activity">
|
<style name="ActivityAnimations" parent="@android:style/Animation.Activity">
|
||||||
|
@ -97,4 +98,24 @@
|
||||||
<item name="android:gravity">center_vertical|end</item>
|
<item name="android:gravity">center_vertical|end</item>
|
||||||
<item name="android:drawableRight">@drawable/ic_chevron_right_dark</item>
|
<item name="android:drawableRight">@drawable/ic_chevron_right_dark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="LocaleWidget">
|
||||||
|
<item name="android:textAppearance">?android:attr/textAppearance</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="LocaleWidget.LocalePicker">
|
||||||
|
<item name="android:orientation">vertical</item>
|
||||||
|
<item name="android:fadingEdge">vertical</item>
|
||||||
|
<item name="android:fadingEdgeLength">50dip</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="LocaleWidget.Material.LocalePicker" parent="LocaleWidget.LocalePicker">
|
||||||
|
<item name="solidColor">@android:color/transparent</item>
|
||||||
|
<item name="selectionDivider">@drawable/divider</item>
|
||||||
|
<item name="selectionDividerHeight">1dip</item>
|
||||||
|
<item name="internalLayout">@layout/locale_picker</item>
|
||||||
|
<item name="internalMinWidth">64dip</item>
|
||||||
|
<item name="internalMaxHeight">180dip</item>
|
||||||
|
<item name="virtualButtonPressedDrawable">@null</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -174,6 +174,7 @@ public class WelcomePage extends SetupPage {
|
||||||
private final Runnable mUpdateLocale = new Runnable() {
|
private final Runnable mUpdateLocale = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mCurrentLocale != null) {
|
if (mCurrentLocale != null) {
|
||||||
|
mLanguagePicker.setEnabled(false);
|
||||||
com.android.internal.app.LocalePicker.updateLocale(mCurrentLocale);
|
com.android.internal.app.LocalePicker.updateLocale(mCurrentLocale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,6 +225,7 @@ public class WelcomePage extends SetupPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onLocaleChanged(Locale paramLocale) {
|
private void onLocaleChanged(Locale paramLocale) {
|
||||||
|
mLanguagePicker.setEnabled(true);
|
||||||
Resources localResources = getActivity().getResources();
|
Resources localResources = getActivity().getResources();
|
||||||
Configuration localConfiguration1 = localResources.getConfiguration();
|
Configuration localConfiguration1 = localResources.getConfiguration();
|
||||||
Configuration localConfiguration2 = new Configuration();
|
Configuration localConfiguration2 = new Configuration();
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
package com.cyanogenmod.setupwizard.ui;
|
package com.cyanogenmod.setupwizard.ui;
|
||||||
|
|
||||||
import com.android.internal.R;
|
import com.cyanogenmod.setupwizard.R;
|
||||||
|
|
||||||
import android.annotation.Widget;
|
import android.annotation.Widget;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -98,7 +98,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
/**
|
/**
|
||||||
* The number of items show in the selector wheel.
|
* The number of items show in the selector wheel.
|
||||||
*/
|
*/
|
||||||
private static int SELECTOR_WHEEL_ITEM_COUNT = 3;
|
private static int sSelectorWheelItemCount = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default update interval during long press.
|
* The default update interval during long press.
|
||||||
|
@ -108,7 +108,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
/**
|
/**
|
||||||
* The index of the middle selector item.
|
* The index of the middle selector item.
|
||||||
*/
|
*/
|
||||||
private static int SELECTOR_MIDDLE_ITEM_INDEX = SELECTOR_WHEEL_ITEM_COUNT / 2;
|
private static int sSelectorMiddleItemIndex = sSelectorWheelItemCount / 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The coefficient by which to adjust (divide) the max fling velocity.
|
* The coefficient by which to adjust (divide) the max fling velocity.
|
||||||
|
@ -144,7 +144,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
* The resource id for the default layout.
|
* The resource id for the default layout.
|
||||||
*/
|
*/
|
||||||
private static final int DEFAULT_LAYOUT_RESOURCE_ID =
|
private static final int DEFAULT_LAYOUT_RESOURCE_ID =
|
||||||
com.cyanogenmod.setupwizard.R.layout.locale_picker;
|
R.layout.locale_picker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant for unspecified size.
|
* Constant for unspecified size.
|
||||||
|
@ -558,7 +558,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
* @param attrs A collection of attributes.
|
* @param attrs A collection of attributes.
|
||||||
*/
|
*/
|
||||||
public LocalePicker(Context context, AttributeSet attrs) {
|
public LocalePicker(Context context, AttributeSet attrs) {
|
||||||
this(context, attrs, R.attr.numberPickerStyle);
|
this(context, attrs, R.attr.localePickerStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -570,44 +570,48 @@ public class LocalePicker extends LinearLayout {
|
||||||
*/
|
*/
|
||||||
public LocalePicker(Context context, AttributeSet attrs, int defStyle) {
|
public LocalePicker(Context context, AttributeSet attrs, int defStyle) {
|
||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
SELECTOR_WHEEL_ITEM_COUNT = context.getResources().getInteger(com.cyanogenmod.setupwizard.R.integer.local_picker_items);
|
sSelectorWheelItemCount = context.getResources().getInteger(R.integer.local_picker_items);
|
||||||
SELECTOR_MIDDLE_ITEM_INDEX = context.getResources().getInteger(com.cyanogenmod.setupwizard.R.integer.local_picker_items)/2;
|
sSelectorMiddleItemIndex = context.getResources().getInteger(R.integer.local_picker_items)/2;
|
||||||
mSelectorIndices= new int[SELECTOR_WHEEL_ITEM_COUNT];
|
mSelectorIndices= new int[sSelectorWheelItemCount];
|
||||||
// process style attributes
|
// process style attributes
|
||||||
TypedArray attributesArray = context.obtainStyledAttributes(
|
TypedArray attributesArray = context.obtainStyledAttributes(
|
||||||
attrs, R.styleable.NumberPicker, defStyle, 0);
|
attrs, R.styleable.LocalePicker, defStyle, 0);
|
||||||
final int layoutResId = attributesArray.getResourceId(
|
final int layoutResId = attributesArray.getResourceId(
|
||||||
R.styleable.NumberPicker_internalLayout, DEFAULT_LAYOUT_RESOURCE_ID);
|
R.styleable.LocalePicker_internalLayout, DEFAULT_LAYOUT_RESOURCE_ID);
|
||||||
|
|
||||||
mHasSelectorWheel = (layoutResId != DEFAULT_LAYOUT_RESOURCE_ID);
|
mHasSelectorWheel = true;
|
||||||
|
|
||||||
mSolidColor = attributesArray.getColor(R.styleable.NumberPicker_solidColor, 0);
|
mSolidColor = attributesArray.getColor(R.styleable.LocalePicker_solidColor, 0);
|
||||||
|
|
||||||
mSelectionDivider = context.getDrawable(com.cyanogenmod.setupwizard.R.drawable.divider);
|
mSelectionDivider = attributesArray.getDrawable(R.styleable.LocalePicker_selectionDivider);
|
||||||
|
|
||||||
mSelectionDividerHeight = UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT;
|
final int defSelectionDividerHeight = (int) TypedValue.applyDimension(
|
||||||
|
TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT,
|
||||||
|
getResources().getDisplayMetrics());
|
||||||
|
mSelectionDividerHeight = attributesArray.getDimensionPixelSize(
|
||||||
|
R.styleable.LocalePicker_selectionDividerHeight, defSelectionDividerHeight);
|
||||||
|
|
||||||
final int defSelectionDividerDistance = (int) TypedValue.applyDimension(
|
final int defSelectionDividerDistance = (int) TypedValue.applyDimension(
|
||||||
TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE,
|
TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE,
|
||||||
getResources().getDisplayMetrics());
|
getResources().getDisplayMetrics());
|
||||||
mSelectionDividersDistance = attributesArray.getDimensionPixelSize(
|
mSelectionDividersDistance = attributesArray.getDimensionPixelSize(
|
||||||
R.styleable.NumberPicker_selectionDividersDistance, defSelectionDividerDistance);
|
R.styleable.LocalePicker_selectionDividersDistance, defSelectionDividerDistance);
|
||||||
|
|
||||||
mMinHeight = attributesArray.getDimensionPixelSize(
|
mMinHeight = attributesArray.getDimensionPixelSize(
|
||||||
R.styleable.NumberPicker_internalMinHeight, SIZE_UNSPECIFIED);
|
R.styleable.LocalePicker_internalMinHeight, SIZE_UNSPECIFIED);
|
||||||
|
|
||||||
mMaxHeight = attributesArray.getDimensionPixelSize(
|
mMaxHeight = attributesArray.getDimensionPixelSize(
|
||||||
R.styleable.NumberPicker_internalMaxHeight, SIZE_UNSPECIFIED);
|
R.styleable.LocalePicker_internalMaxHeight, SIZE_UNSPECIFIED);
|
||||||
if (mMinHeight != SIZE_UNSPECIFIED && mMaxHeight != SIZE_UNSPECIFIED
|
if (mMinHeight != SIZE_UNSPECIFIED && mMaxHeight != SIZE_UNSPECIFIED
|
||||||
&& mMinHeight > mMaxHeight) {
|
&& mMinHeight > mMaxHeight) {
|
||||||
throw new IllegalArgumentException("minHeight > maxHeight");
|
throw new IllegalArgumentException("minHeight > maxHeight");
|
||||||
}
|
}
|
||||||
|
|
||||||
mMinWidth = attributesArray.getDimensionPixelSize(
|
mMinWidth = attributesArray.getDimensionPixelSize(
|
||||||
R.styleable.NumberPicker_internalMinWidth, SIZE_UNSPECIFIED);
|
R.styleable.LocalePicker_internalMinWidth, SIZE_UNSPECIFIED);
|
||||||
|
|
||||||
mMaxWidth = attributesArray.getDimensionPixelSize(
|
mMaxWidth = attributesArray.getDimensionPixelSize(
|
||||||
R.styleable.NumberPicker_internalMaxWidth, SIZE_UNSPECIFIED);
|
R.styleable.LocalePicker_internalMaxWidth, SIZE_UNSPECIFIED);
|
||||||
if (mMinWidth != SIZE_UNSPECIFIED && mMaxWidth != SIZE_UNSPECIFIED
|
if (mMinWidth != SIZE_UNSPECIFIED && mMaxWidth != SIZE_UNSPECIFIED
|
||||||
&& mMinWidth > mMaxWidth) {
|
&& mMinWidth > mMaxWidth) {
|
||||||
throw new IllegalArgumentException("minWidth > maxWidth");
|
throw new IllegalArgumentException("minWidth > maxWidth");
|
||||||
|
@ -616,7 +620,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
mComputeMaxWidth = (mMaxWidth == SIZE_UNSPECIFIED);
|
mComputeMaxWidth = (mMaxWidth == SIZE_UNSPECIFIED);
|
||||||
|
|
||||||
mVirtualButtonPressedDrawable = attributesArray.getDrawable(
|
mVirtualButtonPressedDrawable = attributesArray.getDrawable(
|
||||||
R.styleable.NumberPicker_virtualButtonPressedDrawable);
|
R.styleable.LocalePicker_virtualButtonPressedDrawable);
|
||||||
|
|
||||||
attributesArray.recycle();
|
attributesArray.recycle();
|
||||||
|
|
||||||
|
@ -637,7 +641,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
hideSoftInput();
|
hideSoftInput();
|
||||||
mInputText.clearFocus();
|
mInputText.clearFocus();
|
||||||
if (v.getId() == R.id.increment) {
|
if (v.getId() == R.id.lp__increment) {
|
||||||
changeValueByOne(true);
|
changeValueByOne(true);
|
||||||
} else {
|
} else {
|
||||||
changeValueByOne(false);
|
changeValueByOne(false);
|
||||||
|
@ -649,7 +653,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View v) {
|
||||||
hideSoftInput();
|
hideSoftInput();
|
||||||
mInputText.clearFocus();
|
mInputText.clearFocus();
|
||||||
if (v.getId() == R.id.increment) {
|
if (v.getId() == R.id.lp__increment) {
|
||||||
postChangeCurrentByOneFromLongPress(true, 0);
|
postChangeCurrentByOneFromLongPress(true, 0);
|
||||||
} else {
|
} else {
|
||||||
postChangeCurrentByOneFromLongPress(false, 0);
|
postChangeCurrentByOneFromLongPress(false, 0);
|
||||||
|
@ -660,7 +664,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
|
|
||||||
// increment button
|
// increment button
|
||||||
if (!mHasSelectorWheel) {
|
if (!mHasSelectorWheel) {
|
||||||
mIncrementButton = (ImageButton) findViewById(R.id.increment);
|
mIncrementButton = (ImageButton) findViewById(R.id.lp__increment);
|
||||||
mIncrementButton.setOnClickListener(onClickListener);
|
mIncrementButton.setOnClickListener(onClickListener);
|
||||||
mIncrementButton.setOnLongClickListener(onLongClickListener);
|
mIncrementButton.setOnLongClickListener(onLongClickListener);
|
||||||
} else {
|
} else {
|
||||||
|
@ -669,7 +673,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
|
|
||||||
// decrement button
|
// decrement button
|
||||||
if (!mHasSelectorWheel) {
|
if (!mHasSelectorWheel) {
|
||||||
mDecrementButton = (ImageButton) findViewById(R.id.decrement);
|
mDecrementButton = (ImageButton) findViewById(R.id.lp__decrement);
|
||||||
mDecrementButton.setOnClickListener(onClickListener);
|
mDecrementButton.setOnClickListener(onClickListener);
|
||||||
mDecrementButton.setOnLongClickListener(onLongClickListener);
|
mDecrementButton.setOnLongClickListener(onLongClickListener);
|
||||||
} else {
|
} else {
|
||||||
|
@ -677,7 +681,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
// input text
|
// input text
|
||||||
mInputText = (EditText) findViewById(R.id.numberpicker_input);
|
mInputText = (EditText) findViewById(R.id.localepicker_input);
|
||||||
mInputText.setOnFocusChangeListener(new OnFocusChangeListener() {
|
mInputText.setOnFocusChangeListener(new OnFocusChangeListener() {
|
||||||
public void onFocusChange(View v, boolean hasFocus) {
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
if (hasFocus) {
|
if (hasFocus) {
|
||||||
|
@ -903,7 +907,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
showSoftInput();
|
showSoftInput();
|
||||||
} else {
|
} else {
|
||||||
int selectorIndexOffset = (eventY / mSelectorElementHeight)
|
int selectorIndexOffset = (eventY / mSelectorElementHeight)
|
||||||
- SELECTOR_MIDDLE_ITEM_INDEX;
|
- sSelectorMiddleItemIndex;
|
||||||
if (selectorIndexOffset > 0) {
|
if (selectorIndexOffset > 0) {
|
||||||
changeValueByOne(true);
|
changeValueByOne(true);
|
||||||
mPressedStateHelper.buttonTapped(
|
mPressedStateHelper.buttonTapped(
|
||||||
|
@ -1075,12 +1079,12 @@ public class LocalePicker extends LinearLayout {
|
||||||
public void scrollBy(int x, int y) {
|
public void scrollBy(int x, int y) {
|
||||||
int[] selectorIndices = mSelectorIndices;
|
int[] selectorIndices = mSelectorIndices;
|
||||||
if (!mWrapSelectorWheel && y > 0
|
if (!mWrapSelectorWheel && y > 0
|
||||||
&& selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] <= mMinValue) {
|
&& selectorIndices[sSelectorMiddleItemIndex] <= mMinValue) {
|
||||||
mCurrentScrollOffset = mInitialScrollOffset;
|
mCurrentScrollOffset = mInitialScrollOffset;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!mWrapSelectorWheel && y < 0
|
if (!mWrapSelectorWheel && y < 0
|
||||||
&& selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] >= mMaxValue) {
|
&& selectorIndices[sSelectorMiddleItemIndex] >= mMaxValue) {
|
||||||
mCurrentScrollOffset = mInitialScrollOffset;
|
mCurrentScrollOffset = mInitialScrollOffset;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1088,16 +1092,16 @@ public class LocalePicker extends LinearLayout {
|
||||||
while (mCurrentScrollOffset - mInitialScrollOffset > mSelectorTextGapHeight) {
|
while (mCurrentScrollOffset - mInitialScrollOffset > mSelectorTextGapHeight) {
|
||||||
mCurrentScrollOffset -= mSelectorElementHeight;
|
mCurrentScrollOffset -= mSelectorElementHeight;
|
||||||
decrementSelectorIndices(selectorIndices);
|
decrementSelectorIndices(selectorIndices);
|
||||||
setValueInternal(selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX], true);
|
setValueInternal(selectorIndices[sSelectorMiddleItemIndex], true);
|
||||||
if (!mWrapSelectorWheel && selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] <= mMinValue) {
|
if (!mWrapSelectorWheel && selectorIndices[sSelectorMiddleItemIndex] <= mMinValue) {
|
||||||
mCurrentScrollOffset = mInitialScrollOffset;
|
mCurrentScrollOffset = mInitialScrollOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (mCurrentScrollOffset - mInitialScrollOffset < -mSelectorTextGapHeight) {
|
while (mCurrentScrollOffset - mInitialScrollOffset < -mSelectorTextGapHeight) {
|
||||||
mCurrentScrollOffset += mSelectorElementHeight;
|
mCurrentScrollOffset += mSelectorElementHeight;
|
||||||
incrementSelectorIndices(selectorIndices);
|
incrementSelectorIndices(selectorIndices);
|
||||||
setValueInternal(selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX], true);
|
setValueInternal(selectorIndices[sSelectorMiddleItemIndex], true);
|
||||||
if (!mWrapSelectorWheel && selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] >= mMaxValue) {
|
if (!mWrapSelectorWheel && selectorIndices[sSelectorMiddleItemIndex] >= mMaxValue) {
|
||||||
mCurrentScrollOffset = mInitialScrollOffset;
|
mCurrentScrollOffset = mInitialScrollOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1468,7 +1472,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
// item. Otherwise, if the user starts editing the text via the
|
// item. Otherwise, if the user starts editing the text via the
|
||||||
// IME he may see a dimmed version of the old value intermixed
|
// IME he may see a dimmed version of the old value intermixed
|
||||||
// with the new one.
|
// with the new one.
|
||||||
if (i != SELECTOR_MIDDLE_ITEM_INDEX || mInputText.getVisibility() != VISIBLE) {
|
if (i != sSelectorMiddleItemIndex || mInputText.getVisibility() != VISIBLE) {
|
||||||
canvas.drawText(scrollSelectorValue, x, y, mSelectorWheelPaint);
|
canvas.drawText(scrollSelectorValue, x, y, mSelectorWheelPaint);
|
||||||
}
|
}
|
||||||
y += mSelectorElementHeight;
|
y += mSelectorElementHeight;
|
||||||
|
@ -1564,7 +1568,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
int[] selectorIndices = mSelectorIndices;
|
int[] selectorIndices = mSelectorIndices;
|
||||||
int current = getValue();
|
int current = getValue();
|
||||||
for (int i = 0; i < mSelectorIndices.length; i++) {
|
for (int i = 0; i < mSelectorIndices.length; i++) {
|
||||||
int selectorIndex = current + (i - SELECTOR_MIDDLE_ITEM_INDEX);
|
int selectorIndex = current + (i - sSelectorMiddleItemIndex);
|
||||||
if (mWrapSelectorWheel) {
|
if (mWrapSelectorWheel) {
|
||||||
selectorIndex = getWrappedSelectorIndex(selectorIndex);
|
selectorIndex = getWrappedSelectorIndex(selectorIndex);
|
||||||
}
|
}
|
||||||
|
@ -1641,7 +1645,7 @@ public class LocalePicker extends LinearLayout {
|
||||||
// mInputText
|
// mInputText
|
||||||
int editTextTextPosition = mInputText.getBaseline() + mInputText.getTop();
|
int editTextTextPosition = mInputText.getBaseline() + mInputText.getTop();
|
||||||
mInitialScrollOffset = editTextTextPosition
|
mInitialScrollOffset = editTextTextPosition
|
||||||
- (mSelectorElementHeight * SELECTOR_MIDDLE_ITEM_INDEX);
|
- (mSelectorElementHeight * sSelectorMiddleItemIndex);
|
||||||
mCurrentScrollOffset = mInitialScrollOffset;
|
mCurrentScrollOffset = mInitialScrollOffset;
|
||||||
updateInputTextView();
|
updateInputTextView();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue