Move add public chat button to home screen

This commit is contained in:
Niels Andriesse 2019-10-15 16:19:00 +11:00
parent c2d4f4b58d
commit a5b543c43c
4 changed files with 30 additions and 20 deletions

View File

@ -1,7 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:title="@string/text_secure_normal__menu_new_group" <item android:title="@string/activity_conversation_list_add_public_chat_button_title"
android:id="@+id/menu_conversation_list_add_public_chat_option"
android:icon="@drawable/ic_group_white_24dp"
app:showAsAction="always" />
<!-- <item android:title="@string/text_secure_normal__menu_new_group"
android:id="@+id/menu_new_group" /> android:id="@+id/menu_new_group" />
<item android:title="@string/text_secure_normal__menu_clear_passphrase" <item android:title="@string/text_secure_normal__menu_clear_passphrase"
@ -17,6 +23,6 @@
android:id="@+id/menu_settings" /> android:id="@+id/menu_settings" />
<item android:title="@string/text_secure_normal__help" <item android:title="@string/text_secure_normal__help"
android:id="@+id/menu_help"/> android:id="@+id/menu_help"/> -->
</menu> </menu>

View File

@ -1639,5 +1639,7 @@
<string name="fragment_scan_qr_code_camera_permission_dialog_message">Loki Messenger needs camera access to scan QR codes.</string> <string name="fragment_scan_qr_code_camera_permission_dialog_message">Loki Messenger needs camera access to scan QR codes.</string>
<!-- Conversation activity --> <!-- Conversation activity -->
<string name="activity_conversation_copy_public_key_button_title">Copy public key</string> <string name="activity_conversation_copy_public_key_button_title">Copy public key</string>
<!-- Conversation list activity -->
<string name="activity_conversation_list_add_public_chat_button_title">Add Public Chat</string>
</resources> </resources>

View File

@ -29,6 +29,7 @@ import android.support.annotation.NonNull;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.support.v7.widget.TooltipCompat; import android.support.v7.widget.TooltipCompat;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -44,6 +45,7 @@ import org.thoughtcrime.securesms.database.Address;
import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo; import org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo;
import org.thoughtcrime.securesms.lock.RegistrationLockDialog; import org.thoughtcrime.securesms.lock.RegistrationLockDialog;
import org.thoughtcrime.securesms.loki.AddPublicChatActivity;
import org.thoughtcrime.securesms.loki.JazzIdenticonDrawable; import org.thoughtcrime.securesms.loki.JazzIdenticonDrawable;
import org.thoughtcrime.securesms.notifications.MarkReadReceiver; import org.thoughtcrime.securesms.notifications.MarkReadReceiver;
import org.thoughtcrime.securesms.notifications.MessageNotifier; import org.thoughtcrime.securesms.notifications.MessageNotifier;
@ -127,18 +129,15 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
@Override @Override
public boolean onPrepareOptionsMenu(Menu menu) { public boolean onPrepareOptionsMenu(Menu menu) {
return false;
/*
MenuInflater inflater = this.getMenuInflater(); MenuInflater inflater = this.getMenuInflater();
menu.clear(); menu.clear();
inflater.inflate(R.menu.text_secure_normal, menu); inflater.inflate(R.menu.text_secure_normal, menu);
menu.findItem(R.id.menu_clear_passphrase).setVisible(!TextSecurePreferences.isPasswordDisabled(this)); // menu.findItem(R.id.menu_clear_passphrase).setVisible(!TextSecurePreferences.isPasswordDisabled(this));
super.onPrepareOptionsMenu(menu); super.onPrepareOptionsMenu(menu);
return true; return true;
*/
} }
private void initializeSearchListener() { private void initializeSearchListener() {
@ -235,12 +234,13 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
super.onOptionsItemSelected(item); super.onOptionsItemSelected(item);
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.menu_new_group: createGroup(); return true; // case R.id.menu_new_group: createGroup(); return true;
case R.id.menu_settings: handleDisplaySettings(); return true; // case R.id.menu_settings: handleDisplaySettings(); return true;
case R.id.menu_clear_passphrase: handleClearPassphrase(); return true; // case R.id.menu_clear_passphrase: handleClearPassphrase(); return true;
case R.id.menu_mark_all_read: handleMarkAllRead(); return true; // case R.id.menu_mark_all_read: handleMarkAllRead(); return true;
case R.id.menu_invite: handleInvite(); return true; // case R.id.menu_invite: handleInvite(); return true;
case R.id.menu_help: handleHelp(); return true; // case R.id.menu_help: handleHelp(); return true;
case R.id.menu_conversation_list_add_public_chat_option: addNewPublicChat(); return true;
} }
return false; return false;
@ -321,4 +321,8 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
Toast.makeText(this, R.string.ConversationListActivity_there_is_no_browser_installed_on_your_device, Toast.LENGTH_LONG).show(); Toast.makeText(this, R.string.ConversationListActivity_there_is_no_browser_installed_on_your_device, Toast.LENGTH_LONG).show();
} }
} }
private void addNewPublicChat() {
startActivity(new Intent(this, AddPublicChatActivity.class));
}
} }

View File

@ -2766,15 +2766,13 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
if (isBackspace) { if (isBackspace) {
currentMentionStartIndex = -1; currentMentionStartIndex = -1;
mentionCandidateSelectionView.hide(); mentionCandidateSelectionView.hide();
try { ArrayList<Mention> mentionsToRemove = new ArrayList<>();
for (Mention mention : mentions) { for (Mention mention : mentions) {
if (!text.contains(mention.getDisplayName())) { if (!text.contains(mention.getDisplayName())) {
mentions.remove(mention); mentionsToRemove.add(mention);
}
} }
} catch (Exception exception) {
mentions.clear(); // TODO: Dirty workaround for ConcurrentModificationException
} }
mentions.removeAll(mentionsToRemove);
} }
if (text.length() > 0) { if (text.length() > 0) {
if (currentMentionStartIndex > text.length()) { if (currentMentionStartIndex > text.length()) {