WIP support icon
Added static sim icon to alert box for selecting different sim accounts. Change-Id: Ib22ceba4b96d636754d7946859f194488517ff9d
This commit is contained in:
36
res/layout/select_account_list_item.xml
Normal file
36
res/layout/select_account_list_item.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- Layout of a single item in the InCallUI Account Chooser Dialog. -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp" >
|
||||
|
||||
<ImageView android:id="@+id/icon"
|
||||
android:layout_width="48dp"
|
||||
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"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
@@ -381,11 +381,13 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
||||
String[] arr = new String[availableSubInfoLength];
|
||||
arr = list.toArray(arr);
|
||||
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
|
||||
android.R.layout.simple_list_item_1, arr);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
|
||||
ListAdapter adapter = new SelectAccountListAdapter(
|
||||
builder.getContext(),
|
||||
R.layout.select_account_list_item,
|
||||
arr);
|
||||
|
||||
if (id == DATA_PICK) {
|
||||
builder.setTitle(R.string.select_sim_for_data);
|
||||
} else if (id == CALLS_PICK) {
|
||||
@@ -398,6 +400,49 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
||||
.create();
|
||||
}
|
||||
|
||||
private class SelectAccountListAdapter extends ArrayAdapter<String> {
|
||||
private Context mContext;
|
||||
private int mResId;
|
||||
|
||||
public SelectAccountListAdapter(
|
||||
Context context, int resource, String[] arr) {
|
||||
super(context, resource, arr);
|
||||
mContext = context;
|
||||
mResId = resource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = (LayoutInflater)
|
||||
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
View rowView;
|
||||
final ViewHolder holder;
|
||||
|
||||
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);
|
||||
rowView.setTag(holder);
|
||||
}
|
||||
else {
|
||||
rowView = convertView;
|
||||
holder = (ViewHolder) rowView.getTag();
|
||||
}
|
||||
|
||||
holder.textView.setText(getItem(position));
|
||||
holder.imageView.setImageDrawable(getResources().getDrawable(R.drawable.ic_sim_sd));
|
||||
return rowView;
|
||||
}
|
||||
|
||||
private class ViewHolder {
|
||||
TextView textView;
|
||||
ImageView imageView;
|
||||
}
|
||||
}
|
||||
|
||||
private void setActivity(Preference preference, SubInfoRecord sir) {
|
||||
final String key = preference.getKey();
|
||||
|
||||
|
Reference in New Issue
Block a user