Skip to content

Commit

Permalink
Updated proguard rules. This required swapping out the roughike botto…
Browse files Browse the repository at this point in the history
…mbar library for the design support bottom nav view. The bottombar lib caused a missing reference issue when minifying.
  • Loading branch information
andrewvora committed May 28, 2017
1 parent f2b95d9 commit 708a7bd
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 23 deletions.
5 changes: 0 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ android {
}

def appCompatVersion = '25.3.1'
def leakCanaryVersion = '1.3.1'

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
Expand All @@ -73,10 +72,6 @@ dependencies {
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.code.gson:gson:2.7'

debugCompile "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
testCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
Expand Down
7 changes: 7 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

## ButterKnife Rules
# Retain generated class which implement ViewBinder.
-keep public class * implements butterknife.internal.ViewBinder { public <init>(); }
Expand All @@ -25,6 +26,12 @@
-keepclasseswithmembernames class * { @butterknife.* <methods>; }
-keepclasseswithmembernames class * { @butterknife.* <fields>; }

## Firebase Rules
-keepattributes Signature
-keepclassmembers class com.andrewvora.apps.rideatlanta.data.models.** {
*;
}

## Design Support Library
-keep class android.support.design.widget.** { *; }
-keep interface android.support.design.widget.** { *; }
Expand Down
26 changes: 14 additions & 12 deletions app/src/main/java/com/andrewvora/apps/rideatlanta/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
Expand All @@ -30,8 +31,8 @@
import com.andrewvora.apps.rideatlanta.data.repos.NotificationsRepo;
import com.andrewvora.apps.rideatlanta.data.repos.TrainsRepo;
import com.andrewvora.apps.rideatlanta.favoriteroutes.FavoriteRoutesContract;
import com.andrewvora.apps.rideatlanta.favoriteroutes.FavoriteRoutesLoadingCache;
import com.andrewvora.apps.rideatlanta.favoriteroutes.FavoriteRoutesFragment;
import com.andrewvora.apps.rideatlanta.favoriteroutes.FavoriteRoutesLoadingCache;
import com.andrewvora.apps.rideatlanta.favoriteroutes.FavoriteRoutesPresenter;
import com.andrewvora.apps.rideatlanta.home.HomeContract;
import com.andrewvora.apps.rideatlanta.home.HomeFragment;
Expand All @@ -43,8 +44,6 @@
import com.andrewvora.apps.rideatlanta.trains.TrainRoutesContract;
import com.andrewvora.apps.rideatlanta.trains.TrainRoutesFragment;
import com.andrewvora.apps.rideatlanta.trains.TrainRoutesPresenter;
import com.roughike.bottombar.BottomBar;
import com.roughike.bottombar.OnTabSelectListener;

import butterknife.BindView;
import butterknife.ButterKnife;
Expand All @@ -56,7 +55,7 @@ public class MainActivity extends AppCompatActivity {
@BindView(R.id.toolbar_icon) ImageButton mToolbarIconView;
@BindView(R.id.toolbar_title) TextView mToolbarTitleView;
@BindView(R.id.toolbar) Toolbar mToolbar;
@BindView(R.id.bottom_bar) BottomBar mBottomBar;
@BindView(R.id.bottom_bar) BottomNavigationView mBottomBar;

private FavoriteRoutesLoadingCache mFavRouteDataManager;
private Handler mPollingHandler;
Expand Down Expand Up @@ -90,11 +89,15 @@ protected void onCreate(Bundle savedInstanceState) {
}

mPollingHandler = new Handler();
mBottomBar.setDefaultTabPosition(1);
mBottomBar.setOnTabSelectListener(new OnTabSelectListener() {
mBottomBar.setSelectedItemId(R.id.tab_home);
mBottomBar.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public void onTabSelected(@IdRes int tabId) {
switch(tabId) {
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch(item.getItemId()) {
case R.id.tab_home:
onHomeTabSelected();
break;

case R.id.tab_buses:
onBusesTabSelected();
break;
Expand All @@ -103,10 +106,6 @@ public void onTabSelected(@IdRes int tabId) {
onTrainsTabSelected();
break;

case R.id.tab_home:
onHomeTabSelected();
break;

case R.id.tab_fav_routes:
onFavRoutesTabSelected();
break;
Expand All @@ -115,13 +114,16 @@ public void onTabSelected(@IdRes int tabId) {
onNotificationsTabSelected();
break;
}
return true;
}
});
}

@Override
protected void onResume() {
super.onResume();

onHomeTabSelected();
mPollingHandler.post(mPollingTask);
}

Expand Down
11 changes: 6 additions & 5 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@

</android.support.design.widget.AppBarLayout>

<com.roughike.bottombar.BottomBar
<android.support.design.widget.BottomNavigationView
style="@style/LowElevationStyle"
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_bar_height"
android:layout_gravity="bottom"
app:bb_activeTabColor="@color/primary_orange"
app:bb_inActiveTabAlpha="1"
app:bb_activeTabAlpha="1"
app:bb_tabXmlResource="@xml/bottom_nav_tabs"/>
android:background="@color/colorAccent"
app:itemTextColor="@color/md_white_1000"
app:itemIconTint="@color/md_white_1000"
app:menu="@menu/menu_bottom_nav"/>

</android.support.design.widget.CoordinatorLayout>
4 changes: 3 additions & 1 deletion app/src/main/res/layout/element_home_alert_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
android:id="@+id/alert_time_stamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="100dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:gravity="end"
android:textSize="14sp"
tools:text="5h"/>
tools:text="May 26, 2017, 10:55 PM"/>

<TextView
style="@style/NotificationTextStyle"
Expand Down
40 changes: 40 additions & 0 deletions app/src/main/res/menu/menu_bottom_nav.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="https://schemas.android.com/apk/res/android"
xmlns:app="https://schemas.android.com/apk/res-auto">

<item
android:id="@+id/tab_home"
android:enabled="true"
android:icon="@drawable/ic_home_24dp"
android:title="@string/title_tab_home"
app:showAsAction="ifRoom"/>

<item
android:id="@+id/tab_fav_routes"
android:enabled="true"
android:icon="@drawable/ic_favorite_filled_24dp"
android:title="@string/title_tab_fav_routes"
app:showAsAction="ifRoom"/>

<item
android:id="@+id/tab_buses"
android:enabled="true"
android:icon="@drawable/ic_bus_24dp"
android:title="@string/title_tab_buses"
app:showAsAction="ifRoom"/>

<item
android:id="@+id/tab_trains"
android:enabled="true"
android:icon="@drawable/ic_train_24dp"
android:title="@string/title_tab_trains"
app:showAsAction="ifRoom"/>

<item
android:id="@+id/tab_notifications"
android:enabled="true"
android:icon="@drawable/ic_notifications_24dp"
android:title="@string/title_tab_notifications"
app:showAsAction="ifRoom"/>
</menu>

0 comments on commit 708a7bd

Please sign in to comment.