Add close button to ApplyActivity
Signed-off-by: Joey <joey@lineageos.org>
diff --git a/app/src/main/java/org/lineageos/backgrounds/ui/ApplyActivity.java b/app/src/main/java/org/lineageos/backgrounds/ui/ApplyActivity.java
index 0cc5788..3bf770f 100644
--- a/app/src/main/java/org/lineageos/backgrounds/ui/ApplyActivity.java
+++ b/app/src/main/java/org/lineageos/backgrounds/ui/ApplyActivity.java
@@ -54,6 +54,7 @@
private TextView mBothView;
private TextView mHomeView;
private TextView mLockView;
+ private ImageView mCloseView;
@Override
protected void onCreate(@Nullable Bundle savedInstance) {
@@ -66,10 +67,12 @@
mBothView = findViewById(R.id.apply_both);
mHomeView = findViewById(R.id.apply_home);
mLockView = findViewById(R.id.apply_lock);
+ mCloseView = findViewById(R.id.apply_close);
mBothView.setOnClickListener(v -> applyWallpaper(BOTH_FLAG));
mHomeView.setOnClickListener(v -> applyWallpaper(HOME_FLAG));
mLockView.setOnClickListener(v -> applyWallpaper(LOCK_FLAG));
+ mCloseView.setOnClickListener(v -> finish());
setup();
}
@@ -147,6 +150,7 @@
private void applyWallpaper(final int flags) {
hideApplyButton();
+ mCloseView.setClickable(false);
final Drawable drawable = mPreviewView.getDrawable();
diff --git a/app/src/main/res/drawable/bg_apply_close.xml b/app/src/main/res/drawable/bg_apply_close.xml
new file mode 100644
index 0000000..a47af00
--- /dev/null
+++ b/app/src/main/res/drawable/bg_apply_close.xml
@@ -0,0 +1,20 @@
+<!--
+ Copyright (C) 2019 The LineageOS 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.
+ -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+
+ <solid android:color="@color/apply_closeBg" />
+</shape>
diff --git a/app/src/main/res/drawable/ic_close.xml b/app/src/main/res/drawable/ic_close.xml
new file mode 100644
index 0000000..c02b51d
--- /dev/null
+++ b/app/src/main/res/drawable/ic_close.xml
@@ -0,0 +1,24 @@
+<!--
+ Copyright (C) 2019 The LineageOS 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">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z" />
+</vector>
diff --git a/app/src/main/res/layout/activity_apply.xml b/app/src/main/res/layout/activity_apply.xml
index cb3b83c..3128077 100644
--- a/app/src/main/res/layout/activity_apply.xml
+++ b/app/src/main/res/layout/activity_apply.xml
@@ -27,7 +27,18 @@
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:transitionName="transition_shared_preview"
- tools:src="@drawable/nature_night" />
+ tools:src="@drawable/space_riseup" />
+
+ <ImageView
+ android:id="@+id/apply_close"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_gravity="top|start"
+ android:layout_margin="16dp"
+ android:background="@drawable/bg_apply_close"
+ android:contentDescription="@string/apply_close"
+ android:padding="4dp"
+ android:src="@drawable/ic_close" />
<LinearLayout
android:id="@+id/apply_button"
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 4f4038d..f46c4c1 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -26,4 +26,5 @@
<color name="navigationBar_divider">#1f000000</color>
<color name="item_nameBg">#1f000000</color>
+ <color name="apply_closeBg">#4f000000</color>
</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 66eac60..3965f93 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -25,6 +25,8 @@
<string name="apply_success">Wallpaper applied</string>
<string name="apply_failure">Unable to set this wallpaper</string>
+ <string name="apply_close">Close</string>
+
<!-- Mono wallpaper names-->
<eat-comment />