added dedicated scan button
This commit is contained in:
parent
e0317cfa14
commit
b0bec2c390
|
@ -73,6 +73,7 @@ android {
|
||||||
archivesBaseName += "-$versionName"
|
archivesBaseName += "-$versionName"
|
||||||
applicationId "eu.siacs.conversations"
|
applicationId "eu.siacs.conversations"
|
||||||
resValue "string", "applicationId", applicationId
|
resValue "string", "applicationId", applicationId
|
||||||
|
resValue "string", "app_name", "Conversations"
|
||||||
}
|
}
|
||||||
|
|
||||||
dataBinding {
|
dataBinding {
|
||||||
|
|
|
@ -257,6 +257,9 @@ public class ConversationActivity extends XmppActivity implements OnConversation
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case R.id.action_scan_qr_code:
|
||||||
|
UriHandlerActivity.scan(this);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1616,29 +1616,31 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reInit(Conversation conversation) {
|
private void reInit(Conversation conversation) {
|
||||||
Log.d(Config.LOGTAG, "reInit()");
|
reInit(conversation, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void reInit(Conversation conversation, boolean restore) {
|
||||||
if (conversation == null) {
|
if (conversation == null) {
|
||||||
Log.d(Config.LOGTAG, "conversation was null :(");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.activity == null) {
|
if (this.activity == null) {
|
||||||
Log.d(Config.LOGTAG, "activity was null");
|
|
||||||
this.conversation = conversation;
|
this.conversation = conversation;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Log.d(Config.LOGTAG, "reInit(restore="+Boolean.toString(restore)+")");
|
||||||
setupIme();
|
setupIme();
|
||||||
if (this.conversation != null) {
|
if (this.conversation != null) {
|
||||||
final String msg = this.binding.textinput.getText().toString();
|
final String msg = this.binding.textinput.getText().toString();
|
||||||
if (this.conversation.setNextMessage(msg)) {
|
if (this.conversation.setNextMessage(msg)) {
|
||||||
activity.xmppConnectionService.updateConversation(conversation);
|
activity.xmppConnectionService.updateConversation(conversation);
|
||||||
}
|
}
|
||||||
if (this.conversation != conversation) {
|
if (this.conversation != conversation && !restore) {
|
||||||
updateChatState(this.conversation, msg);
|
updateChatState(this.conversation, msg);
|
||||||
messageListAdapter.stopAudioPlayer();
|
messageListAdapter.stopAudioPlayer();
|
||||||
}
|
}
|
||||||
this.conversation.trim();
|
if (!restore) {
|
||||||
|
this.conversation.trim();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2259,7 +2261,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
clearPending();
|
clearPending();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reInit(conversation);
|
reInit(conversation, true);
|
||||||
}
|
}
|
||||||
ActivityResult activityResult = postponedActivityResult.pop();
|
ActivityResult activityResult = postponedActivityResult.pop();
|
||||||
if (activityResult != null) {
|
if (activityResult != null) {
|
||||||
|
|
|
@ -626,10 +626,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
showJoinConferenceDialog(null);
|
showJoinConferenceDialog(null);
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_scan_qr_code:
|
case R.id.action_scan_qr_code:
|
||||||
Intent intent = new Intent(this, UriHandlerActivity.class);
|
UriHandlerActivity.scan(this);
|
||||||
intent.setAction(UriHandlerActivity.ACTION_SCAN_QR_CODE);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
|
||||||
startActivity(intent);
|
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_hide_offline:
|
case R.id.action_hide_offline:
|
||||||
mHideOfflineContacts = !item.isChecked();
|
mHideOfflineContacts = !item.isChecked();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.siacs.conversations.ui;
|
package eu.siacs.conversations.ui;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.support.v7.app.AppCompatActivity ;
|
import android.support.v7.app.AppCompatActivity ;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
@ -9,6 +10,7 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.persistance.DatabaseBackend;
|
import eu.siacs.conversations.persistance.DatabaseBackend;
|
||||||
import eu.siacs.conversations.utils.XmppUri;
|
import eu.siacs.conversations.utils.XmppUri;
|
||||||
import eu.siacs.conversations.utils.zxing.IntentIntegrator;
|
import eu.siacs.conversations.utils.zxing.IntentIntegrator;
|
||||||
|
@ -103,4 +105,11 @@ public class UriHandlerActivity extends AppCompatActivity {
|
||||||
finish();
|
finish();
|
||||||
super.onActivityResult(requestCode, requestCode, intent);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 168 B |
Binary file not shown.
After Width: | Height: | Size: 133 B |
Binary file not shown.
After Width: | Height: | Size: 205 B |
Binary file not shown.
After Width: | Height: | Size: 270 B |
Binary file not shown.
After Width: | Height: | Size: 344 B |
|
@ -20,6 +20,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end|bottom"
|
android:layout_gravity="end|bottom"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:src="?attr/icon_new"/>
|
android:src="@drawable/ic_chat_white_24dp"/>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</layout>
|
</layout>
|
|
@ -1,5 +1,11 @@
|
||||||
<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">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_scan_qr_code"
|
||||||
|
android:title="@string/scan_qr_code"
|
||||||
|
app:showAsAction="always"
|
||||||
|
android:visible="@bool/show_qr_code_scan"
|
||||||
|
android:icon="?attr/icon_scan_qr_code"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_accounts"
|
android:id="@+id/action_accounts"
|
||||||
android:orderInCategory="90"
|
android:orderInCategory="90"
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<bool name="show_qr_code_scan">false</bool>
|
||||||
|
</resources>
|
||||||
|
|
|
@ -41,4 +41,5 @@
|
||||||
<bool name="never_send">false</bool>
|
<bool name="never_send">false</bool>
|
||||||
<bool name="return_to_previous">false</bool>
|
<bool name="return_to_previous">false</bool>
|
||||||
<bool name="validate_hostname">false</bool>
|
<bool name="validate_hostname">false</bool>
|
||||||
|
<bool name="show_qr_code_scan">true</bool>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name" translatable="false">Conversations</string>
|
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="action_add">New conversation</string>
|
<string name="action_add">New conversation</string>
|
||||||
<string name="action_accounts">Manage accounts</string>
|
<string name="action_accounts">Manage accounts</string>
|
||||||
|
|
Loading…
Reference in New Issue