Added progress bar to popup, to better indicate loading
All checks were successful
Android Release Build / build (push) Successful in 7s
All checks were successful
Android Release Build / build (push) Successful in 7s
This commit is contained in:
parent
0a6df829d4
commit
240f95eba2
4 changed files with 57 additions and 10 deletions
|
@ -11,8 +11,8 @@ android {
|
||||||
applicationId = "partisan.weforge.xyz.pulse"
|
applicationId = "partisan.weforge.xyz.pulse"
|
||||||
minSdk = 29
|
minSdk = 29
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 11
|
versionCode = 12
|
||||||
versionName = "1.3.2"
|
versionName = "1.4.0"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@ import android.view.LayoutInflater
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.view.ContextThemeWrapper
|
import android.view.ContextThemeWrapper
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
|
import android.widget.ProgressBar
|
||||||
import androidx.annotation.RequiresPermission
|
import androidx.annotation.RequiresPermission
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -81,6 +83,7 @@ class PopupWindow(
|
||||||
service.cancelCall()
|
service.cancelCall()
|
||||||
}, prefs.redirectionDelay)
|
}, prefs.redirectionDelay)
|
||||||
setDescription(destinationId)
|
setDescription(destinationId)
|
||||||
|
startProgressAnimation(prefs.redirectionDelay)
|
||||||
if (!add()) {
|
if (!add()) {
|
||||||
timer?.cancel()
|
timer?.cancel()
|
||||||
service.placeCallUnmodified()
|
service.placeCallUnmodified()
|
||||||
|
@ -94,6 +97,15 @@ class PopupWindow(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun startProgressAnimation(duration: Long) {
|
||||||
|
val bar = view.findViewById<ProgressBar>(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)
|
@RequiresPermission(Manifest.permission.CALL_PHONE)
|
||||||
private fun call(data: Uri) {
|
private fun call(data: Uri) {
|
||||||
Intent(Intent.ACTION_VIEW).apply {
|
Intent(Intent.ACTION_VIEW).apply {
|
||||||
|
|
17
app/src/main/res/drawable/progress_drawable.xml
Normal file
17
app/src/main/res/drawable/progress_drawable.xml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:id="@android:id/background">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#22000000" />
|
||||||
|
<corners android:radius="999dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item android:id="@android:id/progress">
|
||||||
|
<clip>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="?attr/colorPrimary" />
|
||||||
|
<corners android:radius="999dp" />
|
||||||
|
</shape>
|
||||||
|
</clip>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
|
@ -10,14 +10,32 @@
|
||||||
app:cardBackgroundColor="?attr/colorSurface"
|
app:cardBackgroundColor="?attr/colorSurface"
|
||||||
android:background="@android:color/white">
|
android:background="@android:color/white">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/description"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="16dp"
|
android:orientation="vertical">
|
||||||
android:textColor="?attr/colorOnSurface"
|
|
||||||
android:textSize="16sp"
|
<TextView
|
||||||
android:textAppearance="?attr/textAppearanceBodyMedium"
|
android:id="@+id/description"
|
||||||
android:textAlignment="center"
|
android:layout_width="wrap_content"
|
||||||
tools:text="Popup text" />
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:textColor="?attr/colorOnSurface"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textAppearance="?attr/textAppearanceBodyMedium"
|
||||||
|
android:textAlignment="center"
|
||||||
|
tools:text="Popup text" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progress"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="3dp"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:indeterminate="false"
|
||||||
|
android:max="100"
|
||||||
|
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||||
|
android:progressDrawable="@drawable/progress_drawable"/>
|
||||||
|
</LinearLayout>
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue