use of com.mikepenz.aboutlibraries.ui.LibsSupportFragment in project AboutLibraries by mikepenz.
the class FragmentActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fragment);
// Remove line to test RTL support
// getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
new DrawerBuilder(this).withToolbar(toolbar).addDrawerItems(new PrimaryDrawerItem().withName("Home"), new PrimaryDrawerItem().withName(R.string.action_manifestactivity).withIdentifier(R.id.action_manifestactivity).withSelectable(false), new PrimaryDrawerItem().withName(R.string.action_extendactivity).withIdentifier(R.id.action_extendactivity).withSelectable(false), new PrimaryDrawerItem().withName(R.string.action_customsortactivity).withIdentifier(R.id.action_customsortactivity).withSelectable(false), new PrimaryDrawerItem().withName(R.string.action_opensource).withIdentifier(R.id.action_opensource).withSelectable(false)).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(View view, int i, IDrawerItem drawerItem) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
long id = drawerItem.getIdentifier();
if (id == R.id.action_opensource) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/mikepenz/AboutLibraries"));
startActivity(browserIntent);
} else if (id == R.id.action_extendactivity) {
Intent intent = new Intent(getApplicationContext(), ExtendActivity.class);
startActivity(intent);
} else if (id == R.id.action_customsortactivity) {
Intent intent = new Intent(getApplicationContext(), CustomSortActivity.class);
startActivity(intent);
} else if (id == R.id.action_manifestactivity) {
new LibsBuilder().withLibraries("crouton", "actionbarsherlock", "showcaseview", "android_job").withAutoDetect(false).withLicenseShown(true).withVersionShown(true).withActivityTitle("Open Source").withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR).withListener(libsListener).withLibTaskCallback(libTaskCallback).withUiListener(libsUIListener).start(FragmentActivity.this);
}
return false;
}
}).build();
/*
//NOTE: This is how you can modify a specific library definition during runtime
HashMap<String, HashMap<String, String>> libsModification = new HashMap<String, HashMap<String, String>>();
HashMap<String, String> modifyAboutLibraries = new HashMap<String, String>();
modifyAboutLibraries.put("name", "_AboutLibraries");
libsModification.put("aboutlibraries", modifyAboutLibraries);
.withLibraryModification(libsModification);
*/
LibsSupportFragment fragment = new LibsBuilder().withVersionShown(false).withLicenseShown(true).withLibraryModification("aboutlibraries", Libs.LibraryFields.LIBRARY_NAME, "_AboutLibraries").supportFragment();
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
}
use of com.mikepenz.aboutlibraries.ui.LibsSupportFragment in project AboutLibraries by mikepenz.
the class LibsBuilder method supportFragment.
/**
* supportFragment() method to build and create the fragment with the set params
*
* @return the fragment to set in your application
*/
public LibsSupportFragment supportFragment() {
Bundle bundle = new Bundle();
bundle.putSerializable("data", this);
LibsSupportFragment fragment = new LibsSupportFragment();
fragment.setArguments(bundle);
return fragment;
}
use of com.mikepenz.aboutlibraries.ui.LibsSupportFragment in project Slide by ccrama.
the class SettingsLibs method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
applyColorTheme();
setContentView(R.layout.activity_settings_libs);
setupAppBar(R.id.toolbar, R.string.settings_about_libs, true, true);
LibsSupportFragment fragment = new LibsBuilder().supportFragment();
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().replace(R.id.root_fragment, fragment).commit();
}
}
use of com.mikepenz.aboutlibraries.ui.LibsSupportFragment in project bugzy by cpunq.
the class AboutActivity method subscribeToViewModel.
public void subscribeToViewModel() {
mViewModel.getNavigateToLibrariesCommand().observe(this, v -> {
LibsSupportFragment fragment = new LibsBuilder().withFields(R.string.class.getFields()).supportFragment();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction().replace(R.id.container_frame, fragment);
ft.addToBackStack(null);
ft.commit();
});
}
Aggregations