mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 09:49:21 +02:00
Merge pull request #3810 from deltachat/adb/account-move-to-top
allow to "move to top" accounts in the accounts list
This commit is contained in:
commit
54f2d2e991
5 changed files with 38 additions and 2 deletions
|
@ -16,7 +16,8 @@
|
|||
* Removed padlocks, as encrypted is the default "normal" state. Instead, unencrypted email is marked with a small email / letter (✉️) icon
|
||||
* Classic email chats/threads get a big email / letter icon making it easy to recognize
|
||||
* After some time, add a device message asking to donate. Can't wait? Donate today at https://delta.chat/donate
|
||||
* Update to core 2.0.0
|
||||
* Allow to sort profiles up in the profile switcher
|
||||
* Update to core 2.1.0
|
||||
|
||||
## v1.58.4
|
||||
2025-05
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 192a6a2b9dd9413eb175e1c3e88b93a6b59d515a
|
||||
Subproject commit 402e42f858514e5c1fbab3c88ad3d5f884009b8b
|
|
@ -164,6 +164,10 @@ public class Rpc {
|
|||
return gson.fromJson(getResult("create_broadcast", accountId, chatName), Integer.class);
|
||||
}
|
||||
|
||||
public void setAccountsOrder(List<Integer> order) throws RpcException {
|
||||
getResult("set_accounts_order", order);
|
||||
}
|
||||
|
||||
private static class Request {
|
||||
private final String jsonrpc = "2.0";
|
||||
public final String method;
|
||||
|
|
|
@ -41,6 +41,8 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
|||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class AccountSelectionListFragment extends DialogFragment implements DcEventCenter.DcEventDelegate
|
||||
{
|
||||
private static final String TAG = AccountSelectionListFragment.class.getSimpleName();
|
||||
|
@ -134,9 +136,35 @@ public class AccountSelectionListFragment extends DialogFragment implements DcEv
|
|||
onToggleMute(accountId);
|
||||
} else if (itemId == R.id.menu_set_tag) {
|
||||
onSetTag(accountId);
|
||||
} else if (itemId == R.id.menu_move_to_top) {
|
||||
onMoveToTop(accountId);
|
||||
}
|
||||
}
|
||||
|
||||
private void onMoveToTop(int accountId) {
|
||||
Activity activity = getActivity();
|
||||
if (activity == null) return;
|
||||
|
||||
int[] accountIds = DcHelper.getAccounts(activity).getAll();
|
||||
Integer[] ids = new Integer[accountIds.length];
|
||||
ids[0] = accountId;
|
||||
int j = 1;
|
||||
for (int accId : accountIds) {
|
||||
if (accId != accountId) {
|
||||
ids[j++] = accId;
|
||||
}
|
||||
}
|
||||
|
||||
Rpc rpc = DcHelper.getRpc(activity);
|
||||
try {
|
||||
rpc.setAccountsOrder(Arrays.asList(ids));
|
||||
} catch (RpcException e) {
|
||||
Log.e(TAG, "Error calling rpc.setAccountsOrder()", e);
|
||||
}
|
||||
|
||||
refreshData();
|
||||
}
|
||||
|
||||
private void onSetTag(int accountId) {
|
||||
Activity activity = getActivity();
|
||||
if (activity == null) return;
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
<item android:title="@string/profile_tag"
|
||||
android:id="@+id/menu_set_tag"/>
|
||||
|
||||
<item android:title="@string/move_to_top"
|
||||
android:id="@+id/menu_move_to_top"/>
|
||||
|
||||
<item android:title="@string/delete"
|
||||
android:id="@+id/delete"/>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue