Skip to content

Commit

Permalink
0.9.7 maven push
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashok-Varma authored and Ashok-Varma committed Mar 23, 2016
1 parent 99f7dd7 commit 750f88a
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 35 deletions.
34 changes: 17 additions & 17 deletions app/src/main/res/layout/activity_bottom_navigation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">


<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="horizontal">

<CheckBox
android:id="@+id/mode_classic"
Expand All @@ -34,9 +34,9 @@
</LinearLayout>

<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="horizontal">

<CheckBox
android:id="@+id/bg_static"
Expand All @@ -55,9 +55,9 @@
</LinearLayout>

<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="horizontal">

<CheckBox
android:id="@+id/items_3"
Expand All @@ -84,24 +84,24 @@

<Button
android:id="@+id/refresh"
android:text="Refresh"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Refresh" />

<TextView
android:id="@+id/message"
android:padding="10dp"
android:textSize="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="20dp" />
</LinearLayout>


<com.ashokvarma.bottomnavigation.BottomNavigationBar
android:id="@+id/bottom_navigation_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />
android:id="@+id/bottom_navigation_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />

</FrameLayout>
2 changes: 1 addition & 1 deletion bottom-navigation-bar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ext {
siteUrl = 'https://github.com/Ashok-Varma/bottomnavigation'
gitUrl = 'https://github.com/Ashok-Varma/bottomnavigation.git'

libraryVersion = '0.9.6'
libraryVersion = '0.9.7'

developerId = 'Ashok-Varma'
developerName = 'Ashok Varma'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import android.support.annotation.IntDef;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -166,7 +165,7 @@ public void initialise() {
}
}

if(mBackgroundStyle == BACKGROUND_STYLE_STATIC){
if (mBackgroundStyle == BACKGROUND_STYLE_STATIC) {
mBackgroundOverlay.setBackgroundColor(mBackgroundColor);
mContainer.setBackgroundColor(mBackgroundColor);
}
Expand Down Expand Up @@ -197,14 +196,14 @@ public void initialise() {
}

if (bottomNavigationTabs.size() > mFirstSelectedPosition) {
selectTab(mFirstSelectedPosition, true);
} else if (bottomNavigationTabs.size() > 0){
selectTab(0, true);
selectTabInternal(mFirstSelectedPosition, true, true);
} else if (bottomNavigationTabs.size() > 0) {
selectTabInternal(0, true, true);
}
}
}

public void clearAll(){
public void clearAll() {
mTabContainer.removeAllViews();
bottomNavigationTabs.clear();
bottomNavigationItems.clear();
Expand All @@ -216,14 +215,13 @@ public void clearAll(){
private void setUpTab(BottomNavigationTab bottomNavigationTab, BottomNavigationItem currentItem, int itemWidth, int itemActiveWidth) {
bottomNavigationTab.setInactiveWidth(itemWidth);
bottomNavigationTab.setActiveWidth(itemActiveWidth);
Log.e("widths", "inactive : " + itemWidth + ", active : " + itemActiveWidth);
bottomNavigationTab.setPosition(bottomNavigationItems.indexOf(currentItem));

bottomNavigationTab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
BottomNavigationTab bottomNavigationTabView = (BottomNavigationTab) v;
selectTab(bottomNavigationTabView.getPosition(), false);
selectTabInternal(bottomNavigationTabView.getPosition(), false, true);
}
});

Expand All @@ -236,8 +234,16 @@ public void onClick(View v) {
mTabContainer.addView(bottomNavigationTab);
}

private void selectTab(int newPosition, boolean firstTab) {
sendListenerCall(mSelectedPosition, newPosition);
public void selectTab(int newPosition){
selectTab(newPosition, true);
}
public void selectTab(int newPosition, boolean callListener){
selectTabInternal(newPosition, false, callListener);
}

private void selectTabInternal(int newPosition, boolean firstTab, boolean callListener) {
if (callListener)
sendListenerCall(mSelectedPosition, newPosition);
if (mSelectedPosition != newPosition) {
if (mBackgroundStyle == BACKGROUND_STYLE_STATIC) {
if (mSelectedPosition != -1)
Expand Down Expand Up @@ -322,6 +328,10 @@ public int getBackgroundColor() {
return mBackgroundColor;
}

public int getCurrentSelectedPosition(){
return mSelectedPosition;
}

/**
* Callback interface invoked when a tab's selection state changes.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,22 @@ void init() {
labelView = (TextView) view.findViewById(R.id.classic_bottom_navigation_title);
iconView = (ImageView) view.findViewById(R.id.classic_bottom_navigation_icon);

labelScale = getResources().getDimension(R.dimen.classic_label_inactive) / getResources().getDimension(R.dimen.classic_label_active);
labelScale = getResources().getDimension(R.dimen.classic_label_active) / getResources().getDimension(R.dimen.classic_label_inactive);

super.init();
}

@Override
public void select(boolean setActiveColor, int animationDuration) {

labelView.animate().scaleX(1).scaleY(1).setDuration(animationDuration).start();
labelView.animate().scaleX(labelScale).scaleY(labelScale).setDuration(animationDuration).start();
// labelView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.classic_label_active));
super.select(setActiveColor, animationDuration);
}

@Override
public void unSelect(boolean setActiveColor, int animationDuration) {
labelView.animate().scaleX(labelScale).scaleY(labelScale).setDuration(animationDuration).start();
labelView.animate().scaleX(1).scaleY(1).setDuration(animationDuration).start();
// labelView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.classic_label_inactive));
super.unSelect(setActiveColor, animationDuration);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
android:layout_height="@dimen/bottom_navigation_height"
android:background="?selectableItemBackgroundBorderless"
android:paddingBottom="@dimen/classic_height_bottom_padding"
android:paddingLeft="@dimen/classic_width_padding"
android:paddingRight="@dimen/classic_width_padding"
android:paddingTop="@dimen/classic_height_top_padding_inactive">

<ImageView
Expand All @@ -21,8 +23,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:gravity="center"
android:scaleY="@dimen/classic_label_active_to_inactive_ratio"
android:scaleX="@dimen/classic_label_active_to_inactive_ratio"
android:includeFontPadding="false"
android:lines="1"
android:textSize="@dimen/classic_label_inactive" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
android:layout_height="@dimen/bottom_navigation_height"
android:background="?selectableItemBackgroundBorderless"
android:orientation="vertical"
android:paddingTop="@dimen/shifting_height_top_padding_inactive">
android:paddingTop="@dimen/shifting_height_top_padding_inactive"
android:paddingLeft="@dimen/shifting_width_custom_padding"
android:paddingRight="@dimen/shifting_width_custom_padding">

<ImageView
android:id="@+id/shifting_bottom_navigation_icon"
Expand Down
3 changes: 2 additions & 1 deletion bottom-navigation-bar/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<dimen name="classic_label_active">14sp</dimen>
<dimen name="classic_label_inactive">12sp</dimen>
<item name="classic_label_active_to_inactive_ratio" format="float" type="dimen">0.857</item>
<!--<item name="classic_label_active_to_inactive_ratio" format="float" type="dimen">0.857</item>-->

<dimen name="classic_icon_grid">24dp</dimen>

Expand All @@ -21,6 +21,7 @@
<dimen name="shifting_max_width_active">168dp</dimen>
<dimen name="shifting_min_width_inactive">64dp</dimen>
<dimen name="shifting_max_width_inactive">96dp</dimen>
<dimen name="shifting_width_custom_padding">6dp</dimen>

<dimen name="shifting_height">56dp</dimen>
<dimen name="shifting_height_bottom_padding_inactive">16dp</dimen>
Expand Down

0 comments on commit 750f88a

Please sign in to comment.