~singpolyma/cheogram-android

b0bec2c390cbad5b1ad62d9c97c3a5f887133319 — Daniel Gultsch 5 years ago e0317cf
added dedicated scan button
M build.gradle => build.gradle +1 -0
@@ 73,6 73,7 @@ android {
        archivesBaseName += "-$versionName"
        applicationId "eu.siacs.conversations"
        resValue "string", "applicationId", applicationId
        resValue "string", "app_name", "Conversations"
    }

    dataBinding {

M src/main/java/eu/siacs/conversations/ui/ConversationActivity.java => src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +3 -0
@@ 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);
	}

M src/main/java/eu/siacs/conversations/ui/ConversationFragment.java => src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +10 -8
@@ 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) {

M src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java => src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +1 -4
@@ 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();

M src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java => src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java +9 -0
@@ 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);
    }
}

A src/main/res/drawable-hdpi/ic_chat_white_24dp.png => src/main/res/drawable-hdpi/ic_chat_white_24dp.png +0 -0
A src/main/res/drawable-mdpi/ic_chat_white_24dp.png => src/main/res/drawable-mdpi/ic_chat_white_24dp.png +0 -0
A src/main/res/drawable-xhdpi/ic_chat_white_24dp.png => src/main/res/drawable-xhdpi/ic_chat_white_24dp.png +0 -0
A src/main/res/drawable-xxhdpi/ic_chat_white_24dp.png => src/main/res/drawable-xxhdpi/ic_chat_white_24dp.png +0 -0
A src/main/res/drawable-xxxhdpi/ic_chat_white_24dp.png => src/main/res/drawable-xxxhdpi/ic_chat_white_24dp.png +0 -0
M src/main/res/layout/fragment_conversations_overview.xml => src/main/res/layout/fragment_conversations_overview.xml +1 -1
@@ 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"/>
    </FrameLayout>
</layout>
\ No newline at end of file

M src/main/res/menu/activity_conversations.xml => src/main/res/menu/activity_conversations.xml +6 -0
@@ 1,6 1,12 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
      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
        android:id="@+id/action_accounts"
        android:orderInCategory="90"
        android:title="@string/action_accounts"

A src/main/res/values-w945dp/defaults.xml => src/main/res/values-w945dp/defaults.xml +5 -0
@@ 0,0 1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <bool name="show_qr_code_scan">false</bool>
</resources>


M src/main/res/values/defaults.xml => src/main/res/values/defaults.xml +1 -0
@@ 41,4 41,5 @@
    <bool name="never_send">false</bool>
    <bool name="return_to_previous">false</bool>
    <bool name="validate_hostname">false</bool>
    <bool name="show_qr_code_scan">true</bool>
</resources>

M src/main/res/values/strings.xml => src/main/res/values/strings.xml +0 -1
@@ 1,6 1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
	<string name="app_name" translatable="false">Conversations</string>
	<string name="action_settings">Settings</string>
	<string name="action_add">New conversation</string>
	<string name="action_accounts">Manage accounts</string>