use of m.co.rh.id.anavigator.StatefulView in project a-medic-log by rh-id.
the class SettingsPage method dispose.
@Override
public void dispose(Activity activity) {
super.dispose(activity);
if (mStatefulViews != null && !mStatefulViews.isEmpty()) {
for (StatefulView statefulView : mStatefulViews) {
statefulView.dispose(activity);
}
mStatefulViews.clear();
mStatefulViews = null;
}
}
use of m.co.rh.id.anavigator.StatefulView in project a-medic-log by rh-id.
the class AppProviderModule method getNavigator.
@SuppressWarnings({ "rawtypes", "unchecked" })
private Navigator getNavigator(Provider provider) {
Map<String, StatefulViewFactory<Activity, StatefulView<Activity>>> navMap = new HashMap<>();
navMap.put(Routes.HOME_PAGE, (args, activity) -> {
if (args instanceof StatefulView) {
return (StatefulView) args;
}
return new SplashPage();
});
navMap.put(Routes.SETTINGS_PAGE, (args, activity) -> new SettingsPage());
navMap.put(Routes.DONATIONS_PAGE, (args, activity) -> new DonationsPage());
navMap.put(Routes.PROFILES_PAGE, (args, activity) -> new ProfileListPage());
navMap.put(Routes.PROFILE_SELECT_DIALOG, (args, activity) -> new ProfileSelectSVDialog());
navMap.put(Routes.PROFILE_DETAIL_PAGE, (args, activity) -> new ProfileDetailPage());
navMap.put(Routes.NOTES_PAGE, (args, activity) -> new NoteListPage());
navMap.put(Routes.NOTE_DETAIL_PAGE, (args, activity) -> new NoteDetailPage());
navMap.put(Routes.NOTE_TAG_DETAIL_DIALOG, (args, activity) -> new NoteTagDetailSVDialog());
navMap.put(Routes.NOTE_ATTACHMENT_DETAIL_PAGE, (args, activity) -> new NoteAttachmentDetailPage());
navMap.put(Routes.MEDICINE_DETAIL_PAGE, (args, activity) -> new MedicineDetailPage());
navMap.put(Routes.MEDICINE_REMINDER_DETAIL_PAGE, (args, activity) -> new MedicineReminderDetailPage());
navMap.put(Routes.MEDICINE_INTAKES_PAGE, (args, activity) -> new MedicineIntakeListPage());
navMap.put(Routes.MEDICINE_INTAKE_DETAIL_PAGE, (args, activity) -> new MedicineIntakeDetailPage());
navMap.put(Routes.COMMON_CREATE_FILE_DIALOG, (args, activity) -> new CreateFileSVDialog());
navMap.put(Routes.COMMON_IMAGEVIEW, (args, activity) -> new ImageViewPage());
navMap.putAll(provider.get(NavExtDialogConfig.class).getNavMap());
NavConfiguration.Builder<Activity, StatefulView> navBuilder = new NavConfiguration.Builder(Routes.HOME_PAGE, navMap);
navBuilder.setSaveStateFile(new File(mApplication.getCacheDir(), "anavigator/Navigator.state"));
navBuilder.setRequiredComponent(provider);
NavConfiguration<Activity, StatefulView> navConfiguration = navBuilder.build();
Navigator navigator = new Navigator(MainActivity.class, navConfiguration);
mNavigator = navigator;
mApplication.registerActivityLifecycleCallbacks(navigator);
mApplication.registerComponentCallbacks(navigator);
return navigator;
}
use of m.co.rh.id.anavigator.StatefulView in project a-medic-log by rh-id.
the class SettingsPage method createView.
@Override
protected View createView(Activity activity, ViewGroup container) {
View view = activity.getLayoutInflater().inflate(R.layout.page_settings, container, false);
mAppBarSV.setTitle(activity.getString(R.string.title_settings));
ViewGroup containerAppBar = view.findViewById(R.id.container_app_bar);
containerAppBar.addView(mAppBarSV.buildView(activity, container));
ViewGroup content = view.findViewById(R.id.content);
for (StatefulView statefulView : mStatefulViews) {
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
content.addView(statefulView.buildView(activity, content), lparams);
}
return view;
}
Aggregations