Merge "Add app icons to leasee view in shared data dev options." into rvc-dev am: 6647ac93d4
am: 4af89f865c
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/11817586 Change-Id: Ie48811783028a45cf841f6244a6be53f47dbded4
This commit is contained in:
@@ -18,35 +18,46 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="vertical"
|
android:orientation="horizontal"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||||
android:padding="@dimen/list_preferred_item_padding">
|
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
|
<LinearLayout
|
||||||
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_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:gravity="center_vertical"
|
||||||
android:textColor="?android:attr/textColorSecondary"/>
|
android:orientation="vertical"
|
||||||
|
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||||
|
android:padding="@dimen/list_preferred_item_padding">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/lease_expiry"
|
android:id="@+id/lease_package"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textDirection="locale"
|
||||||
android:textColor="?android:attr/textColorSecondary"/>
|
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>
|
</LinearLayout>
|
||||||
|
@@ -23,8 +23,10 @@ import android.app.blob.BlobStoreManager;
|
|||||||
import android.app.blob.LeaseInfo;
|
import android.app.blob.LeaseInfo;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -90,6 +92,7 @@ public class LeaseInfoListView extends ListActivity {
|
|||||||
private LinearLayout getHeaderView() {
|
private LinearLayout getHeaderView() {
|
||||||
final LinearLayout headerView = (LinearLayout) mInflater.inflate(
|
final LinearLayout headerView = (LinearLayout) mInflater.inflate(
|
||||||
R.layout.blob_list_item_view , null);
|
R.layout.blob_list_item_view , null);
|
||||||
|
headerView.setEnabled(false); // disable clicking
|
||||||
final TextView blobLabel = headerView.findViewById(R.id.blob_label);
|
final TextView blobLabel = headerView.findViewById(R.id.blob_label);
|
||||||
final TextView blobId = headerView.findViewById(R.id.blob_id);
|
final TextView blobId = headerView.findViewById(R.id.blob_id);
|
||||||
final TextView blobExpiry = headerView.findViewById(R.id.blob_expiry);
|
final TextView blobExpiry = headerView.findViewById(R.id.blob_expiry);
|
||||||
@@ -137,9 +140,12 @@ public class LeaseInfoListView extends ListActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class LeaseListAdapter extends ArrayAdapter<LeaseInfo> {
|
private class LeaseListAdapter extends ArrayAdapter<LeaseInfo> {
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
LeaseListAdapter(Context context) {
|
LeaseListAdapter(Context context) {
|
||||||
super(context, 0);
|
super(context, 0);
|
||||||
|
|
||||||
|
mContext = context;
|
||||||
final List<LeaseInfo> leases = mBlobInfo.getLeases();
|
final List<LeaseInfo> leases = mBlobInfo.getLeases();
|
||||||
if (CollectionUtils.isEmpty(leases)) {
|
if (CollectionUtils.isEmpty(leases)) {
|
||||||
return;
|
return;
|
||||||
@@ -152,8 +158,17 @@ public class LeaseInfoListView extends ListActivity {
|
|||||||
final LeaseInfoViewHolder holder = LeaseInfoViewHolder.createOrRecycle(
|
final LeaseInfoViewHolder holder = LeaseInfoViewHolder.createOrRecycle(
|
||||||
mInflater, convertView);
|
mInflater, convertView);
|
||||||
convertView = holder.rootView;
|
convertView = holder.rootView;
|
||||||
|
convertView.setEnabled(false); // disable clicking
|
||||||
|
|
||||||
final LeaseInfo lease = getItem(position);
|
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.leasePackageName.setText(lease.getPackageName());
|
||||||
holder.leaseDescription.setText(getDescriptionString(lease));
|
holder.leaseDescription.setText(getDescriptionString(lease));
|
||||||
holder.leaseExpiry.setText(getString(R.string.accessor_expires_text,
|
holder.leaseExpiry.setText(getString(R.string.accessor_expires_text,
|
||||||
|
@@ -18,6 +18,7 @@ package com.android.settings.development.storage;
|
|||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -27,6 +28,7 @@ import com.android.settings.R;
|
|||||||
*/
|
*/
|
||||||
class LeaseInfoViewHolder {
|
class LeaseInfoViewHolder {
|
||||||
View rootView;
|
View rootView;
|
||||||
|
ImageView appIcon;
|
||||||
TextView leasePackageName;
|
TextView leasePackageName;
|
||||||
TextView leaseDescription;
|
TextView leaseDescription;
|
||||||
TextView leaseExpiry;
|
TextView leaseExpiry;
|
||||||
@@ -39,6 +41,7 @@ class LeaseInfoViewHolder {
|
|||||||
|
|
||||||
final LeaseInfoViewHolder holder = new LeaseInfoViewHolder();
|
final LeaseInfoViewHolder holder = new LeaseInfoViewHolder();
|
||||||
holder.rootView = convertView;
|
holder.rootView = convertView;
|
||||||
|
holder.appIcon = convertView.findViewById(R.id.app_icon);
|
||||||
holder.leasePackageName = convertView.findViewById(R.id.lease_package);
|
holder.leasePackageName = convertView.findViewById(R.id.lease_package);
|
||||||
holder.leaseDescription = convertView.findViewById(R.id.lease_desc);
|
holder.leaseDescription = convertView.findViewById(R.id.lease_desc);
|
||||||
holder.leaseExpiry = convertView.findViewById(R.id.lease_expiry);
|
holder.leaseExpiry = convertView.findViewById(R.id.lease_expiry);
|
||||||
|
@@ -103,9 +103,9 @@ public class SharedDataPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<BlobInfo> generateBlobList() {
|
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");
|
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");
|
System.currentTimeMillis(), -1, "test description 2");
|
||||||
|
|
||||||
List<LeaseInfo> accessors = new ArrayList<>();
|
List<LeaseInfo> accessors = new ArrayList<>();
|
||||||
|
Reference in New Issue
Block a user