aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-12-26 15:32:31 -0800
committerAllan Wang <me@allanwang.ca>2019-12-26 15:32:31 -0800
commited18f003bb3bd80149e9fce7288382fb85dafdd7 (patch)
tree0aafd03e23abc05969797896506720750cf2e732
parent15494d3b42315fa6fa7ae5daeb5ddf1f964b3932 (diff)
downloadfrost-ed18f003bb3bd80149e9fce7288382fb85dafdd7.tar.gz
frost-ed18f003bb3bd80149e9fce7288382fb85dafdd7.tar.bz2
frost-ed18f003bb3bd80149e9fce7288382fb85dafdd7.zip
Convert to view binding
-rw-r--r--app/build.gradle2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt4
-rw-r--r--app/src/main/res/layout/activity_image.xml84
-rw-r--r--gradle.properties2
4 files changed, 44 insertions, 48 deletions
diff --git a/app/build.gradle b/app/build.gradle
index c89bf1f4..9e442c2b 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -65,7 +65,7 @@ android {
textOutput 'stdout'
}
- dataBinding {
+ viewBinding {
enabled = true
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
index d7876888..71152190 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
@@ -24,7 +24,6 @@ import android.os.Bundle
import android.os.Environment
import android.view.View
import androidx.customview.widget.ViewDragHelper
-import androidx.databinding.DataBindingUtil
import ca.allanwang.kau.internal.KauBaseActivity
import ca.allanwang.kau.logging.KauLoggerExtension
import ca.allanwang.kau.mediapicker.scanMedia
@@ -177,7 +176,8 @@ class ImageActivity : KauBaseActivity() {
L.v { "Launching with true url $result" }
result
}
- binding = DataBindingUtil.setContentView(this, R.layout.activity_image)
+ binding = ActivityImageBinding.inflate(layoutInflater)
+ setContentView(binding.root)
binding.onCreate()
tempFile = File(cacheDir(this), imageHash)
launch(CoroutineExceptionHandler { _, throwable -> loadError(throwable) }) {
diff --git a/app/src/main/res/layout/activity_image.xml b/app/src/main/res/layout/activity_image.xml
index 2bf68056..7d79cb74 100644
--- a/app/src/main/res/layout/activity_image.xml
+++ b/app/src/main/res/layout/activity_image.xml
@@ -1,51 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
-<layout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
-
- <androidx.coordinatorlayout.widget.CoordinatorLayout
- android:id="@+id/image_container"
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/image_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <ProgressBar
+ android:id="@+id/image_progress"
+ style="?android:attr/progressBarStyleLarge"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center" />
+
+ <com.pitchedapps.frost.views.DragFrame
+ android:id="@+id/image_drag"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <ProgressBar
- android:id="@+id/image_progress"
- style="?android:attr/progressBarStyleLarge"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center" />
-
- <com.pitchedapps.frost.views.DragFrame
- android:id="@+id/image_drag"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
- android:id="@+id/image_photo"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:alpha="0"
- android:scaleX="0.9"
- android:scaleY="0.9" />
-
- </com.pitchedapps.frost.views.DragFrame>
-
- <TextView
- android:id="@+id/image_text"
+ <com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
+ android:id="@+id/image_photo"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:alpha="0.5"
- android:padding="@dimen/kau_padding_normal"
- app:behavior_peekHeight="44dp"
- app:layout_behavior="@string/bottom_sheet_behavior" />
+ android:layout_height="match_parent"
+ android:alpha="0"
+ android:scaleX="0.9"
+ android:scaleY="0.9" />
- <com.google.android.material.floatingactionbutton.FloatingActionButton
- android:id="@+id/image_fab"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="end|bottom"
- android:layout_margin="@dimen/kau_fab_margin"
- android:visibility="invisible" />
+ </com.pitchedapps.frost.views.DragFrame>
- </androidx.coordinatorlayout.widget.CoordinatorLayout>
-
-</layout>
+ <TextView
+ android:id="@+id/image_text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:alpha="0.5"
+ android:padding="@dimen/kau_padding_normal"
+ app:behavior_peekHeight="44dp"
+ app:layout_behavior="@string/bottom_sheet_behavior" />
+
+ <com.google.android.material.floatingactionbutton.FloatingActionButton
+ android:id="@+id/image_fab"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="end|bottom"
+ android:layout_margin="@dimen/kau_fab_margin"
+ android:visibility="invisible" />
+
+</androidx.coordinatorlayout.widget.CoordinatorLayout>
diff --git a/gradle.properties b/gradle.properties
index 76cb9e27..7268656e 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -16,7 +16,7 @@ org.gradle.daemon = true
APP_ID=Frost
APP_GROUP=com.pitchedapps
-KAU=490fa00
+KAU=41cd51a
android.useAndroidX=true
android.enableJetifier=true