mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-15 08:29:24 +00:00
Added local contacts help
This commit is contained in:
parent
8d0fb2d564
commit
3513b122d7
2 changed files with 33 additions and 5 deletions
|
@ -21,6 +21,9 @@ package eu.faircode.email;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -143,19 +146,32 @@ public class FragmentContacts extends FragmentBase {
|
|||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
PackageManager pm = getContext().getPackageManager();
|
||||
menu.findItem(R.id.menu_help).setVisible(getIntentHelp().resolveActivity(pm) != null);
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_delete:
|
||||
onDelete();
|
||||
case R.id.menu_help:
|
||||
onMenuHelp();
|
||||
return true;
|
||||
case R.id.menu_delete:
|
||||
onMenuDelete();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void onDelete() {
|
||||
private void onMenuHelp() {
|
||||
startActivity(getIntentHelp());
|
||||
}
|
||||
|
||||
private void onMenuDelete() {
|
||||
final View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_message, null);
|
||||
final TextView tvMessage = dview.findViewById(R.id.tvMessage);
|
||||
|
||||
|
@ -184,4 +200,10 @@ public class FragmentContacts extends FragmentBase {
|
|||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private static Intent getIntentHelp() {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse("https://github.com/M66B/open-source-email/blob/master/FAQ.md#user-content-faq84"));
|
||||
return intent;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,15 @@
|
|||
app:actionViewClass="androidx.appcompat.widget.SearchView"
|
||||
app:showAsAction="collapseActionView|always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_help"
|
||||
android:icon="@drawable/baseline_help_24"
|
||||
android:title="@string/title_setup_help"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_delete"
|
||||
android:icon="@drawable/baseline_delete_24"
|
||||
android:title="@string/title_delete"
|
||||
app:showAsAction="always" />
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
Loading…
Add table
Reference in a new issue