mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 13:50:30 +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 com.github.libretube.R
|
||||
import com.github.libretube.obj.DeleteUserRequest
|
||||
import com.github.libretube.requireMainActivityRestart
|
||||
import com.github.libretube.util.RetrofitInstance
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
|
||||
@ -60,13 +61,14 @@ class DeleteAccountDialog : DialogFragment() {
|
||||
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
|
||||
val token = sharedPref?.getString("token", "")!!
|
||||
|
||||
val response = try {
|
||||
try {
|
||||
RetrofitInstance.api.deleteAccount(token, DeleteUserRequest(password))
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, e.toString())
|
||||
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
|
||||
return@launchWhenCreated
|
||||
}
|
||||
requireMainActivityRestart = true
|
||||
Toast.makeText(context, R.string.success, Toast.LENGTH_SHORT).show()
|
||||
logout()
|
||||
dialog?.dismiss()
|
||||
|
@ -12,7 +12,7 @@
|
||||
android:id="@+id/back_imageButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginVertical="10dp"
|
||||
android:backgroundTint="@android:color/transparent"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
@ -23,7 +23,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/settings"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:textSize="20sp"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
@ -24,6 +23,7 @@
|
||||
<Button
|
||||
android:id="@+id/addToPlaylist"
|
||||
android:text="@string/addToPlaylist"
|
||||
style="@style/CustomDialogButton" />
|
||||
style="@style/CustomDialogButton"
|
||||
android:layout_marginRight="16dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -40,7 +40,8 @@
|
||||
<Button
|
||||
android:id="@+id/create_new_playlist"
|
||||
android:text="@string/createPlaylist"
|
||||
style="@style/CustomDialogButton" />
|
||||
style="@style/CustomDialogButton"
|
||||
android:layout_marginRight="16dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -61,7 +61,8 @@
|
||||
<Button
|
||||
android:id="@+id/addInstance"
|
||||
android:text="@string/addInstance"
|
||||
style="@style/CustomDialogButton" />
|
||||
style="@style/CustomDialogButton"
|
||||
android:layout_marginRight="16dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -39,7 +39,8 @@
|
||||
<Button
|
||||
android:id="@+id/delete_account_confirm"
|
||||
android:text="@string/deleteAccount"
|
||||
style="@style/CustomDialogButton" />
|
||||
style="@style/CustomDialogButton"
|
||||
android:layout_marginRight="16dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
<Button
|
||||
android:id="@+id/download"
|
||||
android:text="@string/download"
|
||||
style="@style/CustomDialogButton" />
|
||||
style="@style/CustomDialogButton"
|
||||
android:layout_marginRight="16dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -51,7 +51,8 @@
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
android:text="@string/login"
|
||||
style="@style/CustomDialogButton" />
|
||||
style="@style/CustomDialogButton"
|
||||
android:layout_marginRight="16dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -44,31 +44,31 @@
|
||||
|
||||
</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_height">wrap_content</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: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 name="CustomDialogTextInputLayout" parent="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="hintEnabled">false</item>
|
||||
<item name="android:layout_marginLeft">10dp</item>
|
||||
<item name="android:layout_marginRight">10dp</item>
|
||||
<item name="android:layout_marginTop">16dp</item>
|
||||
<item name="android:layout_marginBottom">4dp</item>
|
||||
<item name="android:layout_marginLeft">15dp</item>
|
||||
<item name="android:layout_marginRight">15dp</item>
|
||||
<item name="android:layout_marginTop">10dp</item>
|
||||
<item name="android:layout_marginBottom">5dp</item>
|
||||
|
||||
<item name="boxCornerRadiusBottomStart">15dp</item>
|
||||
<item name="boxCornerRadiusBottomEnd">15dp</item>
|
||||
<item name="boxCornerRadiusTopEnd">15dp</item>
|
||||
<item name="boxCornerRadiusTopStart">15dp</item>
|
||||
|
||||
</style>
|
||||
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user