From 672abb566a747b0d1e51b3876c70541084428846 Mon Sep 17 00:00:00 2001 From: Akexorcist Date: Mon, 16 Oct 2017 04:32:46 +0700 Subject: [PATCH 1/5] Update fully gitignore for android project Remove .idea directory --- .gitignore | 62 ++++++++++++++++++++++++--- .idea/.name | 1 - .idea/compiler.xml | 22 ---------- .idea/copyright/profiles_settings.xml | 3 -- .idea/encodings.xml | 6 --- .idea/gradle.xml | 19 -------- .idea/misc.xml | 46 -------------------- .idea/modules.xml | 9 ---- .idea/runConfigurations.xml | 12 ------ .idea/vcs.xml | 6 --- app/.gitignore | 1 - 11 files changed, 55 insertions(+), 132 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/copyright/profiles_settings.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/gradle.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/runConfigurations.xml delete mode 100644 .idea/vcs.xml delete mode 100644 app/.gitignore diff --git a/.gitignore b/.gitignore index 9c4de58..f23280a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,55 @@ -.gradle -/local.properties -/.idea/workspace.xml -/.idea/libraries -.DS_Store -/build -/captures +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# Intellij +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/dictionaries +.idea/libraries + +# Keystore files +*.jks + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + +# Google Services (e.g. APIs or Firebase) +google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json \ No newline at end of file diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index f0d60be..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -LabDesignLibrary \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 96cc43e..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 7d80135..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 1a3eaff..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index d99954c..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build From d8ae5eb32a51190471f7d8c3afe759c4573de484 Mon Sep 17 00:00:00 2001 From: Akexorcist Date: Mon, 16 Oct 2017 04:33:04 +0700 Subject: [PATCH 2/5] Remove .iml files --- Lab-Android-DesignLibrary.iml | 19 ------- app/app.iml | 98 ----------------------------------- 2 files changed, 117 deletions(-) delete mode 100644 Lab-Android-DesignLibrary.iml delete mode 100644 app/app.iml diff --git a/Lab-Android-DesignLibrary.iml b/Lab-Android-DesignLibrary.iml deleted file mode 100644 index 6d7bde6..0000000 --- a/Lab-Android-DesignLibrary.iml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/app.iml b/app/app.iml deleted file mode 100644 index 23ab90b..0000000 --- a/app/app.iml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 574b6db10d73201905581c5b50f9b67c63a92406 Mon Sep 17 00:00:00 2001 From: Akexorcist Date: Mon, 16 Oct 2017 04:34:30 +0700 Subject: [PATCH 3/5] Update Build tools v26.0.2 Update SDK version v26 Update Design Support v26.1.0 Update Gradle wrapper v4.1 Update Gradle plugin v2.3.3 Add google maven repository --- app/build.gradle | 8 ++++---- build.gradle | 4 +++- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ce77714..13e9a31 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,13 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 23 - buildToolsVersion "23.0.1" + compileSdkVersion 26 + buildToolsVersion "26.0.2" defaultConfig { applicationId "com.inthecheesefactory.lab.designlibrary" minSdkVersion 15 - targetSdkVersion 23 + targetSdkVersion 26 versionCode 1 versionName "1.0" } @@ -21,5 +21,5 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:design:23.1.0' + compile 'com.android.support:design:26.1.0' } diff --git a/build.gradle b/build.gradle index 9405f3f..6b65a86 100644 --- a/build.gradle +++ b/build.gradle @@ -3,9 +3,10 @@ buildscript { repositories { jcenter() + maven { url 'https://maven.google.com' } } dependencies { - classpath 'com.android.tools.build:gradle:1.2.3' + classpath 'com.android.tools.build:gradle:2.3.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -15,5 +16,6 @@ buildscript { allprojects { repositories { jcenter() + maven { url 'https://maven.google.com' } } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ff08662..0a091cf 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip From ebf03f14f401abc9a2ce5409eb46f9619f70f8e2 Mon Sep 17 00:00:00 2001 From: Akexorcist Date: Mon, 16 Oct 2017 04:35:11 +0700 Subject: [PATCH 4/5] Use compat padding with FAB --- app/src/main/res/layout/activity_main.xml | 7 ++++--- app/src/main/res/values-v21/dimens.xml | 4 ---- app/src/main/res/values/dimens.xml | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 app/src/main/res/values-v21/dimens.xml diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 8f0dd00..aebe741 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -74,7 +74,7 @@ android:hint="Password" /> - + @@ -84,12 +84,13 @@ android:id="@+id/fabBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="bottom|right" + android:layout_gravity="bottom|right|end" android:layout_marginBottom="@dimen/fab_margin_bottom" android:layout_marginRight="@dimen/fab_margin_right" android:src="@drawable/ic_plus" app:borderWidth="0dp" - app:fabSize="normal" /> + app:fabSize="normal" + app:useCompatPadding="true" /> diff --git a/app/src/main/res/values-v21/dimens.xml b/app/src/main/res/values-v21/dimens.xml deleted file mode 100644 index 4e8ad39..0000000 --- a/app/src/main/res/values-v21/dimens.xml +++ /dev/null @@ -1,4 +0,0 @@ - - 16dp - 16dp - diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 82dfd04..0666a72 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -3,8 +3,8 @@ 16dp 16dp - 0.1dp - 0.1dp + 16dp + 16dp 256dp 192dp From 745d9be0ba605cbe8a57aecf44b12c8a64ffb754 Mon Sep 17 00:00:00 2001 From: Akexorcist Date: Mon, 16 Oct 2017 04:37:17 +0700 Subject: [PATCH 5/5] Remove class casting in view binding Change drawer listener method --- .../lab/designlibrary/CodeLabActivity.java | 15 +++++++-- .../lab/designlibrary/MainActivity.java | 31 +++++++++++++++---- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/inthecheesefactory/lab/designlibrary/CodeLabActivity.java b/app/src/main/java/com/inthecheesefactory/lab/designlibrary/CodeLabActivity.java index 33481c5..e35572a 100644 --- a/app/src/main/java/com/inthecheesefactory/lab/designlibrary/CodeLabActivity.java +++ b/app/src/main/java/com/inthecheesefactory/lab/designlibrary/CodeLabActivity.java @@ -22,14 +22,25 @@ protected void onCreate(Bundle savedInstanceState) { } private void initInstances() { - drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); + // Class casting no longer needed for support library v26+ +// drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); + drawerLayout = findViewById(R.id.drawerLayout); drawerToggle = new ActionBarDrawerToggle(CodeLabActivity.this, drawerLayout, R.string.hello_world, R.string.hello_world); - drawerLayout.setDrawerListener(drawerToggle); + // setDrawerListener is deprecated, use addDrawerListener and removeDrawerListener instead +// drawerLayout.setDrawerListener(drawerToggle); + drawerLayout.addDrawerListener(drawerToggle); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } + @Override + protected void onDestroy() { + super.onDestroy(); + // setDrawerListener is deprecated, use addDrawerListener and removeDrawerListener instead + drawerLayout.removeDrawerListener(drawerToggle); + } + @Override public void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); diff --git a/app/src/main/java/com/inthecheesefactory/lab/designlibrary/MainActivity.java b/app/src/main/java/com/inthecheesefactory/lab/designlibrary/MainActivity.java index 9677fe6..5ad984d 100644 --- a/app/src/main/java/com/inthecheesefactory/lab/designlibrary/MainActivity.java +++ b/app/src/main/java/com/inthecheesefactory/lab/designlibrary/MainActivity.java @@ -35,21 +35,31 @@ protected void onCreate(Bundle savedInstanceState) { } private void initToolbar() { - toolbar = (Toolbar) findViewById(R.id.toolbar); + // Class casting no longer needed for support library v26+ +// toolbar = (Toolbar) findViewById(R.id.toolbar); + toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); } private void initInstances() { - drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); + // Class casting no longer needed for support library v26+ +// drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); + drawerLayout = findViewById(R.id.drawerLayout); drawerToggle = new ActionBarDrawerToggle(MainActivity.this, drawerLayout, R.string.hello_world, R.string.hello_world); - drawerLayout.setDrawerListener(drawerToggle); + // setDrawerListener is deprecated, use addDrawerListener and removeDrawerListener instead +// drawerLayout.setDrawerListener(drawerToggle); + drawerLayout.addDrawerListener(drawerToggle); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); - rootLayout = (CoordinatorLayout) findViewById(R.id.rootLayout); + // Class casting no longer needed for support library v26+ +// rootLayout = (CoordinatorLayout) findViewById(R.id.rootLayout); + rootLayout = findViewById(R.id.rootLayout); - fabBtn = (FloatingActionButton) findViewById(R.id.fabBtn); + // Class casting no longer needed for support library v26+ +// fabBtn = (FloatingActionButton) findViewById(R.id.fabBtn); + fabBtn = findViewById(R.id.fabBtn); fabBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -64,10 +74,19 @@ public void onClick(View v) { } }); - collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsingToolbarLayout); + // Class casting no longer needed for support library v26+ +// collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsingToolbarLayout); + collapsingToolbarLayout = findViewById(R.id.collapsingToolbarLayout); collapsingToolbarLayout.setTitle("Design Library"); } + @Override + protected void onDestroy() { + super.onDestroy(); + // setDrawerListener is deprecated, use addDrawerListener and removeDrawerListener instead + drawerLayout.removeDrawerListener(drawerToggle); + } + @Override public void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState);