提交 f867960f 编写于 作者: J jessyan

Retrofit to 2.1.0

上级 ec9186bb
<component name="libraryTable">
<library name="animated-vector-drawable-23.4.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/arms/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.4.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/arms/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.4.0/res" />
<root url="jar://$PROJECT_DIR$/rxerrorhandler/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.4.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/rxerrorhandler/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.4.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
......
<component name="libraryTable">
<library name="appcompat-v7-23.4.0">
<ANNOTATIONS>
<root url="jar://$PROJECT_DIR$/arms/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/annotations.zip!/" />
<root url="jar://$PROJECT_DIR$/rxerrorhandler/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/annotations.zip!/" />
<root url="jar://$PROJECT_DIR$/arms/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="file://$PROJECT_DIR$/arms/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res" />
<root url="jar://$PROJECT_DIR$/arms/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/rxerrorhandler/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res" />
<root url="jar://$PROJECT_DIR$/rxerrorhandler/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
......
......@@ -5,6 +5,8 @@
<root url="file://$PROJECT_DIR$/arms/build/intermediates/exploded-aar/com.jakewharton.rxbinding/rxbinding-recyclerview-v7/0.4.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.jakewharton.rxbinding/rxbinding-recyclerview-v7/0.4.0/b009076f63acb2343863ac6e852b58ccb08d7bb3/rxbinding-recyclerview-v7-0.4.0-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
......@@ -2,8 +2,8 @@
<library name="support-v4-23.4.0">
<ANNOTATIONS>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.4.0/annotations.zip!/" />
<root url="jar://$PROJECT_DIR$/arms/build/intermediates/exploded-aar/com.android.support/support-v4/23.4.0/annotations.zip!/" />
<root url="jar://$PROJECT_DIR$/rxerrorhandler/build/intermediates/exploded-aar/com.android.support/support-v4/23.4.0/annotations.zip!/" />
<root url="jar://$PROJECT_DIR$/arms/build/intermediates/exploded-aar/com.android.support/support-v4/23.4.0/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.4.0/jars/classes.jar!/" />
......
<component name="libraryTable">
<library name="support-vector-drawable-23.4.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/arms/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/23.4.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/arms/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/23.4.0/res" />
<root url="file://$PROJECT_DIR$/rxerrorhandler/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/23.4.0/res" />
<root url="jar://$PROJECT_DIR$/rxerrorhandler/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/23.4.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -22,7 +22,6 @@ import okhttp3.Cache;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import retrofit2.BaseUrl;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
......@@ -166,14 +165,9 @@ public class ClientModule {
* @date 8/30/16 1:15 PM
* @description:配置retrofit
*/
private Retrofit configureRetrofit(Retrofit.Builder builder, OkHttpClient client, final HttpUrl httpUrl) {
private Retrofit configureRetrofit(Retrofit.Builder builder, OkHttpClient client, HttpUrl httpUrl) {
return builder
.baseUrl(new BaseUrl() {
@Override
public HttpUrl url() {
return httpUrl;
}
})//域名
.baseUrl(httpUrl)//域名
.client(client)//设置okhttp
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())//使用rxjava
.addConverterFactory(GsonConverterFactory.create())//使用Gson
......
......@@ -161,5 +161,34 @@ public class PermissionUtil {
}
}
/**
* 请求获取手机状态的权限
*/
public static void readPhonestate(final RequestPermission requestPermission, RxPermissions rxPermissions, RxErrorHandler errorHandler) {
//先确保是否已经申请过权限
boolean isPermissionsGranted =
rxPermissions
.isGranted(Manifest.permission.READ_PHONE_STATE);
if (isPermissionsGranted) {//已经申请过,直接执行操作
requestPermission.onRequestPermissionSuccess();
} else {//没有申请过,则申请
rxPermissions
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe(new ErrorHandleSubscriber<Boolean>(errorHandler) {
@Override
public void onNext(Boolean granted) {
if (granted) {
Timber.tag(TAG).d("request SEND_SMS success");
requestPermission.onRequestPermissionSuccess();
} else {
Timber.tag(TAG).e("request permissons failure");
}
}
});
}
}
}
......@@ -8,6 +8,8 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.RecyclerView;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.SpannedString;
......@@ -32,11 +34,12 @@ public class UiUtils {
/**
* 设置hint大小
*
* @param size
* @param v
* @param res
*/
public static void setViewHintSize(int size, TextView v, int res){
public static void setViewHintSize(int size, TextView v, int res) {
SpannableString ss = new SpannableString(getResources().getString(
res));
// 新建一个属性对象,设置文字的大小
......@@ -47,7 +50,7 @@ public class UiUtils {
// 设置hint
v.setHint(new SpannedString(ss)); // 一定要进行转换,否则属性会消失
}
/**
* dip转pix
......@@ -372,7 +375,6 @@ public class UiUtils {
*
* @param string
* @return
*
* @throws Exception
*/
public static String MD5encode(String string) {
......@@ -408,5 +410,18 @@ public class UiUtils {
}
/**
* 配置recycleview
*
* @param recyclerView
* @param layoutManager
*/
public static void configRecycleView(final RecyclerView recyclerView
, RecyclerView.LayoutManager layoutManager) {
recyclerView.setLayoutManager(layoutManager);
//如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
recyclerView.setHasFixedSize(true);
recyclerView.setItemAnimator(new DefaultItemAnimator());
}
}
......@@ -7,7 +7,7 @@ ext {
versionCode : 1,
versionName : "1.0",
androidSupportSdkVersion: "23.3.0",
retrofitSdkVersion : "2.0.0-beta4",
retrofitSdkVersion : "2.1.0",
dagger2SdkVersion : "2.6",
rxlifecycleSdkVersion : "0.6.1",
espressoSdkVersion : "2.2.2"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册