summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorVinod Krishnan <vinodkrishnan@google.com>2016-03-16 18:15:45 -0700
committerVinod Krishnan <vinodkrishnan@google.com>2016-03-18 16:19:00 -0700
commit3cc4e9da825cc19608e8d9f9df4c5a5d8eff379a (patch)
tree6ed027bff67067106ba6409a8ec2e8534d953aac /src/com
parent6317f684a214b23fa3103943daaf7a47aa676914 (diff)
downloadandroid_packages_apps_PackageInstaller-3cc4e9da825cc19608e8d9f9df4c5a5d8eff379a.tar.gz
android_packages_apps_PackageInstaller-3cc4e9da825cc19608e8d9f9df4c5a5d8eff379a.tar.bz2
android_packages_apps_PackageInstaller-3cc4e9da825cc19608e8d9f9df4c5a5d8eff379a.zip
Show No permissions, if there are no permissions
Change-Id: I285e326994268fc5b561e4a445ac2af326a64397
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/packageinstaller/permission/ui/wear/AppPermissionsFragmentWear.java18
-rw-r--r--src/com/android/packageinstaller/permission/ui/wear/TitledSettingsFragment.java21
2 files changed, 24 insertions, 15 deletions
diff --git a/src/com/android/packageinstaller/permission/ui/wear/AppPermissionsFragmentWear.java b/src/com/android/packageinstaller/permission/ui/wear/AppPermissionsFragmentWear.java
index 13a16d6e..4b621a64 100644
--- a/src/com/android/packageinstaller/permission/ui/wear/AppPermissionsFragmentWear.java
+++ b/src/com/android/packageinstaller/permission/ui/wear/AppPermissionsFragmentWear.java
@@ -123,18 +123,18 @@ public final class AppPermissionsFragmentWear extends TitledSettingsFragment {
super.onViewCreated(view, savedInstanceState);
if (mAppPermissions != null) {
initializeLayout(mAdapter);
- bindHeader(mAppPermissions.getPackageInfo());
+ mHeader.setText(R.string.app_permissions);
+ mDetails.setText(R.string.no_permissions);
+ if (mAdapter.getItemCount() == 0) {
+ mDetails.setVisibility(View.VISIBLE);
+ mWheel.setVisibility(View.GONE);
+ } else {
+ mDetails.setVisibility(View.GONE);
+ mWheel.setVisibility(View.VISIBLE);
+ }
}
}
- private void bindHeader(PackageInfo packageInfo) {
- Activity activity = getActivity();
- PackageManager pm = activity.getPackageManager();
- ApplicationInfo appInfo = packageInfo.applicationInfo;
- CharSequence label = appInfo.loadLabel(pm);
- mHeader.setText(label);
- }
-
private void initializePermissionGroupList() {
final String packageName = mAppPermissions.getPackageInfo().packageName;
List<AppPermissionGroup> groups = mAppPermissions.getPermissionGroups();
diff --git a/src/com/android/packageinstaller/permission/ui/wear/TitledSettingsFragment.java b/src/com/android/packageinstaller/permission/ui/wear/TitledSettingsFragment.java
index ef7efb28..b673a498 100644
--- a/src/com/android/packageinstaller/permission/ui/wear/TitledSettingsFragment.java
+++ b/src/com/android/packageinstaller/permission/ui/wear/TitledSettingsFragment.java
@@ -28,7 +28,7 @@ import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
-import android.widget.FrameLayout;
+import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.packageinstaller.permission.ui.wear.settings.ViewUtils;
@@ -46,6 +46,7 @@ public abstract class TitledSettingsFragment extends Fragment implements
private int mInitialHeaderHeight;
protected TextView mHeader;
+ protected TextView mDetails;
protected WearableListView mWheel;
private int mCharLimitShortTitle;
@@ -114,6 +115,9 @@ public abstract class TitledSettingsFragment extends Fragment implements
mHeader.addOnLayoutChangeListener(this);
mHeader.addTextChangedListener(mHeaderTextWatcher);
+ mDetails = (TextView) v.findViewById(R.id.details);
+ mDetails.addOnLayoutChangeListener(this);
+
mWheel.setAdapter(adapter);
mWheel.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
@@ -134,13 +138,14 @@ public abstract class TitledSettingsFragment extends Fragment implements
adjustHeaderSize();
- positionOnCircular(getContext(), mHeader, mWheel);
+ positionOnCircular(getContext(), mHeader, mDetails, mWheel);
}
- public void positionOnCircular(Context context, View header, final ViewGroup wheel) {
+ public void positionOnCircular(Context context, View header, View details,
+ final ViewGroup wheel) {
if (ViewUtils.getIsCircular(context)) {
- FrameLayout.LayoutParams params =
- (FrameLayout.LayoutParams) header.getLayoutParams();
+ LinearLayout.LayoutParams params =
+ (LinearLayout.LayoutParams) header.getLayoutParams();
params.topMargin = (int) context.getResources().getDimension(
R.dimen.settings_header_top_margin_circular);
// Note that the margins are made symmetrical here. Since they're symmetrical we choose
@@ -152,10 +157,14 @@ public abstract class TitledSettingsFragment extends Fragment implements
params.rightMargin = margin;
params.gravity = Gravity.CENTER_HORIZONTAL;
header.setLayoutParams(params);
+ details.setLayoutParams(params);
if (header instanceof TextView) {
((TextView) header).setGravity(Gravity.CENTER);
}
+ if (details instanceof TextView) {
+ ((TextView) details).setGravity(Gravity.CENTER);
+ }
final int leftPadding = (int) context.getResources().getDimension(
R.dimen.round_content_padding_left);
@@ -209,7 +218,7 @@ public abstract class TitledSettingsFragment extends Fragment implements
}
mHeader.setMinHeight((int) height);
- FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mHeader.getLayoutParams();
+ LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mHeader.getLayoutParams();
final Context context = getContext();
if (!singleLine) {
// Make the top margin a little bit smaller so there is more space for the title.