Skip to content

Commit

Permalink
Added Bottom Bar
Browse files Browse the repository at this point in the history
New Material Design component
  • Loading branch information
Suleiman19 committed Apr 3, 2016
1 parent a38bd43 commit d277a67
Show file tree
Hide file tree
Showing 9 changed files with 218 additions and 124 deletions.
181 changes: 105 additions & 76 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion MaterialSample/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion MaterialSample/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 20 additions & 18 deletions MaterialSample/app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,16 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.amulyakhare/com.amulyakhare.textdrawable/1.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/palette-v7/23.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/23.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/palette-v7/23.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/23.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.github.ozodrukh/CircularReveal/1.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.roughike/bottom-bar/1.1.7/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
Expand All @@ -91,17 +92,18 @@
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.2.0" level="project" />
<orderEntry type="library" exported="" name="palette-v7-23.2.1" level="project" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" name="palette-v7-23.2.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.2.0" level="project" />
<orderEntry type="library" exported="" name="CircularReveal-1.1.0" level="project" />
<orderEntry type="library" exported="" name="bottom-bar-1.1.7" level="project" />
<orderEntry type="library" exported="" name="com.amulyakhare.textdrawable-1.0.1" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-23.2.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.2.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.2.0" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-23.2.0" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-23.2.0" level="project" />
<orderEntry type="library" exported="" name="design-23.2.0" level="project" />
<orderEntry type="library" exported="" name="design-23.2.1" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-23.2.1" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.2.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.2.1" level="project" />
<orderEntry type="library" exported="" name="CircularReveal-1.1.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.2.1" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-23.2.1" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-23.2.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.2.1" level="project" />
</component>
</module>
11 changes: 6 additions & 5 deletions MaterialSample/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ repositories {

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.android.support:cardview-v7:23.2.0'
compile 'com.android.support:palette-v7:23.2.0'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:palette-v7:23.2.1'
compile 'com.github.ozodrukh:CircularReveal:1.1.0'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.roughike:bottom-bar:1.1.7'

}
2 changes: 2 additions & 0 deletions MaterialSample/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.suleiman.material">


<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.CardView;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
Expand All @@ -14,6 +16,8 @@
import android.view.View;
import android.widget.Toast;

import com.roughike.bottombar.BottomBar;
import com.roughike.bottombar.OnMenuTabSelectedListener;
import com.suleiman.material.R;
import com.suleiman.material.adapter.SimpleRecyclerAdapter;
import com.suleiman.material.utils.Utils;
Expand All @@ -22,13 +26,15 @@ public class MainActivity extends AppCompatActivity {
Toolbar toolbar;
RecyclerView recyclerView;
SimpleRecyclerAdapter adapter;
RecyclerView mainRecyclerView;
CardView listItem;
Intent intent;

String[] colors = {"#96CC7A", "#EA705D", "#66BBCC"};

public static final String PREF_USER_FIRST_TIME = "user_first_time";
boolean isUserFirstTime;

BottomBar bottomBar;

@Override
protected void onStart() {
super.onStart();
Expand All @@ -46,12 +52,9 @@ protected void onCreate(Bundle savedInstanceState) {
Intent introIntent = new Intent(MainActivity.this, PagerActivity.class);
introIntent.putExtra(PREF_USER_FIRST_TIME, isUserFirstTime);

if (isUserFirstTime) {

if (isUserFirstTime)
startActivity(introIntent);

}


setContentView(R.layout.activity_main);

Expand All @@ -61,13 +64,12 @@ protected void onCreate(Bundle savedInstanceState) {
}
getSupportActionBar().setTitle("Material Design Samples");

mainRecyclerView = (RecyclerView) findViewById(R.id.recyclerview);
listItem = (CardView) findViewById(R.id.cardlist_item);
recyclerView = (RecyclerView) findViewById(R.id.home_recyclerview);

recyclerView.setHasFixedSize(true);
recyclerView = (RecyclerView) findViewById(R.id.main_recycler);

recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setHasFixedSize(true);

if (adapter == null) {
adapter = new SimpleRecyclerAdapter(this);
Expand Down Expand Up @@ -120,6 +122,40 @@ public void onItemClick(View view, int position) {
}
});



// Attaching Bottom Bar
// bottomBar = BottomBar.attach(this, savedInstanceState);

// Attach Bottom Bar and enable Quick Return
bottomBar = BottomBar.attachShy((CoordinatorLayout) findViewById(R.id.main_coordinator),
recyclerView, savedInstanceState);
bottomBar.noNavBarGoodness();

// Customizations
for (int i = 0; i < colors.length; i++)
bottomBar.mapColorForTab(i, colors[i]);

bottomBar.setActiveTabColor(ContextCompat.getColor(this, R.color.white));


bottomBar.setItemsFromMenu(R.menu.bottom_bar, new OnMenuTabSelectedListener() {
@Override
public void onMenuItemSelected(int resId) {
switch (resId) {
case R.id.bottombaritem_0:
recyclerView.setBackgroundColor(Color.parseColor(colors[0]));
break;
case R.id.bottombaritem_1:
recyclerView.setBackgroundColor(Color.parseColor(colors[1]));
break;
case R.id.bottombaritem_2:
recyclerView.setBackgroundColor(Color.parseColor(colors[2]));
break;
}
}
});

}


Expand Down
26 changes: 14 additions & 12 deletions MaterialSample/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.suleiman.material.activities.MainActivity">

<FrameLayout
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize">
android:layout_height="wrap_content">

<include layout="@layout/toolbar_w_shadow" />

<android.support.v7.widget.RecyclerView
android:id="@+id/home_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false" />
</android.support.design.widget.AppBarLayout>

</FrameLayout>

<include layout="@layout/toolbar_w_shadow" />
<android.support.v7.widget.RecyclerView
android:id="@+id/main_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />


</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
22 changes: 22 additions & 0 deletions MaterialSample/app/src/main/res/menu/bottom_bar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">


<item
android:id="@+id/bottombaritem_0"
android:icon="@drawable/ic_call_24dp"
android:title="Recents" />


<item
android:id="@+id/bottombaritem_1"
android:icon="@drawable/ic_query_builder_24dp"
android:title="Recents" />

<item
android:id="@+id/bottombaritem_2"
android:icon="@drawable/ic_flight_24dp"
android:title="Recents" />


</menu>

0 comments on commit d277a67

Please sign in to comment.