Skip to content

Commit

Permalink
修改README
Browse files Browse the repository at this point in the history
  • Loading branch information
jenly1314 committed Mar 24, 2017
1 parent 4999f35 commit c1f71c8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 65 deletions.
11 changes: 3 additions & 8 deletions Base.iml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
Expand Down Expand Up @@ -81,28 +83,21 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/24.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/24.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 24 Platform (1)" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
42 changes: 27 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

Base是针对于Android开发封装好一些常用的基类,主要包括通用的Adapter、Activity、Fragment、Dialog等、和一些常用的Util类,只为更简单。

##引入
## 引入

###Maven:
### Maven:
```maven
<dependency>
<groupId>com.king.base</groupId>
Expand All @@ -18,18 +18,18 @@ Base是针对于Android开发封装好一些常用的基类,主要包括通用
<type>pom</type>
</dependency>
```
###Gradle:
### Gradle:
```gradle
compile 'com.king.base:base:2.0'
```
###Lvy:
### Lvy:
```lvy
<dependency org='com.king.base' name='base' rev='2.0'>
<artifact name='$AID' ext='pom'></artifact>
</dependency>
```

###引入的库:
### 引入的库:
```gradle
provided 'com.android.support:recyclerview-v7:24.0.+'
```
Expand All @@ -42,12 +42,12 @@ compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:appcompat-v7:24.0.+'
```

##简要说明:
## 简要说明:
Base主要实用地方体现在:出统一的代码风格,实用的各种基类,BaseActivity和BaseFragment里面还有许多实用的代码封装,只要用了Base,使用Fragment就感觉跟使用Activtiy基本是一样的。

##代码示例:
## 代码示例:

###通用的Adapter
### 通用的Adapter
```Java
/**
*
Expand All @@ -73,7 +73,7 @@ public class TestAdapter extends ViewHolderAdapter<String> {

```

###基类BaseActivity
### 基类BaseActivity
```Java
public class TestActivity extends BaseActivity {

Expand Down Expand Up @@ -105,7 +105,7 @@ public class TestActivity extends BaseActivity {
}
}
```
###GestureActivity
### GestureActivity
```Java
public class TestGestureActivity extends GestureActivity {

Expand Down Expand Up @@ -148,7 +148,7 @@ public class TestGestureActivity extends GestureActivity {
}
}
```
###SplashActivity
### SplashActivity
```Java
public class TestSplashActivity extends SplashActivity {
@Override
Expand Down Expand Up @@ -178,7 +178,7 @@ public class TestSplashActivity extends SplashActivity {
}
```

###BaseFragment
### BaseFragment
```Java
public class TestFragment extends BaseFragment {
@Override
Expand Down Expand Up @@ -207,7 +207,7 @@ public class TestFragment extends BaseFragment {
}
}
```
###BaseDialogFragment
### BaseDialogFragment
```Java
public class TestDialogFragment extends BaseDialogFragment {
@Override
Expand Down Expand Up @@ -237,11 +237,11 @@ public class TestDialogFragment extends BaseDialogFragment {
}
```

###WebFragment
### WebFragment
```Java
WebFragment实现基本webView功能
```
###其他小功能
### 其他小功能

使用Log:
统一控制管理Log
Expand Down Expand Up @@ -298,6 +298,18 @@ public class TestDialogFragment extends BaseDialogFragment {

更多实用黑科技,请速速使用Base体会吧。

## 关于我
Name: Jenly

Email: jenly1314@gmail.com / jenly1314@vip.qq.com

CSDN: http://www.csdn.net/jenly121

Github: https://github.com/jenly1314

微信公众号:

![公众号](http://olambmg9j.bkt.clouddn.com/jenly666.jpg)

## License

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ publish {
userOrg = 'jenly'//bintray.com用户名
groupId = 'com.king.base'//jcenter上的路径
artifactId = 'base'//项目名称
publishVersion = '2.0'//版本号
publishVersion = '2.0.1'//版本号
desc = 'Base for Android'//描述
website = 'https://github.com/jenly1314/Base'//网站
}
Expand Down
54 changes: 13 additions & 41 deletions src/main/java/com/king/base/fragment/WebFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/**
* @author Jenly <a href="mailto:jenly1314@gmail.com">Jenly</a>
*/
public class WebFragment extends BaseFragment{
public class WebFragment extends BaseFragment{

public static final int OPR_WEBVIEW_BACK = 0x01;

Expand All @@ -42,16 +42,16 @@ public class WebFragment extends BaseFragment{

private boolean isShowError;

public static WebFragment newInstance(String url) {
public static WebFragment newInstance() {

Bundle args = new Bundle();
args.putString(KEY_URL,url);

WebFragment fragment = new WebFragment();
fragment.url = url;
fragment.setArguments(args);
return fragment;
}


@Override
public int inflaterRootView() {
return R.layout.fragment_web;
Expand All @@ -74,39 +74,18 @@ public void initUI() {
@Override
public void addListeners() {

rootView.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View view, int i, KeyEvent keyEvent) {

if(keyEvent.getAction() == KeyEvent.ACTION_DOWN && keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK){

if(isGoBack()){
webView.goBack();
}else{
finish();
}
return true;
}

return false;
}
});
}

@Override
public void initData() {
WebSettings ws = webView.getSettings();
//是否允许脚本支持
ws.setJavaScriptEnabled(true);

ws.setDomStorageEnabled(true);

ws.setJavaScriptCanOpenWindowsAutomatically(true);

ws.setSaveFormData(false);
// ws.setAppCacheEnabled(false);
ws.setCacheMode(WebSettings.LOAD_NO_CACHE);


webView.setHorizontalScrollBarEnabled(false);

// webView.addJavascriptInterface(new WebJavascriptInterface(),"android");
Expand All @@ -128,6 +107,9 @@ public void onProgressChanged(WebView view, int newProgress) {
load(webView,url);
}

public WebView getWebView(){
return webView;
}

public WebViewClient getWebViewClient(){
return new WebViewClient(){
Expand All @@ -136,6 +118,7 @@ public WebViewClient getWebViewClient(){
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
LogUtils.d("startUrl:" + url);
webView.setVisibility(View.VISIBLE);
isError = false;
}

Expand Down Expand Up @@ -183,10 +166,9 @@ public void onPageFinished(WebView view, String url) {
* @param group
* @return true表示已添加ErrorView并显示ErrorView/false表示不处理
*/
public boolean addErrorView(ViewGroup group){

public boolean addErrorView(ViewGroup group){
return false;
}
};

private void showReceiveError(){
isError = true;
Expand All @@ -198,6 +180,7 @@ private void showReceiveError(){

if(isShowError){
vError.setVisibility(View.VISIBLE);
webView.setVisibility(View.GONE);
}


Expand All @@ -207,6 +190,7 @@ private void hideReceiveError(){
if(isError){
showReceiveError();
}else{
webView.setVisibility(View.VISIBLE);
vError.setVisibility(View.GONE);
}

Expand Down Expand Up @@ -244,19 +228,7 @@ private void updateProgressBar(boolean isVisibility,int progress){

@Override
public void onEventMessage(EventMessage em) {
if(isStop){
return;
}

switch (em.what){
case OPR_WEBVIEW_BACK:
if(isGoBack()){
webView.goBack();
}else{
finish();
}
break;
}
}

}
Expand Down

0 comments on commit c1f71c8

Please sign in to comment.