summaryrefslogtreecommitdiffstats
path: root/src/com/android/packageinstaller/permission/ui/television/SettingsWithHeader.java
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2015-10-29 13:14:27 -0700
committerSvetoslav Ganov <svetoslavganov@google.com>2015-11-18 20:03:50 +0000
commit2cf17ddcef3c8dd260bd3d174123842c81a7d025 (patch)
treebd6cf4fca561cb0c62767c1fd5781991cac171c3 /src/com/android/packageinstaller/permission/ui/television/SettingsWithHeader.java
parent30707bb7a27157d5124b0c648509c0e63d1da392 (diff)
downloadandroid_packages_apps_PackageInstaller-2cf17ddcef3c8dd260bd3d174123842c81a7d025.tar.gz
android_packages_apps_PackageInstaller-2cf17ddcef3c8dd260bd3d174123842c81a7d025.tar.bz2
android_packages_apps_PackageInstaller-2cf17ddcef3c8dd260bd3d174123842c81a7d025.zip
Clean up package installer styling
Package installer should be using exclusively the device defaut themes on handhelds (phones and tables) to allow OEMs customize its look and feel. Also for handhelds the installer should use the same preference framework as the settings app to ensure it looks like the settings app on an OEMs device. This change needs to be picked up by a GMS build to deliver to partners ensuring the installer UI is consistent with the device UI. bug:24286616 Change-Id: I92e39fd1488e76b0b23b7f1efa13e04ed5bbc7ba
Diffstat (limited to 'src/com/android/packageinstaller/permission/ui/television/SettingsWithHeader.java')
-rw-r--r--src/com/android/packageinstaller/permission/ui/television/SettingsWithHeader.java85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/com/android/packageinstaller/permission/ui/television/SettingsWithHeader.java b/src/com/android/packageinstaller/permission/ui/television/SettingsWithHeader.java
new file mode 100644
index 00000000..c7f5cda3
--- /dev/null
+++ b/src/com/android/packageinstaller/permission/ui/television/SettingsWithHeader.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+package com.android.packageinstaller.permission.ui.television;
+
+import android.content.Intent;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.android.packageinstaller.R;
+import com.android.packageinstaller.permission.utils.Utils;
+
+public abstract class SettingsWithHeader extends PermissionsFrameFragment
+ implements OnClickListener {
+
+ private View mHeader;
+ protected Intent mInfoIntent;
+ protected Drawable mIcon;
+ protected CharSequence mLabel;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ ViewGroup root = (ViewGroup) super.onCreateView(inflater, container, savedInstanceState);
+
+ if (!Utils.isTelevision(getContext())) {
+ mHeader = inflater.inflate(R.layout.header, root, false);
+ getPreferencesContainer().addView(mHeader, 0);
+ updateHeader();
+ }
+
+ return root;
+ }
+
+ public void setHeader(Drawable icon, CharSequence label, Intent infoIntent) {
+ mIcon = icon;
+ mLabel = label;
+ mInfoIntent = infoIntent;
+ updateHeader();
+ }
+
+ private void updateHeader() {
+ if (mHeader != null) {
+ final ImageView appIcon = (ImageView) mHeader.findViewById(R.id.icon);
+ appIcon.setImageDrawable(mIcon);
+
+ final TextView appName = (TextView) mHeader.findViewById(R.id.name);
+ appName.setText(mLabel);
+
+ final View info = mHeader.findViewById(R.id.info);
+ if (mInfoIntent == null) {
+ info.setVisibility(View.GONE);
+ } else {
+ info.setVisibility(View.VISIBLE);
+ info.setClickable(true);
+ info.setOnClickListener(this);
+ }
+ }
+ }
+
+ @Override
+ public void onClick(View v) {
+ getActivity().startActivity(mInfoIntent);
+ }
+
+}