Merge "Change privacy setting string"
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index 787c559..fd0fc6c 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -2,18 +2,6 @@
<issues format="4">
<issue
- id="LintError"
- severity="Error"
- message="No `.class` files were found in project ".", so none of the classfile based checks could be run. Does the project need to be built first?"
- category="Lint"
- priority="10"
- summary="Lint Failure"
- explanation="This issue type represents a problem running lint itself. Examples include failure to find bytecode for source files (which means certain detectors could not be run), parsing errors in lint configuration files, etc.
These errors are not errors in your own code, but they are shown to make it clear that some checks were not completed.">
- <location
- file="."/>
- </issue>
-
- <issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
@@ -1301,6 +1289,54 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="qr_corner_line_color">#ffdadce0</color>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="133"
+ column="5"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="qr_focused_corner_line_color">#ff1a73e8</color>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="134"
+ column="5"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <color name="qr_background_color">#b3ffffff</color> <!-- 70% white transparency -->"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/values/colors.xml"
+ line="135"
+ column="5"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:background="@color/lock_pattern_background" />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@@ -2441,7 +2477,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/strings.xml"
- line="5805"
+ line="5883"
column="36"/>
</issue>
@@ -2473,7 +2509,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="425"
+ line="415"
column="44"/>
</issue>
@@ -2489,7 +2525,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="431"
+ line="421"
column="44"/>
</issue>
@@ -2505,7 +2541,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="432"
+ line="422"
column="44"/>
</issue>
@@ -2521,23 +2557,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="467"
- column="34"/>
- </issue>
-
- <issue
- id="HardCodedColor"
- severity="Error"
- message="Avoid using hardcoded color"
- category="Correctness"
- priority="4"
- summary="Using hardcoded color"
- explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
- errorLine1=" <item name="strokeColor">@color/homepage_card_stroke_color</item>"
- errorLine2=" ^">
- <location
- file="res/values/styles.xml"
- line="474"
+ line="457"
column="34"/>
</issue>
@@ -2553,7 +2573,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="54"
+ line="57"
column="39"/>
</issue>
@@ -2569,7 +2589,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="55"
+ line="58"
column="40"/>
</issue>
@@ -2585,7 +2605,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="56"
+ line="59"
column="38"/>
</issue>
@@ -2601,7 +2621,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="90"
+ line="97"
column="47"/>
</issue>
@@ -2617,7 +2637,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="90"
+ line="97"
column="47"/>
</issue>
@@ -2633,7 +2653,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="96"
+ line="103"
column="40"/>
</issue>
@@ -2649,7 +2669,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="96"
+ line="103"
column="40"/>
</issue>
@@ -2665,7 +2685,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="159"
+ line="166"
column="45"/>
</issue>
@@ -2681,7 +2701,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="160"
+ line="167"
column="49"/>
</issue>
@@ -2697,7 +2717,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="168"
+ line="175"
column="45"/>
</issue>
@@ -2713,7 +2733,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="169"
+ line="176"
column="49"/>
</issue>
@@ -2729,7 +2749,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="185"
+ line="192"
column="39"/>
</issue>
@@ -2745,7 +2765,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="186"
+ line="193"
column="40"/>
</issue>
@@ -2761,7 +2781,7 @@
errorLine2=" ^">
<location
file="res/values/themes.xml"
- line="187"
+ line="194"
column="38"/>
</issue>
diff --git a/res/layout-sw360dp/homepage_condition_full_tile.xml b/res/layout-sw360dp/homepage_condition_full_tile.xml
new file mode 100644
index 0000000..4a8ad0a
--- /dev/null
+++ b/res/layout-sw360dp/homepage_condition_full_tile.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2018 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.
+-->
+
+<com.google.android.material.card.MaterialCardView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@style/ContextualCardStyle">
+
+ <LinearLayout
+ android:id="@+id/content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingStart="@dimen/homepage_card_padding_start"
+ android:paddingEnd="@dimen/homepage_card_padding_end"
+ android:paddingTop="@dimen/homepage_condition_full_card_padding_top"
+ android:paddingBottom="@dimen/homepage_condition_full_card_padding_bottom"
+ android:orientation="horizontal"
+ android:gravity="center_vertical">
+
+ <ImageView
+ android:id="@android:id/icon"
+ android:layout_width="@dimen/homepage_card_icon_size"
+ android:layout_height="@dimen/homepage_card_icon_size"
+ android:tint="?android:attr/colorAccent"/>
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:paddingStart="@dimen/homepage_condition_full_card_padding_start"
+ android:paddingEnd="@dimen/homepage_condition_full_card_padding_end"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/homepage_condition_card_title_margin_bottom"
+ android:textAppearance="@style/TextAppearance.ConditionCardTitle"/>
+
+ <TextView
+ android:id="@android:id/summary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="@style/TextAppearance.ConditionCardSummary"/>
+
+ </LinearLayout>
+
+ <include layout="@layout/vertical_divider"/>
+
+ <Button
+ android:id="@+id/first_action"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ style="@style/ConditionFullCardBorderlessButton"/>
+
+ </LinearLayout>
+
+</com.google.android.material.card.MaterialCardView>
diff --git a/res/layout/homepage_condition_full_tile.xml b/res/layout/homepage_condition_full_tile.xml
index 4b12625..2de1464 100644
--- a/res/layout/homepage_condition_full_tile.xml
+++ b/res/layout/homepage_condition_full_tile.xml
@@ -25,49 +25,50 @@
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingStart="@dimen/homepage_card_padding_start"
- android:paddingEnd="@dimen/homepage_card_padding_end"
- android:paddingTop="@dimen/homepage_condition_full_card_padding_top"
- android:paddingBottom="@dimen/homepage_condition_full_card_padding_bottom"
- android:orientation="horizontal"
- android:gravity="center_vertical">
-
- <ImageView
- android:id="@android:id/icon"
- android:layout_width="@dimen/homepage_card_icon_size"
- android:layout_height="@dimen/homepage_card_icon_size"
- android:tint="?android:attr/colorAccent"/>
+ android:paddingTop="@dimen/homepage_condition_half_card_padding_top"
+ android:orientation="vertical">
<LinearLayout
- android:layout_width="0dp"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_weight="1"
- android:paddingStart="@dimen/homepage_condition_full_card_padding_start"
- android:paddingEnd="@dimen/homepage_condition_full_card_padding_end"
+ android:paddingStart="@dimen/homepage_card_padding_start"
+ android:paddingEnd="@dimen/homepage_card_padding_end"
android:orientation="vertical">
+ <ImageView
+ android:id="@android:id/icon"
+ android:layout_width="@dimen/homepage_card_icon_size"
+ android:layout_height="@dimen/homepage_card_icon_size"
+ android:tint="?android:attr/colorAccent"/>
+
<TextView
android:id="@android:id/title"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:maxLines="1"
+ android:ellipsize="end"
+ android:layout_marginTop="@dimen/homepage_condition_half_card_title_margin_top"
android:layout_marginBottom="@dimen/homepage_condition_card_title_margin_bottom"
- style="@style/TextAppearance.ConditionCardTitle"/>
+ android:textAppearance="@style/TextAppearance.ConditionCardTitle"/>
<TextView
android:id="@android:id/summary"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/TextAppearance.ConditionCardSummary"/>
+ android:maxLines="1"
+ android:ellipsize="end"
+ android:layout_marginBottom="@dimen/homepage_condition_half_card_summary_margin_bottom"
+ android:textAppearance="@style/TextAppearance.ConditionCardSummary"/>
+
+ <include layout="@layout/horizontal_divider"/>
</LinearLayout>
-
- <include layout="@layout/vertical_divider"/>
-
<Button
android:id="@+id/first_action"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/ConditionFullCardBorderlessButton"/>
+ android:scrollbars="none"
+ style="@style/ConditionHalfCardBorderlessButton"/>
</LinearLayout>
diff --git a/res/layout/homepage_condition_half_tile.xml b/res/layout/homepage_condition_half_tile.xml
index 895183f..8f5af02 100644
--- a/res/layout/homepage_condition_half_tile.xml
+++ b/res/layout/homepage_condition_half_tile.xml
@@ -18,7 +18,7 @@
<com.google.android.material.card.MaterialCardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="@dimen/homepage_condition_half_card_height"
+ android:layout_height="wrap_content"
style="@style/ContextualCardStyle">
<LinearLayout
@@ -49,7 +49,7 @@
android:ellipsize="end"
android:layout_marginTop="@dimen/homepage_condition_half_card_title_margin_top"
android:layout_marginBottom="@dimen/homepage_condition_card_title_margin_bottom"
- style="@style/TextAppearance.ConditionCardTitle"/>
+ android:textAppearance="@style/TextAppearance.ConditionCardTitle"/>
<TextView
android:id="@android:id/summary"
@@ -58,7 +58,7 @@
android:maxLines="1"
android:ellipsize="end"
android:layout_marginBottom="@dimen/homepage_condition_half_card_summary_margin_bottom"
- style="@style/TextAppearance.ConditionCardSummary"/>
+ android:textAppearance="@style/TextAppearance.ConditionCardSummary"/>
<include layout="@layout/horizontal_divider"/>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 587184b..2103649 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -128,5 +128,10 @@
<!-- launcher icon color -->
<color name="icon_launcher_setting_color">@*android:color/accent_device_default_light</color>
-</resources>
+ <!-- QR code scanner colors -->
+ <color name="qr_corner_line_color">#ffdadce0</color>
+ <color name="qr_focused_corner_line_color">#ff1a73e8</color>
+ <color name="qr_background_color">#b3ffffff</color> <!-- 70% white transparency -->
+ <!-- End of QR code scanner colors -->
+</resources>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 01f0649..0859d2c 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -346,7 +346,6 @@
<!-- Condition cards size and padding -->
<dimen name="homepage_condition_card_title_margin_bottom">2dp</dimen>
- <dimen name="homepage_condition_half_card_height">150dp</dimen>
<dimen name="homepage_condition_half_card_padding_top">12dp</dimen>
<dimen name="homepage_condition_half_card_title_margin_top">12dp</dimen>
<dimen name="homepage_condition_half_card_summary_margin_bottom">12dp</dimen>
diff --git a/src/com/android/settings/wifi/qrcode/QrDecorateView.java b/src/com/android/settings/wifi/qrcode/QrDecorateView.java
index 253bdb8..6952a63 100644
--- a/src/com/android/settings/wifi/qrcode/QrDecorateView.java
+++ b/src/com/android/settings/wifi/qrcode/QrDecorateView.java
@@ -17,10 +17,13 @@
package com.android.settings.wifi.qrcode;
import android.content.Context;
+import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.AttributeSet;
@@ -33,11 +36,26 @@
* Draws the lines at the corner of the inner frame.
*/
public class QrDecorateView extends View {
- private static final float CORNER_STROKE_WIDTH = 3f; // 3dp
- private static final float CORNER_LINE_LENGTH = 20f; // 20dp
+ private static final float CORNER_STROKE_WIDTH = 4f; // 4dp
+ private static final float CORNER_LINE_LENGTH = 264f; // 264dp
+ private static final float CORNER_RADIUS = 16f; // 16dp
- final private Paint mPaint;
- private RectF mFrame;
+ final private int mCornerColor;
+ final private int mFocusedCornerColor;
+ final private int mBackgroundColor;
+
+ final private Paint mStrokePaint;
+ final private Paint mTransparentPaint;
+ final private Paint mBackgroundPaint;
+
+ final private float mRadius;
+
+ private Bitmap mMaskBitmap;
+ private Canvas mMaskCanvas;
+
+ private RectF mOuterFrame;
+ private RectF mInnerFrame;
+
private boolean mFocused;
public QrDecorateView(Context context) {
@@ -54,78 +72,66 @@
public QrDecorateView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
- final float strokeWidth = TypedValue.applyDimension(
- TypedValue.COMPLEX_UNIT_DIP,
- CORNER_STROKE_WIDTH,
- getResources().getDisplayMetrics()
- );
- mPaint = new Paint();
- mPaint.setStrokeWidth(strokeWidth);
+
mFocused = false;
+ mRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, CORNER_RADIUS,
+ getResources().getDisplayMetrics());
+
+ mCornerColor = context.getResources().getColor(R.color.qr_corner_line_color);
+ mFocusedCornerColor = context.getResources().getColor(R.color.qr_focused_corner_line_color);
+ mBackgroundColor = context.getResources().getColor(R.color.qr_background_color);
+
+ mStrokePaint = new Paint();
+ mStrokePaint.setAntiAlias(true);
+
+ mTransparentPaint = new Paint();
+ mTransparentPaint.setAntiAlias(true);
+ mTransparentPaint.setColor(getResources().getColor(android.R.color.transparent));
+ mTransparentPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
+
+ mBackgroundPaint = new Paint();
+ mBackgroundPaint.setColor(mBackgroundColor);
+ }
+
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ super.onLayout(changed, left, top, right, bottom);
+
+ if(mMaskBitmap == null) {
+ mMaskBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
+ mMaskCanvas = new Canvas(mMaskBitmap);
+ }
+
+ calculateFramePos();
}
@Override
protected void onDraw(Canvas canvas) {
- calculateFramePos();
- final float cornerLineLength = TypedValue.applyDimension(
- TypedValue.COMPLEX_UNIT_DIP,
- CORNER_LINE_LENGTH,
- getResources().getDisplayMetrics()
- );
- mPaint.setColor(mFocused ? Color.GREEN : Color.WHITE);
- drawCorner(mFrame, cornerLineLength, canvas);
- super.onDraw(canvas);
- }
+ // Set frame line color.
+ mStrokePaint.setColor(mFocused ? mFocusedCornerColor : mCornerColor);
+ // Draw background color.
+ mMaskCanvas.drawColor(mBackgroundColor);
+ // Draw outer corner.
+ mMaskCanvas.drawRoundRect(mOuterFrame, mRadius, mRadius, mStrokePaint);
+ // Draw inner transparent corner.
+ mMaskCanvas.drawRoundRect(mInnerFrame, mRadius, mRadius, mTransparentPaint);
- private void drawCorner(RectF frame, float lineLength, Canvas canvas) {
- final float strokeWidth = TypedValue.applyDimension(
- TypedValue.COMPLEX_UNIT_DIP,
- CORNER_STROKE_WIDTH,
- getResources().getDisplayMetrics()
- );
- // Draw top-left corner.
- canvas.drawLine(
- frame.left - strokeWidth / 2,
- frame.top,
- frame.left + lineLength,
- frame.top,
- mPaint);
- canvas.drawLine(frame.left, frame.top, frame.left, frame.top + lineLength, mPaint);
- // Draw top-right corner.
- canvas.drawLine(
- frame.right + strokeWidth / 2,
- frame.top,
- frame.right - lineLength,
- frame.top,
- mPaint);
- canvas.drawLine(frame.right, frame.top, frame.right, frame.top + lineLength, mPaint);
- // Draw bottom-left corner.
- canvas.drawLine(
- frame.left - strokeWidth / 2,
- frame.bottom,
- frame.left + lineLength,
- frame.bottom,
- mPaint);
- canvas.drawLine(frame.left, frame.bottom, frame.left, frame.bottom - lineLength, mPaint);
- // Draw bottom-right corner.
- canvas.drawLine(
- frame.right + strokeWidth / 2,
- frame.bottom,
- frame.right - lineLength,
- frame.bottom,
- mPaint);
- canvas.drawLine(frame.right, frame.bottom, frame.right, frame.bottom - lineLength, mPaint);
+ canvas.drawBitmap(mMaskBitmap, 0, 0, mBackgroundPaint);
+ super.onDraw(canvas);
}
private void calculateFramePos() {
final int centralX = getWidth() / 2;
final int centralY = getHeight() / 2;
- final float halfFrameWidth = getWidth() / 3;
- mFrame = new RectF(
- centralX - halfFrameWidth,
- centralY - halfFrameWidth,
- centralX + halfFrameWidth,
- centralY + halfFrameWidth);
+ final float cornerLineLength = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+ CORNER_LINE_LENGTH, getResources().getDisplayMetrics()) / 2;
+ final float strokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+ CORNER_STROKE_WIDTH, getResources().getDisplayMetrics()) / 2;
+
+ mOuterFrame = new RectF(centralX - cornerLineLength, centralY - cornerLineLength,
+ centralX + cornerLineLength, centralY + cornerLineLength);
+ mInnerFrame = new RectF(mOuterFrame.left + strokeWidth, mOuterFrame.top + strokeWidth,
+ mOuterFrame.right - strokeWidth, mOuterFrame.bottom - strokeWidth);
}
// Draws green lines if focued. Otherwise, draws white lines.