Skip to content

Commit

Permalink
milestone 1.1.1 push
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashok-Varma authored and Ashok-Varma committed Apr 30, 2016
1 parent 78c4c8f commit c5a9b4b
Show file tree
Hide file tree
Showing 9 changed files with 318 additions and 159 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BottomNavigation

get sample apk from [Google Play Store][googlePlayStoreLink]
**get sample apk from [Google Play Store][googlePlayStoreLink]**

<img src="https://raw.githubusercontent.com/Ashok-Varma/BottomNavigation/master/all.gif" width="300" height="550" />

Expand Down Expand Up @@ -76,7 +76,7 @@ bottomNavigationBar
public void onTabSelected(int position) {
}
@Override
public void onTabUnselected(int position) {]
public void onTabUnselected(int position) {
}
@Override
public void onTabReselected(int position) {
Expand Down
18 changes: 18 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion Integer.parseInt(ANDROID_BUILD_SDK_VERSION)
Expand All @@ -19,6 +30,10 @@ android {
}
}

repositories {
maven { url 'https://maven.fabric.io/public' }
}

ext {
supportLibraryVersion = project.ANDROID_SUPPORT_LIBRARY_VERSION
}
Expand All @@ -28,4 +43,7 @@ dependencies {
compile "com.android.support:appcompat-v7:${supportLibraryVersion}"
compile "com.android.support:design:${supportLibraryVersion}"
compile project(':bottom-navigation-bar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
}
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="8ce6f72ae4c61f33d852ccccb2caab802b8f1113" />
</application>

<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import com.ashokvarma.bottomnavigation.BadgeItem;
import com.ashokvarma.bottomnavigation.BottomNavigationBar;
import com.ashokvarma.bottomnavigation.BottomNavigationItem;
import com.crashlytics.android.Crashlytics;

import io.fabric.sdk.android.Fabric;

public class BottomNavigationActivity extends AppCompatActivity implements View.OnClickListener, CompoundButton.OnCheckedChangeListener, BottomNavigationBar.OnTabSelectedListener {

Expand Down Expand Up @@ -46,6 +49,7 @@ public class BottomNavigationActivity extends AppCompatActivity implements View.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
setContentView(R.layout.activity_bottom_navigation);

bottomNavigationBar = (BottomNavigationBar) findViewById(R.id.bottom_navigation_bar);
Expand Down Expand Up @@ -154,6 +158,9 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
}
break;
}
if (!items5.isChecked() && !items3.isChecked() && !items4.isChecked()) {
buttonView.setChecked(true);
}
refresh();
}

Expand All @@ -163,27 +170,27 @@ private void refresh() {

setScrollableText(lastSelectedPosition);

// BadgeItem badgeItem = new BadgeItem().setText("new !");
// BadgeItem badgeItem1 = new BadgeItem().setText("damn big");
numberBadgeItem = new BadgeItem().setBorderWidth(4).setBackgroundColorResource(R.color.blue).setText("" + lastSelectedPosition).setHideOnSelect(autoHide.isChecked());
// BadgeItem numberBadgeItem1 = new BadgeItem().setBorderWidth(4).setBackgroundColorResource(R.color.blue).setText("12");
// BadgeItem numberBadgeItem2 = new BadgeItem().setBorderWidth(6).setText("123");
// BadgeItem badgeItem = null;
// BadgeItem badgeItem1 = null;
// numberBadgeItem = null;
// BadgeItem numberBadgeItem1 = null;
// BadgeItem numberBadgeItem2 = null;
numberBadgeItem = new BadgeItem()
.setBorderWidth(4)
.setBackgroundColorResource(R.color.blue)
.setText("" + lastSelectedPosition)
.setHideOnSelect(autoHide.isChecked());


if (modeFixed.isChecked()) {
bottomNavigationBar.setMode(BottomNavigationBar.MODE_FIXED);
bottomNavigationBar
.setMode(BottomNavigationBar.MODE_FIXED);
} else if (modeShifting.isChecked()) {
bottomNavigationBar.setMode(BottomNavigationBar.MODE_SHIFTING);
bottomNavigationBar
.setMode(BottomNavigationBar.MODE_SHIFTING);
}

if (bgStatic.isChecked()) {
bottomNavigationBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC);
bottomNavigationBar
.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC);
} else if (bgRipple.isChecked()) {
bottomNavigationBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_RIPPLE);
bottomNavigationBar
.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_RIPPLE);
}

if (items3.isChecked()) {
Expand All @@ -201,8 +208,7 @@ private void refresh() {
.addItem(new BottomNavigationItem(R.drawable.ic_tv_white_24dp, "Movies & TV").setActiveColorResource(R.color.brown))
.setFirstSelectedPosition(lastSelectedPosition > 3 ? 3 : lastSelectedPosition)
.initialise();
} else {
items5.setChecked(true);
} else if (items5.isChecked()) {
bottomNavigationBar
.addItem(new BottomNavigationItem(R.drawable.ic_home_white_24dp, "Home").setActiveColorResource(R.color.orange).setBadgeItem(numberBadgeItem))
.addItem(new BottomNavigationItem(R.drawable.ic_book_white_24dp, "Books").setActiveColorResource(R.color.teal))
Expand All @@ -224,6 +230,16 @@ public void onTabSelected(int position) {
setScrollableText(position);
}

@Override
public void onTabUnselected(int position) {

}

@Override
public void onTabReselected(int position) {
message.setText(position + " Tab Reselected");
}

private void setScrollableText(int position) {
switch (position) {
case 0:
Expand All @@ -246,14 +262,4 @@ private void setScrollableText(int position) {
break;
}
}

@Override
public void onTabUnselected(int position) {

}

@Override
public void onTabReselected(int position) {
message.setText(position + " Tab Reselected");
}
}
Loading

0 comments on commit c5a9b4b

Please sign in to comment.