diff options
author | Allan Wang <me@allanwang.ca> | 2019-07-03 14:37:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-03 14:37:27 -0700 |
commit | 00bb4c7a54bb2aaf8a765acd4478e2cc22ff44ba (patch) | |
tree | 1085695a3a6333d174d92af17d547095c872c9f1 | |
parent | 6685ed8d7194a495820b2a06378f738cd6612ad3 (diff) | |
parent | cfc1982400fce040510f8f96b87b377635f97ebf (diff) | |
download | frost-00bb4c7a54bb2aaf8a765acd4478e2cc22ff44ba.tar.gz frost-00bb4c7a54bb2aaf8a765acd4478e2cc22ff44ba.tar.bz2 frost-00bb4c7a54bb2aaf8a765acd4478e2cc22ff44ba.zip |
Merge pull request #1470 from AllanWang/image-activity-layout
Image Activity Layout
-rw-r--r-- | .idea/codeStyles/Project.xml | 9 | ||||
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | app/build.gradle | 10 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt | 1 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt | 128 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/views/DragFrame.kt | 37 | ||||
-rw-r--r-- | app/src/main/res/layout/activity_image.xml | 76 | ||||
-rw-r--r-- | app/src/main/res/layout/activity_image_textless.xml | 37 | ||||
-rw-r--r-- | buildSrc/src/main/kotlin/Versions.kt | 4 | ||||
-rwxr-xr-x | generate-apk-release.sh | 27 |
10 files changed, 182 insertions, 149 deletions
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 3962e1c3..7d1ace49 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -21,6 +21,7 @@ <match> <AND> <NAME>xmlns:android</NAME> + <XML_ATTRIBUTE /> <XML_NAMESPACE>^$</XML_NAMESPACE> </AND> </match> @@ -31,6 +32,7 @@ <match> <AND> <NAME>xmlns:.*</NAME> + <XML_ATTRIBUTE /> <XML_NAMESPACE>^$</XML_NAMESPACE> </AND> </match> @@ -42,6 +44,7 @@ <match> <AND> <NAME>.*:id</NAME> + <XML_ATTRIBUTE /> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> </AND> </match> @@ -52,6 +55,7 @@ <match> <AND> <NAME>.*:name</NAME> + <XML_ATTRIBUTE /> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> </AND> </match> @@ -62,6 +66,7 @@ <match> <AND> <NAME>name</NAME> + <XML_ATTRIBUTE /> <XML_NAMESPACE>^$</XML_NAMESPACE> </AND> </match> @@ -72,6 +77,7 @@ <match> <AND> <NAME>style</NAME> + <XML_ATTRIBUTE /> <XML_NAMESPACE>^$</XML_NAMESPACE> </AND> </match> @@ -82,6 +88,7 @@ <match> <AND> <NAME>.*</NAME> + <XML_ATTRIBUTE /> <XML_NAMESPACE>^$</XML_NAMESPACE> </AND> </match> @@ -93,6 +100,7 @@ <match> <AND> <NAME>.*</NAME> + <XML_ATTRIBUTE /> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> </AND> </match> @@ -104,6 +112,7 @@ <match> <AND> <NAME>.*</NAME> + <XML_ATTRIBUTE /> <XML_NAMESPACE>.*</XML_NAMESPACE> </AND> </match> diff --git a/.travis.yml b/.travis.yml index 49c54d02..f1f59e97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ jdk: - oraclejdk8 env: global: - - ANDROID_API=29 + - ANDROID_API=28 - ANDROID_BUILD_TOOLS=29.0.0 - secure: X3J97ccW+8K0bXPXhX608vPx7Pr/G4ju7quxydqMaYGgClHxoL/WpXOBAyyllde5P28PY4kioaqcI21BEhnAw0QUbmnzVLA1Qd5VS7aMPHpEnInKuOxGZ2d570OZd1f+ozFVt05vzG0VBJlBAkVhz2GWNxQdmIV1sO28MH526JMuYaEREuuywVSZmAeY7AAbW9MeCC2wvHvNmhk2nk6NLRQcsrDHcBsimy9fnnQ9lT/QsvToi1ZJd/MN7YkGDUULR+YmaotBzG546UJ1EiZQX91bFEJfP0oL43Pk7t5snzmHnKjLOr8Mt5QsIUXaiy/uzhUVmuDh1i0GEpZmhqM7nz/T6P7ogaLbbyJeauNmf15nu+e3hSvNiTzKyIwfSSflv8Do3g8/Eo3dKfIi3I8/OKF/uZ76kywh2LRqtZAqxRDiAMDZVwsRgD4aztoWm5AWa3tSoGy1J7i1eoqX6bNqokRbjgheTqcjN13kCdSZi3pZX7UBYm2Vumhn4izhTume19Rh9SqTmRgQ8jM7ynxHh7vVsJPPJG0HbQ623xz+d9mtXGy1fAb0dcUJMXdOhFN3m6AnKuHiF7cmsqje7Euk/TOZyqZmu0xEhTkugMbNKwGrklJiwRr3IoLtPdhLE38u3/auloUqBQ4K/iA9ZdhAreTSHEaI9d3J4N6kqCj3U30= android: diff --git a/app/build.gradle b/app/build.gradle index b21162f9..dbc38c37 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -22,7 +22,7 @@ apply from: '../spotless.gradle' group = APP_GROUP android { - compileSdkVersion kau.Versions.targetSdk + compileSdkVersion Versions.targetSdk buildToolsVersion kau.Versions.buildTools androidGitVersion { @@ -34,7 +34,7 @@ android { defaultConfig { applicationId "${project.APP_GROUP}.${project.APP_ID.toLowerCase(Locale.CANADA)}" minSdkVersion kau.Versions.minSdk - targetSdkVersion kau.Versions.targetSdk + targetSdkVersion Versions.targetSdk versionCode androidGitVersion.code() versionName androidGitVersion.name() multiDexEnabled true @@ -65,6 +65,10 @@ android { textOutput 'stdout' } + dataBinding { + enabled = true + } + def testKeystoreFile = file('../files/test.keystore') def testPropFile = file('../files/test.properties') def withTestSigning = testKeystoreFile.exists() && testPropFile.exists() @@ -295,8 +299,6 @@ dependencies { implementation "com.davemorrissey.labs:subsampling-scale-image-view:${Versions.scaleImageView}" - implementation "com.sothree.slidinguppanel:library:${Versions.slidingPanel}" - implementation "androidx.room:room-ktx:${Versions.room}" implementation "androidx.room:room-runtime:${Versions.room}" kapt "androidx.room:room-compiler:${Versions.room}" diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt index 56125303..4461be71 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt @@ -68,7 +68,6 @@ class AboutActivity : AboutActivityBase(null, { val include = arrayOf( "AboutLibraries", "AndroidIconics", - "androidslidinguppanel", "dbflow", "fastadapter", "glide", 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 c7d31032..5cab957a 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt @@ -24,6 +24,7 @@ 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 @@ -33,6 +34,7 @@ import ca.allanwang.kau.utils.adjustAlpha import ca.allanwang.kau.utils.colorToForeground import ca.allanwang.kau.utils.copyFromInputStream import ca.allanwang.kau.utils.fadeOut +import ca.allanwang.kau.utils.gone import ca.allanwang.kau.utils.isHidden import ca.allanwang.kau.utils.isVisible import ca.allanwang.kau.utils.materialDialog @@ -43,10 +45,12 @@ import ca.allanwang.kau.utils.withAlpha import ca.allanwang.kau.utils.withMinAlpha import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView +import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.floatingactionbutton.FloatingActionButton import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.mikepenz.iconics.typeface.IIcon import com.pitchedapps.frost.R +import com.pitchedapps.frost.databinding.ActivityImageBinding import com.pitchedapps.frost.facebook.FB_IMAGE_ID_MATCHER import com.pitchedapps.frost.facebook.get import com.pitchedapps.frost.facebook.requests.call @@ -63,8 +67,6 @@ import com.pitchedapps.frost.utils.isIndirectImageUrl import com.pitchedapps.frost.utils.logFrostEvent import com.pitchedapps.frost.utils.sendFrostEmail import com.pitchedapps.frost.utils.setFrostColors -import com.sothree.slidinguppanel.SlidingUpPanelLayout -import kotlinx.android.synthetic.main.activity_image.* import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.Deferred import kotlinx.coroutines.Dispatchers @@ -104,7 +106,7 @@ class ImageActivity : KauBaseActivity() { set(value) { if (field == value) return field = value - value.update(image_fab) + value.update(binding.imageFab) } private lateinit var dragHelper: ViewDragHelper @@ -141,14 +143,19 @@ class ImageActivity : KauBaseActivity() { )}_${Math.abs(imageUrl.hashCode())}" } + private lateinit var binding: ActivityImageBinding + private var bottomBehavior: BottomSheetBehavior<View>? = null + private val baseBackgroundColor = if (Prefs.blackMediaBg) Color.BLACK else Prefs.bgColor.withMinAlpha(235) private fun loadError(e: Throwable) { errorRef = e e.logFrostEvent("Image load error") - if (image_progress.isVisible) - image_progress.fadeOut() + with(binding) { + if (imageProgress.isVisible) + imageProgress.fadeOut() + } tempFile.delete() fabAction = FabStates.ERROR } @@ -166,28 +173,49 @@ class ImageActivity : KauBaseActivity() { L.v { "Launching with true url $result" } result } + binding = DataBindingUtil.setContentView(this, R.layout.activity_image) + binding.onCreate() + tempFile = File(cacheDir(this), imageHash) + launch(CoroutineExceptionHandler { _, throwable -> loadError(throwable) }) { + downloadImageTo(tempFile) + binding.imageProgress.fadeOut() + binding.imagePhoto.setImage(ImageSource.uri(frostUriFromFile(tempFile))) + fabAction = FabStates.DOWNLOAD + binding.imagePhoto.animate().alpha(1f).scaleXY(1f).start() + } + } - val layout = - if (!imageText.isNullOrBlank()) R.layout.activity_image else R.layout.activity_image_textless - setContentView(layout) - image_container.setBackgroundColor(baseBackgroundColor) - image_text?.setTextColor(if (Prefs.blackMediaBg) Color.WHITE else Prefs.textColor) - image_text?.setBackgroundColor( - (if (Prefs.blackMediaBg) Color.BLACK else Prefs.bgColor) - .colorToForeground(0.2f).withAlpha(255) - ) - image_text?.text = imageText - image_progress.tint(if (Prefs.blackMediaBg) Color.WHITE else Prefs.accentColor) - image_panel?.addPanelSlideListener(object : - SlidingUpPanelLayout.SimplePanelSlideListener() { - override fun onPanelSlide(panel: View, slideOffset: Float) { - if (slideOffset == 0f && !image_fab.isShown) image_fab.show() - else if (slideOffset != 0f && image_fab.isShown) image_fab.hide() - image_text?.alpha = slideOffset / 2 + 0.5f + private fun ActivityImageBinding.onCreate() { + imageContainer.setBackgroundColor(baseBackgroundColor) + this@ImageActivity.imageText.also { text -> + if (text.isNullOrBlank()) { + imageText.gone() + } else { + imageText.setTextColor(if (Prefs.blackMediaBg) Color.WHITE else Prefs.textColor) + imageText.setBackgroundColor( + (if (Prefs.blackMediaBg) Color.BLACK else Prefs.bgColor) + .colorToForeground(0.2f).withAlpha(255) + ) + imageText.text = text + bottomBehavior = BottomSheetBehavior.from<View>(imageText).apply { + setBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { + override fun onSlide(bottomSheet: View, slideOffset: Float) { + if (slideOffset == 0f && !imageFab.isShown) imageFab.show() + else if (slideOffset != 0f && imageFab.isShown) imageFab.hide() + imageText.alpha = slideOffset / 2 + 0.5f + } + + override fun onStateChanged(bottomSheet: View, newState: Int) { + // No op + } + }) + } + imageText.bringToFront() } - }) - image_fab.setOnClickListener { fabAction.onClick(this) } - image_photo.setOnImageEventListener(object : + } + imageProgress.tint(if (Prefs.blackMediaBg) Color.WHITE else Prefs.accentColor) + imageFab.setOnClickListener { fabAction.onClick(this@ImageActivity) } + imagePhoto.setOnImageEventListener(object : SubsamplingScaleImageView.DefaultOnImageEventListener() { override fun onImageLoadError(e: Exception) { loadError(e) @@ -196,18 +224,11 @@ class ImageActivity : KauBaseActivity() { setFrostColors { themeWindow = false } - tempFile = File(cacheDir(this), imageHash) - launch(CoroutineExceptionHandler { _, throwable -> loadError(throwable) }) { - downloadImageTo(tempFile) - image_progress.fadeOut() - image_photo.setImage(ImageSource.uri(frostUriFromFile(tempFile))) - fabAction = FabStates.DOWNLOAD - image_photo.animate().alpha(1f).scaleXY(1f).start() - dragHelper = ViewDragHelper.create(image_drag, ViewDragCallback()).apply { - setEdgeTrackingEnabled(ViewDragHelper.EDGE_TOP or ViewDragHelper.EDGE_BOTTOM) - } - image_drag.dragHelper = dragHelper + dragHelper = ViewDragHelper.create(imageDrag, ViewDragCallback()).apply { + setEdgeTrackingEnabled(ViewDragHelper.EDGE_TOP or ViewDragHelper.EDGE_BOTTOM) } + imageDrag.dragHelper = dragHelper + imageDrag.viewToIgnore = imageText } private inner class ViewDragCallback : ViewDragHelper.Callback() { @@ -216,7 +237,8 @@ class ImageActivity : KauBaseActivity() { private var scrollToTop = false override fun tryCaptureView(view: View, i: Int): Boolean { - return true + L.d { "Try capture ${view.id} $i ${binding.imagePhoto.id} ${binding.imageText.id}" } + return view === binding.imagePhoto } override fun getViewHorizontalDragRange(child: View): Int = 0 @@ -231,18 +253,24 @@ class ImageActivity : KauBaseActivity() { dy: Int ) { super.onViewPositionChanged(changedView, left, top, dx, dy) - //make sure that we are using the proper axis - scrollPercent = abs(top.toFloat() / image_container.height) - scrollToTop = top < 0 - val multiplier = max(1f - scrollPercent, 0f) - image_fab.alpha = multiplier - image_panel?.alpha = multiplier - image_container.setBackgroundColor(baseBackgroundColor.adjustAlpha(multiplier)) - - if (scrollPercent >= 1) { - if (!isFinishing) { - finish() - overridePendingTransition(0, 0) + with(binding) { + //make sure that we are using the proper axis + scrollPercent = abs(top.toFloat() / imageContainer.height) + scrollToTop = top < 0 + val multiplier = max(1f - scrollPercent, 0f) + + imageFab.alpha = multiplier + bottomBehavior?.also { + imageText.alpha = + multiplier * (if (it.state == BottomSheetBehavior.STATE_COLLAPSED) 0.5f else 1f) + } + imageContainer.setBackgroundColor(baseBackgroundColor.adjustAlpha(multiplier)) + + if (scrollPercent >= 1) { + if (!isFinishing) { + finish() + overridePendingTransition(0, 0) + } } } } @@ -256,7 +284,7 @@ class ImageActivity : KauBaseActivity() { else -> 0 } dragHelper.settleCapturedViewAt(0, finalTop) - image_drag.invalidate() + binding.imageDrag.invalidate() } override fun clampViewPositionHorizontal(child: View, left: Int, dx: Int): Int = 0 diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/DragFrame.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/DragFrame.kt index c2f36536..87ad2bef 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/DragFrame.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/DragFrame.kt @@ -18,8 +18,10 @@ package com.pitchedapps.frost.views import android.annotation.SuppressLint import android.content.Context +import android.graphics.Rect import android.util.AttributeSet import android.view.MotionEvent +import android.view.View import android.widget.FrameLayout import androidx.core.view.ViewCompat import androidx.customview.widget.ViewDragHelper @@ -29,9 +31,20 @@ class DragFrame @JvmOverloads constructor( attrs: AttributeSet? = null, defStyleAttr: Int = 0 ) : FrameLayout(context, attrs, defStyleAttr) { + var dragHelper: ViewDragHelper? = null + var viewToIgnore: View? = null + private val rect = Rect() + private val location = IntArray(2) + private var shouldIgnore: Boolean = false override fun onInterceptTouchEvent(event: MotionEvent): Boolean { + if (event.actionMasked == MotionEvent.ACTION_DOWN) { + shouldIgnore = shouldIgnore(event) + } + if (shouldIgnore) { + return false + } return try { dragHelper?.shouldInterceptTouchEvent(event) ?: false } catch (e: Exception) { @@ -41,6 +54,12 @@ class DragFrame @JvmOverloads constructor( @SuppressLint("ClickableViewAccessibility") override fun onTouchEvent(event: MotionEvent): Boolean { + if (event.actionMasked == MotionEvent.ACTION_DOWN) { + shouldIgnore = shouldIgnore(event) + } + if (shouldIgnore) { + return false + } try { dragHelper?.processTouchEvent(event) ?: return false } catch (e: Exception) { @@ -49,6 +68,24 @@ class DragFrame @JvmOverloads constructor( return true } + override fun dispatchTouchEvent(event: MotionEvent): Boolean { + if (event.actionMasked == MotionEvent.ACTION_DOWN) { + shouldIgnore = shouldIgnore(event) + } + if (shouldIgnore) { + return false + } + return super.dispatchTouchEvent(event) + } + + private fun shouldIgnore(event: MotionEvent): Boolean { + val v = viewToIgnore ?: return false + v.getDrawingRect(rect) + v.getLocationOnScreen(location) + rect.offset(location[0], location[1]) + return rect.contains(event.rawX.toInt(), event.rawY.toInt()) + } + override fun computeScroll() { super.computeScroll() if (dragHelper?.continueSettling(true) == true) { diff --git a/app/src/main/res/layout/activity_image.xml b/app/src/main/res/layout/activity_image.xml index 85837fc3..2bf68056 100644 --- a/app/src/main/res/layout/activity_image.xml +++ b/app/src/main/res/layout/activity_image.xml @@ -1,44 +1,23 @@ <?xml version="1.0" encoding="utf-8"?> -<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.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 - android:id="@+id/image_drag" +<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" android:layout_width="match_parent" android:layout_height="match_parent"> - <com.sothree.slidinguppanel.SlidingUpPanelLayout - android:id="@+id/image_panel" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="bottom" - app:umanoPanelHeight="44dp" - app:umanoShadowHeight="0dp"> + <ProgressBar + android:id="@+id/image_progress" + style="?android:attr/progressBarStyleLarge" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" /> - <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" /> + <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" @@ -48,8 +27,25 @@ android:scaleX="0.9" android:scaleY="0.9" /> - </com.sothree.slidinguppanel.SlidingUpPanelLayout> - - </com.pitchedapps.frost.views.DragFrame> + </com.pitchedapps.frost.views.DragFrame> -</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file + <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> + +</layout> diff --git a/app/src/main/res/layout/activity_image_textless.xml b/app/src/main/res/layout/activity_image_textless.xml deleted file mode 100644 index 41fd43a2..00000000 --- a/app/src/main/res/layout/activity_image_textless.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" - 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"> - - <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> - - <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>
\ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 5d93dbfa..a6df6bda 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -1,5 +1,7 @@ object Versions { + const val targetSdk = 28 + const val andxBiometric = "1.0.0-alpha04" // https://mvnrepository.com/artifact/org.apache.commons/commons-text @@ -32,8 +34,6 @@ object Versions { const val roboelectric = "4.2" // https://github.com/davemorrissey/subsampling-scale-image-view#quick-start const val scaleImageView = "3.10.0" - // https://github.com/umano/AndroidSlidingUpPanel#importing-the-library - const val slidingPanel = "3.4.0" // https://github.com/srs/gradle-node-plugin/releases const val nodeGradle = "1.3.1" }
\ No newline at end of file diff --git a/generate-apk-release.sh b/generate-apk-release.sh index d3a44577..c9b44358 100755 --- a/generate-apk-release.sh +++ b/generate-apk-release.sh @@ -12,14 +12,13 @@ MODULE_NAME=app VERSION_KEY=Frost # Make version key different from module name -# APK is directly moved by docker # create a new directory that will contain our generated apk -# mkdir $HOME/$VERSION_KEY/ +mkdir ${HOME}/${VERSION_KEY}/ # copy generated apk from build folder to the folder just created -# cp -a $MODULE_NAME/build/outputs/apk/releaseTest/. $HOME/$VERSION_KEY/ -# printf "Moved apks\n" -ls -a $HOME/${VERSION_KEY} -if [ -z "$(find $HOME/${VERSION_KEY} -name '*.apk')" ]; then +cp -a ${MODULE_NAME}/build/outputs/apk/releaseTest/. ${HOME}/${VERSION_KEY}/ +printf "Moved apks\n" +ls -a ${HOME}/${VERSION_KEY} +if [[ -z "$(find ${HOME}/${VERSION_KEY} -name '*.apk')" ]]; then echo "No apks found" exit 1 fi @@ -30,30 +29,30 @@ cd $HOME git config --global user.email "$EMAIL" git config --global user.name "$USER_AUTH CI" # clone the repository in the buildApk folder -git clone --quiet --branch=master https://$USER_AUTH:$GITHUB_API_KEY@github.com/$RELEASE_REPO.git master > /dev/null +git clone --quiet --branch=master https://${USER_AUTH}:${GITHUB_API_KEY}@github.com/${RELEASE_REPO}.git master > /dev/null # create version file echo "Create Version File" cd master -echo "$VERSION_KEY v$TRAVIS_BUILD_NUMBER" > "$VERSION_KEY.txt" +echo "${VERSION_KEY} v${TRAVIS_BUILD_NUMBER}" > "${VERSION_KEY}.txt" echo "Push Version File" git remote rm origin -git remote add origin https://$USER_AUTH:$GITHUB_API_KEY@github.com/$RELEASE_REPO.git +git remote add origin https://${USER_AUTH}:${GITHUB_API_KEY}@github.com/${RELEASE_REPO}.git git add -f . -git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed [skip ci]" +git commit -m "Travis build ${TRAVIS_BUILD_NUMBER} pushed [skip ci]" git push -fq origin master > /dev/null echo "Create New Release" -API_JSON="$(printf '{"tag_name": "v%s","target_commitish": "master","name": "v%s","body": "Automatic Release v%s for branch %s %s","draft": false,"prerelease": false}' $TRAVIS_BUILD_NUMBER $TRAVIS_BUILD_NUMBER $TRAVIS_BUILD_NUMBER "\`$TRAVIS_BRANCH\`" "\nhttps://github.com/$TRAVIS_REPO_SLUG/commit/$TRAVIS_COMMIT")" -newRelease="$(curl --data "$API_JSON" https://api.github.com/repos/$RELEASE_REPO/releases?access_token=$GITHUB_API_KEY)" +API_JSON="$(printf '{"tag_name": "v%s","target_commitish": "master","name": "v%s","body": "Automatic Release v%s for branch %s %s","draft": false,"prerelease": false}' ${TRAVIS_BUILD_NUMBER} ${TRAVIS_BUILD_NUMBER} ${TRAVIS_BUILD_NUMBER} "\`${TRAVIS_BRANCH}\`" "\nhttps://github.com/${TRAVIS_REPO_SLUG}/commit/${TRAVIS_COMMIT}")" +newRelease="$(curl --data "${API_JSON}" https://api.github.com/repos/${RELEASE_REPO}/releases?access_token=${GITHUB_API_KEY})" rID="$(echo "$newRelease" | jq ".id")" -cd $HOME/${VERSION_KEY} +cd ${HOME}/${VERSION_KEY} echo "Push apk to $rID" for apk in $(find *.apk -type f); do apkName="${apk::-4}" printf "Apk $apkName\n" - curl "https://uploads.github.com/repos/${RELEASE_REPO}/releases/${rID}/assets?access_token=${GITHUB_API_KEY}&name=${apkName}-v${TRAVIS_BUILD_NUMBER}.apk" --header 'Content-Type: application/zip' --upload-file $apkName.apk -X POST + curl "https://uploads.github.com/repos/${RELEASE_REPO}/releases/${rID}/assets?access_token=${GITHUB_API_KEY}&name=${apkName}-v${TRAVIS_BUILD_NUMBER}.apk" --header 'Content-Type: application/zip' --upload-file ${apkName}.apk -X POST done echo -e "Done\n"
\ No newline at end of file |