mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-05 19:41:57 +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);
|
||||
}
|
||||
|
||||
public int getAccountFileSize(int accountId) throws RpcException {
|
||||
return getResult("get_account_file_size", accountId).getAsInt();
|
||||
}
|
||||
|
||||
private static class Request {
|
||||
private final String jsonrpc = "2.0";
|
||||
public final String method;
|
||||
|
|
|
@ -20,6 +20,8 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import com.b44t.messenger.DcAccounts;
|
||||
import com.b44t.messenger.DcContact;
|
||||
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.R;
|
||||
|
@ -118,11 +120,13 @@ public class AccountSelectionListFragment extends DialogFragment
|
|||
AccountSelectionListFragment.this.dismiss();
|
||||
if (activity == null) return;
|
||||
DcAccounts accounts = DcHelper.getAccounts(activity);
|
||||
Rpc rpc = DcHelper.getRpc(activity);
|
||||
|
||||
View dialogView = View.inflate(activity, R.layout.dialog_delete_profile, null);
|
||||
AvatarView avatar = dialogView.findViewById(R.id.avatar);
|
||||
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);
|
||||
DcContext dcContext = accounts.getAccount(accountId);
|
||||
String name = dcContext.getConfig("displayname");
|
||||
|
@ -134,6 +138,11 @@ public class AccountSelectionListFragment extends DialogFragment
|
|||
avatar.setAvatar(GlideApp.with(activity), recipient, false);
|
||||
nameView.setText(name);
|
||||
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));
|
||||
|
||||
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_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:visibility="gone"
|
||||
android:focusable="false"
|
||||
android:clickable="false" />
|
||||
|
||||
|
|
|
@ -1,31 +1,96 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="@string/delete_account_ask" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:orientation="vertical">
|
||||
android:background="@drawable/delete_account_item_background">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
<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:text="@string/delete_account_ask" />
|
||||
|
||||
<include layout="@layout/contact_selection_list_item"/>
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:fontFamily="sans-serif"
|
||||
android:textSize="16sp"
|
||||
tools:text="Frieeeeeeedrich Nieeeeeeeeeetzsche" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
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
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dp"
|
||||
android:text="@string/delete_account_explain_with_name"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
|
|
|
@ -9,4 +9,6 @@
|
|||
|
||||
<color name="action_mode_status_bar">@color/gray78</color>
|
||||
<color name="dummy_avatar_color">#808080</color>
|
||||
|
||||
<color name="delete_account_item_bg">#222222</color>
|
||||
</resources>
|
||||
|
|
|
@ -68,4 +68,6 @@
|
|||
<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_text_color_selected">@color/reaction_pill_text_color</color>
|
||||
|
||||
<color name="delete_account_item_bg">#eeeeee</color>
|
||||
</resources>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue