mirror of https://github.com/M66B/FairEmail.git
Enable search on primary archive
This commit is contained in:
parent
16f8759a08
commit
3304732e9e
|
@ -78,6 +78,7 @@
|
|||
|
||||
<activity
|
||||
android:name=".ActivitySearch"
|
||||
android:enabled="false"
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
|
|
|
@ -385,12 +385,11 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
protected Long onLoad(Context context, Bundle args) {
|
||||
DB db = DB.getInstance(context);
|
||||
|
||||
EntityFolder archive = db.folder().getPrimaryArchive();
|
||||
if (archive == null)
|
||||
throw new IllegalArgumentException(getString(R.string.title_no_primary_archive));
|
||||
|
||||
db.message().resetSearch();
|
||||
|
||||
EntityFolder archive = db.folder().getPrimaryArchive();
|
||||
if (archive == null)
|
||||
throw new IllegalArgumentException("No primary archive");
|
||||
return archive.id;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package eu.faircode.email;
|
|||
|
||||
import android.Manifest;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
|
@ -93,7 +94,6 @@ public class FragmentSetup extends FragmentEx {
|
|||
private Button btnAccount;
|
||||
private TextView tvAccountDone;
|
||||
private TextView tvNoPrimaryDrafts;
|
||||
private TextView tvNoPrimaryArchive;
|
||||
|
||||
private Button btnIdentity;
|
||||
private TextView tvIdentityDone;
|
||||
|
@ -138,7 +138,6 @@ public class FragmentSetup extends FragmentEx {
|
|||
btnAccount = view.findViewById(R.id.btnAccount);
|
||||
tvAccountDone = view.findViewById(R.id.tvAccountDone);
|
||||
tvNoPrimaryDrafts = view.findViewById(R.id.tvNoPrimaryDrafts);
|
||||
tvNoPrimaryArchive = view.findViewById(R.id.tvNoPrimaryArchive);
|
||||
|
||||
btnIdentity = view.findViewById(R.id.btnIdentity);
|
||||
tvIdentityDone = view.findViewById(R.id.tvIdentityDone);
|
||||
|
@ -286,7 +285,6 @@ public class FragmentSetup extends FragmentEx {
|
|||
tvAccountDone.setText(null);
|
||||
tvAccountDone.setCompoundDrawables(null, null, null, null);
|
||||
tvNoPrimaryDrafts.setVisibility(View.GONE);
|
||||
tvNoPrimaryArchive.setVisibility(View.GONE);
|
||||
|
||||
btnIdentity.setEnabled(false);
|
||||
tvIdentityDone.setText(null);
|
||||
|
@ -386,7 +384,13 @@ public class FragmentSetup extends FragmentEx {
|
|||
livePrimaryArchive.observe(getViewLifecycleOwner(), new Observer<EntityFolder>() {
|
||||
@Override
|
||||
public void onChanged(EntityFolder archive) {
|
||||
tvNoPrimaryArchive.setVisibility(done && archive == null ? View.VISIBLE : View.GONE);
|
||||
PackageManager pm = getContext().getPackageManager();
|
||||
pm.setComponentEnabledSetting(
|
||||
new ComponentName(getContext(), ActivitySearch.class),
|
||||
archive == null
|
||||
? PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
||||
: PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
|
||||
PackageManager.DONT_KILL_APP);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -66,18 +66,6 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAccountDone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvNoPrimaryArchive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title_no_primary_archive"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?attr/colorWarning"
|
||||
android:textIsSelectable="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvNoPrimaryDrafts" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vSeparatorAccount"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -85,7 +73,7 @@
|
|||
android:layout_marginTop="12dp"
|
||||
android:background="?attr/colorSeparator"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvNoPrimaryArchive" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tvNoPrimaryDrafts" />
|
||||
|
||||
<!-- identity -->
|
||||
|
||||
|
|
|
@ -194,7 +194,6 @@
|
|||
<string name="title_no_password">Password missing</string>
|
||||
<string name="title_no_drafts">No drafts folder selected</string>
|
||||
<string name="title_no_primary_drafts">No primary account or no drafts folder</string>
|
||||
<string name="title_no_primary_archive">No primary account or no archive folder</string>
|
||||
<string name="title_no_idle">This provider does not support push messages. This will delay reception of new messages and increase battery usage.</string>
|
||||
<string name="title_account_delete">Delete this account permanently?</string>
|
||||
<string name="title_identity_delete">Delete this identity permanently?</string>
|
||||
|
|
Loading…
Reference in New Issue