/**
* 隐藏软件盘
* @param activity
*/
public static void hideKeyboard(Activity activity) {
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context
.INPUT_METHOD_SERVICE);
// 隐藏软键盘
imm.hideSoftInputFromWindow(activity.getWindow...
阅读全文
网络请求相关类,基于Retrofit
def retrofit_version = "2.4.0"
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation "com.squareup.retrofit2:...
阅读全文
OkHttp不会自动保存session会话,需要我们手动去设置,代码如下
mOkHttpClient = new OkHttpClient.Builder()
//设置连接超时
.connectTimeout(CONNECT_TIME_OUT, TimeUnit.SECONDS)
.readTimeout(READ_TIME_OUT, TimeUnit.SECONDS)
.writeTimeout(WRITE_TIME_OUT, TimeUnit.SECONDS)
//设置cookie
.cookieJa...
阅读全文