Skip to content

Commit 2b98cea

Browse files
Merge pull request #16 from UdacityAndroidBasicsScholarship/UI
[commits by Mahima @amy6]
2 parents 7856c30 + 6820027 commit 2b98cea

22 files changed

+245
-118
lines changed
535 Bytes
Binary file not shown.

.idea/codeStyles/Project.xml

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

100755100644
File mode changed.

.idea/misc.xml

100755100644
Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

100755100644
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

100755100644
File mode changed.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
apply plugin: 'com.android.application'
33

44
android {
5-
compileSdkVersion 26
5+
compileSdkVersion 27
66
defaultConfig {
77
applicationId "com.example.dhananjay.dailygoals"
8-
minSdkVersion 15
9-
targetSdkVersion 26
8+
minSdkVersion 21
9+
targetSdkVersion 27
1010
versionCode 1
1111
versionName "1.0"
1212
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -21,13 +21,13 @@ android {
2121

2222
dependencies {
2323
implementation fileTree(dir: 'libs', include: ['*.jar'])
24-
implementation 'com.android.support:appcompat-v7:26.1.0'
25-
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
24+
implementation 'com.android.support:appcompat-v7:27.1.1'
25+
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
2626
testImplementation 'junit:junit:4.12'
27-
androidTestImplementation 'com.android.support.test:runner:0.5'
28-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
29-
implementation 'com.android.support:cardview-v7:26.1.0'
30-
implementation 'com.android.support:design:26.1.0'
27+
androidTestImplementation 'com.android.support.test:runner:1.0.1'
28+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
29+
implementation 'com.android.support:cardview-v7:27.1.1'
30+
implementation 'com.android.support:design:27.1.1'
3131
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
32-
implementation 'com.android.support:recyclerview-v7:26.1.0'
32+
implementation 'com.android.support:recyclerview-v7:27.1.1'
3333
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package com.example.dhananjay.dailygoals;
2+
3+
import android.content.Context;
4+
import android.support.annotation.NonNull;
5+
import android.support.design.widget.BottomNavigationView;
6+
import android.support.design.widget.CoordinatorLayout;
7+
import android.support.v4.view.ViewCompat;
8+
import android.util.AttributeSet;
9+
import android.util.Log;
10+
import android.view.View;
11+
12+
import static java.lang.Math.max;
13+
import static java.lang.Math.min;
14+
15+
16+
public class BottomNavigationBehavior extends CoordinatorLayout.Behavior<BottomNavigationView> {
17+
18+
/**
19+
* Default constructor for instantiating the behavior
20+
*/
21+
public BottomNavigationBehavior() {
22+
super();
23+
}
24+
25+
/**
26+
* Default constructor for inflating behaviors from the layout
27+
*
28+
* @param context
29+
* @param attrs
30+
*/
31+
32+
public BottomNavigationBehavior(Context context, AttributeSet attrs) {
33+
super(context, attrs);
34+
}
35+
36+
37+
/**
38+
* @param coordinatorLayout the CoordinatorLayout with which the behavior is associated
39+
* @param child the child view of the CoordinatorLayout this behavior is associated with
40+
* @param directTargetChild the child view of the CoordinatorLayout that either is or contains the view that is the target of nested
41+
* scrolling operation
42+
* @param target the descendant of the CoordinatorLayout initiating the scroll operation
43+
* @param axes the axis of scrolling - horizontal or vertical
44+
* @param type type of input event that caused the scrolling
45+
* @return true if behavior wishes to accept this nested scroll
46+
*/
47+
@Override
48+
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull BottomNavigationView child, @NonNull View directTargetChild, @NonNull View target, int axes, int type) {
49+
Log.v("Tag", target.getClass().toString());
50+
return axes == ViewCompat.SCROLL_AXIS_VERTICAL;
51+
}
52+
53+
54+
/**
55+
* @param coordinatorLayout
56+
* @param child
57+
* @param target
58+
* @param dx the horizontal number of pixels that the user attempted to scroll
59+
* @param dy the vertical number of pixels that the user attempted to scroll
60+
* @param consumed an integer array where consumed[0] should be set to dx , consumer[1] should be set
61+
* to dy
62+
* @param type
63+
*/
64+
@Override
65+
public void onNestedPreScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull BottomNavigationView child, @NonNull View target, int dx, int dy, @NonNull int[] consumed, int type) {
66+
super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
67+
child.setTranslationY(max(0f, min(((float) child.getHeight()), child.getTranslationY() + dy)));
68+
}
69+
70+
}

app/src/main/res/drawable/b.jpg

87.2 KB
Loading

0 commit comments

Comments
 (0)