Fine tunes the color correction layout
Bug: 145968068 Test: Manual test Change-Id: I291f2669c110ff6571039da2d224015dfef85488
This commit is contained in:
@@ -22,10 +22,12 @@
|
||||
<TextView
|
||||
android:id="@+id/item_textview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:textSize="20dp"
|
||||
android:layout_height="42dp"
|
||||
android:fontFamily="roboto-bold"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLength="20"
|
||||
android:singleLine="true"/>
|
||||
android:paddingLeft="@dimen/accessibility_layout_margin_start_end"
|
||||
android:singleLine="true"
|
||||
android:textSize="14dp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
@@ -266,7 +266,7 @@
|
||||
<dimen name="message_metadata_top_padding">4dp</dimen>
|
||||
|
||||
<!-- Accessibility Settings -->
|
||||
<dimen name="accessibility_layout_margin_start_end">24dp</dimen>
|
||||
<dimen name="accessibility_layout_margin_start_end">16dp</dimen>
|
||||
<dimen name="accessibility_button_preference_padding_top_bottom">18dp</dimen>
|
||||
|
||||
<!-- Accessibility, Screen magnification. These values are meant to be relative values and the actual layout value will be set programmatically. -->
|
||||
|
@@ -20,6 +20,7 @@ import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.provider.Settings;
|
||||
import android.view.View;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
@@ -122,6 +123,7 @@ public class DaltonizerRadioButtonPreferenceController extends BasePreferenceCon
|
||||
mPreference = (RadioButtonPreference)
|
||||
screen.findPreference(getPreferenceKey());
|
||||
mPreference.setOnClickListener(this);
|
||||
mPreference.setAppendixVisibility(View.GONE);
|
||||
updateState(mPreference);
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@ import android.widget.ListView;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import com.android.settingslib.widget.R;
|
||||
import com.android.settings.R;
|
||||
|
||||
/** Preference that easier preview by matching name to color. */
|
||||
public class PaletteListPreference extends Preference {
|
||||
|
@@ -35,7 +35,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settingslib.widget.R;
|
||||
import com.android.settings.R;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
@@ -55,13 +55,13 @@ import java.util.List;
|
||||
* display also the view background shows the color beside the text variable end point.
|
||||
*/
|
||||
public class PaletteListView extends ListView {
|
||||
private static final float VIEW_PITCH = 0.05f;
|
||||
private final Context mContext;
|
||||
private final DisplayAdapter mDisplayAdapter;
|
||||
private final LayoutInflater mLayoutInflater;
|
||||
private final String mDefaultGradientColorCodeString;
|
||||
private final int mDefaultGradientColor;
|
||||
private float mTextBound;
|
||||
private static final float LANDSCAPE_MAX_WIDTH_PERCENTAGE = 100f;
|
||||
|
||||
public PaletteListView(Context context) {
|
||||
this(context, null);
|
||||
@@ -206,8 +206,17 @@ public class PaletteListView extends ListView {
|
||||
final float textWidth = textView.getPaint().measureText(textView.getText().toString());
|
||||
// Computes rate of text width compare to screen width, and measures the round the double
|
||||
// to two decimal places manually.
|
||||
final float textBound = Math.round(textWidth / getScreenWidth(windowManager) * 100) / 100f;
|
||||
mTextBound = textBound + VIEW_PITCH;
|
||||
final float textBound = Math.round(
|
||||
textWidth / getScreenWidth(windowManager) * LANDSCAPE_MAX_WIDTH_PERCENTAGE)
|
||||
/ LANDSCAPE_MAX_WIDTH_PERCENTAGE;
|
||||
|
||||
// Left padding and right padding with color preview.
|
||||
final float paddingPixel = getResources().getDimension(
|
||||
R.dimen.accessibility_layout_margin_start_end);
|
||||
final float paddingWidth =
|
||||
Math.round(paddingPixel / getScreenWidth(windowManager)
|
||||
* LANDSCAPE_MAX_WIDTH_PERCENTAGE) / LANDSCAPE_MAX_WIDTH_PERCENTAGE;
|
||||
mTextBound = textBound + paddingWidth + paddingWidth;
|
||||
}
|
||||
|
||||
private static class ViewHolder {
|
||||
|
Reference in New Issue
Block a user