Skip to content

Commit

Permalink
Merge pull request #11 from b-lam/develop
Browse files Browse the repository at this point in the history
Fixed navigation bar and preview status bar icons
  • Loading branch information
b-lam authored Apr 12, 2017
2 parents 638bedf + 690ede0 commit 4e7c0d6
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 24 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ android {
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.b_lam.resplash"
minSdkVersion 22
minSdkVersion 21
targetSdkVersion 25
versionCode 3
versionName "1.0.2"
versionCode 4
versionName "1.0.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildConfigField("String", "UNSPLASH_APPLICATION_ID", UNSPLASH_APPLICATION_ID)
buildConfigField("String", "UNSPLASH_SECRET", UNSPLASH_SECRET)
Expand Down
Binary file added app/resplash-1.0.3.apk
Binary file not shown.
30 changes: 16 additions & 14 deletions app/src/main/java/com/b_lam/resplash/ScrollAwareFABBehavior.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@


import android.content.Context;
import android.os.Build;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorListener;
import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;

/**
* Created by Brandon on 10/22/2016.
Expand All @@ -19,24 +25,20 @@ public ScrollAwareFABBehavior(Context context, AttributeSet attrs) {
}

@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout,
FloatingActionButton child, View directTargetChild, View target, int nestedScrollAxes) {
return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL ||
super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target,
nestedScrollAxes);
}

@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child,
View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed,
dyUnconsumed);
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);

if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
//child -> Floating Action Button
if (child.getVisibility() == View.VISIBLE && dyConsumed > 0) {
child.hide();
} else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
} else if (child.getVisibility() == View.GONE && dyConsumed < 0) {
child.show();
}
}

@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View directTargetChild, View target, int nestedScrollAxes) {
return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import android.view.MenuItem;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;

Expand Down
15 changes: 15 additions & 0 deletions app/src/main/res/anim/fab_in.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>

<set xmlns:android="http://schemas.android.com/apk/res/android">

<alpha android:fromAlpha="0.0"
android:toAlpha="1.0"/>

<scale android:fromXScale="0.0"
android:fromYScale="0.0"
android:toXScale="1.0"
android:toYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"/>

</set>
14 changes: 14 additions & 0 deletions app/src/main/res/anim/fab_out.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">

<alpha android:fromAlpha="1.0"
android:toAlpha="0.0"/>

<scale android:fromXScale="1.0"
android:fromYScale="1.0"
android:toXScale="0.0"
android:toYScale="0.0"
android:pivotX="50%"
android:pivotY="50%"/>

</set>
1 change: 0 additions & 1 deletion app/src/main/res/values-v21/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@color/Link_Water</item>
<item name="android:navigationBarColor">@color/Link_Water</item>
</style>

</resources>
12 changes: 9 additions & 3 deletions app/src/main/res/values-v23/styles.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:statusBarColor">@color/Link_Water</item>
<item name="android:navigationBarColor">@color/Link_Water</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:textColor">#000000</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowLightStatusBar">true</item>
</style>

<style name="PreviewTheme">
<item name="android:statusBarColor">@color/md_grey_900</item>
<item name="android:navigationBarColor">@color/md_grey_900</item>
<item name="windowActionBar">true</item>
<item name="windowNoTitle">true</item>
<item name="android:windowLightStatusBar">false</item>
</style>
</resources>
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
<string name="about_unsplash_title">Unsplash.com</string>
<string name="about_unsplash_subtitle">Free (do whatever you want) high-resolution photos</string>
<string name="about_version_title">Version</string>
<string name="about_version_subtitle">1.0.2</string>
<string name="about_version_subtitle">1.0.3</string>
<string name="about_changelog_title">Changelog</string>
<string name="changelog">v1.0.0 - Initial Release\nv1.0.1 - Fixed loading bug\nv1.0.2 - Changed to dark status bar icons</string>
<string name="changelog">v1.0.0 - Initial Release\nv1.0.1 - Fixed loading bug\nv1.0.2 - Changed to dark status bar icons\nv1.0.3 - Fixed navigation bar and preview status bar icons</string>
<string name="about_introduction_title">Introduction</string>
<string name="about_github_title">GitHub</string>
<string name="about_author_title">Brandon Lam</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:statusBarColor">@color/Link_Water</item>
<item name="android:navigationBarColor">@color/Link_Water</item>
<item name="android:textColor">#000000</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
Expand Down

0 comments on commit 4e7c0d6

Please sign in to comment.