mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 17:59:39 +02:00
Merge pull request #1266 from deltachat/less-clicks
less clicks on save-message and start-chat
This commit is contained in:
commit
091a049f7a
4 changed files with 26 additions and 14 deletions
|
@ -38,6 +38,7 @@ public class DcContext {
|
||||||
public final static int DC_GCL_ARCHIVED_ONLY = 0x01;
|
public final static int DC_GCL_ARCHIVED_ONLY = 0x01;
|
||||||
public final static int DC_GCL_NO_SPECIALS = 0x02;
|
public final static int DC_GCL_NO_SPECIALS = 0x02;
|
||||||
public final static int DC_GCL_ADD_ALLDONE_HINT = 0x04;
|
public final static int DC_GCL_ADD_ALLDONE_HINT = 0x04;
|
||||||
|
public final static int DC_GCL_FOR_FORWARDING = 0x08;
|
||||||
|
|
||||||
public final static int DC_GCM_ADDDAYMARKER = 0x01;
|
public final static int DC_GCM_ADDDAYMARKER = 0x01;
|
||||||
|
|
||||||
|
|
|
@ -603,18 +603,22 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||||
|
|
||||||
private void handleForwarding() {
|
private void handleForwarding() {
|
||||||
DcChat dcChat = dcContext.getChat(chatId);
|
DcChat dcChat = dcContext.getChat(chatId);
|
||||||
String name = dcChat.getName();
|
if (dcChat.isSelfTalk()) {
|
||||||
if( !dcChat.isGroup() ) {
|
new RelayingTask(this, chatId).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
int[] contactIds = dcContext.getChatContacts(chatId);
|
} else {
|
||||||
if( contactIds.length==1 || contactIds.length==2 ) {
|
String name = dcChat.getName();
|
||||||
name = dcContext.getContact(contactIds[0]).getNameNAddr();
|
if (!dcChat.isGroup()) {
|
||||||
|
int[] contactIds = dcContext.getChatContacts(chatId);
|
||||||
|
if (contactIds.length == 1 || contactIds.length == 2) {
|
||||||
|
name = dcContext.getContact(contactIds[0]).getNameNAddr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
new AlertDialog.Builder(this)
|
||||||
|
.setMessage(getString(R.string.ask_forward, name))
|
||||||
|
.setPositiveButton(R.string.ok, (dialogInterface, i) -> new RelayingTask(this, chatId).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR))
|
||||||
|
.setNegativeButton(R.string.cancel, (dialogInterface, i) -> finish())
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
new AlertDialog.Builder(this)
|
|
||||||
.setMessage(getString(R.string.ask_forward, name))
|
|
||||||
.setPositiveButton(R.string.ok, (dialogInterface, i) -> new RelayingTask(this, chatId).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR))
|
|
||||||
.setNegativeButton(R.string.cancel, (dialogInterface, i) -> finish())
|
|
||||||
.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleSharing() {
|
private void handleSharing() {
|
||||||
|
|
|
@ -90,7 +90,10 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
||||||
searchToolbar = findViewById(R.id.search_toolbar);
|
searchToolbar = findViewById(R.id.search_toolbar);
|
||||||
searchAction = findViewById(R.id.search_action);
|
searchAction = findViewById(R.id.search_action);
|
||||||
fragmentContainer = findViewById(R.id.fragment_container);
|
fragmentContainer = findViewById(R.id.fragment_container);
|
||||||
conversationListFragment = initFragment(R.id.fragment_container, new ConversationListFragment(), dynamicLanguage.getCurrentLocale());
|
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putBoolean(ConversationListFragment.FORWARDING, isForwarding(this));
|
||||||
|
conversationListFragment = initFragment(R.id.fragment_container, new ConversationListFragment(), dynamicLanguage.getCurrentLocale(), bundle);
|
||||||
|
|
||||||
initializeSearchListener();
|
initializeSearchListener();
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ public class ConversationListFragment extends Fragment
|
||||||
implements LoaderManager.LoaderCallbacks<DcChatlist>, ActionMode.Callback, ItemClickListener, DcEventCenter.DcEventDelegate
|
implements LoaderManager.LoaderCallbacks<DcChatlist>, ActionMode.Callback, ItemClickListener, DcEventCenter.DcEventDelegate
|
||||||
{
|
{
|
||||||
public static final String ARCHIVE = "archive";
|
public static final String ARCHIVE = "archive";
|
||||||
|
public static final String FORWARDING = "for_forwarding";
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private static final String TAG = ConversationListFragment.class.getSimpleName();
|
private static final String TAG = ConversationListFragment.class.getSimpleName();
|
||||||
|
@ -93,12 +94,14 @@ public class ConversationListFragment extends Fragment
|
||||||
private Locale locale;
|
private Locale locale;
|
||||||
private String queryFilter = "";
|
private String queryFilter = "";
|
||||||
private boolean archive;
|
private boolean archive;
|
||||||
|
private boolean forwarding;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
locale = (Locale) getArguments().getSerializable(PassphraseRequiredActionBarActivity.LOCALE_EXTRA);
|
locale = (Locale) getArguments().getSerializable(PassphraseRequiredActionBarActivity.LOCALE_EXTRA);
|
||||||
archive = getArguments().getBoolean(ARCHIVE, false);
|
archive = getArguments().getBoolean(ARCHIVE, false);
|
||||||
|
forwarding = getArguments().getBoolean(FORWARDING, false);
|
||||||
|
|
||||||
ApplicationDcContext dcContext = DcHelper.getContext(getActivity());
|
ApplicationDcContext dcContext = DcHelper.getContext(getActivity());
|
||||||
dcContext.eventCenter.addObserver(DcContext.DC_EVENT_CHAT_MODIFIED, this);
|
dcContext.eventCenter.addObserver(DcContext.DC_EVENT_CHAT_MODIFIED, this);
|
||||||
|
@ -347,10 +350,11 @@ public class ConversationListFragment extends Fragment
|
||||||
@Override
|
@Override
|
||||||
public Loader<DcChatlist> onCreateLoader(int arg0, Bundle arg1) {
|
public Loader<DcChatlist> onCreateLoader(int arg0, Bundle arg1) {
|
||||||
int listflags = 0;
|
int listflags = 0;
|
||||||
if(archive) {
|
if (archive) {
|
||||||
listflags |= DcContext.DC_GCL_ARCHIVED_ONLY;
|
listflags |= DcContext.DC_GCL_ARCHIVED_ONLY;
|
||||||
}
|
} else if (forwarding) {
|
||||||
else {
|
listflags |= DcContext.DC_GCL_FOR_FORWARDING;
|
||||||
|
} else {
|
||||||
listflags |= DcContext.DC_GCL_ADD_ALLDONE_HINT;
|
listflags |= DcContext.DC_GCL_ADD_ALLDONE_HINT;
|
||||||
}
|
}
|
||||||
return new DcChatlistLoader(getActivity(), listflags, queryFilter.isEmpty()? null : queryFilter, 0);
|
return new DcChatlistLoader(getActivity(), listflags, queryFilter.isEmpty()? null : queryFilter, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue