UX fixes for the language draggable cell
This should bring things closer to the recommended UX guidelines. It changes the way the checkbox / label play together, and changes the "localization missing" warning icon to a string. Also some cleanup of hard-coded styles and sizes. Bug: 26758865 Bug: 26707846 Change-Id: I07a78a1e4a41122b91e895e363a217d3e9cacd40
This commit is contained in:
committed by
Roozbeh Pournader
parent
4b796fa7d8
commit
7f78a4b723
@@ -20,16 +20,19 @@ import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
class LocaleDragCell extends LinearLayout {
|
||||
class LocaleDragCell extends RelativeLayout {
|
||||
// We need to keep the label and the checkbox "in sync"
|
||||
// The checkbox shows in remove mode, and the label shows in normal mode, in the same position.
|
||||
// So we need to set the same text to both of them, and coordinate the show / hide.
|
||||
private TextView mLabel;
|
||||
private TextView mMiniLabel;
|
||||
private ImageView mLocalized;
|
||||
private CheckBox mCheckbox;
|
||||
private TextView mMiniLabel;
|
||||
private TextView mLocalized;
|
||||
private ImageView mDragHandle;
|
||||
|
||||
public LocaleDragCell(Context context, AttributeSet attrs) {
|
||||
@@ -40,20 +43,31 @@ class LocaleDragCell extends LinearLayout {
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mLabel = (TextView) findViewById(R.id.label);
|
||||
mLocalized = (ImageView) findViewById(R.id.l10nWarn);
|
||||
mLocalized = (TextView) findViewById(R.id.l10nWarn);
|
||||
mMiniLabel = (TextView) findViewById(R.id.miniLabel);
|
||||
mCheckbox = (CheckBox) findViewById(R.id.checkbox);
|
||||
mDragHandle = (ImageView) findViewById(R.id.dragHandle);
|
||||
}
|
||||
|
||||
public void setShowHandle(boolean showHandle) {
|
||||
mDragHandle.setVisibility(showHandle ? VISIBLE : GONE);
|
||||
// We want invisible, not gone, so that everything else stays the same.
|
||||
// With GONE there is more space for the labels and the text wrapping change.
|
||||
// So the transition between "normal" mode (with numbers) and
|
||||
// "remove mode" (with checkboxes) is not that "smooth"
|
||||
mDragHandle.setVisibility(showHandle ? VISIBLE : INVISIBLE);
|
||||
invalidate();
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setShowCheckbox(boolean showCheckbox) {
|
||||
mCheckbox.setVisibility(showCheckbox ? VISIBLE : GONE);
|
||||
// "Opposite" visibility for label / checkbox
|
||||
if (showCheckbox) {
|
||||
mCheckbox.setVisibility(VISIBLE);
|
||||
mLabel.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
mCheckbox.setVisibility(INVISIBLE);
|
||||
mLabel.setVisibility(VISIBLE);
|
||||
}
|
||||
invalidate();
|
||||
requestLayout();
|
||||
}
|
||||
@@ -75,11 +89,12 @@ class LocaleDragCell extends LinearLayout {
|
||||
|
||||
public void setLabel(String labelText) {
|
||||
mLabel.setText(labelText);
|
||||
mCheckbox.setText(labelText);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setLocalized(boolean localized) {
|
||||
mLocalized.setVisibility(localized ? INVISIBLE : VISIBLE);
|
||||
mLocalized.setVisibility(localized ? GONE : VISIBLE);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@@ -87,14 +102,6 @@ class LocaleDragCell extends LinearLayout {
|
||||
return mDragHandle;
|
||||
}
|
||||
|
||||
public ImageView getTranslateableLabel() {
|
||||
return mLocalized;
|
||||
}
|
||||
|
||||
public TextView getTextLabel() {
|
||||
return mLabel;
|
||||
}
|
||||
|
||||
public CheckBox getCheckbox() {
|
||||
return mCheckbox;
|
||||
}
|
||||
|
Reference in New Issue
Block a user