Added rule help

This commit is contained in:
M66B 2020-06-12 16:39:15 +02:00
parent a601d51966
commit 289f22e9e9
2 changed files with 34 additions and 0 deletions

View File

@ -32,6 +32,8 @@ import android.provider.ContactsContract;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
@ -181,6 +183,7 @@ public class FragmentRule extends FragmentBase {
@Nullable
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
setSubtitle(R.string.title_rule_caption);
setHasOptionsMenu(true);
view = (ViewGroup) inflater.inflate(R.layout.fragment_rule, container, false);
@ -508,6 +511,28 @@ public class FragmentRule extends FragmentBase {
}.execute(this, args, "rule:accounts");
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_rule, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_help:
onMenuHelp();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void onMenuHelp() {
Helper.viewFAQ(getContext(), 71);
}
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putInt("fair:start", spScheduleDayStart.getSelectedItemPosition());

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_help"
android:icon="@drawable/baseline_help_24"
android:title=""
app:showAsAction="always" />
</menu>