diff --git a/app/build.gradle b/app/build.gradle index 7ff0f9e..0637905 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,8 +11,8 @@ android { applicationId = "partisan.weforge.xyz.pulse" minSdk = 29 targetSdk = 34 - versionCode = 11 - versionName = "1.3.2" + versionCode = 12 + versionName = "1.4.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/partisan/weforge/xyz/pulse/PopupWindow.kt b/app/src/main/java/partisan/weforge/xyz/pulse/PopupWindow.kt index 2c932fa..d5f4aa1 100644 --- a/app/src/main/java/partisan/weforge/xyz/pulse/PopupWindow.kt +++ b/app/src/main/java/partisan/weforge/xyz/pulse/PopupWindow.kt @@ -11,6 +11,8 @@ import android.view.LayoutInflater import android.view.WindowManager import android.view.ContextThemeWrapper import android.widget.TextView +import android.animation.ObjectAnimator +import android.widget.ProgressBar import androidx.annotation.RequiresPermission import java.lang.ref.WeakReference import java.util.* @@ -81,6 +83,7 @@ class PopupWindow( service.cancelCall() }, prefs.redirectionDelay) setDescription(destinationId) + startProgressAnimation(prefs.redirectionDelay) if (!add()) { timer?.cancel() service.placeCallUnmodified() @@ -94,6 +97,15 @@ class PopupWindow( ) } + private fun startProgressAnimation(duration: Long) { + val bar = view.findViewById(R.id.progress) + bar.max = 100 + bar.progress = 0 + val animator = ObjectAnimator.ofInt(bar, "progress", 100) + animator.duration = duration + animator.start() + } + @RequiresPermission(Manifest.permission.CALL_PHONE) private fun call(data: Uri) { Intent(Intent.ACTION_VIEW).apply { diff --git a/app/src/main/res/drawable/progress_drawable.xml b/app/src/main/res/drawable/progress_drawable.xml new file mode 100644 index 0000000..8349831 --- /dev/null +++ b/app/src/main/res/drawable/progress_drawable.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/popup.xml b/app/src/main/res/layout/popup.xml index d682d1a..1b46631 100644 --- a/app/src/main/res/layout/popup.xml +++ b/app/src/main/res/layout/popup.xml @@ -10,14 +10,32 @@ app:cardBackgroundColor="?attr/colorSurface" android:background="@android:color/white"> - + android:orientation="vertical"> + + + + +