From 202858ce2803926116ae3a71a28cda9aa0587df1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=91=A3=E4=BF=8A=E9=94=9F?= <1440418246@qq.com>
Date: Sat, 8 Oct 2016 11:36:51 +0800
Subject: [PATCH 1/7] update gradle
---
build.gradle | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/build.gradle b/build.gradle
index bea488c..cd084fd 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,8 +5,8 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
- classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' // Add this line
+ classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' // Add this line
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
From ac5331e5b8873bcd4b761137db5f2d8bf2beb2d2 Mon Sep 17 00:00:00 2001
From: dongjunkun <1440418246@qq.com>
Date: Sat, 8 Oct 2016 15:28:30 +0800
Subject: [PATCH 2/7] update gradle plugin
---
DropDownMenu.iml | 2 +-
app/app.iml | 62 ++++++++++++++-----
app/build.gradle | 8 +--
.../res/layout/item_default_drop_down.xml | 6 +-
build.gradle | 7 ++-
gradle/wrapper/gradle-wrapper.properties | 4 +-
library/build.gradle | 8 +--
library/library.iml | 58 ++++++++++++++---
8 files changed, 111 insertions(+), 44 deletions(-)
diff --git a/DropDownMenu.iml b/DropDownMenu.iml
index a164e72..6981f2b 100644
--- a/DropDownMenu.iml
+++ b/DropDownMenu.iml
@@ -13,7 +13,7 @@
-
+
\ No newline at end of file
diff --git a/app/app.iml b/app/app.iml
index 69b9701..d95da30 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -12,10 +12,7 @@
-
-
- generateDebugAndroidTestSources
generateDebugSources
@@ -28,19 +25,21 @@
-
+
+
+
@@ -50,6 +49,15 @@
+
+
+
+
+
+
+
+
+
@@ -57,6 +65,7 @@
+
@@ -64,35 +73,56 @@
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
+
-
-
+
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index ced36b0..2a42e79 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.2"
+ compileSdkVersion 24
+ buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.yyy.djk.dropdownmenu"
minSdkVersion 14
- targetSdkVersion 23
+ targetSdkVersion 24
versionCode 1
versionName "1.0"
}
@@ -21,7 +21,7 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:appcompat-v7:23.1.1'
+ compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.jakewharton:butterknife:6.1.0'
compile project(':library')
}
diff --git a/app/src/main/res/layout/item_default_drop_down.xml b/app/src/main/res/layout/item_default_drop_down.xml
index e7c24e9..c9c6ae9 100644
--- a/app/src/main/res/layout/item_default_drop_down.xml
+++ b/app/src/main/res/layout/item_default_drop_down.xml
@@ -1,17 +1,15 @@
+ android:orientation="vertical">
-
-
- generateDebugAndroidTestSources
generateDebugSources
@@ -29,18 +26,21 @@
+
+
+
@@ -50,6 +50,15 @@
+
+
+
+
+
+
+
+
+
@@ -57,6 +66,7 @@
+
@@ -64,28 +74,56 @@
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From 23cf2150aa4c34cdb5bd68ad269789e0473a548d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=91=A3=E4=BF=8A=E9=94=9F?= <1440418246@qq.com>
Date: Tue, 11 Apr 2017 15:44:35 +0800
Subject: [PATCH 3/7] Update build.gradle
---
build.gradle | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/build.gradle b/build.gradle
index 9a0af3a..9372bc7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' // Add this line
// NOTE: Do not place your application dependencies here; they belong
@@ -18,4 +18,4 @@ allprojects {
}
dependencies {
-}
\ No newline at end of file
+}
From 6e4e9fc8b96cace7e5c29e40131e981a7123f27a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=91=A3=E4=BF=8A=E9=94=9F?= <1440418246@qq.com>
Date: Tue, 11 Apr 2017 15:45:06 +0800
Subject: [PATCH 4/7] Update build.gradle
---
library/build.gradle | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/library/build.gradle b/library/build.gradle
index aada482..cc8cec5 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -4,12 +4,12 @@ apply plugin: 'com.github.dcendents.android-maven'
group = 'com.github.dongjunkun'
android {
- compileSdkVersion 24
- buildToolsVersion "24.0.2"
+ compileSdkVersion 25
+ buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 11
- targetSdkVersion 24
+ targetSdkVersion 25
versionCode 1
versionName "1.0"
}
@@ -24,5 +24,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
- compile 'com.android.support:appcompat-v7:24.2.1'
+ compile 'com.android.support:appcompat-v7:25.3.1'
}
From 2fe5ac4f5a2f18d0fbfe354cbc4d766ddb36711b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=91=A3=E4=BF=8A=E9=94=9F?= <1440418246@qq.com>
Date: Tue, 11 Apr 2017 15:45:41 +0800
Subject: [PATCH 5/7] Update build.gradle
---
app/build.gradle | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index 2a42e79..e885092 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 24
- buildToolsVersion "24.0.2"
+ compileSdkVersion 25
+ buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.yyy.djk.dropdownmenu"
minSdkVersion 14
- targetSdkVersion 24
+ targetSdkVersion 25
versionCode 1
versionName "1.0"
}
@@ -21,7 +21,7 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:appcompat-v7:24.2.1'
+ compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.jakewharton:butterknife:6.1.0'
compile project(':library')
}
From ade932cb8ca319318c5efa84024c5232113cab51 Mon Sep 17 00:00:00 2001
From: dongjunkun <1440418246@qq.com>
Date: Tue, 11 Apr 2017 16:26:33 +0800
Subject: [PATCH 6/7] update gradle
---
README.md | 12 ++--
app/app.iml | 60 ++++++-------------
gradle/wrapper/gradle-wrapper.properties | 4 +-
library/library.iml | 47 ++++-----------
library/src/main/AndroidManifest.xml | 11 +---
.../java/com/yyydjk/library/DropDownMenu.java | 3 +
library/src/main/res/values/strings.xml | 3 -
7 files changed, 43 insertions(+), 97 deletions(-)
delete mode 100644 library/src/main/res/values/strings.xml
diff --git a/README.md b/README.md
index 3ba1093..47fa0f0 100644
--- a/README.md
+++ b/README.md
@@ -5,12 +5,12 @@
我的博客 [自己造轮子--android常用多条件帅选菜单实现思路(类似美团,爱奇艺电影票下拉菜单)](http://www.jianshu.com/p/d9407f799d2d)
-##特色
+## 特色
- 支持多级菜单
- 你可以完全自定义你的菜单样式,我这里只是封装了一些实用的方法,Tab的切换效果,菜单显示隐藏效果等
- 并非用popupWindow实现,无卡顿
-##ScreenShot
+## ScreenShot
Download APK
@@ -19,7 +19,7 @@
-##Gradle Dependency
+## Gradle Dependency
```
allprojects {
@@ -34,7 +34,7 @@ dependencies {
}
```
-##使用
+## 使用
添加DropDownMenu 到你的布局文件,如下
```
Example
-##关于我
+> 建议拷贝代码到项目中使用,拷贝DropDownMenu.java 以及res下的所有文件即可
+
+## 关于我
简书[dongjunkun](http://www.jianshu.com/users/f07458c1a8f3/latest_articles)
diff --git a/app/app.iml b/app/app.iml
index d95da30..2988082 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -9,7 +9,6 @@
-
@@ -47,7 +46,6 @@
-
@@ -55,7 +53,6 @@
-
@@ -63,64 +60,43 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
+
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index e1d3806..645ca7c 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Sat Oct 08 15:08:05 CST 2016
+#Tue Apr 11 16:01:41 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/library/library.iml b/library/library.iml
index 7b9985a..c22369d 100644
--- a/library/library.iml
+++ b/library/library.iml
@@ -9,7 +9,6 @@
-
@@ -20,7 +19,7 @@
-
+
@@ -48,7 +47,6 @@
-
@@ -56,7 +54,6 @@
-
@@ -64,7 +61,6 @@
-
@@ -72,7 +68,6 @@
-
@@ -80,50 +75,32 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
index e727623..f62c792 100644
--- a/library/src/main/AndroidManifest.xml
+++ b/library/src/main/AndroidManifest.xml
@@ -1,11 +1,2 @@
-
-
-
-
-
-
+
diff --git a/library/src/main/java/com/yyydjk/library/DropDownMenu.java b/library/src/main/java/com/yyydjk/library/DropDownMenu.java
index 92f8480..5c86a34 100644
--- a/library/src/main/java/com/yyydjk/library/DropDownMenu.java
+++ b/library/src/main/java/com/yyydjk/library/DropDownMenu.java
@@ -128,6 +128,9 @@ public void onClick(View v) {
});
containerView.addView(maskView, 1);
maskView.setVisibility(GONE);
+ if (containerView.getChildAt(2) != null){
+ containerView.removeViewAt(2);
+ }
popupMenuViews = new FrameLayout(getContext());
popupMenuViews.setVisibility(GONE);
diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml
deleted file mode 100644
index 6d51856..0000000
--- a/library/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Library
-
From 63e308f94282fa23e4a8c043328033913c88214d Mon Sep 17 00:00:00 2001
From: dongjunkun <1440418246@qq.com>
Date: Tue, 11 Apr 2017 16:46:49 +0800
Subject: [PATCH 7/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0ddmenuMenuHeightPercent?=
=?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=8F=9C=E5=8D=95=E7=9A=84=E6=9C=80=E5=A4=A7?=
=?UTF-8?q?=E9=AB=98=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 3 +-
app/app.iml | 8 +++
app/src/main/res/layout/activity_main.xml | 1 +
library/library.iml | 6 +++
.../java/com/yyydjk/library/DeviceUtils.java | 49 +++++++++++++++++++
.../java/com/yyydjk/library/DropDownMenu.java | 4 ++
library/src/main/res/values/attrs.xml | 1 +
7 files changed, 71 insertions(+), 1 deletion(-)
create mode 100644 library/src/main/java/com/yyydjk/library/DeviceUtils.java
diff --git a/README.md b/README.md
index 47fa0f0..0413c5d 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ allprojects {
}
dependencies {
- compile 'com.github.dongjunkun:DropDownMenu:1.0.3'
+ compile 'com.github.dongjunkun:DropDownMenu:1.0.4'
}
```
@@ -50,6 +50,7 @@ dependencies {
app:ddmenuUnselectedIcon="@mipmap/drop_down_unselected_icon"//tab未选中状态图标
app:ddmaskColor="@color/mask_color" //遮罩颜色,一般是半透明
app:ddmenuBackgroundColor="@color/white" //tab 背景颜色
+ app:ddmenuMenuHeightPercent="0.5" 菜单的最大高度,根据屏幕高度的百分比设置
...
/>
```
diff --git a/app/app.iml b/app/app.iml
index 2988082..e994da9 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -76,13 +76,21 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 200eb11..3493ce9 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -9,6 +9,7 @@
app:ddtextSelectedColor="@color/drop_down_selected"
app:dddividerColor="@color/gray"
app:ddunderlineColor="@color/gray"
+ app:ddmenuMenuHeightPercent="0.5"
app:ddmenuSelectedIcon="@mipmap/drop_down_selected_icon"
app:ddmaskColor="@color/mask_color"
app:ddmenuBackgroundColor="@color/white"
diff --git a/library/library.iml b/library/library.iml
index c22369d..8936acf 100644
--- a/library/library.iml
+++ b/library/library.iml
@@ -77,16 +77,22 @@
+
+
+
+
+
+
diff --git a/library/src/main/java/com/yyydjk/library/DeviceUtils.java b/library/src/main/java/com/yyydjk/library/DeviceUtils.java
new file mode 100644
index 0000000..cd221da
--- /dev/null
+++ b/library/src/main/java/com/yyydjk/library/DeviceUtils.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2013 Peng fei Pan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.yyydjk.library;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.graphics.Point;
+import android.os.Build;
+import android.view.Display;
+import android.view.WindowManager;
+
+/**
+ * 设备工具箱,提供与设备硬件相关的工具方法
+ */
+public class DeviceUtils {
+
+ /**
+ * 获取屏幕尺寸
+ */
+ @SuppressWarnings("deprecation")
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
+ public static Point getScreenSize(Context context){
+ WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+ Display display = windowManager.getDefaultDisplay();
+ if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2){
+ return new Point(display.getWidth(), display.getHeight());
+ }else{
+ Point point = new Point();
+ display.getSize(point);
+ return point;
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/library/src/main/java/com/yyydjk/library/DropDownMenu.java b/library/src/main/java/com/yyydjk/library/DropDownMenu.java
index 5c86a34..fa3a8f2 100644
--- a/library/src/main/java/com/yyydjk/library/DropDownMenu.java
+++ b/library/src/main/java/com/yyydjk/library/DropDownMenu.java
@@ -50,6 +50,8 @@ public class DropDownMenu extends LinearLayout {
//tab未选中图标
private int menuUnselectedIcon;
+ private float menuHeighPercent = 0.5f;
+
public DropDownMenu(Context context) {
super(context, null);
@@ -77,6 +79,7 @@ public DropDownMenu(Context context, AttributeSet attrs, int defStyleAttr) {
menuTextSize = a.getDimensionPixelSize(R.styleable.DropDownMenu_ddmenuTextSize, menuTextSize);
menuSelectedIcon = a.getResourceId(R.styleable.DropDownMenu_ddmenuSelectedIcon, menuSelectedIcon);
menuUnselectedIcon = a.getResourceId(R.styleable.DropDownMenu_ddmenuUnselectedIcon, menuUnselectedIcon);
+ menuHeighPercent = a.getFloat(R.styleable.DropDownMenu_ddmenuMenuHeightPercent,menuHeighPercent);
a.recycle();
//初始化tabMenuView并添加到tabMenuView
@@ -133,6 +136,7 @@ public void onClick(View v) {
}
popupMenuViews = new FrameLayout(getContext());
+ popupMenuViews.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (DeviceUtils.getScreenSize(getContext()).y*menuHeighPercent)));
popupMenuViews.setVisibility(GONE);
containerView.addView(popupMenuViews, 2);
diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml
index cf5bf47..cf25ade 100644
--- a/library/src/main/res/values/attrs.xml
+++ b/library/src/main/res/values/attrs.xml
@@ -11,5 +11,6 @@
+
\ No newline at end of file