diff --git a/hvscrollviewlibrary/.gitignore b/hvscrollviewlibrary/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/hvscrollviewlibrary/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/hvscrollviewlibrary/build.gradle b/hvscrollviewlibrary/build.gradle
new file mode 100644
index 0000000..01745aa
--- /dev/null
+++ b/hvscrollviewlibrary/build.gradle
@@ -0,0 +1,31 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 24
+ buildToolsVersion "23.0.3"
+
+ defaultConfig {
+ minSdkVersion 15
+ targetSdkVersion 24
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+ compile 'com.android.support:appcompat-v7:24.0.0'
+ testCompile 'junit:junit:4.12'
+}
diff --git a/hvscrollviewlibrary/proguard-rules.pro b/hvscrollviewlibrary/proguard-rules.pro
new file mode 100644
index 0000000..9ce50b9
--- /dev/null
+++ b/hvscrollviewlibrary/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in D:\android\SDK\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/hvscrollviewlibrary/src/androidTest/java/com/andjdk/hvscrollviewlibrary/ExampleInstrumentedTest.java b/hvscrollviewlibrary/src/androidTest/java/com/andjdk/hvscrollviewlibrary/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..c71205a
--- /dev/null
+++ b/hvscrollviewlibrary/src/androidTest/java/com/andjdk/hvscrollviewlibrary/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package com.andjdk.hvscrollviewlibrary;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumentation test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() throws Exception {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("com.andjdk.hvscrollviewlibrary.test", appContext.getPackageName());
+ }
+}
diff --git a/hvscrollviewlibrary/src/main/AndroidManifest.xml b/hvscrollviewlibrary/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..b166b4e
--- /dev/null
+++ b/hvscrollviewlibrary/src/main/AndroidManifest.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/andjdk/hvscrollview/base/CommonAdapter.java b/hvscrollviewlibrary/src/main/java/com/andjdk/hvscrollviewlibrary/CommonAdapter.java
similarity index 97%
rename from app/src/main/java/com/andjdk/hvscrollview/base/CommonAdapter.java
rename to hvscrollviewlibrary/src/main/java/com/andjdk/hvscrollviewlibrary/CommonAdapter.java
index 7aacf2c..144f5bb 100644
--- a/app/src/main/java/com/andjdk/hvscrollview/base/CommonAdapter.java
+++ b/hvscrollviewlibrary/src/main/java/com/andjdk/hvscrollviewlibrary/CommonAdapter.java
@@ -24,10 +24,7 @@
* # 佛祖保佑 永无BUG #
* # #
*/
-package com.andjdk.hvscrollview.base;
-
-import java.util.ArrayList;
-import java.util.List;
+package com.andjdk.hvscrollviewlibrary;
import android.content.Context;
import android.view.LayoutInflater;
@@ -36,7 +33,8 @@
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
-import com.andjdk.hvscrollview.R;
+import java.util.ArrayList;
+import java.util.List;
/**
* listview通用的adapter类
diff --git a/app/src/main/java/com/andjdk/hvscrollview/utils/DisplayUtil.java b/hvscrollviewlibrary/src/main/java/com/andjdk/hvscrollviewlibrary/DisplayUtil.java
similarity index 97%
rename from app/src/main/java/com/andjdk/hvscrollview/utils/DisplayUtil.java
rename to hvscrollviewlibrary/src/main/java/com/andjdk/hvscrollviewlibrary/DisplayUtil.java
index 1a6218d..109da39 100644
--- a/app/src/main/java/com/andjdk/hvscrollview/utils/DisplayUtil.java
+++ b/hvscrollviewlibrary/src/main/java/com/andjdk/hvscrollviewlibrary/DisplayUtil.java
@@ -24,7 +24,7 @@
* # 佛祖保佑 永无BUG #
* # #
*/
-package com.andjdk.hvscrollview.utils;
+package com.andjdk.hvscrollviewlibrary;
import android.content.Context;
diff --git a/app/src/main/java/com/andjdk/hvscrollview/view/HVScrollView.java b/hvscrollviewlibrary/src/main/java/com/andjdk/hvscrollviewlibrary/HVScrollView.java
similarity index 95%
rename from app/src/main/java/com/andjdk/hvscrollview/view/HVScrollView.java
rename to hvscrollviewlibrary/src/main/java/com/andjdk/hvscrollviewlibrary/HVScrollView.java
index 3482799..6127ddf 100644
--- a/app/src/main/java/com/andjdk/hvscrollview/view/HVScrollView.java
+++ b/hvscrollviewlibrary/src/main/java/com/andjdk/hvscrollviewlibrary/HVScrollView.java
@@ -24,7 +24,7 @@
* # 佛祖保佑 永无BUG #
* # #
*/
-package com.andjdk.hvscrollview.view;
+package com.andjdk.hvscrollviewlibrary;
import android.content.Context;
import android.util.AttributeSet;
@@ -37,14 +37,10 @@
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
-import android.widget.Toast;
-
-import com.andjdk.hvscrollview.base.CommonAdapter;
-import com.andjdk.hvscrollview.utils.DisplayUtil;
import java.util.ArrayList;
-import static com.andjdk.hvscrollview.utils.DisplayUtil.dip2px;
+import static com.andjdk.hvscrollviewlibrary.DisplayUtil.dip2px;
/**
* Created by andjdk on 2015/11/3.
@@ -96,7 +92,7 @@ private void initView() {
linearLayout.addView(buildHeadLayout());
linearLayout.addView(buildMoveableListView());
- this.addView(linearLayout, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
+ this.addView(linearLayout, new LayoutParams(LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
}
@@ -292,9 +288,9 @@ public void setHeaderListData(String[] headerListData) {
this.mMovableListColumnsText = headerListData;
mMovableListColumnsWidth = new int[headerListData.length];
for (int i = 0; i < headerListData.length; i++) {
- mMovableListColumnsWidth[i] = DisplayUtil.dip2px(context, mMoveViewWidth);
+ mMovableListColumnsWidth[i] = dip2px(context, mMoveViewWidth);
}
- mFixLeftListColumnsWidth = new int[]{DisplayUtil.dip2px(context, mFixViewWidth)};
+ mFixLeftListColumnsWidth = new int[]{dip2px(context, mFixViewWidth)};
mFixLeftListColumnsText = new String[]{"名称"};
}
diff --git a/app/src/main/java/com/andjdk/hvscrollview/base/ViewHolder.java b/hvscrollviewlibrary/src/main/java/com/andjdk/hvscrollviewlibrary/ViewHolder.java
similarity index 99%
rename from app/src/main/java/com/andjdk/hvscrollview/base/ViewHolder.java
rename to hvscrollviewlibrary/src/main/java/com/andjdk/hvscrollviewlibrary/ViewHolder.java
index a38e5c2..8df5609 100644
--- a/app/src/main/java/com/andjdk/hvscrollview/base/ViewHolder.java
+++ b/hvscrollviewlibrary/src/main/java/com/andjdk/hvscrollviewlibrary/ViewHolder.java
@@ -24,7 +24,7 @@
* # 佛祖保佑 永无BUG #
* # #
*/
-package com.andjdk.hvscrollview.base;
+package com.andjdk.hvscrollviewlibrary;
import android.content.Context;
import android.graphics.Bitmap;
diff --git a/hvscrollviewlibrary/src/main/res/values/ids.xml b/hvscrollviewlibrary/src/main/res/values/ids.xml
new file mode 100644
index 0000000..beb1f24
--- /dev/null
+++ b/hvscrollviewlibrary/src/main/res/values/ids.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/hvscrollviewlibrary/src/main/res/values/strings.xml b/hvscrollviewlibrary/src/main/res/values/strings.xml
new file mode 100644
index 0000000..2d27343
--- /dev/null
+++ b/hvscrollviewlibrary/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ HVScrollViewLibrary
+
diff --git a/hvscrollviewlibrary/src/test/java/com/andjdk/hvscrollviewlibrary/ExampleUnitTest.java b/hvscrollviewlibrary/src/test/java/com/andjdk/hvscrollviewlibrary/ExampleUnitTest.java
new file mode 100644
index 0000000..b4c5636
--- /dev/null
+++ b/hvscrollviewlibrary/src/test/java/com/andjdk/hvscrollviewlibrary/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.andjdk.hvscrollviewlibrary;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file