Search in sources :

Example 1 with LibsSupportFragment

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();
}
Also used : LibsSupportFragment(com.mikepenz.aboutlibraries.ui.LibsSupportFragment) FragmentManager(android.support.v4.app.FragmentManager) PrimaryDrawerItem(com.mikepenz.materialdrawer.model.PrimaryDrawerItem) IDrawerItem(com.mikepenz.materialdrawer.model.interfaces.IDrawerItem) LibsBuilder(com.mikepenz.aboutlibraries.LibsBuilder) Intent(android.content.Intent) DrawerBuilder(com.mikepenz.materialdrawer.DrawerBuilder) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Example 2 with LibsSupportFragment

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;
}
Also used : LibsSupportFragment(com.mikepenz.aboutlibraries.ui.LibsSupportFragment) Bundle(android.os.Bundle)

Example 3 with LibsSupportFragment

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();
    }
}
Also used : LibsSupportFragment(com.mikepenz.aboutlibraries.ui.LibsSupportFragment) LibsBuilder(com.mikepenz.aboutlibraries.LibsBuilder)

Example 4 with LibsSupportFragment

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();
    });
}
Also used : LibsSupportFragment(com.mikepenz.aboutlibraries.ui.LibsSupportFragment) R(in.bugzy.R) FragmentTransaction(android.support.v4.app.FragmentTransaction) LibsBuilder(com.mikepenz.aboutlibraries.LibsBuilder)

Aggregations

LibsSupportFragment (com.mikepenz.aboutlibraries.ui.LibsSupportFragment)4 LibsBuilder (com.mikepenz.aboutlibraries.LibsBuilder)3 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 FragmentManager (android.support.v4.app.FragmentManager)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 Toolbar (android.support.v7.widget.Toolbar)1 View (android.view.View)1 DrawerBuilder (com.mikepenz.materialdrawer.DrawerBuilder)1 PrimaryDrawerItem (com.mikepenz.materialdrawer.model.PrimaryDrawerItem)1 IDrawerItem (com.mikepenz.materialdrawer.model.interfaces.IDrawerItem)1 R (in.bugzy.R)1