diff options
author | stefan-niedermann <info@niedermann.it> | 2019-02-07 23:00:46 +0300 |
---|---|---|
committer | stefan-niedermann <info@niedermann.it> | 2019-02-07 23:00:46 +0300 |
commit | 07fd912fe31d62d5a509a3538405da888d96ed09 (patch) | |
tree | 80bd4db1260f35b9869f186102d3e8e3394130ea | |
parent | b1b2d64cb754e7409a5829d7ef6476412f0afce4 (diff) |
#520 App should register as notes app
- Use constants instead of string literals
-rw-r--r-- | app/src/main/java/it/niedermann/owncloud/notes/android/activity/EditNoteActivity.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/EditNoteActivity.java b/app/src/main/java/it/niedermann/owncloud/notes/android/activity/EditNoteActivity.java index 9b781db6..20b4b254 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/EditNoteActivity.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/activity/EditNoteActivity.java @@ -5,14 +5,14 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; -import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AppCompatActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import java.util.Calendar; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; import it.niedermann.owncloud.notes.R; import it.niedermann.owncloud.notes.android.fragment.BaseNoteFragment; import it.niedermann.owncloud.notes.android.fragment.NoteEditFragment; @@ -24,6 +24,8 @@ import it.niedermann.owncloud.notes.util.NoteUtil; public class EditNoteActivity extends AppCompatActivity implements BaseNoteFragment.NoteFragmentListener { + private static final String INTENT_GOOGLE_ASSISTANT = "com.google.android.gm.action.AUTO_SEND"; + private static final String MIMETYPE_TEXT_PLAIN = "text/plain"; public static final String PARAM_NOTE_ID = "noteId"; public static final String PARAM_CATEGORY = "category"; @@ -138,7 +140,11 @@ public class EditNoteActivity extends AppCompatActivity implements BaseNoteFragm } String content = ""; - if (Intent.ACTION_SEND.equals(intent.getAction()) && "text/plain".equals(intent.getType())) { + if ( + MIMETYPE_TEXT_PLAIN.equals(intent.getType()) && + (Intent.ACTION_SEND.equals(intent.getAction()) || + INTENT_GOOGLE_ASSISTANT.equals(intent.getAction())) + ) { content = intent.getStringExtra(Intent.EXTRA_TEXT); } @@ -199,7 +205,7 @@ public class EditNoteActivity extends AppCompatActivity implements BaseNoteFragm ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(note.getTitle()); - if(!note.getCategory().isEmpty()) { + if (!note.getCategory().isEmpty()) { actionBar.setSubtitle(NoteUtil.extendCategory(note.getCategory())); } } |