Skip to content

Commit

Permalink
Update dependencies + more
Browse files Browse the repository at this point in the history
- Update dependencies (support-library, espresso)
- Update compileSdkVersion and targetSdkVersion to 27
- Update buildtools to 27.0.2
- Update Gradle to 4.4
- Update AGP to 3.0.1
- Simplify MainActivity
  • Loading branch information
kleisauke committed Dec 10, 2017
1 parent e1688ec commit 2c1d8be
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 20 deletions.
17 changes: 8 additions & 9 deletions app/build.gradle
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion = "26.0.1"
compileSdkVersion 27
buildToolsVersion = "27.0.2"

defaultConfig {
applicationId "nl.kleisauke.compactcalendarviewtoolbar"
minSdkVersion 14
targetSdkVersion 26
targetSdkVersion 27
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
Expand All @@ -31,12 +31,11 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.0.1'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:26.0.1'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.github.sundeepk:compact-calendar-view:2.0.2.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Expand Up @@ -27,7 +27,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On

private AppBarLayout appBarLayout;

private SimpleDateFormat dateFormat = new SimpleDateFormat("d MMMM yyyy", /*Locale.getDefault()*/Locale.ENGLISH);
private final SimpleDateFormat dateFormat = new SimpleDateFormat("d MMMM yyyy", /*Locale.getDefault()*/Locale.ENGLISH);

private CompactCalendarView compactCalendarView;

Expand Down Expand Up @@ -80,18 +80,15 @@ public void onMonthScroll(Date firstDayOfNewMonth) {
RelativeLayout datePickerButton = findViewById(R.id.date_picker_button);

datePickerButton.setOnClickListener(v -> {
if (isExpanded) {
ViewCompat.animate(arrow).rotation(0).start();
} else {
ViewCompat.animate(arrow).rotation(180).start();
}
float rotation = isExpanded ? 0 : 180;
ViewCompat.animate(arrow).rotation(rotation).start();

isExpanded = !isExpanded;
appBarLayout.setExpanded(isExpanded, true);
});
}

public void setCurrentDate(Date date) {
private void setCurrentDate(Date date) {
setSubtitle(dateFormat.format(date));
if (compactCalendarView != null) {
compactCalendarView.setCurrentDate(date);
Expand All @@ -107,7 +104,7 @@ public void setTitle(CharSequence title) {
}
}

public void setSubtitle(String subtitle) {
private void setSubtitle(String subtitle) {
TextView datePickerTextView = findViewById(R.id.date_picker_text_view);

if (datePickerTextView != null) {
Expand Down
Expand Up @@ -6,6 +6,7 @@
import android.util.AttributeSet;
import android.view.MotionEvent;

@SuppressWarnings("unused")
public class ScrollingCalendarBehavior extends AppBarLayout.Behavior {

public ScrollingCalendarBehavior(Context context, AttributeSet attrs) {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/app_bar_main.xml
Expand Up @@ -60,7 +60,8 @@
android:layout_height="?attr/actionBarSize"
android:background="?android:selectableItemBackground"
android:clickable="true"
android:orientation="vertical">
android:orientation="vertical"
android:focusable="true">

<View
android:id="@+id/centerInParent"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta2'
classpath 'com.android.tools.build:gradle:3.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

0 comments on commit 2c1d8be

Please sign in to comment.