mirror of
https://github.com/yexuejc/hexi-prv.git
synced 2025-06-07 22:14:05 +08:00
README文档完善
This commit is contained in:
parent
fb07a7bb83
commit
7ede3026b1
118
README.me
Normal file
118
README.me
Normal file
@ -0,0 +1,118 @@
|
||||
# 学习RxJava+Retrofit+OkHttp框架的demo #
|
||||
|
||||
## 说明 ##
|
||||
> 1.使用MVP架构
|
||||
>
|
||||
> 2.使用RxJava+Retrofit+OkHttp框架
|
||||
|
||||
## 使用解析 ##
|
||||
> (1).ui --> UI层与Presenter层
|
||||
>
|
||||
> 1)*Activity -->activity
|
||||
> I*View -->activity与presenter的交互接口
|
||||
> *Presenter -->presenter
|
||||
>
|
||||
> 2).ui.base -->VP层super
|
||||
> 2.1)BaseActivity -->所有activity super,里面包含加载框
|
||||
> 2.2)BasePresenter -->所有presenter super,初始化View和Context
|
||||
> 2.3)MvpActivty -->继承自BaseActivity,实例化presenter
|
||||
>
|
||||
> (2).model --> model层
|
||||
>
|
||||
> 1) BaseModel -->super model. 所有modelImpl的继承父类
|
||||
>
|
||||
> 2) model 接口 -->网络请求方法
|
||||
> (3).bean --> 实体,包含普通bean,数据库entity、返回结果Result等
|
||||
>
|
||||
> (4).sys --> 系统(全局)级的处理
|
||||
>
|
||||
> (5).utils --> 工具包
|
||||
|
||||
## 使用步骤 ##
|
||||
1.创建activity继承MvpActivity
|
||||
> (1). ceatePresenter()实例化presenter
|
||||
|
||||
```
|
||||
@Override
|
||||
protected MainPresenter ceatePresenter() {
|
||||
return new MainPresenter(subscription);
|
||||
}
|
||||
```
|
||||
> (2). onInitLayoutBefore()加载layout
|
||||
|
||||
```
|
||||
@Override
|
||||
protected void onInitLayoutBefore() {
|
||||
loadUI(this, R.layout.activity_main);
|
||||
}
|
||||
```
|
||||
> (3). activity中onInitLayoutAfter()之后调用objBeanPresenter.*()方法
|
||||
|
||||
```
|
||||
@Override
|
||||
protected void onInitLayoutAfter() {
|
||||
showLoadingDialog();//显示加载框
|
||||
objBeanPresenter.loadInit();//到presenter去处理逻辑(加载数据)
|
||||
}
|
||||
```
|
||||
> (4).请求结果(更改UI)数据和隐藏加载框的处理放回UI(activity)处理,通过presenter调用I*View接口实现回调
|
||||
|
||||
```
|
||||
@Override
|
||||
public void updateInit(String resultStr) {
|
||||
hideLoadingDialog();
|
||||
pptIcoListAll.setText(resultStr);
|
||||
}
|
||||
```
|
||||
2.presenter
|
||||
> (1).调用model请求数据
|
||||
|
||||
```
|
||||
public void loadInit() {
|
||||
/***
|
||||
* 请求第一种方式
|
||||
*/
|
||||
subscription = PptIcoImpl.getPptIco()//获取PptIco model实例
|
||||
.listALL()//请方法
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getInitObservable(ResultPptIcoGsonFormat.class));
|
||||
//观察者模式订阅(创建观察者 (返回数据类型 ))
|
||||
}
|
||||
```
|
||||
> (2).创建观察者级回调处理
|
||||
|
||||
```
|
||||
private <S> BaseObserver getInitObservable(final Class<S> resultDataClass) {
|
||||
return new BaseObserver<ResultData<S>>(new BaseObserver.HttpCallBack<ResultData<S>>() {
|
||||
@Override
|
||||
public void onComplete(int code, ResultData<S> resultDataClass) {
|
||||
onComplete4Init(code, resultDataClass);//okHttp请求网络之后回调
|
||||
}
|
||||
});
|
||||
}
|
||||
```
|
||||
> (3).回调处理 *ps:根据自己的逻辑处理*
|
||||
|
||||
```
|
||||
private <S> void onComplete4Init(int code, ResultData<S> resultDataClass) {
|
||||
String resultStr = "";
|
||||
switch (code) {
|
||||
case 200://请求成功
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String json = gson.toJson(resultDataClass.toString());
|
||||
System.out.println(json);
|
||||
Log.e("resule", json);
|
||||
resultStr = json;
|
||||
break;
|
||||
case 500://请求失败
|
||||
T.showShort(getContext(), getContext().getString(R.string.error_code_500));
|
||||
break;
|
||||
}
|
||||
//返回到UI的处理 *ps: 更改UI数据通过view回调到UI(activity)*
|
||||
IMainView view = getView();
|
||||
if (view != null) {
|
||||
view.updateInit(resultStr);
|
||||
}
|
||||
}
|
||||
```
|
@ -1 +0,0 @@
|
||||
学习RxJava+Retrofit+OkHttp框架的demo
|
@ -50,65 +50,5 @@ public class ResultPptIco {
|
||||
private @SerializedName("JKJ_BY_GT")List<ResultPptIcoItem> JKJ_BY_GT;
|
||||
private @SerializedName("SY_QXS_TB")List<ResultPptIcoItem> SY_QXS_TB;
|
||||
private @SerializedName("QB_GGT_TB")List<ResultPptIcoItem> QB_GGT_TB;
|
||||
|
||||
}
|
||||
|
||||
class ResultPptIcoItem{
|
||||
private String imgUrl;
|
||||
private int orderBy;
|
||||
private String name;
|
||||
private String M;
|
||||
private double version;
|
||||
|
||||
public String getImgUrl() {
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
public void setImgUrl(String imgUrl) {
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
|
||||
public int getOrderBy() {
|
||||
return orderBy;
|
||||
}
|
||||
|
||||
public void setOrderBy(int orderBy) {
|
||||
this.orderBy = orderBy;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getM() {
|
||||
return M;
|
||||
}
|
||||
|
||||
public void setM(String m) {
|
||||
M = m;
|
||||
}
|
||||
|
||||
public double getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(double version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResultPptIcoItem{" +
|
||||
"imgUrl='" + imgUrl + '\'' +
|
||||
", orderBy=" + orderBy +
|
||||
", name='" + name + '\'' +
|
||||
", M='" + M + '\'' +
|
||||
", version=" + version +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,67 @@
|
||||
package com.yexue.android.hexiprv.bean;
|
||||
|
||||
/**
|
||||
* @author yexue
|
||||
* @version 1.0
|
||||
* @name com.yexue.android.hexiprv.bean
|
||||
* @explain
|
||||
* @time 2017/7/13 13:55
|
||||
*/
|
||||
public class ResultPptIcoItem {
|
||||
private String imgUrl;
|
||||
private int orderBy;
|
||||
private String name;
|
||||
private String M;
|
||||
private double version;
|
||||
|
||||
public String getImgUrl() {
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
public void setImgUrl(String imgUrl) {
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
|
||||
public int getOrderBy() {
|
||||
return orderBy;
|
||||
}
|
||||
|
||||
public void setOrderBy(int orderBy) {
|
||||
this.orderBy = orderBy;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getM() {
|
||||
return M;
|
||||
}
|
||||
|
||||
public void setM(String m) {
|
||||
M = m;
|
||||
}
|
||||
|
||||
public double getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(double version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResultPptIcoItem{" +
|
||||
"imgUrl='" + imgUrl + '\'' +
|
||||
", orderBy=" + orderBy +
|
||||
", name='" + name + '\'' +
|
||||
", M='" + M + '\'' +
|
||||
", version=" + version +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -2,13 +2,21 @@ package com.yexue.android.hexiprv.sys;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.yexue.android.hexiprv.bean.ResultData;
|
||||
|
||||
import java.net.ConnectException;
|
||||
import java.net.SocketTimeoutException;
|
||||
|
||||
import rx.Observer;
|
||||
import rx.Subscriber;
|
||||
import rx.Subscription;
|
||||
import rx.functions.Action1;
|
||||
|
||||
/**
|
||||
* @author yexue
|
||||
* @version 1.0
|
||||
* @name com.yexue.android.hexiprv.sys
|
||||
* @explain
|
||||
* @explain 完整BaseObserver
|
||||
* @time 2017/7/11 15:00
|
||||
*/
|
||||
public class BaseObserver<T> implements Observer<T> {
|
||||
@ -23,7 +31,7 @@ public class BaseObserver<T> implements Observer<T> {
|
||||
*/
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
callBack.onComplete(0, null);
|
||||
//callBack.onComplete(0, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,4 +69,43 @@ public class BaseObserver<T> implements Observer<T> {
|
||||
*/
|
||||
public void onComplete(int code, T t);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建观察者
|
||||
* @param callBack
|
||||
* @return
|
||||
*/
|
||||
public static <T> BaseObserver newObservable(HttpCallBack<? super T> callBack) {
|
||||
return new BaseObserver<T>(callBack);
|
||||
}
|
||||
/**
|
||||
* 创建观察者
|
||||
*
|
||||
* @param onNext
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> Subscriber newSubscriber(final Subscription subscription, final Action1<? super T> onNext) {
|
||||
return new Subscriber<T>() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(T t) {
|
||||
//TODO subscription.isUnsubscribed()=true
|
||||
if (!subscription.isUnsubscribed()) {
|
||||
onNext.call(t);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import android.os.PersistableBundle;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.yexue.android.hexiprv.sys.AppUtils;
|
||||
import com.yexue.android.hexiprv.ui.dialog.DialogLoading;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
import rx.Subscription;
|
||||
@ -63,4 +64,29 @@ public abstract class BaseActivity extends Activity {
|
||||
* </pre>
|
||||
*/
|
||||
protected abstract void onInitLayoutAfter();
|
||||
|
||||
/***********************************加载框********************************************/
|
||||
|
||||
/**
|
||||
* 显示加载框
|
||||
*/
|
||||
protected void showLoadingDialog() {
|
||||
if (loading == null) {
|
||||
loading = new DialogLoading(this);
|
||||
}
|
||||
loading.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭加载框
|
||||
*/
|
||||
protected void hideLoadingDialog() {
|
||||
if (loading != null) {
|
||||
loading.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private DialogLoading loading;
|
||||
/***********************************加载框********************************************/
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
package com.yexue.android.hexiprv.ui.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yexue.android.hexiprv.R;
|
||||
|
||||
/**
|
||||
* @author yexue
|
||||
* @version 1.0
|
||||
* @name com.yexue.android.hexiprv.ui.dialog
|
||||
* @explain
|
||||
* @time 2017/7/13 10:41
|
||||
*/
|
||||
public class DialogLoading extends Dialog {
|
||||
|
||||
private TextView loadingLabel;
|
||||
|
||||
public DialogLoading(Context context) {
|
||||
super(context, R.style.Dialog);
|
||||
setContentView(R.layout.dialog_loading_layout);
|
||||
setCanceledOnTouchOutside(false);
|
||||
loadingLabel = (TextView) findViewById(R.id.loading_text);
|
||||
}
|
||||
|
||||
public void setDialogLabel(String label) {
|
||||
loadingLabel.setText(label);
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package com.yexue.android.hexiprv.ui.main;
|
||||
|
||||
import com.yexue.android.hexiprv.bean.ResultData;
|
||||
|
||||
/**
|
||||
* @author yexue
|
||||
* @version 1.0
|
||||
@ -8,4 +10,7 @@ package com.yexue.android.hexiprv.ui.main;
|
||||
* @time 2017/7/11 11:50
|
||||
*/
|
||||
public interface IMainView {
|
||||
void updateInit(String resulrStr);
|
||||
|
||||
void updateList(String resultStr);
|
||||
}
|
||||
|
@ -1,16 +1,17 @@
|
||||
package com.yexue.android.hexiprv.ui.main;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yexue.android.hexiprv.R;
|
||||
import com.yexue.android.hexiprv.bean.ResultData;
|
||||
import com.yexue.android.hexiprv.ui.base.MvpActivity;
|
||||
|
||||
import butterknife.Bind;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class MainActivity extends MvpActivity<IMainView, MainPresenter> implements IMainView {
|
||||
|
||||
@Bind(R.id.pptIco_list_all)
|
||||
TextView pptIcoListAll;
|
||||
@Bind(R.id.pptIco_list)
|
||||
TextView pptIcoList;
|
||||
|
||||
@ -21,11 +22,24 @@ public class MainActivity extends MvpActivity<IMainView, MainPresenter> implemen
|
||||
|
||||
@Override
|
||||
protected void onInitLayoutAfter() {
|
||||
objBeanPresenter.loadInit();
|
||||
showLoadingDialog();//显示加载框
|
||||
objBeanPresenter.loadInit();//到presenter去处理逻辑(加载数据)
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MainPresenter ceatePresenter() {
|
||||
return new MainPresenter(subscription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInit(String resultStr) {
|
||||
hideLoadingDialog();
|
||||
pptIcoListAll.setText(resultStr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateList(String resultStr) {
|
||||
hideLoadingDialog();
|
||||
pptIcoList.setText(resultStr);
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
package com.yexue.android.hexiprv.ui.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.yexue.android.hexiprv.R;
|
||||
import com.yexue.android.hexiprv.bean.ResultData;
|
||||
import com.yexue.android.hexiprv.bean.ResultPptIco;
|
||||
import com.yexue.android.hexiprv.bean.ResultPptIcoGsonFormat;
|
||||
import com.yexue.android.hexiprv.bean.ResultPptIcoMap;
|
||||
import com.yexue.android.hexiprv.bean.ResultPptIcoItem;
|
||||
import com.yexue.android.hexiprv.model.impl.PptIcoImpl;
|
||||
import com.yexue.android.hexiprv.sys.BaseObserver;
|
||||
import com.yexue.android.hexiprv.ui.base.BasePresenter;
|
||||
@ -15,10 +15,9 @@ import com.yexue.android.hexiprv.utils.T;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import rx.Observable;
|
||||
import rx.Observer;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.functions.Action1;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
@ -43,33 +42,80 @@ public class MainPresenter extends BasePresenter<IMainView> {
|
||||
* </pre>
|
||||
*/
|
||||
public void loadInit() {
|
||||
/***
|
||||
* 请求第一种方式
|
||||
*/
|
||||
subscription = PptIcoImpl.getPptIco()
|
||||
.listALL()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getInitObservable());
|
||||
.subscribe(getInitObservable(ResultPptIcoGsonFormat.class));
|
||||
loadList("SY_BOT_TB");
|
||||
}
|
||||
|
||||
private BaseObserver getInitObservable() {
|
||||
return new BaseObserver<ResultData<ResultPptIcoGsonFormat>>(new BaseObserver.HttpCallBack<ResultData<ResultPptIcoGsonFormat>>() {
|
||||
private <S> BaseObserver getInitObservable(final Class<S> resultDataClass) {
|
||||
return new BaseObserver<ResultData<S>>(new BaseObserver.HttpCallBack<ResultData<S>>() {
|
||||
@Override
|
||||
public void onComplete(int code, ResultData<ResultPptIcoGsonFormat> resultData) {
|
||||
switch (code) {
|
||||
case 0:
|
||||
break;
|
||||
case 200:
|
||||
Log.e("resule",resultData.toString());
|
||||
break;
|
||||
case 500:
|
||||
T.showShort(getContext(), getContext().getString(R.string.error_code_500));
|
||||
break;
|
||||
}
|
||||
public void onComplete(int code, ResultData<S> resultDataClass) {
|
||||
onComplete4Init(code, resultDataClass);//okHttp请求网络之后回调
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private <S> void onComplete4Init(int code, ResultData<S> resultDataClass) {
|
||||
String resultStr = "";
|
||||
switch (code) {
|
||||
case 200://请求成功
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String json = gson.toJson(resultDataClass.toString());
|
||||
System.out.println(json);
|
||||
Log.e("resule", json);
|
||||
resultStr = json;
|
||||
break;
|
||||
case 500://请求失败
|
||||
T.showShort(getContext(), getContext().getString(R.string.error_code_500));
|
||||
break;
|
||||
}
|
||||
//返回到UI的处理 *ps: 更改UI数据通过view回调到UI(activity)*
|
||||
IMainView view = getView();
|
||||
if (view != null) {
|
||||
view.updateInit(resultStr);
|
||||
}
|
||||
}
|
||||
|
||||
public void uploadImg(File file,String method){
|
||||
/**
|
||||
* 获取指定图标
|
||||
*
|
||||
* @param pptKey
|
||||
*/
|
||||
public void loadList(String pptKey) {
|
||||
/**
|
||||
* 请求第二种方式
|
||||
*/
|
||||
subscription = PptIcoImpl.getPptIco()
|
||||
.list(pptKey)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseObserver.newSubscriber(subscription,new Action1<ResultPptIcoItem>() {
|
||||
@Override
|
||||
public void call(ResultPptIcoItem resultPptIcoItem) {
|
||||
//TODO 回调失败
|
||||
onComplete4List(resultPptIcoItem);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private void onComplete4List(ResultPptIcoItem resultDataClass) {
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String json = gson.toJson(resultDataClass.toString());
|
||||
Log.e("resule", json);
|
||||
IMainView view = getView();
|
||||
if (view != null) {
|
||||
view.updateList(json);
|
||||
}
|
||||
}
|
||||
|
||||
public void uploadImg(File file, String method) {
|
||||
|
||||
|
||||
}
|
||||
|
20
app/src/main/res/drawable/loading_progress_bg.xml
Normal file
20
app/src/main/res/drawable/loading_progress_bg.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<gradient
|
||||
android:angle="270.0"
|
||||
android:centerColor="#99000000"
|
||||
android:centerY="0.5"
|
||||
android:endColor="#99000000"
|
||||
android:startColor="#99000000" >
|
||||
</gradient>
|
||||
|
||||
<corners android:radius="5dip" />
|
||||
|
||||
<padding
|
||||
android:bottom="0dp"
|
||||
android:left="0dp"
|
||||
android:right="0dp"
|
||||
android:top="0dp" />
|
||||
|
||||
</shape>
|
@ -4,16 +4,33 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="https://shop.globalhexi.cn/shop/pptIco/list?pptKey=SY_BOT_TB" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pptIco_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
android:background="@color/gray"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="https://shop.globalhexi.cn/shop/pptIco/list?pptKey=SY_BOT_TB" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pptIco_list_all"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/gray"
|
||||
android:text="Hello World!" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pptIco_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/lavender_blush"
|
||||
android:text="Hello World!" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
28
app/src/main/res/layout/dialog_loading_layout.xml
Normal file
28
app/src/main/res/layout/dialog_loading_layout.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/container_dialog"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="140dip"
|
||||
android:layout_height="140dip"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/loading_progress_bg"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loading_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="加载中"
|
||||
android:textColor="#B4B4B4" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
@ -4,4 +4,8 @@
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="gray">#dddddd</color>
|
||||
<!--脸红的淡紫色-->
|
||||
<color name="lavender_blush">#FFF0F5</color>
|
||||
<!--蓟-->
|
||||
<color name="thistle">#D8BFD8</color>
|
||||
</resources>
|
||||
|
@ -8,4 +8,21 @@
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="Dialog" parent="@android:style/Theme.Holo.Dialog">
|
||||
<item name="android:windowSoftInputMode">stateHidden|adjustResize</item>
|
||||
<!-- 边框 -->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<!-- 是否浮现在activity之上 -->
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<!-- 半透明 -->
|
||||
<item name="android:windowIsTranslucent">false</item>
|
||||
<!-- 无标题 -->
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<!-- 背景透明 -->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!-- 模糊 -->
|
||||
<item name="android:backgroundDimEnabled">false</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user