From a51db15ed48ed208f847a0a1f66356c391c3cf70 Mon Sep 17 00:00:00 2001
From: zhangqin <1245366907@qq.com>
Date: Tue, 19 Jun 2018 15:37:09 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9WebViewActivity?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/gradle.xml | 1 +
.idea/modules.xml | 1 +
README.md | 2 +-
app/src/main/AndroidManifest.xml | 2 +
.../ui/home/CustomWebviewActivity.java | 22 +++
.../quickseed/ui/home/HomeFragment.java | 156 ++++++++++--------
app/src/main/res/layout/fragment_home.xml | 57 +------
app/src/main/res/layout/item_list.xml | 14 ++
build.gradle | 32 +---
config.gradle | 27 +++
docs/update.md | 9 +
quicklib/build.gradle | 4 +-
.../quicklib/module/webview/BaseWebView.java | 124 ++++++++++++++
.../module/webview/WebViewActivity.java | 112 +++----------
settings.gradle | 2 +-
widget/.gitignore | 1 +
widget/build.gradle | 33 ++++
widget/deployBintray.gradle | 77 +++++++++
widget/proguard-rules.pro | 21 +++
.../widget/ExampleInstrumentedTest.java | 26 +++
widget/src/main/AndroidManifest.xml | 2 +
widget/src/main/res/values/strings.xml | 3 +
.../com/sdwfqin/widget/ExampleUnitTest.java | 17 ++
23 files changed, 505 insertions(+), 240 deletions(-)
create mode 100644 app/src/main/java/com/sdwfqin/quickseed/ui/home/CustomWebviewActivity.java
create mode 100644 app/src/main/res/layout/item_list.xml
create mode 100644 config.gradle
create mode 100644 quicklib/src/main/java/com/sdwfqin/quicklib/module/webview/BaseWebView.java
create mode 100644 widget/.gitignore
create mode 100644 widget/build.gradle
create mode 100644 widget/deployBintray.gradle
create mode 100644 widget/proguard-rules.pro
create mode 100644 widget/src/androidTest/java/com/sdwfqin/widget/ExampleInstrumentedTest.java
create mode 100644 widget/src/main/AndroidManifest.xml
create mode 100644 widget/src/main/res/values/strings.xml
create mode 100644 widget/src/test/java/com/sdwfqin/widget/ExampleUnitTest.java
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 719a0a1..17ce842 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -12,6 +12,7 @@
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 73ed73b..345dbb2 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -7,6 +7,7 @@
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 889d02d..c006bad 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
### 如果你看到这个仓库,非常荣幸,如果想要用于您的项目中,建议先看源码,因为这是我用来做外包用来快速开发的库,里面很多内容适合我的项目但不一定适合您的项目,当然,如果需要,您可以clone源码中的部分代码用于您的项目中,如有雷同,不甚荣幸
// 主模块
- implementation 'com.sdwfqin.quicklib:quicklib:1.3.0'
+ implementation 'com.sdwfqin.quicklib:quicklib:1.3.1'
// 支付模块(可以不依赖quicklib单独引入)
implementation 'com.sdwfqin.quicklib:paylib:1.0.1'
// 如果使用butterknife请添加【可选】
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f2b5aa0..a7cb443 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -65,6 +65,8 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/sdwfqin/quickseed/ui/home/CustomWebviewActivity.java b/app/src/main/java/com/sdwfqin/quickseed/ui/home/CustomWebviewActivity.java
new file mode 100644
index 0000000..35e78b0
--- /dev/null
+++ b/app/src/main/java/com/sdwfqin/quickseed/ui/home/CustomWebviewActivity.java
@@ -0,0 +1,22 @@
+package com.sdwfqin.quickseed.ui.home;
+
+import com.sdwfqin.quicklib.module.webview.BaseWebView;
+
+/**
+ * 描述:自定义Webview
+ *
+ * @author zhangqin
+ * @date 2018/6/19
+ */
+public class CustomWebviewActivity extends BaseWebView {
+
+ @Override
+ public String getUrl() {
+ return "https://www.sdwfqin.com";
+ }
+
+ @Override
+ public String getActivityTitle() {
+ return "sdwfqin.com";
+ }
+}
diff --git a/app/src/main/java/com/sdwfqin/quickseed/ui/home/HomeFragment.java b/app/src/main/java/com/sdwfqin/quickseed/ui/home/HomeFragment.java
index e2a4aca..4261c4f 100644
--- a/app/src/main/java/com/sdwfqin/quickseed/ui/home/HomeFragment.java
+++ b/app/src/main/java/com/sdwfqin/quickseed/ui/home/HomeFragment.java
@@ -5,13 +5,14 @@
import android.support.design.widget.BottomSheetDialogFragment;
import android.support.v4.app.FragmentManager;
import android.view.View;
-import android.widget.ImageView;
-import android.widget.TextView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import com.qmuiteam.qmui.widget.QMUITopBar;
import com.sdwfqin.quicklib.base.BaseFragment;
-import com.sdwfqin.quicklib.module.webview.WebViewActivity;
import com.sdwfqin.quicklib.module.qrbarscan.QrBarScanActivity;
import com.sdwfqin.quicklib.module.seeimage.SeeImageActivity;
+import com.sdwfqin.quicklib.module.webview.WebViewActivity;
import com.sdwfqin.quicklib.view.dialog.BottomDialogPhotoFragment;
import com.sdwfqin.quicklib.view.dialog.HintDialog;
import com.sdwfqin.quickseed.R;
@@ -22,7 +23,6 @@
import java.util.List;
import butterknife.BindView;
-import butterknife.OnClick;
import static android.app.Activity.RESULT_OK;
@@ -34,12 +34,22 @@
*/
public class HomeFragment extends BaseFragment {
+ @BindView(R.id.list)
+ ListView list;
@BindView(R.id.status_view)
View mStatusView;
- @BindView(R.id.home_msg)
- ImageView mHomeMsg;
- @BindView(R.id.home_title_tv)
- TextView mHomeTitleTv;
+ @BindView(R.id.topbar)
+ QMUITopBar mTopbar;
+
+ private String[] mTitle = new String[]{"跳转网页",
+ "扫描二维码",
+ "颤抖的按钮",
+ "图片预览",
+ "底部弹窗",
+ "上传图片九宫格",
+ "自定义验证码/密码View",
+ "自定义Webview",
+ };
@Override
protected int getLayout() {
@@ -55,79 +65,85 @@ protected void initEventAndData() {
mStatusView.getLayoutParams().height = Constants.STATUS_HEIGHT;
}
- mHomeTitleTv.setText("首页");
+ mTopbar.setTitle("首页");
+ list.setAdapter(new ArrayAdapter<>(mContext, R.layout.item_list, R.id.tv_items, mTitle));
+ initListener();
}
- @Override
- protected void lazyLoadShow(boolean isLoad) {
+ private void initListener() {
+ list.setOnItemClickListener((adapterView, view, i, l) -> {
+ switch (i) {
+ case 0:
+ WebViewActivity.launch(mContext, "https://www.baidu.com");
+ break;
+ case 1:
+ startActivityForResult(new Intent(mContext, QrBarScanActivity.class), Constants.RESULT_CODE_1);
+ break;
+ case 2:
+ HintDialog hintDialog = new HintDialog(mContext);
+ hintDialog.show();
+ hintDialog.setTitle("啊啊啊啊啊啊");
+ hintDialog.hideRight();
+ hintDialog.setLeftText("取消");
+ hintDialog.setOnClickListener(new HintDialog.OnDialogClickListener() {
+ @Override
+ public void left() {
+ showMsg("您点击了取消!");
+ }
+
+ @Override
+ public void right() {
+
+ }
+ });
+ break;
+ case 3:
+ List strings = new ArrayList<>();
+ strings.add("http://pic4.nipic.com/20091217/3885730_124701000519_2.jpg");
+ strings.add("http://img.taopic.com/uploads/allimg/140729/240450-140HZP45790.jpg");
+ SeeImageActivity.launch(mContext, strings);
+ break;
+ case 4:
+ BottomDialogPhotoFragment.Builder builder = new BottomDialogPhotoFragment.Builder();
+ BottomSheetDialogFragment bottomSheetDialogFragment = builder.setOnClickListener(new BottomDialogPhotoFragment.OnDialogClickListener() {
+ @Override
+ public void xiangce() {
- }
+ }
- @OnClick({R.id.a, R.id.b, R.id.c, R.id.d, R.id.e, R.id.f, R.id.g})
- public void onViewClicked(View view) {
- switch (view.getId()) {
- case R.id.a:
- WebViewActivity.launch(mContext, "https://www.baidu.com");
- break;
- case R.id.b:
- startActivityForResult(new Intent(mContext, QrBarScanActivity.class), Constants.RESULT_CODE_1);
- break;
- case R.id.c:
- HintDialog hintDialog = new HintDialog(mContext);
- hintDialog.show();
- hintDialog.setTitle("啊啊啊啊啊啊");
- hintDialog.hideRight();
- hintDialog.setLeftText("取消");
- hintDialog.setOnClickListener(new HintDialog.OnDialogClickListener() {
- @Override
- public void left() {
- showMsg("您点击了取消!");
- }
+ @Override
+ public void paizhao() {
- @Override
- public void right() {
+ }
- }
- });
- break;
- case R.id.d:
- List strings = new ArrayList<>();
- strings.add("http://pic4.nipic.com/20091217/3885730_124701000519_2.jpg");
- strings.add("http://img.taopic.com/uploads/allimg/140729/240450-140HZP45790.jpg");
- SeeImageActivity.launch(mContext, strings);
- break;
- case R.id.e:
- BottomDialogPhotoFragment.Builder builder = new BottomDialogPhotoFragment.Builder();
- BottomSheetDialogFragment bottomSheetDialogFragment = builder.setOnClickListener(new BottomDialogPhotoFragment.OnDialogClickListener() {
- @Override
- public void xiangce() {
-
- }
-
- @Override
- public void paizhao() {
+ @Override
+ public void exit() {
+ }
+ }).builder();
+ FragmentManager fragmentManager = getFragmentManager();
+ if (fragmentManager != null) {
+ bottomSheetDialogFragment.show(fragmentManager, "dialog");
}
+ break;
+ case 5:
+ startActivity(new Intent(mContext, PictureUploadActivity.class));
+ break;
+ case 6:
+ startActivity(new Intent(mContext, PayPwdInputActivity.class));
+ break;
+ case 7:
+ startActivity(new Intent(mContext, CustomWebviewActivity.class));
+ break;
+ default:
+ }
+ });
+ }
- @Override
- public void exit() {
+ @Override
+ protected void lazyLoadShow(boolean isLoad) {
- }
- }).builder();
- FragmentManager fragmentManager = getFragmentManager();
- if (fragmentManager != null) {
- bottomSheetDialogFragment.show(fragmentManager, "dialog");
- }
- break;
- case R.id.f:
- startActivity(new Intent(mContext, PictureUploadActivity.class));
- break;
- case R.id.g:
- startActivity(new Intent(mContext, PayPwdInputActivity.class));
- break;
- default:
- }
}
@Override
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
index 25952d0..e58bbff 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -1,5 +1,4 @@
@@ -10,54 +9,14 @@
android:layout_height="25dp"
android:background="@color/white"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
diff --git a/app/src/main/res/layout/item_list.xml b/app/src/main/res/layout/item_list.xml
new file mode 100644
index 0000000..953b7d9
--- /dev/null
+++ b/app/src/main/res/layout/item_list.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 1c1b454..6595345 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,5 +1,4 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-
+apply from: "config.gradle"
buildscript {
ext.kotlin_version = '1.2.50'
@@ -38,32 +37,3 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}
-
-ext {
- // Sdk and tools
- minSdkVersion = 18
- targetSdkVersion = 27
- compileSdkVersion = 27
- buildToolsVersion = '27.0.3'
-
- support = '27.1.1'
- constraint = '1.1.2'
- glide = '4.7.1'
- butterknife = '8.8.1'
- vlayout = '1.2.15'
- quicklib = '1.2.7'
- qmui = '1.1.5'
- brvah = '2.9.40'
- banner = '1.4.10'
- utilcode = '1.16.4'
- eventbus = '3.1.1'
- rxjava = '2.1.14'
- rxandroid = '2.0.2'
- agentweb = '4.0.2'
- okhttp = '3.10.0'
- retrofit = '2.4.0'
- PhotoView = '2.0.0'
- gson = '2.8.2'
- zxing = '3.3.3'
- wechat = '5.1.4'
-}
diff --git a/config.gradle b/config.gradle
new file mode 100644
index 0000000..a68f9d3
--- /dev/null
+++ b/config.gradle
@@ -0,0 +1,27 @@
+ext {
+ minSdkVersion = 18
+ targetSdkVersion = 27
+ compileSdkVersion = 27
+ buildToolsVersion = '27.0.3'
+
+ support = '27.1.1'
+ constraint = '1.1.2'
+ glide = '4.7.1'
+ butterknife = '8.8.1'
+ vlayout = '1.2.15'
+ quicklib = '1.2.7'
+ qmui = '1.1.5'
+ brvah = '2.9.40'
+ banner = '1.4.10'
+ utilcode = '1.16.4'
+ eventbus = '3.1.1'
+ rxjava = '2.1.14'
+ rxandroid = '2.0.2'
+ agentweb = '4.0.2'
+ okhttp = '3.10.0'
+ retrofit = '2.4.0'
+ PhotoView = '2.0.0'
+ gson = '2.8.2'
+ zxing = '3.3.3'
+ wechat = '5.1.4'
+}
\ No newline at end of file
diff --git a/docs/update.md b/docs/update.md
index 2ae15b4..273e677 100644
--- a/docs/update.md
+++ b/docs/update.md
@@ -1,5 +1,14 @@
# 更新文档
+### 1.3.1
+
+1. 修改WebViewActivity
+2. 添加BaseWebView
+
+### 1.3.0
+
+1. 分离支付模块
+
### 1.2.5
1. 添加:验证码/密码View
diff --git a/quicklib/build.gradle b/quicklib/build.gradle
index 6880dcd..eef9094 100644
--- a/quicklib/build.gradle
+++ b/quicklib/build.gradle
@@ -3,7 +3,7 @@ apply plugin: 'com.android.library'
// gradlew quicklib:install
// gradlew quicklib:bintrayUpload
-version = "1.3.0"
+version = "1.3.1"
android {
compileSdkVersion rootProject.ext.compileSdkVersion
@@ -12,7 +12,7 @@ android {
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
- versionCode 43
+ versionCode 44
versionName version
}
diff --git a/quicklib/src/main/java/com/sdwfqin/quicklib/module/webview/BaseWebView.java b/quicklib/src/main/java/com/sdwfqin/quicklib/module/webview/BaseWebView.java
new file mode 100644
index 0000000..a1246dd
--- /dev/null
+++ b/quicklib/src/main/java/com/sdwfqin/quicklib/module/webview/BaseWebView.java
@@ -0,0 +1,124 @@
+package com.sdwfqin.quicklib.module.webview;
+
+import android.view.KeyEvent;
+import android.webkit.WebChromeClient;
+import android.webkit.WebView;
+import android.widget.LinearLayout;
+
+import com.blankj.utilcode.util.StringUtils;
+import com.just.agentweb.AgentWeb;
+import com.qmuiteam.qmui.widget.QMUITopBarLayout;
+import com.sdwfqin.quicklib.R;
+import com.sdwfqin.quicklib.base.BaseActivity;
+
+/**
+ * 描述:
+ *
+ * @author zhangqin
+ * @date 2018/6/19
+ */
+public abstract class BaseWebView extends BaseActivity {
+ protected QMUITopBarLayout mTopbar;
+ protected LinearLayout mContainer;
+
+ protected String mUrl;
+ protected AgentWeb mAgentWeb;
+
+ @Override
+ protected int getLayout() {
+ return R.layout.quick_activity_web_view;
+ }
+
+ @Override
+ protected void initEventAndData() {
+
+ mTopbar = findViewById(R.id.topbar);
+ mContainer = findViewById(R.id.container);
+
+ if (!StringUtils.isEmpty(getUrl())) {
+ mUrl = getUrl();
+ } else {
+ showMsg("未获取到url地址");
+ finish();
+ }
+
+ mTopbar.setTitle(getActivityTitle());
+
+ mTopbar.addLeftBackImageButton().setOnClickListener(v -> {
+ // true表示AgentWeb处理了该事件
+ if (!mAgentWeb.back()) {
+ finish();
+ }
+ });
+
+ initWebView();
+ }
+
+ private void initWebView() {
+ mAgentWeb = AgentWeb.with(mContext)
+ //传入AgentWeb 的父控件 ,如果父控件为 RelativeLayout , 那么第二参数需要传入 RelativeLayout.LayoutParams ,第一个参数和第二个参数应该对应。
+ .setAgentWebParent(mContainer, new LinearLayout.LayoutParams(-1, -1))
+ .useDefaultIndicator()// 使用默认进度条
+ .setWebChromeClient(new WebChromeClient() {
+ @Override
+ public void onReceivedTitle(WebView view, String title) {
+ super.onReceivedTitle(view, title);
+ mTopbar.setTitle(title);
+ }
+ })
+ //.defaultProgressBarColor() // 使用默认进度条颜色
+ .createAgentWeb()
+ .ready()
+ .go(mUrl);
+ }
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+
+ if (mAgentWeb != null && mAgentWeb.handleKeyEvent(keyCode, event)) {
+ return true;
+ }
+ return super.onKeyDown(keyCode, event);
+ }
+
+ @Override
+ protected void onPause() {
+ if (mAgentWeb != null) {
+ mAgentWeb.getWebLifeCycle().onPause();
+ }
+ super.onPause();
+
+ }
+
+ @Override
+ protected void onResume() {
+ if (mAgentWeb != null) {
+ mAgentWeb.getWebLifeCycle().onResume();
+ }
+ super.onResume();
+ }
+
+ @Override
+ protected void onDestroy() {
+ if (mAgentWeb != null) {
+ mAgentWeb.getWebLifeCycle().onDestroy();
+ }
+ super.onDestroy();
+ }
+
+ /**
+ * 设置url地址
+ *
+ * @return
+ */
+ public abstract String getUrl();
+
+ /**
+ * 设置标题
+ *
+ * @return
+ */
+ public String getActivityTitle() {
+ return "";
+ }
+}
diff --git a/quicklib/src/main/java/com/sdwfqin/quicklib/module/webview/WebViewActivity.java b/quicklib/src/main/java/com/sdwfqin/quicklib/module/webview/WebViewActivity.java
index eafee1c..4936bff 100644
--- a/quicklib/src/main/java/com/sdwfqin/quicklib/module/webview/WebViewActivity.java
+++ b/quicklib/src/main/java/com/sdwfqin/quicklib/module/webview/WebViewActivity.java
@@ -2,15 +2,6 @@
import android.content.Context;
import android.content.Intent;
-import android.view.KeyEvent;
-import android.webkit.WebChromeClient;
-import android.webkit.WebView;
-import android.widget.LinearLayout;
-
-import com.just.agentweb.AgentWeb;
-import com.qmuiteam.qmui.widget.QMUITopBarLayout;
-import com.sdwfqin.quicklib.R;
-import com.sdwfqin.quicklib.base.BaseActivity;
/**
* 描述:WebViewActivity
@@ -18,95 +9,44 @@
* @author 张钦
* @date 2018/1/16
*/
-public class WebViewActivity extends BaseActivity {
-
- QMUITopBarLayout mTopbar;
- LinearLayout mContainer;
-
- private String mUrl;
- private AgentWeb mAgentWeb;
-
+public class WebViewActivity extends BaseWebView {
+
+ /**
+ * 加载网页
+ *
+ * @param context
+ * @param url 页面地址
+ */
public static void launch(Context context, String url) {
Intent i = new Intent(context, WebViewActivity.class);
i.putExtra("url", url);
context.startActivity(i);
}
- @Override
- protected int getLayout() {
- return R.layout.quick_activity_web_view;
+ /**
+ * 加载网页,带有默认标题
+ *
+ * @param context
+ * @param url 页面地址
+ * @param title 默认标题
+ */
+ public static void launch(Context context, String url, String title) {
+ Intent i = new Intent(context, WebViewActivity.class);
+ i.putExtra("url", url);
+ i.putExtra("title", title);
+ context.startActivity(i);
}
@Override
- protected void initEventAndData() {
-
- mTopbar = findViewById(R.id.topbar);
- mContainer = findViewById(R.id.container);
-
- if (getIntent().getStringExtra("url") != null) {
- mUrl = getIntent().getStringExtra("url");
- } else {
- showMsg("未获取到url地址");
- finish();
- }
-
- mTopbar.addLeftBackImageButton().setOnClickListener(v -> {
- // true表示AgentWeb处理了该事件
- if (!mAgentWeb.back()) {
- finish();
- }
- });
-
- initWebView();
- }
-
- private void initWebView() {
- mAgentWeb = AgentWeb.with(mContext)
- //传入AgentWeb 的父控件 ,如果父控件为 RelativeLayout , 那么第二参数需要传入 RelativeLayout.LayoutParams ,第一个参数和第二个参数应该对应。
- .setAgentWebParent(mContainer, new LinearLayout.LayoutParams(-1, -1))
- .useDefaultIndicator()// 使用默认进度条
- .setWebChromeClient(new WebChromeClient(){
- @Override
- public void onReceivedTitle(WebView view, String title) {
- super.onReceivedTitle(view, title);
- mTopbar.setTitle(title);
- }
- })
- //.defaultProgressBarColor() // 使用默认进度条颜色
- .createAgentWeb()
- .ready()
- .go(mUrl);
+ public String getUrl() {
+ return getIntent().getStringExtra("url");
}
@Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
-
- if (mAgentWeb != null && mAgentWeb.handleKeyEvent(keyCode, event)) {
- return true;
+ public String getActivityTitle() {
+ if (getIntent().getStringExtra("title") != null) {
+ return getIntent().getStringExtra("title");
}
- return super.onKeyDown(keyCode, event);
+ return super.getActivityTitle();
}
-
- @Override
- protected void onPause() {
- if (mAgentWeb != null)
- mAgentWeb.getWebLifeCycle().onPause();
- super.onPause();
-
- }
-
- @Override
- protected void onResume() {
- if (mAgentWeb != null)
- mAgentWeb.getWebLifeCycle().onResume();
- super.onResume();
- }
-
- @Override
- protected void onDestroy() {
- if (mAgentWeb != null)
- mAgentWeb.getWebLifeCycle().onDestroy();
- super.onDestroy();
- }
-
}
diff --git a/settings.gradle b/settings.gradle
index 94aaf55..c00662d 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':app', ':quicklib', ':baidumaplib', ':paylib'
\ No newline at end of file
+include ':app', ':quicklib', ':baidumaplib', ':paylib', ':widget'
\ No newline at end of file
diff --git a/widget/.gitignore b/widget/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/widget/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/widget/build.gradle b/widget/build.gradle
new file mode 100644
index 0000000..a73c4ec
--- /dev/null
+++ b/widget/build.gradle
@@ -0,0 +1,33 @@
+apply plugin: 'com.android.library'
+
+// gradlew widget:install
+// gradlew widget:bintrayUpload
+
+version = "1.0.0"
+
+android {
+ compileSdkVersion rootProject.ext.compileSdkVersion
+ buildToolsVersion rootProject.ext.buildToolsVersion
+ defaultConfig {
+ minSdkVersion rootProject.ext.minSdkVersion
+ targetSdkVersion rootProject.ext.targetSdkVersion
+ versionCode 1
+ versionName version
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation "com.android.support:appcompat-v7:$support"
+}
+
+apply from: "deployBintray.gradle"
diff --git a/widget/deployBintray.gradle b/widget/deployBintray.gradle
new file mode 100644
index 0000000..7701341
--- /dev/null
+++ b/widget/deployBintray.gradle
@@ -0,0 +1,77 @@
+apply plugin: 'com.github.dcendents.android-maven'
+apply plugin: 'com.jfrog.bintray'
+
+def siteUrl = 'https://github.com/sdwfqin/AndroidQuick' // 项目的主页
+def gitUrl = 'https://github.com/sdwfqin/AndroidQuick.git' // Git仓库的url
+group = "com.sdwfqin.quicklib" // Maven Group ID for the artifact,一般填你唯一的包名
+install {
+ repositories.mavenInstaller {
+ // This generates POM.xml with proper parameters
+ pom {
+ project {
+ packaging 'aar'
+ // Add your description here
+ description 'Android 快速开发库' //项目描述
+ name 'widget'
+ url siteUrl
+ // Set your license
+ licenses {
+ license {
+ name 'The Apache Software License, Version 2.0'
+ url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ }
+ }
+ developers {
+ developer { // 开发者信息
+ id 'sdwfqin'
+ name 'qinzhang'
+ email 'sdwfqin@gmail.com'
+ }
+ }
+ scm {
+ connection gitUrl
+ developerConnection gitUrl
+ url siteUrl
+ }
+ }
+ }
+ }
+}
+
+task sourcesJar(type: Jar) {
+ from android.sourceSets.main.java.srcDirs
+ classifier = 'sources'
+}
+
+task javadoc(type: Javadoc) {
+ source = android.sourceSets.main.java.srcDirs
+ classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
+ failOnError false
+}
+
+task javadocJar(type: Jar, dependsOn: javadoc) {
+ classifier = 'javadoc'
+ from javadoc.destinationDir
+}
+
+artifacts {
+ archives javadocJar
+ archives sourcesJar
+}
+
+Properties properties = new Properties()
+// 加载本地配置
+properties.load(project.rootProject.file('local.properties').newDataInputStream())
+bintray {
+ user = properties.getProperty("bintray.user")
+ key = properties.getProperty("bintray.apikey")
+ configurations = ['archives']
+ pkg {
+ repo = "widget" //发布到Bintray的那个仓库里,默认账户有四个库,我们这里上传到maven库
+ name = "widget" //发布到Bintray上的项目名字
+ websiteUrl = siteUrl
+ vcsUrl = gitUrl
+ licenses = ["Apache-2.0"]
+ publish = true
+ }
+}
\ No newline at end of file
diff --git a/widget/proguard-rules.pro b/widget/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/widget/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# 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 *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/widget/src/androidTest/java/com/sdwfqin/widget/ExampleInstrumentedTest.java b/widget/src/androidTest/java/com/sdwfqin/widget/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..958ccb4
--- /dev/null
+++ b/widget/src/androidTest/java/com/sdwfqin/widget/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package com.sdwfqin.widget;
+
+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.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("com.sdwfqin.widget.test", appContext.getPackageName());
+ }
+}
diff --git a/widget/src/main/AndroidManifest.xml b/widget/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..5fb1eeb
--- /dev/null
+++ b/widget/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
diff --git a/widget/src/main/res/values/strings.xml b/widget/src/main/res/values/strings.xml
new file mode 100644
index 0000000..35e6cb6
--- /dev/null
+++ b/widget/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ widget
+
diff --git a/widget/src/test/java/com/sdwfqin/widget/ExampleUnitTest.java b/widget/src/test/java/com/sdwfqin/widget/ExampleUnitTest.java
new file mode 100644
index 0000000..55528ce
--- /dev/null
+++ b/widget/src/test/java/com/sdwfqin/widget/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.sdwfqin.widget;
+
+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() {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file