mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-05 10:39:24 +02:00
improve delete-account-dialog layout
This commit is contained in:
parent
b89e094f9f
commit
0482889dfa
7 changed files with 103 additions and 15 deletions
|
@ -138,6 +138,10 @@ public class Rpc {
|
||||||
getResult("leave_webxdc_realtime", accountId, instanceMessageId);
|
getResult("leave_webxdc_realtime", accountId, instanceMessageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getAccountFileSize(int accountId) throws RpcException {
|
||||||
|
return getResult("get_account_file_size", accountId).getAsInt();
|
||||||
|
}
|
||||||
|
|
||||||
private static class Request {
|
private static class Request {
|
||||||
private final String jsonrpc = "2.0";
|
private final String jsonrpc = "2.0";
|
||||||
public final String method;
|
public final String method;
|
||||||
|
|
|
@ -20,6 +20,8 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
import com.b44t.messenger.DcAccounts;
|
import com.b44t.messenger.DcAccounts;
|
||||||
import com.b44t.messenger.DcContact;
|
import com.b44t.messenger.DcContact;
|
||||||
import com.b44t.messenger.DcContext;
|
import com.b44t.messenger.DcContext;
|
||||||
|
import com.b44t.messenger.rpc.Rpc;
|
||||||
|
import com.b44t.messenger.rpc.RpcException;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.ConnectivityActivity;
|
import org.thoughtcrime.securesms.ConnectivityActivity;
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
|
@ -118,11 +120,13 @@ public class AccountSelectionListFragment extends DialogFragment
|
||||||
AccountSelectionListFragment.this.dismiss();
|
AccountSelectionListFragment.this.dismiss();
|
||||||
if (activity == null) return;
|
if (activity == null) return;
|
||||||
DcAccounts accounts = DcHelper.getAccounts(activity);
|
DcAccounts accounts = DcHelper.getAccounts(activity);
|
||||||
|
Rpc rpc = DcHelper.getRpc(activity);
|
||||||
|
|
||||||
View dialogView = View.inflate(activity, R.layout.dialog_delete_profile, null);
|
View dialogView = View.inflate(activity, R.layout.dialog_delete_profile, null);
|
||||||
AvatarView avatar = dialogView.findViewById(R.id.avatar);
|
AvatarView avatar = dialogView.findViewById(R.id.avatar);
|
||||||
TextView nameView = dialogView.findViewById(R.id.name);
|
TextView nameView = dialogView.findViewById(R.id.name);
|
||||||
TextView addrView = dialogView.findViewById(R.id.number);
|
TextView addrView = dialogView.findViewById(R.id.address);
|
||||||
|
TextView sizeView = dialogView.findViewById(R.id.size_label);
|
||||||
TextView description = dialogView.findViewById(R.id.description);
|
TextView description = dialogView.findViewById(R.id.description);
|
||||||
DcContext dcContext = accounts.getAccount(accountId);
|
DcContext dcContext = accounts.getAccount(accountId);
|
||||||
String name = dcContext.getConfig("displayname");
|
String name = dcContext.getConfig("displayname");
|
||||||
|
@ -134,6 +138,11 @@ public class AccountSelectionListFragment extends DialogFragment
|
||||||
avatar.setAvatar(GlideApp.with(activity), recipient, false);
|
avatar.setAvatar(GlideApp.with(activity), recipient, false);
|
||||||
nameView.setText(name);
|
nameView.setText(name);
|
||||||
addrView.setText(contact.getAddr());
|
addrView.setText(contact.getAddr());
|
||||||
|
try {
|
||||||
|
sizeView.setText(Util.getPrettyFileSize(rpc.getAccountFileSize(accountId)));
|
||||||
|
} catch (RpcException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
description.setText(activity.getString(R.string.delete_account_explain_with_name, name));
|
description.setText(activity.getString(R.string.delete_account_explain_with_name, name));
|
||||||
|
|
||||||
AlertDialog dialog = new AlertDialog.Builder(activity)
|
AlertDialog dialog = new AlertDialog.Builder(activity)
|
||||||
|
|
7
src/main/res/drawable/delete_account_item_background.xml
Normal file
7
src/main/res/drawable/delete_account_item_background.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<!-- read issue: https://github.com/deltachat/deltachat-android/issues/480 before introducing an attr here. -->
|
||||||
|
<solid android:color="@color/delete_account_item_bg" />
|
||||||
|
<corners android:radius="8dp" />
|
||||||
|
</shape>
|
|
@ -76,7 +76,6 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:visibility="gone"
|
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:clickable="false" />
|
android:clickable="false" />
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -16,14 +17,78 @@
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
android:text="@string/delete_account_ask" />
|
android:text="@string/delete_account_ask" />
|
||||||
|
|
||||||
<include layout="@layout/contact_selection_list_item"/>
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:background="@drawable/delete_account_item_background">
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.components.AvatarView
|
||||||
|
android:id="@+id/avatar"
|
||||||
|
android:layout_width="56dp"
|
||||||
|
android:layout_height="56dp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="marquee"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:textSize="16sp"
|
||||||
|
tools:text="Frieeeeeeedrich Nieeeeeeeeeetzsche" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/address"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textDirection="ltr"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:ellipsize="marquee"
|
||||||
|
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
|
tools:text="me@example.com" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/size_label"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
|
tools:text="150 MB" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/description"
|
android:id="@+id/description"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:text="@string/delete_account_explain_with_name"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -9,4 +9,6 @@
|
||||||
|
|
||||||
<color name="action_mode_status_bar">@color/gray78</color>
|
<color name="action_mode_status_bar">@color/gray78</color>
|
||||||
<color name="dummy_avatar_color">#808080</color>
|
<color name="dummy_avatar_color">#808080</color>
|
||||||
|
|
||||||
|
<color name="delete_account_item_bg">#222222</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -68,4 +68,6 @@
|
||||||
<color name="reaction_pill_background_selected">@color/light_green</color>
|
<color name="reaction_pill_background_selected">@color/light_green</color>
|
||||||
<color name="reaction_pill_border_selected">@color/reaction_pill_border</color>
|
<color name="reaction_pill_border_selected">@color/reaction_pill_border</color>
|
||||||
<color name="reaction_pill_text_color_selected">@color/reaction_pill_text_color</color>
|
<color name="reaction_pill_text_color_selected">@color/reaction_pill_text_color</color>
|
||||||
|
|
||||||
|
<color name="delete_account_item_bg">#eeeeee</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue