Search in sources :

Example 1 with BottomBar

use of com.roughike.bottombar.BottomBar in project ApertureGallery by MJonesDev.

the class ActivityHome method onCreate.

@Override
protected // TODO - Check if permissions have been granted. If not, request
void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(com.marlonjones.projectevo.R.layout.activity_home);
    final Toolbar toolbar = (Toolbar) findViewById(R.id.tool_bar);
    // This may be changed once the app's name is changed
    toolbar.setTitle("Albums");
    setSupportActionBar(toolbar);
    // Message at start of app!
    new MaterialDialog.Builder(this).title(R.string.alpha_title).content(R.string.alpha_text).positiveText(R.string.OK).show();
    // Asks for permission. Works, sort of. Temporary Solution
    new AskPermission.Builder(this).setPermissions(Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE).setCallback(this).setErrorCallback(this).request(GET_PERMISSIONS);
    // TODO: Consider changing UI to be better, and consider adding Drive/Dropbox support.
    // Fragments are named after explosives seen in COD: MW3
    mContext = ActivityHome.this;
    BottomBar BotLane = BottomBar.attach(this, savedInstanceState);
    // This is due to not being deved for tablets. No need to.
    BotLane.noTabletGoodness();
    BotLane.setItems(R.menu.bottombar_menu);
    BotLane.setOnMenuTabClickListener(new OnMenuTabClickListener() {

        // Consider replacing with Google Bottom Bar from Android Design Library
        @Override
        public void onMenuTabSelected(@IdRes int menuItemId) {
            if (menuItemId == R.id.bottomBarItemOne) {
                toolbar.setTitle("Albums");
                Fragment semtexFrag = new GalleryFragment();
                FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
                ft.replace(R.id.fragment_container, semtexFrag);
                ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
                ft.addToBackStack(null);
                ft.commit();
            }
            if (menuItemId == R.id.bottomBarItemTwo) {
                toolbar.setTitle("Camera");
                Fragment claymoreFrag = new CameraFragment();
                FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
                ft.replace(R.id.fragment_container, claymoreFrag);
                ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
                ft.addToBackStack(null);
                ft.commit();
            }
            if (menuItemId == R.id.bottomBarItemThree) {
                toolbar.setTitle("Videos");
                Fragment moabFrag = new VideoFragment();
                FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
                ft.replace(R.id.fragment_container, moabFrag);
                ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
                ft.addToBackStack(null);
                ft.commit();
            }
        }

        @Override
        public void onMenuTabReSelected(@IdRes int menuItemId) {
            if (menuItemId == R.id.bottomBarItemOne) {
            // The user reselected item number one, scroll your content to top.
            // TODO - Add in "Scroll to top" function for better UX.
            }
        }
    });
}
Also used : BottomBar(com.roughike.bottombar.BottomBar) FragmentTransaction(android.support.v4.app.FragmentTransaction) OnMenuTabClickListener(com.roughike.bottombar.OnMenuTabClickListener) Fragment(android.support.v4.app.Fragment) Toolbar(android.support.v7.widget.Toolbar)

Example 2 with BottomBar

use of com.roughike.bottombar.BottomBar in project BottomBar by roughike.

the class FiveColorChangingTabsActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_color_changing_tabs);
    messageView = (TextView) findViewById(R.id.messageView);
    BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
    bottomBar.setOnTabSelectListener(new OnTabSelectListener() {

        @Override
        public void onTabSelected(@IdRes int tabId) {
            messageView.setText(TabMessage.get(tabId, false));
        }
    });
    bottomBar.setOnTabReselectListener(new OnTabReselectListener() {

        @Override
        public void onTabReSelected(@IdRes int tabId) {
            Toast.makeText(getApplicationContext(), TabMessage.get(tabId, true), Toast.LENGTH_LONG).show();
        }
    });
}
Also used : BottomBar(com.roughike.bottombar.BottomBar) OnTabReselectListener(com.roughike.bottombar.OnTabReselectListener) OnTabSelectListener(com.roughike.bottombar.OnTabSelectListener)

Example 3 with BottomBar

use of com.roughike.bottombar.BottomBar in project Roblu by wdavies973.

the class FormViewer method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_create_form);
    /*
		 * Load dependencies
		 */
    /*
         Stores the user's UI preferences
        */
    RUI rui = new IO(getApplicationContext()).loadSettings().getRui();
    /*
		 * Setup UI
		 */
    // Toolbar
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setTitle("Form editor");
        if (getIntent().getBooleanExtra("master", false))
            getSupportActionBar().setSubtitle("Master form");
    }
    // Bottom bar - selector that lets the user switch between PIT and MATCH forms
    BottomBar bBar = findViewById(R.id.bottomBar);
    bBar.setOnTabSelectListener(this);
    BottomBarTab tab = bBar.getTabAtPosition(0);
    BottomBarTab tab2 = bBar.getTabAtPosition(1);
    tab.setBarColorWhenSelected(rui.getPrimaryColor());
    tab2.setBarColorWhenSelected(rui.getPrimaryColor());
    bBar.selectTabAtPosition(0);
    // Add the "New metric" button
    FloatingActionButton fab = findViewById(R.id.fab);
    fab.setOnClickListener(this);
    // Recycler view setup
    RecyclerView rv = findViewById(R.id.movie_recycler_view);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    rv.setLayoutManager(linearLayoutManager);
    ((SimpleItemAnimator) rv.getItemAnimator()).setSupportsChangeAnimations(false);
    metricsAdapter = new FormRecyclerAdapter(this, this);
    rv.setAdapter(metricsAdapter);
    // Gesture helper
    ItemTouchHelper.Callback callback = new FormRecyclerTouchHelper(metricsAdapter);
    ItemTouchHelper helper = new ItemTouchHelper(callback);
    helper.attachToRecyclerView(rv);
    /*
         * Check to see if we received a form from a different class or
         * if we need to create a new one
         */
    if (getIntent().getSerializableExtra("form") != null) {
        form = (RForm) getIntent().getSerializableExtra("form");
    } else {
        RTextfield name = new RTextfield(0, "Team name", false, true, "");
        RTextfield number = new RTextfield(1, "Team number", true, true, "");
        ArrayList<RMetric> pit = new ArrayList<>();
        pit.add(name);
        pit.add(number);
        form = new RForm(pit, new ArrayList<RMetric>());
    }
    loadViews(true, 0);
    new UIHandler(this, toolbar, fab).update();
}
Also used : SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) UIHandler(com.cpjd.roblu.ui.UIHandler) IO(com.cpjd.roblu.io.IO) RTextfield(com.cpjd.roblu.models.metrics.RTextfield) RUI(com.cpjd.roblu.models.RUI) ArrayList(java.util.ArrayList) RMetric(com.cpjd.roblu.models.metrics.RMetric) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ItemTouchHelper(android.support.v7.widget.helper.ItemTouchHelper) BottomBar(com.roughike.bottombar.BottomBar) RForm(com.cpjd.roblu.models.RForm) BottomBarTab(com.roughike.bottombar.BottomBarTab) FloatingActionButton(android.support.design.widget.FloatingActionButton) RecyclerView(android.support.v7.widget.RecyclerView) Toolbar(android.support.v7.widget.Toolbar)

Example 4 with BottomBar

use of com.roughike.bottombar.BottomBar in project BottomBar by roughike.

the class BadgeActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_three_tabs);
    messageView = (TextView) findViewById(R.id.messageView);
    final BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
    bottomBar.setOnTabSelectListener(new OnTabSelectListener() {

        @Override
        public void onTabSelected(@IdRes int tabId) {
            messageView.setText(TabMessage.get(tabId, false));
        }
    });
    bottomBar.setOnTabReselectListener(new OnTabReselectListener() {

        @Override
        public void onTabReSelected(@IdRes int tabId) {
            Toast.makeText(getApplicationContext(), TabMessage.get(tabId, true), Toast.LENGTH_LONG).show();
        }
    });
    BottomBarTab nearby = bottomBar.getTabWithId(R.id.tab_nearby);
    nearby.setBadgeCount(5);
}
Also used : BottomBar(com.roughike.bottombar.BottomBar) OnTabReselectListener(com.roughike.bottombar.OnTabReselectListener) BottomBarTab(com.roughike.bottombar.BottomBarTab) OnTabSelectListener(com.roughike.bottombar.OnTabSelectListener)

Example 5 with BottomBar

use of com.roughike.bottombar.BottomBar in project BottomBar by roughike.

the class CustomColorAndFontActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_custom_color_and_font);
    messageView = (TextView) findViewById(R.id.messageView);
    BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
    bottomBar.setOnTabSelectListener(new OnTabSelectListener() {

        @Override
        public void onTabSelected(@IdRes int tabId) {
            messageView.setText(TabMessage.get(tabId, false));
        }
    });
    bottomBar.setOnTabReselectListener(new OnTabReselectListener() {

        @Override
        public void onTabReSelected(@IdRes int tabId) {
            Toast.makeText(getApplicationContext(), TabMessage.get(tabId, true), Toast.LENGTH_LONG).show();
        }
    });
}
Also used : BottomBar(com.roughike.bottombar.BottomBar) OnTabReselectListener(com.roughike.bottombar.OnTabReselectListener) OnTabSelectListener(com.roughike.bottombar.OnTabSelectListener)

Aggregations

BottomBar (com.roughike.bottombar.BottomBar)8 OnTabSelectListener (com.roughike.bottombar.OnTabSelectListener)6 OnTabReselectListener (com.roughike.bottombar.OnTabReselectListener)5 Toolbar (android.support.v7.widget.Toolbar)2 BottomBarTab (com.roughike.bottombar.BottomBarTab)2 FloatingActionButton (android.support.design.widget.FloatingActionButton)1 Fragment (android.support.v4.app.Fragment)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)1 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)1 IO (com.cpjd.roblu.io.IO)1 RForm (com.cpjd.roblu.models.RForm)1 RUI (com.cpjd.roblu.models.RUI)1 RMetric (com.cpjd.roblu.models.metrics.RMetric)1 RTextfield (com.cpjd.roblu.models.metrics.RTextfield)1 UIHandler (com.cpjd.roblu.ui.UIHandler)1 OnMenuTabClickListener (com.roughike.bottombar.OnMenuTabClickListener)1 ArrayList (java.util.ArrayList)1