am 6416bec0
: Merge "UI changes for icons in sim settings" into lmp-mr1-dev
* commit '6416bec01de67492ac761ba84c8b86c59e4dee28': UI changes for icons in sim settings
This commit is contained in:
BIN
res/drawable-hdpi/ic_live_help.png
Normal file
BIN
res/drawable-hdpi/ic_live_help.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 411 B |
BIN
res/drawable-mdpi/ic_live_help.png
Normal file
BIN
res/drawable-mdpi/ic_live_help.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 306 B |
BIN
res/drawable-xhdpi/ic_live_help.png
Normal file
BIN
res/drawable-xhdpi/ic_live_help.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 463 B |
BIN
res/drawable-xxhdpi/ic_live_help.png
Normal file
BIN
res/drawable-xxhdpi/ic_live_help.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 635 B |
BIN
res/drawable-xxxhdpi/ic_live_help.png
Normal file
BIN
res/drawable-xxxhdpi/ic_live_help.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 814 B |
@@ -14,11 +14,12 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- Layout of a single item in the InCallUI Account Chooser Dialog. -->
|
||||
<!-- Layout of a single item for displaying sim cards. -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:padding="4dp" >
|
||||
|
||||
<ImageView android:id="@+id/icon"
|
||||
@@ -26,11 +27,32 @@
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="center" />
|
||||
|
||||
<TextView android:id="@+id/text"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:gravity="start|center_vertical"
|
||||
android:layout_marginLeft="8dp"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="15dip"
|
||||
android:layout_marginEnd="6dip"
|
||||
android:layout_marginTop="6dip"
|
||||
android:layout_marginBottom="6dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_weight="1" >
|
||||
<TextView android:id="@+id/title"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:gravity="start|center_vertical"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal" />
|
||||
<TextView android:id="@+id/summary"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:gravity="start|center_vertical"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:layout_alignStart="@id/title" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@@ -22,6 +22,7 @@ import android.content.ContentUris;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
@@ -322,7 +323,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
||||
ListAdapter adapter = new SelectAccountListAdapter(
|
||||
builder.getContext(),
|
||||
R.layout.select_account_list_item,
|
||||
arr);
|
||||
arr, id);
|
||||
|
||||
if (id == DATA_PICK) {
|
||||
builder.setTitle(R.string.select_sim_for_data);
|
||||
@@ -339,43 +340,61 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
||||
private class SelectAccountListAdapter extends ArrayAdapter<String> {
|
||||
private Context mContext;
|
||||
private int mResId;
|
||||
private int mDialogId;
|
||||
private final float OPACITY = 0.54f;
|
||||
|
||||
public SelectAccountListAdapter(
|
||||
Context context, int resource, String[] arr) {
|
||||
Context context, int resource, String[] arr, int dialogId) {
|
||||
super(context, resource, arr);
|
||||
mContext = context;
|
||||
mResId = resource;
|
||||
mDialogId = dialogId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = (LayoutInflater)
|
||||
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
View rowView;
|
||||
final ViewHolder holder;
|
||||
SubscriptionInfo sir;
|
||||
|
||||
if (convertView == null) {
|
||||
// Cache views for faster scrolling
|
||||
rowView = inflater.inflate(mResId, null);
|
||||
holder = new ViewHolder();
|
||||
holder.textView = (TextView) rowView.findViewById(R.id.text);
|
||||
holder.imageView = (ImageView) rowView.findViewById(R.id.icon);
|
||||
holder.title = (TextView) rowView.findViewById(R.id.title);
|
||||
holder.summary = (TextView) rowView.findViewById(R.id.summary);
|
||||
holder.icon = (ImageView) rowView.findViewById(R.id.icon);
|
||||
rowView.setTag(holder);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
rowView = convertView;
|
||||
holder = (ViewHolder) rowView.getTag();
|
||||
}
|
||||
|
||||
holder.textView.setText(getItem(position));
|
||||
holder.imageView.setImageDrawable(getResources().getDrawable(R.drawable.ic_sim_sd));
|
||||
if (mDialogId == CALLS_PICK && position == 0) {
|
||||
holder.title.setText(getItem(position));
|
||||
holder.summary.setText("");
|
||||
holder.icon.setImageDrawable(getResources()
|
||||
.getDrawable(R.drawable.ic_live_help));
|
||||
holder.icon.setAlpha(OPACITY);
|
||||
} else {
|
||||
if (mDialogId == CALLS_PICK && position != 0) {
|
||||
sir = mSelectableSubInfos.get(position - 1);
|
||||
} else {
|
||||
sir = mSelectableSubInfos.get(position);
|
||||
}
|
||||
holder.title.setText(sir.getDisplayName());
|
||||
holder.summary.setText(sir.getNumber());
|
||||
holder.icon.setImageBitmap(sir.createIconBitmap(mContext));
|
||||
}
|
||||
return rowView;
|
||||
}
|
||||
|
||||
private class ViewHolder {
|
||||
TextView textView;
|
||||
ImageView imageView;
|
||||
TextView title;
|
||||
TextView summary;
|
||||
ImageView icon;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,10 +416,12 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
||||
private SubscriptionInfo mSubInfoRecord;
|
||||
private int mSlotId;
|
||||
private int[] tintArr;
|
||||
Context mContext;
|
||||
|
||||
public SimPreference(Context context, SubscriptionInfo subInfoRecord, int slotId) {
|
||||
super(context);
|
||||
|
||||
mContext = context;
|
||||
mSubInfoRecord = subInfoRecord;
|
||||
mSlotId = slotId;
|
||||
setKey("sim" + mSlotId);
|
||||
@@ -411,12 +432,17 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
||||
public void update() {
|
||||
final Resources res = getResources();
|
||||
|
||||
setTitle(String.format(getResources()
|
||||
.getString(R.string.sim_editor_title), (mSlotId + 1)));
|
||||
if (mSubInfoRecord != null) {
|
||||
setTitle(String.format(res.getString(R.string.sim_editor_title),
|
||||
(mSubInfoRecord.getSimSlotIndex() + 1)));
|
||||
setSummary(mSubInfoRecord.getDisplayName() + " - " +
|
||||
mSubInfoRecord.getNumber().toString());
|
||||
setEnabled(true);
|
||||
if (TextUtils.isEmpty(mSubInfoRecord.getNumber().toString())) {
|
||||
setSummary(mSubInfoRecord.getDisplayName());
|
||||
} else {
|
||||
setSummary(mSubInfoRecord.getDisplayName() + " - " +
|
||||
mSubInfoRecord.getNumber().toString());
|
||||
setEnabled(true);
|
||||
}
|
||||
setIcon(new BitmapDrawable(res, (mSubInfoRecord.createIconBitmap(mContext))));
|
||||
} else {
|
||||
setSummary(R.string.sim_slot_empty);
|
||||
setFragment(null);
|
||||
@@ -424,20 +450,6 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
||||
}
|
||||
}
|
||||
|
||||
public String getFormattedPhoneNumber() {
|
||||
try{
|
||||
final String rawNumber = PhoneFactory.getPhone(mSlotId).getLine1Number();
|
||||
String formattedNumber = null;
|
||||
if (!TextUtils.isEmpty(rawNumber)) {
|
||||
formattedNumber = PhoneNumberUtils.formatNumber(rawNumber);
|
||||
}
|
||||
|
||||
return formattedNumber;
|
||||
} catch (java.lang.IllegalStateException ise){
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
public SubscriptionInfo getSubInfoRecord() {
|
||||
return mSubInfoRecord;
|
||||
}
|
||||
@@ -480,7 +492,12 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
||||
});
|
||||
|
||||
TextView numberView = (TextView)dialogLayout.findViewById(R.id.number);
|
||||
numberView.setText(simPref.getFormattedPhoneNumber());
|
||||
final String rawNumber = mSubInfoRecord.getNumber();
|
||||
if (TextUtils.isEmpty(rawNumber)) {
|
||||
numberView.setText(res.getString(com.android.internal.R.string.unknownName));
|
||||
} else {
|
||||
numberView.setText(PhoneNumberUtils.formatNumber(rawNumber));
|
||||
}
|
||||
|
||||
TextView carrierView = (TextView)dialogLayout.findViewById(R.id.carrier);
|
||||
carrierView.setText(mSubInfoRecord.getCarrierName());
|
||||
|
Reference in New Issue
Block a user