Added legend, privacy and about to setup menu

This commit is contained in:
M66B 2018-09-19 11:28:24 +00:00
parent 8b14f68a35
commit 2ea9986977
4 changed files with 45 additions and 8 deletions

View File

@ -215,7 +215,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
if (pro == null || pro.resolveActivity(getPackageManager()) != null)
drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_monetization_on_24, R.string.menu_pro));
if (getIntentPrivacy().resolveActivity(getPackageManager()) != null)
if (Helper.getIntentPrivacy().resolveActivity(getPackageManager()) != null)
drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_account_box_24, R.string.menu_privacy));
drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_info_24, R.string.menu_about));
@ -562,12 +562,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
}.load(this, new Bundle());
}
private Intent getIntentPrivacy() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://email.faircode.eu/privacy/"));
return intent;
}
private Intent getIntentFAQ() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://github.com/M66B/open-source-email/blob/master/FAQ.md"));
@ -634,7 +628,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
}
private void onMenuPrivacy() {
Helper.view(this, getIntentPrivacy());
Helper.view(this, Helper.getIntentPrivacy());
}
private void onMenuAbout() {

View File

@ -364,6 +364,10 @@ public class FragmentSetup extends FragmentEx {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_legend:
onMenuLegend();
return true;
case R.id.menu_export:
if (Helper.isPro(getContext()))
startActivityForResult(getIntentExport(), ActivitySetup.REQUEST_EXPORT);
@ -378,6 +382,14 @@ public class FragmentSetup extends FragmentEx {
startActivityForResult(getIntentImport(), ActivitySetup.REQUEST_IMPORT);
return true;
case R.id.menu_privacy:
onMenuPrivacy();
return true;
case R.id.menu_about:
onMenuAbout();
return true;
default:
return super.onOptionsItemSelected(item);
}
@ -411,6 +423,22 @@ public class FragmentSetup extends FragmentEx {
}
}
private void onMenuPrivacy() {
Helper.view(getContext(), Helper.getIntentPrivacy());
}
private void onMenuLegend() {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, new FragmentLegend()).addToBackStack("legend");
fragmentTransaction.commit();
}
private void onMenuAbout() {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, new FragmentAbout()).addToBackStack("about");
fragmentTransaction.commit();
}
private Intent getIntentHelp() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://github.com/M66B/open-source-email/blob/master/SETUP.md"));

View File

@ -97,6 +97,12 @@ public class Helper {
customTabsIntent.launchUrl(context, uri);
}
static Intent getIntentPrivacy() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://email.faircode.eu/privacy/"));
return intent;
}
static int resolveColor(Context context, int attr) {
int[] attrs = new int[]{attr};
TypedArray a = context.getTheme().obtainStyledAttributes(attrs);

View File

@ -1,9 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_legend"
android:title="@string/menu_legend" />
<item
android:id="@+id/menu_export"
android:title="@string/title_setup_export" />
<item
android:id="@+id/menu_import"
android:title="@string/title_setup_import" />
<item
android:id="@+id/menu_privacy"
android:title="@string/menu_privacy" />
<item
android:id="@+id/menu_about"
android:title="@string/menu_about" />
</menu>