Commit b66767c2 authored by Lennart Bader's avatar Lennart Bader
Browse files

Added plan options menu

parent 791f7ce7
......@@ -6,6 +6,8 @@ import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -47,9 +49,18 @@ public class PlanFragment extends Fragment {
today = new PlanLogic(todayPlan);
tomorrow = new PlanLogic(tomorrowPlan);
setHasOptionsMenu(true);
return view;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
inflater.inflate(R.menu.plan_details_menu, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public void onResume() {
super.onResume();
......
......@@ -88,10 +88,14 @@ public class PlanLogic implements FragmentHolderLogic {
}
adapter.notifyDataSetChanged();
TabLayout tabLayout = ((MainActivity)context).getToolbarManager().getTabs();
TabLayout.Tab tab;
if (this.plan.getDay().equals("today")) {
tabLayout.getTabAt(0).setText(plan.getDayString());
tab = tabLayout.getTabAt(0);
} else {
tabLayout.getTabAt(1).setText(plan.getDayString());
tab = tabLayout.getTabAt(1);
}
if (tab != null) {
tab.setText(plan.getDayString());
}
}
}
<?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/show_absent"
android:icon="@drawable/ic_show_absent"
android:title="@string/plan_show_absent"
app:showAsAction="ifRoom"/>
<item android:id="@+id/show_marquee"
android:icon="@drawable/ic_show_marquee"
android:title="@string/plan_show_marquee"
app:showAsAction="ifRoom" />
</menu>
\ No newline at end of file
......@@ -51,6 +51,8 @@
<string name="plan_header">Plan:</string>
<string name="subst_header">Vertretung:</string>
<string name="comment_header">Bemerkung:</string>
<string name="plan_show_marquee">Mitteilungen anzeigen</string>
<string name="plan_show_absent">Abwesende Lehrer anzeigen</string>
<!-- ACCOUNT -->
<string name="account_info">Sie sind angemeldet.</string>
......
......@@ -31,6 +31,8 @@
<string name="plan_header">Plan:</string>
<string name="subst_header">Substitution:</string>
<string name="comment_header">Comment:</string>
<string name="plan_show_marquee">Show announcements</string>
<string name="plan_show_absent">Show absent teachers</string>
<!-- API CODES -->
<string name="api_offline">No Internet connection</string>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment