am 5fd97c55
: Merge "WIP support icon" into lmp-sprout-dev
* commit '5fd97c551fb8cbcc43d762d9c609be1061cc5170': WIP support icon
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];
|
String[] arr = new String[availableSubInfoLength];
|
||||||
arr = list.toArray(arr);
|
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());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
|
||||||
|
ListAdapter adapter = new SelectAccountListAdapter(
|
||||||
|
builder.getContext(),
|
||||||
|
R.layout.select_account_list_item,
|
||||||
|
arr);
|
||||||
|
|
||||||
if (id == DATA_PICK) {
|
if (id == DATA_PICK) {
|
||||||
builder.setTitle(R.string.select_sim_for_data);
|
builder.setTitle(R.string.select_sim_for_data);
|
||||||
} else if (id == CALLS_PICK) {
|
} else if (id == CALLS_PICK) {
|
||||||
@@ -398,6 +400,49 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
.create();
|
.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) {
|
private void setActivity(Preference preference, SubInfoRecord sir) {
|
||||||
final String key = preference.getKey();
|
final String key = preference.getKey();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user