diff --git a/.idea/.name b/.idea/.name
deleted file mode 100644
index 61186e9..0000000
--- a/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-DesignSupportLibraryDemo
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
deleted file mode 100644
index bd4202c..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
index 7158618..ee95a72 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,8 +1,5 @@
-
-
-
@@ -27,36 +24,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
+
\ 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
index 796b96d..a307a61 100644
--- a/app/.gitignore
+++ b/app/.gitignore
@@ -1 +1,37 @@
-/build
+# Built application files
+/*/build/
+
+# Crashlytics configuations
+com_crashlytics_export_strings.xml
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Gradle generated files
+.gradle/
+
+# Signing files
+.signing/
+
+# User-specific configurations
+.idea/libraries/
+.idea/workspace.xml
+.idea/tasks.xml
+.idea/.name
+.idea/compiler.xml
+.idea/copyright/profiles_settings.xml
+.idea/encodings.xml
+.idea/misc.xml
+.idea/modules.xml
+.idea/scopes/scope_settings.xml
+.idea/vcs.xml
+*.iml
+
+# OS-specific files
+.DS_Store
+.DS_Store?
+._*
+.Spotlight-V100
+.Trashes
+ehthumbs.db
+Thumbs.db
\ No newline at end of file
diff --git a/app/app.iml b/app/app.iml
index 0a26ec8..da111d5 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -12,10 +12,7 @@
-
-
- generateDebugAndroidTestSources
generateDebugSources
@@ -28,21 +25,23 @@
-
+
+
-
+
+
-
+
@@ -50,6 +49,15 @@
+
+
+
+
+
+
+
+
+
@@ -57,6 +65,15 @@
+
+
+
+
+
+
+
+
+
@@ -64,40 +81,41 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index c0f4b85..873a8b9 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 22
- buildToolsVersion '22.0.1'
+ compileSdkVersion 24
+ buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.hujiang.designsupportlibrarydemo"
minSdkVersion 16
- targetSdkVersion 22
+ targetSdkVersion 24
versionCode 1
versionName "1.0"
}
@@ -21,8 +21,8 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:appcompat-v7:22.2.0'
- compile 'com.android.support:design:22.2.0'
- compile 'com.android.support:cardview-v7:22.2.0'
- compile 'com.android.support:recyclerview-v7:22.2.0'
+ compile 'com.android.support:appcompat-v7:24.2.0'
+ compile 'com.android.support:design:24.2.0'
+ compile 'com.android.support:cardview-v7:24.2.0'
+ compile 'com.android.support:recyclerview-v7:24.2.0'
}
diff --git a/app/src/main/java/com/hujiang/designsupportlibrarydemo/CommonUtil.java b/app/src/main/java/com/hujiang/designsupportlibrarydemo/CommonUtil.java
new file mode 100644
index 0000000..109b84a
--- /dev/null
+++ b/app/src/main/java/com/hujiang/designsupportlibrarydemo/CommonUtil.java
@@ -0,0 +1,46 @@
+package com.hujiang.designsupportlibrarydemo;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.util.TypedValue;
+
+/**
+ * 通用工具类
+ *
+ * @author Lshare
+ * @date 2016/9/28
+ */
+public class CommonUtil {
+ /**
+ * 获取状态栏高度
+ *
+ * @param context
+ * @return
+ */
+ public static int getStatusBarHeight(Context context) {
+ int statusBarHeight = 0;
+ Resources res = context.getResources();
+ int resourceId = res.getIdentifier("status_bar_height", "dimen", "android");
+ if (resourceId != 0) {
+ try {
+ statusBarHeight = res.getDimensionPixelSize(resourceId);
+ } catch (Resources.NotFoundException ex) {
+ }
+ }
+ return statusBarHeight;
+ }
+
+ /**
+ * 获取Actionbar高度
+ *
+ * @param context
+ * @return
+ */
+ public static int getActionbarHeight(Context context) {
+ TypedValue typedValue = new TypedValue();
+ context.getTheme().resolveAttribute(android.R.attr.actionBarSize, typedValue, true);
+ float actionbarHeight = typedValue.getDimension(context.getResources().getDisplayMetrics());
+ return (int) actionbarHeight;
+ }
+
+}
diff --git a/app/src/main/java/com/hujiang/designsupportlibrarydemo/DetailActivity.java b/app/src/main/java/com/hujiang/designsupportlibrarydemo/DetailActivity.java
index 9cb4827..6155462 100644
--- a/app/src/main/java/com/hujiang/designsupportlibrarydemo/DetailActivity.java
+++ b/app/src/main/java/com/hujiang/designsupportlibrarydemo/DetailActivity.java
@@ -1,25 +1,36 @@
package com.hujiang.designsupportlibrarydemo;
+import android.content.res.TypedArray;
import android.os.Bundle;
-import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
+import android.util.TypedValue;
import android.view.View;
+import android.view.ViewGroup;
public class DetailActivity extends AppCompatActivity {
+ private Toolbar toolbar;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
-
- Toolbar toolbar = (Toolbar) this.findViewById(R.id.toolbar);
+ toolbar = (Toolbar) this.findViewById(R.id.toolbar);
+ adjustToolbarHeight();
setSupportActionBar(toolbar);
+ }
- CollapsingToolbarLayout collapsingToolbar =
- (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
- collapsingToolbar.setTitle("我的课程");
+ /**
+ * 调整Toolbar的高度为:statusbarHeight + actionbarHeight
+ */
+ private void adjustToolbarHeight() {
+ int toolbarHeight = CommonUtil.getStatusBarHeight(this) + CommonUtil.getActionbarHeight
+ (this);
+ ViewGroup.LayoutParams layoutParams = toolbar.getLayoutParams();
+ layoutParams.height = toolbarHeight;
+ toolbar.setLayoutParams(layoutParams);
}
public void checkin(View view) {
diff --git a/app/src/main/res/layout/activity_detail.xml b/app/src/main/res/layout/activity_detail.xml
index c8fcc44..42ac1c6 100755
--- a/app/src/main/res/layout/activity_detail.xml
+++ b/app/src/main/res/layout/activity_detail.xml
@@ -4,31 +4,28 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fitsSystemWindows="true">
+ android:layout_height="match_parent">
+ app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
@@ -36,8 +33,9 @@
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 2354cb2..9a384e3 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,20 +1,28 @@
-
-
-
-
-
+ android:background="@color/window_background">
+
+
+
+
+
+
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/values-v19/styles.xml b/app/src/main/res/values-v19/styles.xml
new file mode 100644
index 0000000..e50f66c
--- /dev/null
+++ b/app/src/main/res/values-v19/styles.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 9405f3f..b193299 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.2.3'
+ classpath 'com.android.tools.build:gradle:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a93996a..2b6ae12 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Tue Jun 02 17:56:37 CST 2015
+#Wed Sep 28 16:34:17 CST 2016
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-2.14.1-all.zip