mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 07:50:31 +05:30
Merge pull request #621 from Bnyro/master
[SILENT] improve dialog buttons
This commit is contained in:
commit
94faafb50e
@ -14,6 +14,7 @@ import androidx.fragment.app.DialogFragment
|
|||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.obj.DeleteUserRequest
|
import com.github.libretube.obj.DeleteUserRequest
|
||||||
|
import com.github.libretube.requireMainActivityRestart
|
||||||
import com.github.libretube.util.RetrofitInstance
|
import com.github.libretube.util.RetrofitInstance
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
|
||||||
@ -60,13 +61,14 @@ class DeleteAccountDialog : DialogFragment() {
|
|||||||
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
|
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
|
||||||
val token = sharedPref?.getString("token", "")!!
|
val token = sharedPref?.getString("token", "")!!
|
||||||
|
|
||||||
val response = try {
|
try {
|
||||||
RetrofitInstance.api.deleteAccount(token, DeleteUserRequest(password))
|
RetrofitInstance.api.deleteAccount(token, DeleteUserRequest(password))
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(TAG, e.toString())
|
Log.e(TAG, e.toString())
|
||||||
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
|
||||||
return@launchWhenCreated
|
return@launchWhenCreated
|
||||||
}
|
}
|
||||||
|
requireMainActivityRestart = true
|
||||||
Toast.makeText(context, R.string.success, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, R.string.success, Toast.LENGTH_SHORT).show()
|
||||||
logout()
|
logout()
|
||||||
dialog?.dismiss()
|
dialog?.dismiss()
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
android:id="@+id/back_imageButton"
|
android:id="@+id/back_imageButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="20dp"
|
android:layout_marginLeft="15dp"
|
||||||
android:layout_marginVertical="10dp"
|
android:layout_marginVertical="10dp"
|
||||||
android:backgroundTint="@android:color/transparent"
|
android:backgroundTint="@android:color/transparent"
|
||||||
android:background="?android:selectableItemBackgroundBorderless"
|
android:background="?android:selectableItemBackgroundBorderless"
|
||||||
@ -23,7 +23,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/settings"
|
android:text="@string/settings"
|
||||||
android:layout_marginLeft="20dp"
|
android:layout_marginLeft="25dp"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:layout_gravity="center" />
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -24,6 +23,7 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/addToPlaylist"
|
android:id="@+id/addToPlaylist"
|
||||||
android:text="@string/addToPlaylist"
|
android:text="@string/addToPlaylist"
|
||||||
style="@style/CustomDialogButton" />
|
style="@style/CustomDialogButton"
|
||||||
|
android:layout_marginRight="16dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -40,7 +40,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/create_new_playlist"
|
android:id="@+id/create_new_playlist"
|
||||||
android:text="@string/createPlaylist"
|
android:text="@string/createPlaylist"
|
||||||
style="@style/CustomDialogButton" />
|
style="@style/CustomDialogButton"
|
||||||
|
android:layout_marginRight="16dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -61,7 +61,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/addInstance"
|
android:id="@+id/addInstance"
|
||||||
android:text="@string/addInstance"
|
android:text="@string/addInstance"
|
||||||
style="@style/CustomDialogButton" />
|
style="@style/CustomDialogButton"
|
||||||
|
android:layout_marginRight="16dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -39,7 +39,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/delete_account_confirm"
|
android:id="@+id/delete_account_confirm"
|
||||||
android:text="@string/deleteAccount"
|
android:text="@string/deleteAccount"
|
||||||
style="@style/CustomDialogButton" />
|
style="@style/CustomDialogButton"
|
||||||
|
android:layout_marginRight="16dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/download"
|
android:id="@+id/download"
|
||||||
android:text="@string/download"
|
android:text="@string/download"
|
||||||
style="@style/CustomDialogButton" />
|
style="@style/CustomDialogButton"
|
||||||
|
android:layout_marginRight="16dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -51,7 +51,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/login"
|
android:id="@+id/login"
|
||||||
android:text="@string/login"
|
android:text="@string/login"
|
||||||
style="@style/CustomDialogButton" />
|
style="@style/CustomDialogButton"
|
||||||
|
android:layout_marginRight="16dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -44,31 +44,31 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="CustomDialogButton">
|
<style name="CustomDialogButton" parent="@style/Widget.Material3.Button.TextButton">
|
||||||
|
|
||||||
<item name="android:layout_width">wrap_content</item>
|
<item name="android:layout_width">wrap_content</item>
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
<item name="android:layout_gravity">right</item>
|
<item name="android:layout_gravity">right</item>
|
||||||
<item name="android:layout_marginRight">16dp</item>
|
|
||||||
<item name="android:layout_marginBottom">8dp</item>
|
<item name="android:layout_marginBottom">8dp</item>
|
||||||
<item name="android:padding">8dp</item>
|
<item name="android:padding">8dp</item>
|
||||||
<item name="android:textSize">14sp</item>
|
|
||||||
<item name="android:backgroundTint">@android:color/transparent</item>
|
|
||||||
<item name="android:textColor">?attr/colorPrimary</item>
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="CustomDialogTextInputLayout" parent="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
<style name="CustomDialogTextInputLayout" parent="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||||
|
|
||||||
<item name="android:layout_width">match_parent</item>
|
<item name="android:layout_width">match_parent</item>
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
<item name="hintEnabled">false</item>
|
<item name="hintEnabled">false</item>
|
||||||
<item name="android:layout_marginLeft">10dp</item>
|
<item name="android:layout_marginLeft">15dp</item>
|
||||||
<item name="android:layout_marginRight">10dp</item>
|
<item name="android:layout_marginRight">15dp</item>
|
||||||
<item name="android:layout_marginTop">16dp</item>
|
<item name="android:layout_marginTop">10dp</item>
|
||||||
<item name="android:layout_marginBottom">4dp</item>
|
<item name="android:layout_marginBottom">5dp</item>
|
||||||
|
|
||||||
<item name="boxCornerRadiusBottomStart">15dp</item>
|
<item name="boxCornerRadiusBottomStart">15dp</item>
|
||||||
<item name="boxCornerRadiusBottomEnd">15dp</item>
|
<item name="boxCornerRadiusBottomEnd">15dp</item>
|
||||||
<item name="boxCornerRadiusTopEnd">15dp</item>
|
<item name="boxCornerRadiusTopEnd">15dp</item>
|
||||||
<item name="boxCornerRadiusTopStart">15dp</item>
|
<item name="boxCornerRadiusTopStart">15dp</item>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user