diff --git a/build.gradle b/build.gradle index 4c9c8a32d..852ea2891 100644 --- a/build.gradle +++ b/build.gradle @@ -73,6 +73,7 @@ android { archivesBaseName += "-$versionName" applicationId "eu.siacs.conversations" resValue "string", "applicationId", applicationId + resValue "string", "app_name", "Conversations" } dataBinding { diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 345173901..49fb047de 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -257,6 +257,9 @@ public class ConversationActivity extends XmppActivity implements OnConversation return true; } break; + case R.id.action_scan_qr_code: + UriHandlerActivity.scan(this); + return true; } return super.onOptionsItemSelected(item); } diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 5a44c92fd..584ccbed9 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1616,29 +1616,31 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } private void reInit(Conversation conversation) { - Log.d(Config.LOGTAG, "reInit()"); + reInit(conversation, false); + } + + private void reInit(Conversation conversation, boolean restore) { if (conversation == null) { - Log.d(Config.LOGTAG, "conversation was null :("); return; } - if (this.activity == null) { - Log.d(Config.LOGTAG, "activity was null"); this.conversation = conversation; return; } - + Log.d(Config.LOGTAG, "reInit(restore="+Boolean.toString(restore)+")"); setupIme(); if (this.conversation != null) { final String msg = this.binding.textinput.getText().toString(); if (this.conversation.setNextMessage(msg)) { activity.xmppConnectionService.updateConversation(conversation); } - if (this.conversation != conversation) { + if (this.conversation != conversation && !restore) { updateChatState(this.conversation, msg); messageListAdapter.stopAudioPlayer(); } - this.conversation.trim(); + if (!restore) { + this.conversation.trim(); + } } @@ -2259,7 +2261,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke clearPending(); return; } - reInit(conversation); + reInit(conversation, true); } ActivityResult activityResult = postponedActivityResult.pop(); if (activityResult != null) { diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 1be1ae019..cc5c34577 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -626,10 +626,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU showJoinConferenceDialog(null); return true; case R.id.action_scan_qr_code: - Intent intent = new Intent(this, UriHandlerActivity.class); - intent.setAction(UriHandlerActivity.ACTION_SCAN_QR_CODE); - intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); - startActivity(intent); + UriHandlerActivity.scan(this); return true; case R.id.action_hide_offline: mHideOfflineContacts = !item.isChecked(); diff --git a/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java b/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java index 40915b264..59292d6af 100644 --- a/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java @@ -1,5 +1,6 @@ package eu.siacs.conversations.ui; +import android.app.Activity; import android.support.v7.app.AppCompatActivity ; import android.content.Intent; import android.net.Uri; @@ -9,6 +10,7 @@ import java.util.Arrays; import java.util.List; import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; import eu.siacs.conversations.persistance.DatabaseBackend; import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.utils.zxing.IntentIntegrator; @@ -103,4 +105,11 @@ public class UriHandlerActivity extends AppCompatActivity { finish(); super.onActivityResult(requestCode, requestCode, intent); } + + public static void scan(Activity activity) { + Intent intent = new Intent(activity, UriHandlerActivity.class); + intent.setAction(UriHandlerActivity.ACTION_SCAN_QR_CODE); + intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); + activity.startActivity(intent); + } } diff --git a/src/main/res/drawable-hdpi/ic_chat_white_24dp.png b/src/main/res/drawable-hdpi/ic_chat_white_24dp.png new file mode 100644 index 000000000..d2cfdf1f6 Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_chat_white_24dp.png differ diff --git a/src/main/res/drawable-mdpi/ic_chat_white_24dp.png b/src/main/res/drawable-mdpi/ic_chat_white_24dp.png new file mode 100644 index 000000000..dac4cb9fc Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_chat_white_24dp.png differ diff --git a/src/main/res/drawable-xhdpi/ic_chat_white_24dp.png b/src/main/res/drawable-xhdpi/ic_chat_white_24dp.png new file mode 100644 index 000000000..ace0bef32 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_chat_white_24dp.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_chat_white_24dp.png b/src/main/res/drawable-xxhdpi/ic_chat_white_24dp.png new file mode 100644 index 000000000..424509055 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_chat_white_24dp.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_chat_white_24dp.png b/src/main/res/drawable-xxxhdpi/ic_chat_white_24dp.png new file mode 100644 index 000000000..d708e1580 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_chat_white_24dp.png differ diff --git a/src/main/res/layout/fragment_conversations_overview.xml b/src/main/res/layout/fragment_conversations_overview.xml index 52b4cdd5c..8409e96ca 100644 --- a/src/main/res/layout/fragment_conversations_overview.xml +++ b/src/main/res/layout/fragment_conversations_overview.xml @@ -20,6 +20,6 @@ android:layout_height="wrap_content" android:layout_gravity="end|bottom" android:layout_margin="16dp" - android:src="?attr/icon_new"/> + android:src="@drawable/ic_chat_white_24dp"/> \ No newline at end of file diff --git a/src/main/res/menu/activity_conversations.xml b/src/main/res/menu/activity_conversations.xml index 885fa45a7..7c22f56d7 100644 --- a/src/main/res/menu/activity_conversations.xml +++ b/src/main/res/menu/activity_conversations.xml @@ -1,5 +1,11 @@