gradle引入方法
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.dongyonghui:CommonLib:1.0'
}
初始化
在Application继承BaseApplication,并复写重新登录方法:
@Override
public void reLogin() {
SPEntity spEntity = EasySharedPreferences.load(SPEntity.class);
spEntity.loginResponseBean = null;
spEntity.commit();
AppExit();
Intent intent = new Intent(this, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
初始化日志和网络
//是否启用日志
EasyLog.Companion.getDEFAULT().setEnable(true);
private void initHttp() {
//设置请求头
HttpHeaders headers = getCommonHttpHeaders();
//设置请求参数
EasyHttp.getInstance()
.debug("GouKu", BuildConfig.DEBUG)
.addCommonHeaders(headers)//设置全局公共头
.addInterceptor(new MyHeaderTokenInterceptor(headers));//token追加拦截器
}
public HttpHeaders getCommonHttpHeaders() {
HttpHeaders headers = new HttpHeaders();
headers.put("User-Agent", SystemInfoUtils.getUserAgent(this));
headers.put("Gouku-App-Origin", "31");
headers.put("Content-Type", "application/json;charset=UTF-8");
return headers;
}
使用MVP: Activity 继承 BaseMVPActivity Presenter 继承 MVPPresenter 然后在Activity中实例化Presenter
RecyclerView适配器基类: 普通列表适配器继承 BaseQuickRecyclerViewAdapter 分组列表适配器继承 BaseSectionQuickRecyclerViewAdapter
ListView适配器基类: 继承 BaseListViewAdapter
添加权限
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
目录索引
- EasyUtils: EasyAndroid开源项目工具类
- EasyHttp: RxEasyHttp开源项目工具类
- PictureLib: PictureLib开源项目工具类
- UpdateApp: UpdateApp开源项目工具类
- Calender: Calender开源项目工具类
- Dialog: Dialog开源项目工具类
- Number: Number开源项目工具类
- Picker: Picker开源项目工具类
- PopFilter: PopFilter开源项目工具类
- SeekBar: SeekBar开源项目工具类
- TabLayout: TabLayout开源项目工具类
- TitleBar: TitleBar开源项目工具类
- SlantedTextView_使用说明: SlantedTextView_使用说明
- TagGroup_使用说明: TagGroup_使用说明
- WrapLayout_使用说明: WrapLayout_使用说明