Commit 53dbe0d9 authored by Svetoslav's avatar Svetoslav Committed by android-build-merger
Browse files

Clean up package installer styling am: 2cf17ddc

am: c10abb25

* commit 'c10abb25':
  Clean up package installer styling
<!--
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:pathData="M1,21l22,0L12,2L1,21zM13,18l-2,0l0,-2l2,0L13,18zM13,14l-2,0l0,-4l2,0L13,14z"
android:fillColor="@android:color/white"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#000000"
android:pathData="M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7
7v2h14V7H7z" />
<path
android:pathData="M0 0h24v24H0z" />
</vector>
\ No newline at end of file
......@@ -4,9 +4,9 @@
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.
......@@ -32,7 +32,7 @@ installation screens
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_marginStart="8dip"
android:background="@color/transparent"
android:background="@android:color/transparent"
android:layout_alignParentStart="true"
android:gravity="start"
android:scaleType="centerCrop"/>
......@@ -61,6 +61,6 @@ installation screens
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</FrameLayout>
</RelativeLayout>
......@@ -18,6 +18,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="@+id/dialog_container"
android:layout_width="fill_parent"
......@@ -46,7 +47,7 @@
android:visibility="gone">
</CheckBox>
<com.android.internal.widget.ButtonBarLayout
<com.android.packageinstaller.permission.ui.ButtonBarLayout
android:id="@+id/button_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -62,8 +63,8 @@
android:paddingBottom="4dp"
android:paddingEnd="12dp"
android:singleLine="true"
style="@android:style/TextAppearance.Material.Body2"
android:textColor="@color/grant_permissions_progress_color"
style="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:visibility="invisible">
</TextView>
......@@ -72,14 +73,16 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="invisible" />
android:visibility="invisible" >
</Space>
<Button
android:id="@+id/permission_deny_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="@string/grant_dialog_button_deny" />
android:text="@string/grant_dialog_button_deny" >
</Button>
<Button
android:id="@+id/permission_allow_button"
......@@ -87,9 +90,11 @@
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:layout_marginStart="8dip"
android:text="@string/grant_dialog_button_allow" />
android:text="@string/grant_dialog_button_allow" >
</Button>
</com.android.internal.widget.ButtonBarLayout>
</com.android.packageinstaller.permission.ui.ButtonBarLayout>
</LinearLayout>
</com.android.packageinstaller.permission.ui.ManualLayoutFrame>
......@@ -17,9 +17,8 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@drawable/header_background"
android:gravity="center_vertical"
android:theme="@style/Theme.Header.Settings" >
android:background="?android:attr/colorPrimary"
android:gravity="center_vertical" >
<ImageView android:id="@+id/icon"
android:layout_width="@dimen/header_subsettings_margin_start"
......@@ -31,12 +30,11 @@
android:id="@+id/name"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_toStartOf="@+id/app_settings"
android:layout_marginStart="@dimen/header_subsettings_margin_start"
android:layout_alignWithParentIfMissing="true"
android:layout_centerVertical="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/white"
android:textColor="?android:attr/textColorPrimaryInverse"
android:textAlignment="viewStart" />
<ImageView
......@@ -52,11 +50,4 @@
android:src="@drawable/ic_info"
style="?android:attr/borderlessButtonStyle" />
<View
android:id="@+id/row_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/listDivider" />
</RelativeLayout>
......@@ -31,9 +31,10 @@
android:id="@+id/install_confirm_question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="16dip"
android:paddingEnd="16dip"
android:text="@string/install_confirm_question"
android:textAppearance="?android:attr/textAppearanceMedium"
style="@style/padded"
android:paddingTop="4dip" />
<ImageView
......
......@@ -26,15 +26,14 @@
android:layout_height="36dip"
android:layout_marginTop="3dp"
android:tint="?android:attr/colorAccent"
android:scaleType="fitCenter" />
android:scaleType="fitCenter" >
</ImageView>
<TextView
android:id="@+id/permission_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/permission_icon"
android:lineSpacingMultiplier="1.024"
android:fontFamily="@*android:string/font_family_body_2_material"
android:paddingStart="16dip"
android:paddingEnd="8dip"
style="?android:attr/textAppearanceMedium">
......
......@@ -30,8 +30,8 @@
android:layout_height="match_parent"
android:text="@string/no_permissions"
android:gravity="center"
android:textAppearance="@android:style/TextAppearance.Large"
/>
style="?android:attr/textAppearanceLarge">
</TextView>
</FrameLayout>
......
......@@ -37,7 +37,7 @@
android:paddingEnd="20dp"
android:paddingTop="4dp"
android:paddingBottom="4dp">
<com.android.internal.widget.PreferenceImageView
<com.android.packageinstaller.permission.ui.PreferenceImageView
android:id="@android:id/icon"
android:layout_width="24dp"
android:layout_height="24dp"
......
......@@ -37,7 +37,7 @@
android:paddingEnd="20dp"
android:paddingTop="4dp"
android:paddingBottom="4dp">
<com.android.internal.widget.PreferenceImageView
<com.android.packageinstaller.permission.ui.PreferenceImageView
android:id="@android:id/icon"
android:layout_width="36dp"
android:layout_height="36dp"
......
......@@ -40,9 +40,10 @@
android:id="@+id/activity_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="16dip"
android:paddingEnd="16dip"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="?android:attr/textAppearanceMedium"
style="@style/padded"
android:visibility="gone" />
<!-- The snippet (title & icon) about the application being uninstalled. -->
......
......@@ -15,6 +15,13 @@
-->
<resources>
<color name="lb_content_title_text_color">#FFF1F1F1</color>
<color name="lb_content_breadcrumb_text_color">#88F1F1F1</color>
<color name="lb_content_description_text_color">#88F1F1F1</color>
<color name="lb_action_fragment_background">#FF111111</color>
<color name="lb_dialog_activity_background">#77000000</color>
<color name="grant_permissions_background_color">#ff263238</color>
<color name="grant_permissions_app_color">@color/grant_permissions_white_text_alpha_100</color>
<color name="grant_permissions_progress_color">@color/grant_permissions_white_text_alpha_100</color>
......
......@@ -14,8 +14,24 @@
limitations under the License.
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
<item android:drawable="@color/header_background_color" />
</ripple>
<resources>
<style name="PreferenceThemeOverlay.v14.Permissions">
<item name="preferenceStyle">@style/Preference.Permissions</item>
<item name="preferenceCategoryStyle">@style/Preference.Category.Permissions</item>
<item name="switchPreferenceStyle">@style/Preference.SwitchPreference.Permissions</item>
</style>
<style name="Preference.Permissions">
<item name="layout">@layout/preference_permissions</item>
</style>
<style name="Preference.Category.Permissions">
<item name="layout">@layout/preference_category_material</item>
</style>
<style name="Preference.SwitchPreference.Permissions">
<item name="layout">@layout/preference_permissions_switch</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 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.
-->
<resources>
<color name="shadow">#cc222222</color>
<color name="transparent">#00000000</color>
<color name="header_background_color">#ff37474f</color>
<color name="grant_permissions_app_color">@*android:color/primary_text_default_material_light</color>
<color name="grant_permissions_progress_color">#60000000</color>
<color name="lb_content_title_text_color">#FFF1F1F1</color>
<color name="lb_content_breadcrumb_text_color">#88F1F1F1</color>
<color name="lb_content_description_text_color">#88F1F1F1</color>
<color name="lb_action_fragment_background">#FF111111</color>
<color name="lb_dialog_activity_background">#77000000</color>
</resources>
......@@ -15,37 +15,22 @@
-->
<resources>
<style name="padded">
<item name="android:paddingStart">16dip</item>
<item name="android:paddingEnd">16dip</item>
</style>
<style name="Theme.DialogWhenLarge" parent="@android:style/Theme.DeviceDefault.Light.DialogWhenLarge.NoActionBar"/>
<style name="Theme.AlertDialogActivity" parent="@android:style/Theme.DeviceDefault.Light.Panel">
<item name="android:backgroundDimEnabled">true</item>
</style>
<style name="Theme.Header.Settings" parent="@android:style/Theme.DeviceDefault.Settings">
</style>
<style name="PreferenceThemeOverlay.v14.Permissions">
<item name="preferenceStyle">@style/Preference.Permissions</item>
<item name="preferenceCategoryStyle">@style/Preference.Category.Permissions</item>
<item name="switchPreferenceStyle">@style/Preference.SwitchPreference.Permissions</item>
<style name="Theme.DialogWhenLarge"
parent="@android:style/Theme.DeviceDefault.Light.DialogWhenLarge.NoActionBar">
</style>
<style name="Preference.Permissions">
<item name="layout">@layout/preference_permissions</item>
</style>
<style name="Preference.Category.Permissions">
<item name="layout">@layout/preference_category_material</item>
<style name="Theme.AlertDialogActivity"
parent="@android:style/Theme.DeviceDefault.Light.Panel">
<item name="android:backgroundDimEnabled">true</item>
</style>
<style name="Preference.SwitchPreference.Permissions">
<item name="layout">@layout/preference_permissions_switch</item>
<style name="Theme.Header.Settings"
parent="@android:style/Theme.DeviceDefault.Settings">
</style>
<style name="ActionBar" parent="@android:style/Widget.Material.ActionBar.Solid">
<item name="android:contentInsetStart">72dp</item>
</style>
</resources>
......@@ -16,11 +16,13 @@
-->
<resources>
<style name="Settings" parent="@android:style/Theme.DeviceDefault.Settings">
<item name="android:actionBarStyle">@style/ActionBar</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Permissions</item>
<style name="Settings"
parent="@android:style/Theme.DeviceDefault.Settings">
</style>
<style name="GrantPermissions"
parent="@android:style/Theme.DeviceDefault.Light.Dialog.NoActionBar" />
parent="@android:style/Theme.DeviceDefault.Light.Dialog.NoActionBar">
</style>
</resources>
......@@ -31,6 +31,7 @@ import android.util.ArraySet;
import android.util.Log;
import android.util.SparseArray;
import com.android.packageinstaller.R;
import com.android.packageinstaller.permission.utils.Utils;
import java.util.ArrayList;
......@@ -275,7 +276,7 @@ public class PermissionApps {
if (info.icon != 0) {
mIcon = info.loadUnbadgedIcon(mPm);
} else {
mIcon = mContext.getDrawable(com.android.internal.R.drawable.ic_perm_device_info);
mIcon = mContext.getDrawable(R.drawable.ic_perm_device_info);
}
mIcon = Utils.applyTint(mContext, mIcon, android.R.attr.colorControlNormal);
}
......
/*
* 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;
import android.content.Context;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.widget.LinearLayout;
import com.android.packageinstaller.R;
/**
* An extension of LinearLayout that automatically switches to vertical
* orientation when it can't fit its child views horizontally.
*/
public class ButtonBarLayout extends LinearLayout {
/** Whether the current configuration allows stacking. */
private boolean mAllowStacking;
private int mLastWidthSize = -1;
public ButtonBarLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mAllowStacking = true;
}
public void setAllowStacking(boolean allowStacking) {
if (mAllowStacking != allowStacking) {
mAllowStacking = allowStacking;
if (!mAllowStacking && getOrientation() == LinearLayout.VERTICAL) {
setStacked(false);
}
requestLayout();
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int widthSize = MeasureSpec.getSize(widthMeasureSpec);
if (mAllowStacking) {
if (widthSize > mLastWidthSize && isStacked()) {
// We're being measured wider this time, try un-stacking.
setStacked(false);
}
mLastWidthSize = widthSize;
}
boolean needsRemeasure = false;
// If we're not stacked, make sure the measure spec is AT_MOST rather
// than EXACTLY. This ensures that we'll still get TOO_SMALL so that we
// know to stack the buttons.
final int initialWidthMeasureSpec;
if (!isStacked() && MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY) {
initialWidthMeasureSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.AT_MOST);
// We'll need to remeasure again to fill excess space.
needsRemeasure = true;
} else {
initialWidthMeasureSpec = widthMeasureSpec;
}
super.onMeasure(initialWidthMeasureSpec, heightMeasureSpec);
if (mAllowStacking && !isStacked()) {
final int measuredWidth = getMeasuredWidthAndState();
final int measuredWidthState = measuredWidth & MEASURED_STATE_MASK;
if (measuredWidthState == MEASURED_STATE_TOO_SMALL) {
setStacked(true);
// Measure again in the new orientation.
needsRemeasure = true;
}
}
if (needsRemeasure) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
private void setStacked(boolean stacked) {
setOrientation(stacked ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL);
setGravity(stacked ? Gravity.RIGHT : Gravity.BOTTOM);
final View spacer = findViewById(R.id.spacer);
if (spacer != null) {
spacer.setVisibility(stacked ? View.GONE : View.INVISIBLE);
}
// Reverse the child order. This is specific to the Material button
// bar's layout XML and will probably not generalize.
final int childCount = getChildCount();
for (int i = childCount - 2; i >= 0; i--) {
bringChildToFront(getChildAt(i));
}
}
private boolean isStacked() {
return getOrientation() == LinearLayout.VERTICAL;
}
}
......@@ -26,11 +26,12 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PermissionInfo;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.Icon;
import android.hardware.camera2.utils.ArrayUtils;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
......@@ -72,9 +73,11 @@ public class GrantPermissionsActivity extends OverlayTouchActivity
setTitle(R.string.permission_request_title);
if (Utils.isTelevision(this)) {
mViewHandler = new GrantPermissionsTvViewHandler(this).setResultListener(this);
mViewHandler = new com.android.packageinstaller.permission.ui.television
.GrantPermissionsViewHandlerImpl(this).setResultListener(this);
} else {
mViewHandler = new GrantPermissionsDefaultViewHandler(this).setResultListener(this);
mViewHandler = new com.android.packageinstaller.permission.ui.handheld
.GrantPermissionsViewHandlerImpl(this).setResultListener(this);
}
mRequestedPermissions = getIntent().getStringArrayExtra(
......@@ -206,8 +209,7 @@ public class GrantPermissionsActivity extends OverlayTouchActivity
// Color the app name.
int appLabelStart = message.toString().indexOf(appLabel.toString(), 0);
int appLabelLength = appLabel.length();
int color = getColor(R.color.grant_permissions_app_color);
message.setSpan(new ForegroundColorSpan(color), appLabelStart,
message.setSpan(new StyleSpan(Typeface.BOLD), appLabelStart,
appLabelStart + appLabelLength, 0);
// Set the new grant view
......
......@@ -25,7 +25,7 @@ import android.view.WindowManager;
* Class for managing the presentation and user interaction of the "grant
* permissions" user interface.
*/
interface GrantPermissionsViewHandler {
public interface GrantPermissionsViewHandler {
/**
* Listener interface for getting notified when the user responds to a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment