diff options
author | Tiem Song <tiem@google.com> | 2017-09-18 10:45:25 -0700 |
---|---|---|
committer | Tiem Song <tiem@google.com> | 2017-09-19 13:12:16 -0700 |
commit | 689cc0c97534750dfe9a7b977ef6d134dfba9285 (patch) | |
tree | 70dc64e0124f6f070ca0e4490e5da9df7f6b59d0 /wearable | |
parent | e42e7f837dee72aa07c1fa3efef41fdbdf938ac6 (diff) | |
download | android-689cc0c97534750dfe9a7b977ef6d134dfba9285.tar.gz |
Update Notifications sample - prep work for Kotlin version
Based on the feedback in ag/2799773 from benweiss@.
Bug: 65631986
Test: Manually ran app on emulated phone and watch, verified that there
are no regressions
Change-Id: I4b2bd955e6eb3325b76e7b36669bbab6eaba68f6
(cherry picked from commit 2f0f033a3dcec3c3ee71b7060126298ddc625534)
Diffstat (limited to 'wearable')
11 files changed, 303 insertions, 222 deletions
diff --git a/wearable/wear/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java b/wearable/wear/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java index 4ade3ed1..9ee81527 100644 --- a/wearable/wear/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java +++ b/wearable/wear/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java @@ -58,12 +58,12 @@ public class MainActivity extends Activity implements Handler.Callback { private CheckBox mIncludeContentIntentCheckbox; private CheckBox mVibrateCheckbox; private BackgroundPickers mBackgroundPickers; - private int postedNotificationCount = 0; + private int mPostedNotificationCount = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.main); + setContentView(R.layout.activity_main); mHandler = new Handler(this); mTextChangedListener = new UpdateNotificationsOnTextChangeListener(); @@ -172,15 +172,25 @@ public class MainActivity extends Activity implements Handler.Callback { private void updateTextEditors(NotificationPreset preset) { mTitleEditText.setText(getString(preset.titleResId)); mTextEditText.setText(getString(preset.textResId)); + + View[] presetViews = { + findViewById(R.id.title_label), + findViewById(R.id.title_editor), + findViewById(R.id.text_label), + findViewById(R.id.text_editor) + }; + if (preset == NotificationPresets.BASIC) { - findViewById(R.id.title_edit_field).setVisibility(View.VISIBLE); + for (View v : presetViews) { + v.setVisibility(View.VISIBLE); + } mTitleEditText.addTextChangedListener(mTextChangedListener); - findViewById(R.id.text_edit_field).setVisibility(View.VISIBLE); mTextEditText.addTextChangedListener(mTextChangedListener); } else { - findViewById(R.id.title_edit_field).setVisibility(View.GONE); + for (View v : presetViews) { + v.setVisibility(View.GONE); + } mTitleEditText.removeTextChangedListener(mTextChangedListener); - findViewById(R.id.text_edit_field).setVisibility(View.GONE); mTextEditText.removeTextChangedListener(mTextChangedListener); } } @@ -195,9 +205,10 @@ public class MainActivity extends Activity implements Handler.Callback { if (cancelExisting) { // Cancel all existing notifications to trigger fresh-posting behavior: For example, - // switching from HIGH to LOW priority does not cause a reordering in Notification Shade. + // switching from HIGH to LOW priority does not cause a reordering in Notification + // Shade. NotificationManagerCompat.from(this).cancelAll(); - postedNotificationCount = 0; + mPostedNotificationCount = 0; // Post the updated notifications on a delay to avoid a cancel+post race condition // with notification manager. @@ -215,12 +226,27 @@ public class MainActivity extends Activity implements Handler.Callback { sendBroadcast(new Intent(NotificationIntentReceiver.ACTION_ENABLE_MESSAGES) .setClass(this, NotificationIntentReceiver.class)); + Notification[] notifications = buildNotifications(); + + // Post new notifications + NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(this); + for (int i = 0; i < notifications.length; i++) { + notificationManagerCompat.notify(i, notifications[i]); + } + // Cancel any that are beyond the current count. + for (int i = notifications.length; i < mPostedNotificationCount; i++) { + notificationManagerCompat.cancel(i); + } + mPostedNotificationCount = notifications.length; + } + + /** + * Build the sample notifications + */ + + private Notification[] buildNotifications() { NotificationPreset preset = NotificationPresets.PRESETS[ mPresetSpinner.getSelectedItemPosition()]; - CharSequence titlePreset = mTitleEditText.getText(); - CharSequence textPreset = mTextEditText.getText(); - PriorityPreset priorityPreset = PriorityPresets.PRESETS[ - mPrioritySpinner.getSelectedItemPosition()]; ActionsPreset actionsPreset = ActionsPresets.PRESETS[ mActionsSpinner.getSelectedItemPosition()]; if (preset.actionsRequired() && actionsPreset == ActionsPresets.NO_ACTIONS_PRESET) { @@ -230,26 +256,16 @@ public class MainActivity extends Activity implements Handler.Callback { actionsPreset), true); } NotificationPreset.BuildOptions options = new NotificationPreset.BuildOptions( - titlePreset, - textPreset, - priorityPreset, + mTitleEditText.getText(), + mTextEditText.getText(), + PriorityPresets.PRESETS[mPrioritySpinner.getSelectedItemPosition()], actionsPreset, mIncludeLargeIconCheckbox.isChecked(), mLocalOnlyCheckbox.isChecked(), mIncludeContentIntentCheckbox.isChecked(), mVibrateCheckbox.isChecked(), mBackgroundPickers.getRes()); - Notification[] notifications = preset.buildNotifications(this, options); - - // Post new notifications - for (int i = 0; i < notifications.length; i++) { - NotificationManagerCompat.from(this).notify(i, notifications[i]); - } - // Cancel any that are beyond the current count. - for (int i = notifications.length; i < postedNotificationCount; i++) { - NotificationManagerCompat.from(this).cancel(i); - } - postedNotificationCount = notifications.length; + return preset.buildNotifications(this, options); } @Override @@ -272,17 +288,14 @@ public class MainActivity extends Activity implements Handler.Callback { } @Override - public void onNothingSelected(AdapterView<?> adapterView) { - } + public void onNothingSelected(AdapterView<?> adapterView) {} } private class UpdateNotificationsOnTextChangeListener implements TextWatcher { @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - } + public void beforeTextChanged(CharSequence s, int start, int count, int after) {} - public void onTextChanged(CharSequence s, int start, int before, int count) { - } + public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override public void afterTextChanged(Editable s) { diff --git a/wearable/wear/Notifications/Application/src/main/res/drawable/selected_background.xml b/wearable/wear/Notifications/Application/src/main/res/drawable/selected_background.xml index 5852dd89..f470fc8a 100644 --- a/wearable/wear/Notifications/Application/src/main/res/drawable/selected_background.xml +++ b/wearable/wear/Notifications/Application/src/main/res/drawable/selected_background.xml @@ -17,11 +17,11 @@ <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <padding - android:top="4dp" - android:bottom="4dp" - android:left="4dp" - android:right="4dp"/> + android:top="@dimen/shape_padding" + android:bottom="@dimen/shape_padding" + android:left="@dimen/shape_padding" + android:right="@dimen/shape_padding"/> <stroke - android:width="4dp" - android:color="@android:color/holo_blue_bright" /> + android:width="@dimen/shape_stroke_width" + android:color="@color/blue" /> </shape> diff --git a/wearable/wear/Notifications/Application/src/main/res/drawable/unselected_background.xml b/wearable/wear/Notifications/Application/src/main/res/drawable/unselected_background.xml index 16131675..a5468972 100644 --- a/wearable/wear/Notifications/Application/src/main/res/drawable/unselected_background.xml +++ b/wearable/wear/Notifications/Application/src/main/res/drawable/unselected_background.xml @@ -17,11 +17,11 @@ <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <padding - android:top="4dp" - android:bottom="4dp" - android:left="4dp" - android:right="4dp"/> + android:top="@dimen/shape_padding" + android:bottom="@dimen/shape_padding" + android:left="@dimen/shape_padding" + android:right="@dimen/shape_padding"/> <stroke - android:width="4dp" - android:color="#ff000000" /> + android:width="@dimen/shape_stroke_width" + android:color="@android:color/black" /> </shape> diff --git a/wearable/wear/Notifications/Application/src/main/res/layout/activity_main.xml b/wearable/wear/Notifications/Application/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..2a54ebfa --- /dev/null +++ b/wearable/wear/Notifications/Application/src/main/res/layout/activity_main.xml @@ -0,0 +1,232 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2017 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. +--> + +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <android.support.constraint.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + tools:layout_editor_absoluteX="0dp" + tools:layout_editor_absoluteY="81dp"> + + <TextView + android:id="@+id/textView" + android:layout_width="368dp" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:layout_marginStart="16dp" + android:layout_marginTop="8dp" + android:text="@string/properties" + android:textAllCaps="true" + android:textColor="@color/blue" + android:textSize="18sp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textView2" + android:layout_width="48dp" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:minWidth="0dp" + android:text="@string/preset" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView" + tools:layout_editor_absoluteX="8dp" /> + + <Spinner + android:id="@+id/preset_spinner" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:layout_marginStart="8dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/textView2" + android:layout_marginTop="12dp" + app:layout_constraintTop_toBottomOf="@+id/textView" /> + + <TextView + android:id="@+id/textView3" + android:layout_width="48dp" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:text="@string/priority" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView2" + tools:layout_editor_absoluteX="8dp" /> + + <Spinner + android:id="@+id/priority_spinner" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:layout_marginStart="8dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toEndOf="@+id/textView3" + tools:layout_editor_absoluteY="83dp" + android:layout_marginTop="14dp" + app:layout_constraintTop_toBottomOf="@+id/preset_spinner" /> + + <TextView + android:id="@+id/textView4" + android:layout_width="48dp" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:text="@string/actions" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView3" + tools:layout_editor_absoluteX="8dp" /> + + <Spinner + android:id="@+id/actions_spinner" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:layout_marginStart="8dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toEndOf="@+id/textView4" + tools:layout_editor_absoluteY="118dp" + android:layout_marginTop="11dp" + app:layout_constraintTop_toBottomOf="@+id/priority_spinner" /> + + <TextView + android:id="@+id/title_label" + android:layout_width="48dp" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:labelFor="@+id/title_editor" + android:text="@string/title" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView4" + tools:layout_editor_absoluteX="8dp" /> + + <EditText + android:id="@id/title_editor" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:layout_marginStart="8dp" + android:ems="10" + android:inputType="textPersonName" + app:layout_constraintBaseline_toBaselineOf="@+id/title_label" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toEndOf="@+id/title_label" /> + + <TextView + android:id="@+id/text_label" + android:layout_width="48dp" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:labelFor="@+id/text_editor" + android:text="@string/text" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/title_label" + tools:layout_editor_absoluteX="8dp" /> + + <EditText + android:id="@id/text_editor" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:layout_marginStart="8dp" + android:ems="10" + android:inputType="textPersonName" + app:layout_constraintBaseline_toBaselineOf="@+id/text_label" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toEndOf="@+id/text_label" /> + + <CheckBox + android:id="@+id/include_large_icon_checkbox" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="16dp" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:text="@string/include_large_icon" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/text_label" /> + + <CheckBox + android:id="@+id/local_only_checkbox" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="16dp" + android:layout_marginStart="16dp" + android:layout_marginTop="8dp" + android:text="@string/local_only" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/include_large_icon_checkbox" /> + + <CheckBox + android:id="@+id/include_content_intent_checkbox" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="16dp" + android:layout_marginStart="16dp" + android:layout_marginTop="8dp" + android:text="@string/include_content_intent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/local_only_checkbox" /> + + <CheckBox + android:id="@+id/vibrate_checkbox" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="16dp" + android:layout_marginStart="16dp" + android:layout_marginTop="8dp" + android:text="@string/vibrate" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/include_content_intent_checkbox" /> + + <LinearLayout + android:id="@+id/background_pickers" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" + android:layout_marginEnd="16dp" + android:layout_marginStart="16dp" + android:layout_marginTop="8dp" + android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/vibrate_checkbox" /> + </android.support.constraint.ConstraintLayout> +</ScrollView> diff --git a/wearable/wear/Notifications/Application/src/main/res/layout/main.xml b/wearable/wear/Notifications/Application/src/main/res/layout/main.xml deleted file mode 100644 index 3068ddcd..00000000 --- a/wearable/wear/Notifications/Application/src/main/res/layout/main.xml +++ /dev/null @@ -1,173 +0,0 @@ - -<!-- 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. ---> - -<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:paddingBottom="@dimen/activity_vertical_margin" - android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" - tools:context="com.example.android.support.wearable.notifications.MainActivity" - tools:ignore="MergeRootFrame"> - - <LinearLayout android:id="@+id/container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <include layout="@layout/layout_divider" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <TextView - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:minWidth="@dimen/editor_spinner_caption_min_width" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:gravity="center_vertical" - android:text="@string/preset" /> - - <Spinner android:id="@+id/preset_spinner" - android:layout_marginLeft="10dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <TextView - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:minWidth="@dimen/editor_spinner_caption_min_width" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:gravity="center_vertical" - android:text="@string/priority" /> - - <Spinner android:id="@+id/priority_spinner" - android:layout_marginLeft="10dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <TextView - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:minWidth="@dimen/editor_spinner_caption_min_width" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:gravity="center_vertical" - android:text="@string/actions" /> - - <Spinner android:id="@+id/actions_spinner" - android:layout_marginLeft="10dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - </LinearLayout> - - <LinearLayout - android:id="@+id/title_edit_field" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <TextView - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:minWidth="@dimen/editor_spinner_caption_min_width" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:gravity="center_vertical" - android:text="@string/title" /> - - <EditText android:id="@+id/title_editor" - android:layout_marginLeft="10dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - </LinearLayout> - - <LinearLayout - android:id="@+id/text_edit_field" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <TextView - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:minWidth="@dimen/editor_spinner_caption_min_width" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:gravity="center_vertical" - android:text="@string/text" /> - - <EditText android:id="@+id/text_editor" - android:layout_marginLeft="10dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - </LinearLayout> - - <CheckBox android:id="@+id/include_large_icon_checkbox" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:paddingTop="@dimen/editor_item_padding_top" - android:paddingBottom="@dimen/editor_item_padding_bottom" - android:text="@string/include_large_icon" /> - - <CheckBox android:id="@+id/local_only_checkbox" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:paddingTop="@dimen/editor_item_padding_top" - android:paddingBottom="@dimen/editor_item_padding_bottom" - android:text="@string/local_only" /> - - <CheckBox android:id="@+id/include_content_intent_checkbox" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:paddingTop="@dimen/editor_item_padding_top" - android:paddingBottom="@dimen/editor_item_padding_bottom" - android:text="@string/include_content_intent" /> - - <CheckBox android:id="@+id/vibrate_checkbox" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:paddingTop="@dimen/editor_item_padding_top" - android:paddingBottom="@dimen/editor_item_padding_bottom" - android:text="@string/vibrate" /> - - <LinearLayout android:id="@+id/background_pickers" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - </LinearLayout> - - </LinearLayout> - -</ScrollView> diff --git a/wearable/wear/Notifications/Application/src/main/res/values/colors.xml b/wearable/wear/Notifications/Application/src/main/res/values/colors.xml index fbcf9562..118f3d47 100644 --- a/wearable/wear/Notifications/Application/src/main/res/values/colors.xml +++ b/wearable/wear/Notifications/Application/src/main/res/values/colors.xml @@ -15,5 +15,6 @@ --> <resources> - <color name="divider_text">@android:color/holo_blue_dark</color> + <color name="blue">#0000FF</color> + <color name="divider_text">@color/blue</color> </resources> diff --git a/wearable/wear/Notifications/Application/src/main/res/values/dimens.xml b/wearable/wear/Notifications/Application/src/main/res/values/dimens.xml index fd97910a..77da63e4 100644 --- a/wearable/wear/Notifications/Application/src/main/res/values/dimens.xml +++ b/wearable/wear/Notifications/Application/src/main/res/values/dimens.xml @@ -26,4 +26,6 @@ <dimen name="image_picker_item_side">48dp</dimen> + <dimen name="shape_padding">4dp</dimen> + <dimen name="shape_stroke_width">4dp</dimen> </resources> diff --git a/wearable/wear/Notifications/Wearable/src/main/res/layout/activity_notification_display.xml b/wearable/wear/Notifications/Wearable/src/main/res/layout/activity_notification_display.xml index 7a329d2b..d91f6aa5 100644 --- a/wearable/wear/Notifications/Wearable/src/main/res/layout/activity_notification_display.xml +++ b/wearable/wear/Notifications/Wearable/src/main/res/layout/activity_notification_display.xml @@ -22,11 +22,11 @@ <TextView android:id="@+id/title" android:layout_width="match_parent" android:layout_height="match_parent" - android:textSize="16sp" - android:padding="8dp" + android:textSize="@dimen/default_text_size" + android:padding="@dimen/default_padding" android:gravity="center_vertical|center_horizontal" - android:textColor="#7777FF" - android:shadowColor="#222299" + android:textColor="@color/notification_display_text_color" + android:shadowColor="@color/notification_display_shadow_color" android:shadowRadius="2" android:shadowDx="1" android:shadowDy="1" diff --git a/wearable/wear/Notifications/Wearable/src/main/res/values/colors.xml b/wearable/wear/Notifications/Wearable/src/main/res/values/colors.xml index 10fad66c..a81e1bc2 100644 --- a/wearable/wear/Notifications/Wearable/src/main/res/values/colors.xml +++ b/wearable/wear/Notifications/Wearable/src/main/res/values/colors.xml @@ -18,4 +18,6 @@ <color name="wl_blue">#2878ff</color> <color name="wl_gray">#c1c1c1</color> <color name="text_color">#434343</color> + <color name="notification_display_text_color">#7777FF</color> + <color name="notification_display_shadow_color">#222299</color> </resources> diff --git a/wearable/wear/Notifications/Wearable/src/main/res/values/dimens.xml b/wearable/wear/Notifications/Wearable/src/main/res/values/dimens.xml index 50214e65..8698c3c6 100644 --- a/wearable/wear/Notifications/Wearable/src/main/res/values/dimens.xml +++ b/wearable/wear/Notifications/Wearable/src/main/res/values/dimens.xml @@ -19,5 +19,7 @@ <dimen name="activity_horizontal_margin">16dp</dimen> <dimen name="activity_vertical_margin">16dp</dimen> <dimen name="animation_range">60dp</dimen> + <dimen name="default_text_size">16sp</dimen> + <dimen name="default_padding">8dp</dimen> </resources> diff --git a/wearable/wear/Notifications/template-params.xml b/wearable/wear/Notifications/template-params.xml index 9399f696..90f9d96e 100644 --- a/wearable/wear/Notifications/template-params.xml +++ b/wearable/wear/Notifications/template-params.xml @@ -30,6 +30,8 @@ <has_handheld_app>true</has_handheld_app> </wearable> + <dependency>com.android.support.constraint:constraint-layout:1.0.2</dependency> + <strings> <intro> <![CDATA[ |