mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 13:35:18 +00:00
Implement clear all data dialog redesign
This commit is contained in:
parent
7f1359c6d3
commit
b80d70c31f
11
res/drawable/destructive_dialog_button_background.xml
Normal file
11
res/drawable/destructive_dialog_button_background.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<solid android:color="@color/destructive" />
|
||||||
|
|
||||||
|
<corners android:radius="@dimen/dialog_button_corner_radius" />
|
||||||
|
|
||||||
|
<stroke android:width="@dimen/border_thickness" android:color="@color/destructive" />
|
||||||
|
</shape>
|
57
res/layout/dialog_clear_all_data.xml
Normal file
57
res/layout/dialog_clear_all_data.xml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/default_dialog_background_inset"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="32dp"
|
||||||
|
android:paddingTop="@dimen/medium_spacing"
|
||||||
|
android:paddingRight="32dp"
|
||||||
|
android:paddingBottom="@dimen/medium_spacing">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Clear All Data"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="@dimen/medium_font_size" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/seedTextView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
|
android:text="This will delete your entire account, including all data, any messages currently linked to your Session ID, as well as your personal key pair."
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:textSize="@dimen/small_font_size"
|
||||||
|
android:textAlignment="center" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="@style/UnimportantDialogButton"
|
||||||
|
android:id="@+id/cancelButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="@dimen/small_button_height"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Cancel" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="@style/DestructiveDialogButton"
|
||||||
|
android:id="@+id/clearAllDataButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="@dimen/small_button_height"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginLeft="@dimen/medium_spacing"
|
||||||
|
android:text="Delete" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -77,6 +77,13 @@
|
|||||||
<item name="android:textColor">@color/text</item>
|
<item name="android:textColor">@color/text</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="DestructiveDialogButton">
|
||||||
|
<item name="android:background">@drawable/destructive_dialog_button_background</item>
|
||||||
|
<item name="android:textAllCaps">false</item>
|
||||||
|
<item name="android:textSize">@dimen/small_font_size</item>
|
||||||
|
<item name="android:textColor">@color/text</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="SessionIDTextView">
|
<style name="SessionIDTextView">
|
||||||
<item name="android:background">@drawable/session_id_text_view_background</item>
|
<item name="android:background">@drawable/session_id_text_view_background</item>
|
||||||
<item name="android:padding">@dimen/medium_spacing</item>
|
<item name="android:padding">@dimen/medium_spacing</item>
|
||||||
|
@ -28,6 +28,7 @@ import org.thoughtcrime.securesms.avatar.AvatarSelection
|
|||||||
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil
|
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil
|
||||||
import org.thoughtcrime.securesms.database.Address
|
import org.thoughtcrime.securesms.database.Address
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory
|
import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||||
|
import org.thoughtcrime.securesms.loki.redesign.dialogs.ClearAllDataDialog
|
||||||
import org.thoughtcrime.securesms.loki.redesign.dialogs.SeedDialog
|
import org.thoughtcrime.securesms.loki.redesign.dialogs.SeedDialog
|
||||||
import org.thoughtcrime.securesms.loki.redesign.utilities.push
|
import org.thoughtcrime.securesms.loki.redesign.utilities.push
|
||||||
import org.thoughtcrime.securesms.loki.toPx
|
import org.thoughtcrime.securesms.loki.toPx
|
||||||
@ -80,6 +81,7 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
copyButton.setOnClickListener { copyPublicKey() }
|
copyButton.setOnClickListener { copyPublicKey() }
|
||||||
shareButton.setOnClickListener { sharePublicKey() }
|
shareButton.setOnClickListener { sharePublicKey() }
|
||||||
seedButton.setOnClickListener { showSeed() }
|
seedButton.setOnClickListener { showSeed() }
|
||||||
|
clearAllDataButton.setOnClickListener { clearAllData() }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
@ -241,5 +243,9 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
private fun showSeed() {
|
private fun showSeed() {
|
||||||
SeedDialog().show(supportFragmentManager, "Seed Dialog")
|
SeedDialog().show(supportFragmentManager, "Seed Dialog")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun clearAllData() {
|
||||||
|
ClearAllDataDialog().show(supportFragmentManager, "Clear All Data Dialog")
|
||||||
|
}
|
||||||
// endregion
|
// endregion
|
||||||
}
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package org.thoughtcrime.securesms.loki.redesign.dialogs
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.support.v4.app.DialogFragment
|
||||||
|
import android.support.v7.app.AlertDialog
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import kotlinx.android.synthetic.main.dialog_clear_all_data.view.*
|
||||||
|
import network.loki.messenger.R
|
||||||
|
import org.thoughtcrime.securesms.ApplicationContext
|
||||||
|
|
||||||
|
class ClearAllDataDialog : DialogFragment() {
|
||||||
|
|
||||||
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
|
val builder = AlertDialog.Builder(context!!)
|
||||||
|
val contentView = LayoutInflater.from(context!!).inflate(R.layout.dialog_clear_all_data, null)
|
||||||
|
contentView.cancelButton.setOnClickListener { dismiss() }
|
||||||
|
contentView.clearAllDataButton.setOnClickListener { clearAllData() }
|
||||||
|
builder.setView(contentView)
|
||||||
|
val result = builder.create()
|
||||||
|
result.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun clearAllData() {
|
||||||
|
ApplicationContext.getInstance(context).clearData()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user