Browse Source

Added text action to search primary archive

main
M66B 6 years ago
parent
commit
2bddf838c6
5 changed files with 56 additions and 8 deletions
  1. +8
    -2
      app/src/main/AndroidManifest.xml
  2. +39
    -0
      app/src/main/java/eu/faircode/email/ActivityView.java
  3. +5
    -0
      app/src/main/java/eu/faircode/email/DaoFolder.java
  4. +2
    -5
      app/src/main/java/eu/faircode/email/FragmentMessages.java
  5. +2
    -1
      app/src/main/res/values/strings.xml

+ 8
- 2
app/src/main/AndroidManifest.xml View File

@ -50,9 +50,15 @@
<activity <activity
android:name=".ActivityView" android:name=".ActivityView"
android:exported="false"
android:exported="true"
android:launchMode="singleTop" android:launchMode="singleTop"
android:parentActivityName=".ActivityMain" />
android:parentActivityName=".ActivityMain">
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity <activity
android:name=".ActivityCompose" android:name=".ActivityCompose"


+ 39
- 0
app/src/main/java/eu/faircode/email/ActivityView.java View File

@ -310,6 +310,45 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
intent.putExtra("thread", action.split(":", 2)[1]); intent.putExtra("thread", action.split(":", 2)[1]);
onViewThread(intent); onViewThread(intent);
} }
if (getIntent().hasExtra(Intent.EXTRA_PROCESS_TEXT)) {
String search = getIntent().getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT).toString();
intent.removeExtra(Intent.EXTRA_PROCESS_TEXT);
setIntent(intent);
Bundle args = new Bundle();
args.putString("search", search);
new SimpleTask<Long>() {
@Override
protected Long onLoad(Context context, Bundle args) {
EntityFolder archive = DB.getInstance(context).folder().getPrimaryArchive();
if (archive == null)
throw new IllegalArgumentException(getString(R.string.title_no_archive));
return archive.id;
}
@Override
protected void onLoaded(Bundle args, Long archive) {
Bundle sargs = new Bundle();
sargs.putLong("folder", archive);
sargs.putString("search", args.getString("search"));
FragmentMessages fragment = new FragmentMessages();
fragment.setArguments(sargs);
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("search");
fragmentTransaction.commit();
}
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(ActivityView.this, ex);
}
}.load(this, args);
}
} }
@Override @Override


+ 5
- 0
app/src/main/java/eu/faircode/email/DaoFolder.java View File

@ -96,6 +96,11 @@ public interface DaoFolder {
" WHERE `primary` AND type = '" + EntityFolder.DRAFTS + "'") " WHERE `primary` AND type = '" + EntityFolder.DRAFTS + "'")
EntityFolder getPrimaryDrafts(); EntityFolder getPrimaryDrafts();
@Query("SELECT folder.* FROM folder" +
" JOIN account ON account.id = folder.account" +
" WHERE `primary` AND type = '" + EntityFolder.ARCHIVE + "'")
EntityFolder getPrimaryArchive();
@Query("SELECT * FROM folder WHERE type = '" + EntityFolder.OUTBOX + "'") @Query("SELECT * FROM folder WHERE type = '" + EntityFolder.OUTBOX + "'")
EntityFolder getOutbox(); EntityFolder getOutbox();


+ 2
- 5
app/src/main/java/eu/faircode/email/FragmentMessages.java View File

@ -657,12 +657,9 @@ public class FragmentMessages extends FragmentEx {
@Override @Override
protected void onLoaded(Bundle args, Void data) { protected void onLoaded(Bundle args, Void data) {
Intent intent = new Intent();
intent.putExtra("folder", args.getLong("folder", folder));
intent.putExtra("search", args.getString("search"));
FragmentMessages fragment = new FragmentMessages(); FragmentMessages fragment = new FragmentMessages();
fragment.setArguments(intent.getExtras());
fragment.setArguments(args);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("search"); fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("search");
fragmentTransaction.commit(); fragmentTransaction.commit();


+ 2
- 1
app/src/main/res/values/strings.xml View File

@ -124,7 +124,8 @@
<string name="title_no_host">Host name missing</string> <string name="title_no_host">Host name missing</string>
<string name="title_no_user">User name missing</string> <string name="title_no_user">User name missing</string>
<string name="title_no_password">Password missing</string> <string name="title_no_password">Password missing</string>
<string name="title_no_drafts">Drafts folder missing</string>
<string name="title_no_drafts">No primary account or no drafts folder</string>
<string name="title_no_archive">No primary account or no archive folder</string>
<string name="title_no_idle">This provider does not support push messages. Reception of new messages can be delayed.</string> <string name="title_no_idle">This provider does not support push messages. Reception of new messages can be delayed.</string>
<string name="title_no_uidplus">IMAP UIDPLUS not supported, see the FAQ</string> <string name="title_no_uidplus">IMAP UIDPLUS not supported, see the FAQ</string>
<string name="title_account_delete">Delete this account permanently?</string> <string name="title_account_delete">Delete this account permanently?</string>


Loading…
Cancel
Save