mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +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:
+2
-1
@@ -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
Submodule jni/deltachat-core-rust updated: 192a6a2b9d...402e42f858
@@ -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"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user