Merge "[Wi-Fi] Request focus on input field when config a WiFi network" into rvc-dev
diff --git a/res/layout/lease_list_item_view.xml b/res/layout/lease_list_item_view.xml
index 5edd9e5..92717f8 100644
--- a/res/layout/lease_list_item_view.xml
+++ b/res/layout/lease_list_item_view.xml
@@ -18,35 +18,46 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
- android:orientation="vertical"
+ android:orientation="horizontal"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:padding="@dimen/list_preferred_item_padding">
- <!-- TODO (varunshah@): add an image view for the app icon -->
+ <ImageView
+ android:id="@+id/app_icon"
+ android:layout_width="@dimen/secondary_app_icon_size"
+ android:layout_height="@dimen/secondary_app_icon_size"/>
- <TextView
- android:id="@+id/lease_package"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textDirection="locale"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal"
- android:singleLine="true"
- android:textAppearance="?android:attr/textAppearanceListItem"/>
-
- <TextView
- android:id="@+id/lease_desc"
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/textColorSecondary"/>
+ android:gravity="center_vertical"
+ android:orientation="vertical"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ android:padding="@dimen/list_preferred_item_padding">
- <TextView
- android:id="@+id/lease_expiry"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/textColorSecondary"/>
+ <TextView
+ android:id="@+id/lease_package"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textDirection="locale"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceListItem"/>
+
+ <TextView
+ android:id="@+id/lease_desc"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"/>
+
+ <TextView
+ android:id="@+id/lease_expiry"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"/>
+ </LinearLayout>
</LinearLayout>
diff --git a/src/com/android/settings/development/storage/LeaseInfoListView.java b/src/com/android/settings/development/storage/LeaseInfoListView.java
index b20bb65..22002fb 100644
--- a/src/com/android/settings/development/storage/LeaseInfoListView.java
+++ b/src/com/android/settings/development/storage/LeaseInfoListView.java
@@ -23,8 +23,10 @@
import android.app.blob.LeaseInfo;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Typeface;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
@@ -90,6 +92,7 @@
private LinearLayout getHeaderView() {
final LinearLayout headerView = (LinearLayout) mInflater.inflate(
R.layout.blob_list_item_view , null);
+ headerView.setEnabled(false); // disable clicking
final TextView blobLabel = headerView.findViewById(R.id.blob_label);
final TextView blobId = headerView.findViewById(R.id.blob_id);
final TextView blobExpiry = headerView.findViewById(R.id.blob_expiry);
@@ -137,9 +140,12 @@
}
private class LeaseListAdapter extends ArrayAdapter<LeaseInfo> {
+ private Context mContext;
+
LeaseListAdapter(Context context) {
super(context, 0);
+ mContext = context;
final List<LeaseInfo> leases = mBlobInfo.getLeases();
if (CollectionUtils.isEmpty(leases)) {
return;
@@ -152,8 +158,17 @@
final LeaseInfoViewHolder holder = LeaseInfoViewHolder.createOrRecycle(
mInflater, convertView);
convertView = holder.rootView;
+ convertView.setEnabled(false); // disable clicking
final LeaseInfo lease = getItem(position);
+ Drawable appIcon;
+ try {
+ appIcon = mContext.getPackageManager().getApplicationIcon(lease.getPackageName());
+ } catch (PackageManager.NameNotFoundException e) {
+ // set to system default app icon
+ appIcon = mContext.getDrawable(android.R.drawable.sym_def_app_icon);
+ }
+ holder.appIcon.setImageDrawable(appIcon);
holder.leasePackageName.setText(lease.getPackageName());
holder.leaseDescription.setText(getDescriptionString(lease));
holder.leaseExpiry.setText(getString(R.string.accessor_expires_text,
diff --git a/src/com/android/settings/development/storage/LeaseInfoViewHolder.java b/src/com/android/settings/development/storage/LeaseInfoViewHolder.java
index d74c929..66b37ec 100644
--- a/src/com/android/settings/development/storage/LeaseInfoViewHolder.java
+++ b/src/com/android/settings/development/storage/LeaseInfoViewHolder.java
@@ -18,6 +18,7 @@
import android.view.LayoutInflater;
import android.view.View;
+import android.widget.ImageView;
import android.widget.TextView;
import com.android.settings.R;
@@ -27,6 +28,7 @@
*/
class LeaseInfoViewHolder {
View rootView;
+ ImageView appIcon;
TextView leasePackageName;
TextView leaseDescription;
TextView leaseExpiry;
@@ -39,6 +41,7 @@
final LeaseInfoViewHolder holder = new LeaseInfoViewHolder();
holder.rootView = convertView;
+ holder.appIcon = convertView.findViewById(R.id.app_icon);
holder.leasePackageName = convertView.findViewById(R.id.lease_package);
holder.leaseDescription = convertView.findViewById(R.id.lease_desc);
holder.leaseExpiry = convertView.findViewById(R.id.lease_expiry);
diff --git a/tests/robotests/src/com/android/settings/development/storage/SharedDataPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/storage/SharedDataPreferenceControllerTest.java
index c6a19c7..88904df 100644
--- a/tests/robotests/src/com/android/settings/development/storage/SharedDataPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/storage/SharedDataPreferenceControllerTest.java
@@ -103,9 +103,9 @@
}
private List<BlobInfo> generateBlobList() {
- LeaseInfo one = new LeaseInfo("com.google.android.photos",
+ LeaseInfo one = new LeaseInfo("com.google.android.apps.photos",
System.currentTimeMillis(), -1, "test description");
- LeaseInfo two = new LeaseInfo("com.google.android.drive",
+ LeaseInfo two = new LeaseInfo("om.google.android.googlequicksearchbox",
System.currentTimeMillis(), -1, "test description 2");
List<LeaseInfo> accessors = new ArrayList<>();