{
13 | public Context mContext;
14 | public E mModel;
15 | public T mView;
16 |
17 | public void setVM(T v, E m) {
18 | this.mView = v;
19 | this.mModel = m;
20 | this.onStart();
21 | }
22 |
23 | public void onStart() {
24 | }
25 |
26 |
27 | public void onDestroy() {
28 | mModel.onDestroy();
29 | }
30 |
31 | public void okRefresh(){
32 |
33 | }
34 |
35 | public void okLoadMore(){
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/base/BaseTempActivity.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.base;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.IntentFilter;
7 | import android.os.Bundle;
8 | import android.view.KeyEvent;
9 |
10 | import androidx.appcompat.app.AppCompatActivity;
11 |
12 |
13 | public class BaseTempActivity extends AppCompatActivity {
14 | public Context context;
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | context = this;
19 | }
20 |
21 | @Override
22 | public boolean onKeyDown(int keyCode, KeyEvent event) {
23 | if (keyCode == KeyEvent.KEYCODE_BACK
24 | && event.getRepeatCount() == 0) {
25 | this.finish();
26 | return true;
27 | }
28 | return super.onKeyDown(keyCode, event);
29 | }
30 |
31 | @Override
32 | protected void onDestroy() {
33 | super.onDestroy();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/base/BaseUiView.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.base;
2 |
3 | /**
4 | * @author sam
5 | * @version 1.0
6 | * @date 2018/5/7
7 | */
8 | /**
9 | * BaseUiView 是应用中所有UiView的顶级抽象类,适合抽取UiView的公共方法和属性
10 | *
11 | * UiView:MVP架构中的V。
12 | *
13 | * Created by tianlai on 16-3-3.
14 | */
15 | public interface BaseUiView {
16 |
17 | /**
18 | * showLoading 方法主要用于页面请求数据时显示加载状态
19 | */
20 | public void showLoading();
21 |
22 | /**
23 | * showEmpty 方法用于请求的数据为空的状态
24 | */
25 | public void showEmpty();
26 |
27 | /**
28 | * showError 方法用于请求数据出错
29 | */
30 | public void showError();
31 |
32 | /**
33 | * showError 方法用于请求数据完成
34 | */
35 | public void loadingComplete();
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/cache/Cache.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.cache;
2 |
3 | public class Cache {
4 | private String key;// 缓存ID
5 | private Object value;// 缓存数据
6 | private long timeOut;// 更新时间
7 | private boolean expired; // 是否终止
8 |
9 | public Cache() {
10 | super();
11 | }
12 |
13 | public Cache(String key, Object value, long timeOut, boolean expired) {
14 | this.key = key;
15 | this.value = value;
16 | this.timeOut = timeOut;
17 | this.expired = expired;
18 | }
19 |
20 | public String getKey() {
21 | return key;
22 | }
23 |
24 | public long getTimeOut() {
25 | return timeOut;
26 | }
27 |
28 | public Object getValue() {
29 | return value;
30 | }
31 |
32 | public void setKey(String string) {
33 | key = string;
34 | }
35 |
36 | public void setTimeOut(long l) {
37 | timeOut = l;
38 | }
39 |
40 | public void setValue(Object object) {
41 | value = object;
42 | }
43 |
44 | public boolean isExpired() {
45 | return expired;
46 | }
47 |
48 | public void setExpired(boolean b) {
49 | expired = b;
50 | }
51 | }
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/cache/DataCache.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.cache;
2 |
3 | /**
4 | * @author
5 | * @version 1.0
6 | * @date 2018/3/2
7 | */
8 |
9 | public class DataCache {
10 | }
11 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/configs/IConstants.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.configs;
2 |
3 | public interface IConstants {
4 | /**
5 | * 加载界面的三种状态
6 | */
7 | String STATE_LOADING = "loading";
8 | String STATE_SUCCESSED = "success";
9 | String STATE_FAILED = "failed";
10 | /**
11 | * 根据资源id跳转的界面
12 | */
13 | int FIND_CARPORT_LIST = 1;// 找车场
14 | int PARKING_DETAIL = 2;// 找车场列表的详情
15 | int CARPORT_DETAIL = 3;// 车位的详情
16 | int NAVI_FRAGMENT = 4;// 导航界面
17 | int SEARCH_MAP = 5;// 地图搜索界面
18 |
19 | /**
20 | * 界面中的一些常亮
21 | */
22 | int MAX_ITEM_LOAD_MORE = 5;// 当首次请求数据超过条后开启加载更多功能
23 | int PAGER_ROWS = 7;// 每一页的数据
24 | String EXIT_APP = "exit_app";// 退出登陆
25 | }
26 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/constant/MemoryConstants.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.constant;
2 |
3 |
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 |
7 | import androidx.annotation.IntDef;
8 |
9 | /**
10 | *
11 | * author: Blankj
12 | * blog : http://blankj.com
13 | * time : 2017/03/13
14 | * desc : The constants of memory.
15 | *
16 | */
17 | public final class MemoryConstants {
18 |
19 | public static final int BYTE = 1;
20 | public static final int KB = 1024;
21 | public static final int MB = 1048576;
22 | public static final int GB = 1073741824;
23 |
24 | @IntDef({BYTE, KB, MB, GB})
25 | @Retention(RetentionPolicy.SOURCE)
26 | public @interface Unit {
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/constant/ServerReturnCode.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.constant;
2 |
3 | public enum ServerReturnCode {
4 | REQUEST_FAIL(0, "请求失败##"),REQUEST_SUCCESS(1, "请求成功@@"),
5 | DEVICE_NOT_ONLINE(2, "设备不在线"), TIME_OUT(3, "超时"),PARA_EXCEPTION(-1, "请求失败异常"), DEVICE_EXCEPTION(-9, "网络异常"), UNKNOWN(999, "未知原因");
6 |
7 | private int code; // 返回编码
8 | private String reason; // 返回原因
9 | public int getCode() {
10 | return code;
11 | }
12 |
13 | public void setCode(int code) {
14 | this.code = code;
15 | }
16 |
17 | public String getReason() {
18 | return reason;
19 | }
20 |
21 | public void setReason(String reason) {
22 | this.reason = reason;
23 | }
24 |
25 | private ServerReturnCode(int code, String reason) {
26 | this.code = code;
27 | this.reason = reason;
28 | }
29 |
30 | //根据错误原因返回错误代码
31 | public static int getCodeByReason(String reason) {
32 | for (ServerReturnCode c : ServerReturnCode.values()) {
33 | if (c.getReason().equals(reason.trim())) {
34 | return c.code;
35 | }
36 | }
37 | return ServerReturnCode.UNKNOWN.code;
38 | }
39 |
40 | //根据错误代码返回错误原因
41 | public static String getReasonByCode(int code) {
42 | for (ServerReturnCode c : ServerReturnCode.values()) {
43 | if (c.getCode() == code) {
44 | return c.reason;
45 | }
46 | }
47 | return ServerReturnCode.UNKNOWN.reason;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/constant/TimeConstants.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.constant;
2 |
3 |
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 |
7 | import androidx.annotation.IntDef;
8 |
9 | /**
10 | *
11 | * author: Blankj
12 | * blog : http://blankj.com
13 | * time : 2017/03/13
14 | * desc : The constants of time.
15 | *
16 | */
17 | public final class TimeConstants {
18 |
19 | public static final int MSEC = 1;
20 | public static final int SEC = 1000;
21 | public static final int MIN = 60000;
22 | public static final int HOUR = 3600000;
23 | public static final int DAY = 86400000;
24 |
25 | @IntDef({MSEC, SEC, MIN, HOUR, DAY})
26 | @Retention(RetentionPolicy.SOURCE)
27 | public @interface Unit {
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/encryption/SHAUtils.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.encryption;
2 |
3 | import java.security.MessageDigest;
4 | import java.security.NoSuchAlgorithmException;
5 |
6 | /**
7 | * @Description:主要功能:SHA-1 加密 不可逆(Secure Hash Algorithm,安全散列算法)
8 | * @Prject: CommonUtilLibrary
9 | * @Package: com.jingewenku.abrahamcaijin.commonutil.encryption
10 | * @author: AbrahamCaiJin
11 | * @date: 2017年05月16日 15:57
12 | * @Copyright: 个人版权所有
13 | * @Company:
14 | * @version: 1.0.0
15 | */
16 |
17 | public class SHAUtils {
18 |
19 | private SHAUtils() {
20 | throw new UnsupportedOperationException("cannot be instantiated");
21 | }
22 |
23 | /**
24 | * SHA-512 加密
25 | * @param data
26 | * @return
27 | */
28 | public static String encryptSHA(byte[] data) {
29 | MessageDigest sha = null;
30 | try {
31 | sha = MessageDigest.getInstance("SHA-512");
32 | sha.update(data);
33 | } catch (NoSuchAlgorithmException e) {
34 | e.printStackTrace();
35 | }
36 | byte[] resultBytes = sha.digest();
37 | StringBuilder builder = new StringBuilder();
38 | for (int i = 0; i < resultBytes.length; i++) {
39 | if (Integer.toHexString(0xFF & resultBytes[i]).length() == 1) {
40 | builder.append("0").append(
41 | Integer.toHexString(0xFF & resultBytes[i]));
42 | } else {
43 | builder.append(Integer.toHexString(0xFF & resultBytes[i]));
44 | }
45 | }
46 | return builder.toString();
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/exception/DataException.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.exception;
2 | /**
3 | * @ClassName: DataException
4 | * @Description: 处理自定义数据格式异常
5 | * @author sam
6 | * @date 2013-12-27 下午6:15:45
7 | */
8 | public class DataException extends Exception {
9 | String errorMessage;
10 |
11 | public DataException(String errorMessage) {
12 | this.errorMessage = errorMessage;
13 | }
14 |
15 | public String toString() {
16 | return errorMessage;
17 | }
18 |
19 | @Override
20 | public String getMessage() {
21 | return errorMessage;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/helper/BottomNavigationViewHelper.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.helper;
2 |
3 | import android.annotation.SuppressLint;
4 |
5 | import com.google.android.material.bottomnavigation.BottomNavigationItemView;
6 | import com.google.android.material.bottomnavigation.BottomNavigationMenuView;
7 | import com.google.android.material.bottomnavigation.BottomNavigationView;
8 |
9 | import java.lang.reflect.Field;
10 |
11 | // 利用反射,改变 item 中 mShiftingMode 的值
12 | public class BottomNavigationViewHelper {
13 |
14 | @SuppressLint({"RestrictedApi", "WrongConstant"})
15 | public static void disableShiftMode(BottomNavigationView navigationView) {
16 |
17 | BottomNavigationMenuView menuView = (BottomNavigationMenuView) navigationView.getChildAt(0);
18 | try {
19 | Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
20 | shiftingMode.setAccessible(true);
21 | shiftingMode.setBoolean(menuView, false);
22 | shiftingMode.setAccessible(false);
23 |
24 | for (int i = 0; i < menuView.getChildCount(); i++) {
25 | BottomNavigationItemView itemView = (BottomNavigationItemView) menuView.getChildAt(i);
26 | itemView.setLabelVisibilityMode(0);
27 | itemView.setShifting(false);
28 | // itemView.setShiftingMode(false);
29 | itemView.setChecked(itemView.getItemData().isChecked());
30 | }
31 |
32 | } catch (NoSuchFieldException | IllegalAccessException e) {
33 | e.printStackTrace();
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/interfaces/PermissionListener.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.interfaces;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by sam on 2017/4/19.
7 | * 权限回调接口
8 | */
9 |
10 | public interface PermissionListener {
11 | void onGranted();
12 |
13 | void onDenied(List deniedPermissions);
14 | }
15 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/interfaces/SubscriberOnNextListener.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.interfaces;
2 |
3 | /**
4 | * Created by sam on 16/3/10.
5 | */
6 | public interface SubscriberOnNextListener {
7 | void onNext(T t);
8 | }
9 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/ActivityBean.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data;
2 |
3 | /**
4 | * @author
5 | * @version 1.0
6 | * @date 2018/4/13
7 | */
8 | public class ActivityBean {
9 | private int id;
10 | private String title;
11 | private String content;
12 | private String url;
13 |
14 | public int getId() {
15 | return id;
16 | }
17 |
18 | public void setId(int id) {
19 | this.id = id;
20 | }
21 |
22 | public String getTitle() {
23 | return title;
24 | }
25 |
26 | public void setTitle(String title) {
27 | this.title = title;
28 | }
29 |
30 | public String getContent() {
31 | return content;
32 | }
33 |
34 | public void setContent(String content) {
35 | this.content = content;
36 | }
37 |
38 | public String getUrl() {
39 | return url;
40 | }
41 |
42 | public void setUrl(String url) {
43 | this.url = url;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/DataBean.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data;
2 |
3 | /**
4 | * @author
5 | * @version 1.0
6 | * @date 2018/4/13
7 | */
8 | public class DataBean {
9 | public String name;
10 |
11 | public String phone;
12 |
13 | public String getName() {
14 | return name;
15 | }
16 |
17 | public void setName(String name) {
18 | this.name = name;
19 | }
20 |
21 | public String getPhone() {
22 | return phone;
23 | }
24 |
25 | public void setPhone(String phone) {
26 | this.phone = phone;
27 | }
28 |
29 | @Override
30 | public String toString() {
31 | return "DataBean{" + "name='" + name + '\'' + ", phone='" + phone + '\'' + '}';
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/FromJsonUtils.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data;
2 |
3 | import com.google.gson.GsonBuilder;
4 |
5 | /**
6 | * @author sam
7 | * @version 1.0
8 | * @date 2018/4/13
9 | */
10 | public class FromJsonUtils {
11 | public static BaseResponse fromJson(String json, Class clazz) {
12 | return new GsonBuilder()
13 | .registerTypeAdapter(BaseResponse.class, new JsonFormatParser(clazz))
14 | .enableComplexMapKeySerialization()
15 | .serializeNulls()
16 | .create()
17 | .fromJson(json, BaseResponse.class);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/GenericType.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data;
2 |
3 | import java.lang.reflect.ParameterizedType;
4 | import java.lang.reflect.Type;
5 |
6 | /**
7 | * @author
8 | * @version 1.0
9 | * @date 2018/8/4
10 | */
11 | public class GenericType {
12 |
13 | private final Type type;
14 |
15 | protected GenericType(){
16 | Type superClass = getClass().getGenericSuperclass();
17 |
18 | type = ((ParameterizedType) superClass).getActualTypeArguments()[0];
19 | }
20 |
21 | public Type getType() {
22 | return type;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/HttpStatus.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | /**
6 | * @author
7 | * @version 1.0
8 | * @date 2018/8/4
9 | */
10 | public class HttpStatus {
11 | @SerializedName("code")
12 | private int mCode;
13 | @SerializedName("message")
14 | private String mMessage;
15 |
16 | public int getCode() {
17 | return mCode;
18 | }
19 |
20 | public String getMessage() {
21 | return mMessage;
22 | }
23 |
24 | /**
25 | * API是否请求失败 * * @return 失败返回true, 成功返回false
26 | */
27 | // public boolean isCodeInvalid() {
28 | // return mCode != Constants.WEB_RESP_CODE_SUCCESS;
29 | // }
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/entity/HttpResult.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data.entity;
2 |
3 | /**
4 | * Created by sam on 16/3/5.
5 | */
6 | public class HttpResult {
7 |
8 | private int count;
9 | private int start;
10 | private int total;
11 | private String title;
12 |
13 | //用来模仿Data
14 | private T subjects;
15 |
16 |
17 | public int getCount() {
18 | return count;
19 | }
20 |
21 | public void setCount(int count) {
22 | this.count = count;
23 | }
24 |
25 | public int getStart() {
26 | return start;
27 | }
28 |
29 | public void setStart(int start) {
30 | this.start = start;
31 | }
32 |
33 | public int getTotal() {
34 | return total;
35 | }
36 |
37 | public void setTotal(int total) {
38 | this.total = total;
39 | }
40 |
41 | public String getTitle() {
42 | return title;
43 | }
44 |
45 | public void setTitle(String title) {
46 | this.title = title;
47 | }
48 |
49 |
50 | public T getSubjects() {
51 | return subjects;
52 | }
53 |
54 | public void setSubjects(T subjects) {
55 | this.subjects = subjects;
56 | }
57 |
58 |
59 | @Override
60 | public String toString() {
61 | StringBuffer sb = new StringBuffer();
62 | sb.append("title=" + title + " count=" + count + " start=" + start);
63 | if (null != subjects) {
64 | sb.append(" subjects:" + subjects.toString());
65 | }
66 | return sb.toString();
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/pojo/GankEntry.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data.pojo;
2 |
3 | /**
4 | * Created by zhouwei on 16/11/17.
5 | */
6 |
7 | public class GankEntry {
8 |
9 | public String _id;
10 | public String createdAt;
11 | public String desc;
12 | public String publishedAt;
13 | public String source;
14 | public String type;
15 | public String url;
16 | public boolean used;
17 | public String who;
18 | }
19 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/pojo/GankResp.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data.pojo;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by zhouwei on 16/11/17.
7 | */
8 |
9 | public class GankResp {
10 | public boolean error;
11 | public List results;
12 | }
13 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/pojo/Movie.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data.pojo;
2 |
3 | /**
4 | *
5 | * Created by zhouwei on 16/11/9.
6 | */
7 |
8 | public class Movie {
9 | public Rate rating;
10 | public String title;
11 | public String collect_count;
12 | public String original_title;
13 | public String subtype;
14 | public String year;
15 | public MovieImage images;
16 |
17 | public static class Rate{
18 | public int max;
19 | public float average;
20 | public String stars;
21 | public int min;
22 | }
23 |
24 | public static class MovieImage{
25 | public String small;
26 | public String large;
27 | public String medium;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/pojo/MovieSubject.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data.pojo;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * @author
7 | * @version 1.0
8 | * @date 2018/3/18
9 | */
10 |
11 | public class MovieSubject {
12 | public int count;
13 | public int start;
14 | public int total;
15 | public List subjects;
16 | public String title;
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/pojo/User.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data.pojo;
2 |
3 | /**
4 | * @author
5 | * @version 1.0
6 | * @date 3/5/2018
7 | */
8 |
9 | public class User {
10 | private long uid;
11 | private String userName;
12 | private String token;
13 |
14 | public long getUid() {
15 | return uid;
16 | }
17 |
18 | public void setUid(long uid) {
19 | this.uid = uid;
20 | }
21 |
22 | public String getToken() {
23 | return token;
24 | }
25 |
26 | public void setToken(String token) {
27 | this.token = token;
28 | }
29 |
30 | public String getUserName() {
31 | return userName;
32 | }
33 |
34 | public void setUserName(String userName) {
35 | this.userName = userName;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/pojo/WrapperRspEntity.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data.pojo;
2 |
3 | /**
4 | * @author
5 | * @version 1.0
6 | * @date 3/5/2018
7 | */
8 |
9 | public class WrapperRspEntity {
10 | private int status;
11 | private T data;
12 | private String msg;
13 |
14 | public int getStatus() {
15 | return status;
16 | }
17 |
18 | public void setStatus(int status) {
19 | this.status = status;
20 | }
21 |
22 | public T getData() {
23 | return data;
24 | }
25 |
26 | public void setData(T data) {
27 | this.data = data;
28 | }
29 |
30 | public String getMsg() {
31 | return msg;
32 | }
33 |
34 | public void setMsg(String msg) {
35 | this.msg = msg;
36 | }
37 | }
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/response/GankPostResponse.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data.response;
2 |
3 | /**
4 | * @author
5 | * @version 1.0
6 | * @date 2018/3/12
7 | */
8 |
9 | public class GankPostResponse {
10 | }
11 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/response/NotLoginResponse.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data.response;
2 |
3 | /**
4 | * @author
5 | * @version 1.0
6 | * @date 2018/3/7
7 | */
8 |
9 | public class NotLoginResponse {
10 | /**
11 | * msg : need_login
12 | * code : 103
13 | * request : POST /v2/book/reviews
14 | */
15 |
16 | private String msg;
17 | private int code;
18 | private String request;
19 |
20 | public String getMsg() {
21 | return msg;
22 | }
23 |
24 | public void setMsg(String msg) {
25 | this.msg = msg;
26 | }
27 |
28 | public int getCode() {
29 | return code;
30 | }
31 |
32 | public void setCode(int code) {
33 | this.code = code;
34 | }
35 |
36 | public String getRequest() {
37 | return request;
38 | }
39 |
40 | public void setRequest(String request) {
41 | this.request = request;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/data/response/myinterface/MyResponseException.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.data.response.myinterface;
2 |
3 | /**
4 | * @author sam
5 | * @version 1.0
6 | * @date 2019/3/22
7 | */
8 | public class MyResponseException {
9 | /**
10 | * data :
11 | * code : 1
12 | * message : 请求失败
13 | */
14 |
15 | private String data;
16 | private int code;
17 | private String message;
18 |
19 | public String getData() {
20 | return data;
21 | }
22 |
23 | public void setData(String data) {
24 | this.data = data;
25 | }
26 |
27 | public int getCode() {
28 | return code;
29 | }
30 |
31 | public void setCode(int code) {
32 | this.code = code;
33 | }
34 |
35 | public String getMessage() {
36 | return message;
37 | }
38 |
39 | public void setMessage(String message) {
40 | this.message = message;
41 | }
42 |
43 | @Override
44 | public String toString() {
45 | return "MyResponseException{" + "data='" + data + '\'' + ", code=" + code + ", message='" + message + '\'' + '}';
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/exception/ApiErrorCode.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.exception;
2 |
3 | /**
4 | * @author
5 | * @version 1.0
6 | * @date 2018/3/14
7 | */
8 |
9 | public interface ApiErrorCode {
10 | /**
11 | * 客户端错误
12 | */
13 | int ERROR_CLIENT_AUTHORIZED = 1;
14 | /**
15 | * 用户授权失败
16 | */
17 | int ERROR_USER_AUTHORIZED = 2;
18 | /**
19 | * 请求参数错误
20 | */
21 | int ERROR_REQUEST_PARAM = 3;
22 | /**
23 | * 参数检验不通过
24 | */
25 | int ERROR_PARAM_CHECK = 4;
26 | /**
27 | * 自定义错误
28 | */
29 | int ERROR_OTHER = 10;
30 | /**
31 | * 无网络连接
32 | */
33 | int ERROR_NO_INTERNET = 11;
34 | }
35 |
36 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/exception/ApiException.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.exception;
2 |
3 | import com.cg.baseproject.request.data.BaseResponse;
4 |
5 | /**
6 | *
7 | * @author sam
8 | * @date 2019/3/20
9 | * @version 1.0
10 | */
11 | public class ApiException extends Exception {
12 | private int code;
13 | private String message;
14 |
15 | public ApiException(Throwable throwable, int code) {
16 | super(throwable);
17 | this.code = code;
18 | }
19 |
20 | public void setMessage(String message) {
21 | this.message = message;
22 | }
23 |
24 | @Override
25 | public String getMessage() {
26 | return message;
27 | }
28 |
29 | public int getCode() {
30 | return code;
31 | }
32 |
33 | public BaseResponse baseResult;
34 |
35 | public ApiException(String detailMessage) {
36 | super(detailMessage);
37 | setMessage(detailMessage);
38 | }
39 |
40 | public ApiException(BaseResponse detailMessage) {
41 | super(detailMessage.getMsg());
42 | // super(detailMessage.getMessage()+detailMessage.getMsg());
43 | this.baseResult = detailMessage;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/exception/ERROR.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.exception;
2 |
3 | /**
4 | * Created by 12262 on 2016/5/31.
5 | * 与服务器约定好的异常
6 | */
7 | public class ERROR {
8 | /**
9 | * 未知错误
10 | */
11 | public static final int UNKNOWN = 1000;
12 | /**
13 | * 解析错误ERROR
14 | */
15 | public static final int PARSE_ERROR = 1001;
16 | /**
17 | * 网络错误
18 | */
19 | public static final int NETWORD_ERROR = 1002;
20 | /**
21 | * 协议出错
22 | */
23 | public static final int HTTP_ERROR = 1003;
24 |
25 | /**
26 | * 证书出错
27 | */
28 | public static final int SSL_ERROR = 1005;
29 | }
30 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/exception/ResultException.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.exception;
2 |
3 | /**
4 | * @author
5 | * @version 1.0
6 | * @date 2018/3/14
7 | */
8 |
9 | public class ResultException extends RuntimeException {
10 |
11 | private int errCode = 0;
12 |
13 | public ResultException(int errCode, String msg) {
14 | super(msg);
15 | this.errCode = errCode;
16 | }
17 |
18 | public int getErrCode() {
19 | return errCode;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/exception/ServerException.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.exception;
2 |
3 | /**
4 | * Created by 12262 on 2016/5/31.
5 | */
6 | public class ServerException extends RuntimeException {
7 | private int code;
8 | private String msg;
9 |
10 | public ServerException(int code, String msg) {
11 | this.code = code;
12 | this.msg = msg;
13 | }
14 |
15 | public int getCode() {
16 | return code;
17 | }
18 |
19 | public String getMsg() {
20 | return msg;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/RequestAPI.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit;
2 |
3 | /**
4 | * @author sam
5 | * @version 1.0
6 | * @date 2018/3/20
7 | */
8 | public class RequestAPI extends BaseRequestBusiness {
9 | private T t;
10 | private static RequestAPI mRequestAPI;
11 |
12 | /**
13 | * 单例模式,得到RequestAPI的实例
14 | * @date 2019/3/21
15 | * @version 1.0
16 | * @param * @param null
17 | * @return
18 | */
19 | public static synchronized RequestAPI getInstance() {
20 | if (mRequestAPI == null) {
21 | mRequestAPI = new RequestAPI();
22 | }
23 | return mRequestAPI;
24 | }
25 |
26 | /**
27 | * 得到API请求接口类
28 | * @date 2019/3/21
29 | * @version 1.0
30 | * @param * @Class 传入工程接口类
31 | * @return
32 | */
33 | // @SuppressWarnings("unchecked")
34 | public T getApi(Class apiInterfaceClazz) {
35 | if (t == null) {
36 | t = (T) RetrofitRequestManager.getInstance().getRetrofit().create(apiInterfaceClazz);
37 | }
38 | return t;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/cache/CookieJar.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.cache;
2 |
3 | import java.util.HashMap;
4 | import java.util.List;
5 |
6 | import okhttp3.Cookie;
7 | import okhttp3.HttpUrl;
8 |
9 | /**
10 | * @author
11 | * @version 1.0
12 | * @date 2018/3/9
13 | */
14 |
15 | public class CookieJar {
16 | // httpClientBuilder.cookieJar(new CookieJar() {
17 | // final HashMap> cookieStore = new HashMap<>();
18 | //
19 | // @Override
20 | // public void saveFromResponse(HttpUrl url, List cookies) {
21 | // cookieStore.put(url, cookies);//保存cookie
22 | // //也可以使用SP保存
23 | // }
24 | //
25 | // @Override
26 | // public List loadForRequest(HttpUrl url) {
27 | // List cookies = cookieStore.get(url);//取出cookie
28 | // return cookies != null ? cookies : new ArrayList();
29 | // }
30 | // });
31 | }
32 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/cache/RetrofitCache.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.cache;
2 |
3 | import com.cg.baseproject.BaseApplication;
4 |
5 | import java.io.File;
6 |
7 | import okhttp3.Cache;
8 |
9 | /**
10 | * @author
11 | * @version 1.0
12 | * @date 2018/3/9
13 | */
14 |
15 | public class RetrofitCache {
16 | //创建Cache
17 | File httpCacheDirectory = new File(BaseApplication.getContext().getCacheDir(), "OkHttpCache");
18 | Cache cache = new Cache(httpCacheDirectory, 10 * 1024 * 1024);
19 | // httpClientBuilder.cache(cache);
20 | // //设置缓存
21 | // httpClientBuilder.addNetworkInterceptor(getCacheInterceptor2());
22 | // httpClientBuilder.addInterceptor(getCacheInterceptor2());
23 | }
24 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/converter/FastJsonRequestBodyConverter.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.converter;
2 |
3 | /**
4 | * @author
5 | * @version 1.0
6 | * @date 2018/8/7
7 | */
8 | import com.alibaba.fastjson.JSON;
9 |
10 | import java.io.IOException;
11 |
12 | import okhttp3.MediaType;
13 | import okhttp3.RequestBody;
14 | import retrofit2.Converter;
15 |
16 | /**
17 | * 类名称: FastJsonRequestBodyConverter
18 | * 类描述: RequestBody转换器
19 | * 创建人: Lincoln
20 | * 修改人: Lincoln
21 | * 修改时间: 2016年03月08日 下午5:02
22 | * 修改备注:
23 | *
24 | * @version 1.0.0
25 | */
26 | public class FastJsonRequestBodyConverter implements Converter {
27 | private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");
28 |
29 | @Override
30 | public RequestBody convert(T value) throws IOException {
31 | return RequestBody.create(MEDIA_TYPE, JSON.toJSONBytes(value));
32 | }
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/converter/FastJsonResponseBodyConverter.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.converter;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import java.io.IOException;
5 | import java.lang.reflect.Type;
6 | import okhttp3.ResponseBody;
7 | import okio.BufferedSource;
8 | import okio.Okio;
9 | import retrofit2.Converter;
10 |
11 | /**
12 | * 类名称: FastJsonResponseBodyConverter
13 | * 类描述: ResponseBody转换器
14 | * 创建人: Lincoln
15 | * 修改人: Lincoln
16 | * 修改时间: 2016年03月08日 下午3:58
17 | * 修改备注:
18 | *
19 | * @version 1.0.0
20 | */
21 | public class FastJsonResponseBodyConverter implements Converter {
22 | private final Type type;
23 |
24 | public FastJsonResponseBodyConverter(Type type) {
25 | this.type = type;
26 | }
27 |
28 | /*
29 | * 转换方法
30 | */
31 | @Override
32 | public T convert(ResponseBody value) throws IOException {
33 | BufferedSource bufferedSource = Okio.buffer(value.source());
34 | String tempStr = bufferedSource.readUtf8();
35 | bufferedSource.close();
36 | return JSON.parseObject(tempStr, type);
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/converter/MyGsonRequestBodyConverter.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.converter;
2 |
3 | import com.google.gson.Gson;
4 | import com.google.gson.TypeAdapter;
5 | import com.google.gson.stream.JsonWriter;
6 |
7 | import java.io.IOException;
8 | import java.io.OutputStreamWriter;
9 | import java.io.Writer;
10 | import java.nio.charset.Charset;
11 |
12 | import okhttp3.MediaType;
13 | import okhttp3.RequestBody;
14 | import okhttp3.ResponseBody;
15 | import okio.Buffer;
16 | import retrofit2.Converter;
17 | /**
18 | * @author sam
19 | * @version 1.0
20 | * @date 2018/8/4
21 | */
22 | public class MyGsonRequestBodyConverter implements Converter {
23 | private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");
24 | private static final Charset UTF_8 = Charset.forName("UTF-8");
25 | private final Gson gson;
26 | private final TypeAdapter adapter;
27 |
28 | public MyGsonRequestBodyConverter(Gson gson, TypeAdapter adapter) {
29 | this.gson = gson;
30 | this.adapter = adapter;
31 | }
32 |
33 | @Override
34 | public RequestBody convert(T value) throws IOException {
35 | Buffer buffer = new Buffer();
36 | Writer writer = new OutputStreamWriter(buffer.outputStream(), UTF_8);
37 | JsonWriter jsonWriter = gson.newJsonWriter(writer);
38 | adapter.write(jsonWriter, value);
39 | jsonWriter.close();
40 | return RequestBody.create(MEDIA_TYPE, buffer.readByteString());
41 | }
42 | }
43 |
44 |
45 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/converter/MyStringRequestBodyConverter.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.converter;
2 |
3 | import java.io.IOException;
4 | import java.io.OutputStreamWriter;
5 | import java.io.Writer;
6 | import java.nio.charset.Charset;
7 |
8 | import okhttp3.MediaType;
9 | import okhttp3.RequestBody;
10 | import okhttp3.ResponseBody;
11 | import okio.Buffer;
12 | import retrofit2.Converter;
13 |
14 | /**
15 | * @author sam
16 | * @version 1.0
17 | * @date 2018/3/14
18 | */
19 |
20 | public class MyStringRequestBodyConverter implements Converter {
21 | private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");
22 | private static final Charset UTF_8 = Charset.forName("UTF-8");
23 |
24 |
25 | @Override public RequestBody convert(String value) throws IOException {
26 | Buffer buffer = new Buffer();
27 | Writer writer = new OutputStreamWriter(buffer.outputStream(), UTF_8);
28 | writer.write(value);
29 | writer.close();
30 | return RequestBody.create(MEDIA_TYPE, buffer.readByteString());
31 | }
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/converter/MyStringResponseConverter.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.converter;
2 |
3 | import com.cg.baseproject.configs.BaseProjectConfig;
4 | import com.cg.baseproject.request.data.BaseResponse;
5 | import com.cg.baseproject.request.exception.ServerException;
6 | import com.google.gson.Gson;
7 |
8 | import java.io.IOException;
9 | import java.lang.reflect.Type;
10 |
11 | import okhttp3.ResponseBody;
12 | import retrofit2.Converter;
13 |
14 | /**
15 | * @author sam
16 | * @version 1.0
17 | * @date 2018/3/14
18 | */
19 |
20 | public class MyStringResponseConverter implements Converter {
21 |
22 | @Override
23 | public String convert(ResponseBody value) throws IOException {
24 | try {
25 | return value.string();
26 | } finally {
27 | value.close();
28 | }
29 | }
30 | }
31 |
32 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/factory/FastJsonConverterFactory.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.factory;
2 |
3 | import com.cg.baseproject.request.retrofit.converter.FastJsonRequestBodyConverter;
4 | import com.cg.baseproject.request.retrofit.converter.FastJsonResponseBodyConverter;
5 |
6 | import java.lang.annotation.Annotation;
7 | import java.lang.reflect.Type;
8 |
9 | import okhttp3.RequestBody;
10 | import okhttp3.ResponseBody;
11 | import retrofit2.Converter;
12 | import retrofit2.Retrofit;
13 |
14 | /**
15 | * 类名称: FastJsonConverterFactory
16 | * 类描述: FastJsonCoverter
17 | * 创建人: Lincoln
18 | * 修改人: Lincoln
19 | * 修改时间: 2016年03月08日 下午3:48
20 | * 修改备注:
21 | *
22 | * @version 1.0.0
23 | */
24 | public class FastJsonConverterFactory extends Converter.Factory{
25 |
26 | public static FastJsonConverterFactory create() {
27 | return new FastJsonConverterFactory();
28 | }
29 |
30 | /**
31 | * 需要重写父类中responseBodyConverter,该方法用来转换服务器返回数据
32 | */
33 | @Override
34 | public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
35 | return new FastJsonResponseBodyConverter<>(type);
36 | }
37 |
38 | /**
39 | * 需要重写父类中responseBodyConverter,该方法用来转换发送给服务器的数据
40 | */
41 | @Override
42 | public Converter, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
43 | return new FastJsonRequestBodyConverter<>();
44 | }
45 | }
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/factory/MyStringConverterFactory.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.factory;
2 |
3 | import com.cg.baseproject.request.retrofit.converter.MyStringRequestBodyConverter;
4 | import com.cg.baseproject.request.retrofit.converter.MyStringResponseConverter;
5 |
6 | import java.lang.annotation.Annotation;
7 | import java.lang.reflect.Type;
8 |
9 | import okhttp3.RequestBody;
10 | import okhttp3.ResponseBody;
11 | import retrofit2.Converter;
12 | import retrofit2.Retrofit;
13 | /**
14 | * @author
15 | * @version 1.0
16 | * @date 2018/8/4
17 | */
18 | public class MyStringConverterFactory extends Converter.Factory {
19 |
20 | public static final MyStringConverterFactory INSTANCE = new MyStringConverterFactory();
21 |
22 | public static MyStringConverterFactory create() {
23 | return INSTANCE;
24 | }
25 |
26 | @Override
27 | public Converter responseBodyConverter(Type type, Annotation[] annotations,
28 | Retrofit retrofit) {
29 | return new MyStringResponseConverter();
30 | }
31 |
32 | @Override
33 | public Converter, RequestBody> requestBodyConverter(Type type,
34 | Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
35 | return new MyStringRequestBodyConverter();
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/interceptor/CommonParamsInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.interceptor;
2 |
3 |
4 | import java.io.IOException;
5 |
6 | import okhttp3.HttpUrl;
7 | import okhttp3.Interceptor;
8 | import okhttp3.Request;
9 | import okhttp3.Response;
10 |
11 | /**
12 | * @author
13 | * @version 1.0
14 | * @date 2018/3/9
15 | */
16 |
17 | public class CommonParamsInterceptor implements Interceptor {
18 | @Override
19 | public Response intercept(Chain chain) throws IOException {
20 | Request originRequest = chain.request();
21 | Request request;
22 | HttpUrl httpUrl = originRequest.url().newBuilder().
23 | addQueryParameter("paltform", "android").
24 | addQueryParameter("version", "1.0.0").build();
25 | request = originRequest.newBuilder().url(httpUrl).build();
26 | return chain.proceed(request);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/interceptor/EncryptInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.interceptor;
2 |
3 | import java.io.IOException;
4 |
5 | import okhttp3.Interceptor;
6 | import okhttp3.Request;
7 | import okhttp3.Response;
8 |
9 | /**
10 | * @author
11 | * @version 1.0
12 | * @date 3/8/2018
13 | */
14 |
15 | public class EncryptInterceptor implements Interceptor {
16 | @Override
17 | public Response intercept(Interceptor.Chain chain) throws IOException {
18 | Request request = chain.request();
19 | //这个是请求的url,也就是咱们前面配置的baseUrl
20 | String url = request.url().toString();
21 | //这个是请求方法
22 | String method = request.method();
23 | // long t1 = System.nanoTime(); request = encrypt(request);
24 | //模拟的加密方法
25 | Response response = chain.proceed(request);
26 | long t2 = System.nanoTime();
27 | // response = decrypt(response);
28 | return response;
29 | }
30 |
31 |
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/interceptor/HeaderInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.interceptor;
2 |
3 |
4 | import java.io.IOException;
5 |
6 | import okhttp3.Interceptor;
7 | import okhttp3.Request;
8 | import okhttp3.Response;
9 |
10 | /**
11 | * 添加请求头
12 | * @author
13 | * @version 1.0
14 | * @date 3/8/2018
15 | */
16 |
17 | public class HeaderInterceptor implements Interceptor {
18 | @Override
19 | public Response intercept(Chain chain) throws IOException {
20 | Request originalRequest = chain.request();
21 | Request.Builder builder = originalRequest.newBuilder();
22 | builder.addHeader("version", "1");
23 | builder.addHeader("time", System.currentTimeMillis() + "");
24 |
25 | Request.Builder requestBuilder = builder.method(originalRequest.method(), originalRequest.body());
26 | Request request = requestBuilder.build();
27 | return chain.proceed(request);
28 | }
29 | // @Override
30 | // public Response intercept(Chain chain) throws IOException {
31 | // Request original = chain.request();
32 | // Request request = original.newBuilder()
33 | // .addHeader("userData", "json")
34 | // .method(original.method(), original.body())
35 | // .build();
36 | // return chain.proceed(request);
37 | // }
38 | }
39 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/interceptor/QueryParameterInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.interceptor;
2 |
3 |
4 | import java.io.IOException;
5 |
6 | import okhttp3.HttpUrl;
7 | import okhttp3.Interceptor;
8 | import okhttp3.Request;
9 | import okhttp3.Response;
10 |
11 | /**
12 | * @author
13 | * @version 1.0
14 | * @date 2018/3/9
15 | */
16 |
17 | public class QueryParameterInterceptor implements Interceptor {
18 | @Override
19 | public Response intercept(Chain chain) throws IOException {
20 | Request originalRequest = chain.request();
21 | Request request;
22 | HttpUrl modifiedUrl = originalRequest.url().newBuilder()
23 | // Provide your custom parameter here
24 | .addQueryParameter("platform", "android")
25 | .addQueryParameter("version", "1.0.0")
26 | .build();
27 | request = originalRequest.newBuilder().url(modifiedUrl).build();
28 | return chain.proceed(request);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/interceptor/ResponseTimeInterceptors.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.interceptor;
2 |
3 |
4 | import java.io.IOException;
5 | import okhttp3.Interceptor;
6 | import okhttp3.Response;
7 |
8 | /**
9 | * @author
10 | * @version 1.0
11 | * @date 2018/3/9
12 | */
13 |
14 | public class ResponseTimeInterceptors implements Interceptor {
15 | @Override
16 | public Response intercept(Chain chain) throws IOException {
17 | okhttp3.Response response = chain.proceed(chain.request());
18 | String timestamp = response.header("time");
19 | if (timestamp != null) {
20 | //获取到响应header中的time
21 | }
22 | return response;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/retrofit/progress/ProgressCancelListener.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.retrofit.progress;
2 |
3 | /**
4 | * Created by sam on 16/3/10.
5 | */
6 | public interface ProgressCancelListener {
7 | void onCancelProgress();
8 | }
9 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/request/volley/VolleyRequestBusiness.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.request.volley;
2 |
3 | import com.google.gson.Gson;
4 | import java.util.HashMap;
5 | import java.util.Map;
6 |
7 | /**
8 | * @ClassName: RequestBusiness
9 | * @Description: 对所有接口进行统一管理,所有接口统一在这里注册
10 | * 接口测试链接:http://huoli.sgs8.com/test.aspx
11 | * @author sam
12 | */
13 | public class VolleyRequestBusiness {
14 | //服务器地址
15 | private static Gson gson = new Gson();
16 | private static Map params = new HashMap();
17 |
18 | //用户建议接口
19 | /*public static void userSuggest(String uid, String cid, String suggestion, String contact, Response.Listener succesListener, ErrorListener erroListener){
20 | params.clear();
21 | params.put("uid", uid);
22 | params.put("cid", cid);
23 | params.put("suggestion", suggestion);
24 | params.put("contact", contact);
25 | RequestManager.getQueueInstance().add(new GsonRequest(URLContants.getSuggestURL(),
26 | PostResponseResultData.class,params,succesListener,erroListener));
27 | }*/
28 |
29 | //版本更新接口
30 | /*public static void versionUpdate(String vr, String md5, String pn, String type, Response.Listener succesListener, ErrorListener erroListener){
31 | RequestManager.getQueueInstance().add(new GsonRequest(URLContants.getApkUpdateURL(vr, md5, pn, type),
32 | UpdateReturnData.class,succesListener,erroListener));
33 | }*/
34 |
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/rx/rxbus/AbstractSubscriber.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 Anadea Inc
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.cg.baseproject.rx.rxbus;
18 |
19 | import io.reactivex.disposables.Disposable;
20 | import io.reactivex.functions.Consumer;
21 |
22 | abstract class AbstractSubscriber implements Consumer, Disposable {
23 |
24 | private volatile boolean disposed;
25 |
26 | @Override
27 | public void accept(T event) {
28 | try {
29 | acceptEvent(event);
30 | } catch (Exception e) {
31 | throw new RuntimeException("Could not dispatch event: " + event.getClass(), e);
32 | }
33 | }
34 |
35 | @Override
36 | public void dispose() {
37 | if (!disposed) {
38 | disposed = true;
39 | release();
40 | }
41 | }
42 |
43 | @Override
44 | public boolean isDisposed() {
45 | return disposed;
46 | }
47 |
48 | protected abstract void acceptEvent(T event) throws Exception;
49 |
50 | protected abstract void release();
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/rx/rxbus/Bus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 Anadea Inc
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.cg.baseproject.rx.rxbus;
18 |
19 |
20 | import androidx.annotation.NonNull;
21 | import io.reactivex.functions.Consumer;
22 |
23 | public interface Bus {
24 |
25 | void register(@NonNull Object observer);
26 |
27 | CustomSubscriber obtainSubscriber(@NonNull Class eventClass, @NonNull Consumer receiver);
28 |
29 | void registerSubscriber(@NonNull Object observer, @NonNull CustomSubscriber subscriber);
30 |
31 | void unregister(@NonNull Object observer);
32 |
33 | void post(@NonNull Object event);
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/rx/rxbus/BusProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 Anadea Inc
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.cg.baseproject.rx.rxbus;
18 |
19 | public final class BusProvider {
20 |
21 | private BusProvider() {
22 | }
23 |
24 | public static Bus getInstance() {
25 | return BusHolder.INSTANCE;
26 | }
27 |
28 | private static final class BusHolder {
29 | final static Bus INSTANCE = new RxBus();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/rx/rxbus/Subscribe.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 Anadea Inc
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.cg.baseproject.rx.rxbus;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | @Retention(RetentionPolicy.RUNTIME)
25 | @Target(ElementType.METHOD)
26 | public @interface Subscribe {
27 | }
28 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/rx/rxbus/event/Event.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.rx.rxbus.event;
2 |
3 | /**
4 | * @author
5 | * @version 1.0
6 | * @date 2017/6/20 0020
7 | */
8 |
9 | public class Event {
10 | private String id;
11 | private String name;
12 | private String tips;
13 |
14 | public Event(String id, String name, String tips) {
15 | this.id = id;
16 | this.name = name;
17 | this.tips = tips;
18 | }
19 |
20 | public String getId() {
21 | return id;
22 | }
23 |
24 | public void setId(String id) {
25 | this.id = id;
26 | }
27 |
28 | public String getName() {
29 | return name;
30 | }
31 |
32 | public void setName(String name) {
33 | this.name = name;
34 | }
35 |
36 | public String getTips() {
37 | return tips;
38 | }
39 |
40 | public void setTips(String tips) {
41 | this.tips = tips;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/rx/rxbus/event/EventTypes.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.rx.rxbus.event;
2 |
3 | /**
4 | * @author
5 | * @version 1.0
6 | * @date 2017/6/20 0020
7 | */
8 |
9 | public class EventTypes {
10 | public static final String DATA_SYN = "com.gatz.stwl.DATA_SYN";
11 | }
12 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/rx/rxbus/event/RxBusListener.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.rx.rxbus.event;
2 |
3 | public class RxBusListener {
4 | public interface IRxBusListener {
5 | public void onRxBusStateChanged(int state);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/rx/rxbus/event/RxBusListenerManager.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.rx.rxbus.event;
2 |
3 |
4 | public class RxBusListenerManager {
5 | private static RxBusListenerManager mRxBusListenerManager;
6 |
7 | public static RxBusListenerManager getInstance() {
8 | if (mRxBusListenerManager == null) {
9 | mRxBusListenerManager = new RxBusListenerManager();
10 | }
11 | return mRxBusListenerManager;
12 | }
13 |
14 | //声明一个注册监听状态的监听器引用
15 | public RxBusListener.IRxBusListener mIRxBusListener;
16 | //回调接口的监听器
17 | public void setRxBusListener(RxBusListener.IRxBusListener iRxBusListener){
18 | mIRxBusListener = iRxBusListener;
19 | }
20 |
21 | public void triggerRxBusListener(int state){
22 | if(mIRxBusListener != null){
23 | mIRxBusListener.onRxBusStateChanged(state);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/screenadaptation/base/BaseScreenAdaptActivity.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.screenadaptation.base;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.appcompat.app.AppCompatActivity;
6 |
7 | /**
8 | * @author sam
9 | * @version 1.0
10 | * @date 2018/8/12
11 | */
12 | public abstract class BaseScreenAdaptActivity extends AppCompatActivity {
13 |
14 | protected abstract void initScreenAdaption();//初始化屏幕适配
15 | protected abstract int getActivityLayoutId();////布局中Fragment的ID
16 | protected abstract void initViews();//初始化界面
17 | protected abstract void initData();// 初始化数据,请求网络数据等
18 |
19 | @Override
20 | public void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | initScreenAdaption();
23 | setContentView(getActivityLayoutId());
24 | initViews();
25 | initData();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/security/Aauthority.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.security;
2 |
3 | /**
4 | * @author
5 | * @version 1.0
6 | * @date 2022/4/18
7 | */
8 | public class Aauthority {
9 | }
10 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/utils/SingletonUtils.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.utils;
2 |
3 | /**
4 | * @Description:主要功能:Singleton helper class for lazily initialization
5 | * @Prject: CommonUtilLibrary
6 | * @Package: com.jingewenku.abrahamcaijin.commonutil
7 | * @author: AbrahamCaiJin
8 | * @date: 2017年05月24日 18:17
9 | * @Copyright: 个人版权所有
10 | * @Company:
11 | * @version: 1.0.0
12 | */
13 |
14 | public abstract class SingletonUtils {
15 |
16 | private T instance;
17 |
18 | protected abstract T newInstance();
19 |
20 | public final T getInstance() {
21 | if (instance == null) {
22 | synchronized (SingletonUtils.class) {
23 | if (instance == null) {
24 | instance = newInstance();
25 | }
26 | }
27 | }
28 | return instance;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/utils/android/AdbUtils.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.utils.android;
2 |
3 | import java.io.DataOutputStream;
4 | import java.util.ArrayList;
5 | import java.util.List;
6 |
7 | /**
8 | * @author
9 | * @version 1.0
10 | * @date 2018/4/4
11 | */
12 | public class AdbUtils {
13 |
14 | public static void doCmds(String cmd) throws Exception {
15 | List listCmd = new ArrayList();
16 | listCmd.add(cmd);
17 | doCmds(listCmd);
18 |
19 | }
20 | public static void doCmds(List cmds) throws Exception {
21 | Process process = Runtime.getRuntime().exec("su");
22 | DataOutputStream os = new DataOutputStream(process.getOutputStream());
23 | for (String tmpCmd : cmds) {
24 | os.writeBytes(tmpCmd+"\n");
25 | }
26 | os.writeBytes("exit\n");
27 | os.flush();
28 | os.close();
29 | process.waitFor();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/utils/android/HtmlUtils.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.utils.android;
2 |
3 | /**
4 | * @Description:主要功能:html标签管理类
5 | * @Prject: CommonUtilLibrary
6 | * @Package: com.jingewenku.abrahamcaijin.commonutil
7 | * @author: AbrahamCaiJin
8 | * @date: 2017年05月24日 18:15
9 | * @Copyright: 个人版权所有
10 | * @Company:
11 | * @version: 1.0.0
12 | */
13 |
14 | public class HtmlUtils {
15 | /**
16 | * 为给定的字符串添加HTML红色标记,当使用Html.fromHtml()方式显示到TextView 的时候其将是红色的
17 | * @param string 给定的字符串
18 | * @return
19 | */
20 | public static String addHtmlRedFlag(String string){
21 | return ""+string+"";
22 | }
23 |
24 | /**
25 | * 将给定的字符串中所有给定的关键字标红
26 | * @param sourceString 给定的字符串
27 | * @param keyword 给定的关键字
28 | * @return 返回的是带Html标签的字符串,在使用时要通过Html.fromHtml()转换为Spanned对象再传递给TextView对象
29 | */
30 | public static String keywordMadeRed(String sourceString, String keyword){
31 | String result = "";
32 | if(sourceString != null && !"".equals(sourceString.trim())){
33 | if(keyword != null && !"".equals(keyword.trim())){
34 | result = sourceString.replaceAll(keyword, ""+keyword+"");
35 | }else{
36 | result = sourceString;
37 | }
38 | }
39 | return result;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/utils/android/KeyBoardUtils.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.utils.android;
2 |
3 | import android.content.Context;
4 | import android.view.inputmethod.InputMethodManager;
5 | import android.widget.EditText;
6 |
7 | /**
8 | * Created by sam on 2017/4/25.
9 | * 手机键盘工具类
10 | */
11 |
12 | public class KeyBoardUtils {
13 |
14 | /**
15 | * 打开软键盘
16 | *
17 | * @param mEditText
18 | * 输入框
19 | * @param mContext
20 | * 上下文
21 | */
22 | public static void openKeybord(EditText mEditText, Context mContext) {
23 | InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
24 | imm.showSoftInput(mEditText, InputMethodManager.RESULT_SHOWN);
25 | imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
26 | }
27 |
28 | /**
29 | * 关闭软键盘
30 | *
31 | * @param mEditText
32 | * 输入框
33 | * @param mContext
34 | * 上下文
35 | */
36 | public static void closeKeybord(EditText mEditText, Context mContext) {
37 | InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
38 | imm.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/utils/android/SettingUtils.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.utils.android;
2 |
3 | import com.cg.baseproject.BaseApplication;
4 |
5 | /**
6 | * @author
7 | * @version 1.0
8 | * @date 2018/3/5
9 | */
10 |
11 | public class SettingUtils {
12 | private static SettingUtils instance;
13 | private SharedPreferencesUtils preferenceUtils;
14 | private static final String IS_LOGIN = "is_login";//用户是否登录
15 |
16 | /**
17 | * SettingUtils.getInstance().setIsLogin(true);//设置登录配置项
18 | SettingUtils.getInstance().getIsLogin();//获取登录配置项,false为默认值
19 | * @param isLogin
20 | */
21 | public void setIsLogin(boolean isLogin){
22 | preferenceUtils.setParam(IS_LOGIN,isLogin);
23 | }
24 |
25 | public boolean getIsLogin(){
26 | return (Boolean) preferenceUtils.getParam(IS_LOGIN,false);
27 | }
28 |
29 |
30 | /**
31 | * 创建一个新的实例 SettingsUtils.
32 | */
33 | private SettingUtils() {
34 | preferenceUtils = SharedPreferencesUtils.getInstance();
35 | }
36 |
37 | public static synchronized SettingUtils getInstance(){
38 | if (instance == null) {
39 | instance = new SettingUtils();
40 | }
41 | return instance;
42 | }
43 |
44 | public void clearSettings() {
45 | preferenceUtils.clear(BaseApplication.getContext());
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/view/loading/leafloading/UiUtils.java:
--------------------------------------------------------------------------------
1 |
2 | package com.cg.baseproject.view.loading.leafloading;
3 |
4 | import android.content.Context;
5 | import android.util.DisplayMetrics;
6 | import android.view.WindowManager;
7 |
8 | public class UiUtils {
9 |
10 | static public int getScreenWidthPixels(Context context) {
11 | DisplayMetrics dm = new DisplayMetrics();
12 | ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()
13 | .getMetrics(dm);
14 | return dm.widthPixels;
15 | }
16 |
17 | static public int dipToPx(Context context, int dip) {
18 | return (int) (dip * getScreenDensity(context) + 0.5f);
19 | }
20 |
21 | static public float getScreenDensity(Context context) {
22 | try {
23 | DisplayMetrics dm = new DisplayMetrics();
24 | ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()
25 | .getMetrics(dm);
26 | return dm.density;
27 | } catch (Exception e) {
28 | return DisplayMetrics.DENSITY_DEFAULT;
29 | }
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/view/loading/progress/ProgressLoading.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.view.loading.progress;
2 |
3 |
4 | import android.app.Dialog;
5 | import android.content.Context;
6 | import android.widget.TextView;
7 |
8 | import com.cg.baseproject.R;
9 |
10 | public class ProgressLoading {
11 | private Context mContext;
12 | private Dialog progressDialog;
13 |
14 | public ProgressLoading(Context context) {
15 | mContext = context;
16 | }
17 |
18 | public Dialog loadDialog() {
19 | progressDialog = new Dialog(mContext, R.style.progress_dialog);
20 | progressDialog.setContentView(R.layout.progress_loading);
21 | progressDialog.setCancelable(true);
22 | progressDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
23 | TextView msg = (TextView) progressDialog.findViewById(R.id.id_tv_loadingmsg);
24 | msg.setText("玩命加载中...");
25 | progressDialog.setCanceledOnTouchOutside(true);
26 | progressDialog.show();
27 | return progressDialog;
28 | }
29 |
30 | public void removeDialog() {
31 | progressDialog.dismiss();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/view/nicespinner/SimpleSpinnerTextFormatter.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.view.nicespinner;
2 |
3 | import android.text.Spannable;
4 | import android.text.SpannableString;
5 |
6 | public class SimpleSpinnerTextFormatter implements SpinnerTextFormatter {
7 |
8 | @Override public Spannable format(String text) {
9 | return new SpannableString(text);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/view/nicespinner/SpinnerTextFormatter.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.view.nicespinner;
2 |
3 | import android.text.Spannable;
4 |
5 | public interface SpinnerTextFormatter {
6 | Spannable format(String text);
7 | }
8 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/view/searchview/ICallBack.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.view.searchview;
2 |
3 | /**
4 | * Created by Carson_Ho on 17/8/10.
5 | */
6 |
7 | public interface ICallBack {
8 | void SearchAciton(String string);
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/view/searchview/RecordSQLiteOpenHelper.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.view.searchview;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteOpenHelper;
6 |
7 | /**
8 | * Created by Carson_Ho on 17/8/10.
9 | */
10 |
11 | // 继承自SQLiteOpenHelper数据库类的子类
12 | public class RecordSQLiteOpenHelper extends SQLiteOpenHelper {
13 |
14 | private static String name = "temp.db";
15 | private static Integer version = 1;
16 |
17 | public RecordSQLiteOpenHelper(Context context) {
18 | super(context, name, null, version);
19 | }
20 |
21 | @Override
22 | public void onCreate(SQLiteDatabase db) {
23 | // 打开数据库 & 建立了一个叫records的表,里面只有一列name来存储历史记录:
24 | db.execSQL("create table records(id integer primary key autoincrement,name varchar(200))");
25 | }
26 |
27 | @Override
28 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
29 |
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/view/searchview/SearchListView.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.view.searchview;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.ListView;
6 |
7 | /**
8 | * Created by Carson_Ho on 17/8/10.
9 | */
10 |
11 | public class SearchListView extends ListView {
12 | public SearchListView(Context context) {
13 | super(context);
14 | }
15 |
16 | public SearchListView(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | }
19 |
20 | public SearchListView(Context context, AttributeSet attrs, int defStyle) {
21 | super(context, attrs, defStyle);
22 | }
23 |
24 | //通过复写其onMeasure方法、达到对ScrollView适配的效果
25 | @Override
26 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
27 | int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
28 | MeasureSpec.AT_MOST);
29 | super.onMeasure(widthMeasureSpec, expandSpec);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/view/searchview/bCallBack.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.view.searchview;
2 |
3 | /**
4 | * Created by Carson_Ho on 17/8/11.
5 | */
6 |
7 | public interface bCallBack {
8 | void BackAciton();
9 | }
10 |
--------------------------------------------------------------------------------
/baseproject/src/main/java/com/cg/baseproject/view/view/progress/ProgressBarLayout.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject.view.view.progress;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.MotionEvent;
6 | import android.view.View;
7 | import android.view.animation.ScaleAnimation;
8 | import android.widget.ProgressBar;
9 | import android.widget.RelativeLayout;
10 | import android.widget.TextView;
11 |
12 | import com.cg.baseproject.R;
13 |
14 | public class ProgressBarLayout extends RelativeLayout {
15 | private View view;
16 | private ProgressBar imgProgress;
17 | private TextView tvProgress;
18 | private ScaleAnimation animation;
19 | public ProgressBarLayout(Context context) {
20 | super(context);
21 | addProgressView(context);
22 | }
23 |
24 | public ProgressBarLayout(Context context, AttributeSet attrs) {
25 | super(context, attrs);
26 | addProgressView(context);
27 | }
28 | private void addProgressView(Context context){
29 | view= View.inflate(context, R.layout.progress_bar_layout, null);
30 | imgProgress=(ProgressBar)view.findViewById(R.id.imgProgress);
31 | tvProgress=(TextView)view.findViewById(R.id.tvProgress);
32 | addView(view);
33 | }
34 | public void show(){
35 | setVisibility(VISIBLE);
36 | }
37 | public void hide(){
38 | setVisibility(GONE);
39 | }
40 | @Override
41 | public boolean dispatchTouchEvent(MotionEvent ev) {
42 | return true;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/anim/dialog_enter.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/anim/dialog_exit.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/anim/rotate_animation.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
13 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/color/color_bt_top_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/color/color_btn1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-nodpi/drop_down_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-nodpi/drop_down_shadow.9.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xhdpi/ic_arrow_drop_down_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xhdpi/ic_arrow_drop_down_black_24dp.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/back.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/clear.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/ic_arrow_drop_down_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/ic_arrow_drop_down_black_24dp.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_01.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_02.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_03.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_04.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_05.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_06.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_07.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_08.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_09.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_10.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_11.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/ic_loading_white_12.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/img_load_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/img_load_error.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/img_loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/img_loading.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxhdpi/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxhdpi/search.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable-xxxhdpi/ic_arrow_drop_down_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable-xxxhdpi/ic_arrow_drop_down_black_24dp.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/arrow.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/bg_alpha_twenty.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/btn_back.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/dialog_loading.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/line_dashed.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
11 |
12 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/line_h_gray.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/line_solid.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/load_progress_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/loading_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable/loading_bg.9.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/progress_drawable_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/shape_radius.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/spinner_drawable.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/sys_toast.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/drawable/sys_toast.9.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/vbtn_arrow_back.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/vbtn_arrow_forward.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/vbtn_arrow_more.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/vbtn_titlebar_me.xml:
--------------------------------------------------------------------------------
1 |
6 |
12 |
13 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/drawable/vbtn_titlebar_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
12 |
13 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/layout/bad_network.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/layout/content_page_loading.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
11 |
12 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/layout/loading.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/layout/progress_bar_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
27 |
28 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/layout/progress_loading.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
23 |
24 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/layout/progressbar_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/layout/reset_error_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
19 |
29 |
30 |
40 |
41 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/layout/spinner_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/layout/view_empty_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/mipmap-xxhdpi/btn_back_n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/mipmap-xxhdpi/btn_back_n.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/mipmap-xxhdpi/dialog_loading_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/mipmap-xxhdpi/dialog_loading_img.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/mipmap-xxhdpi/fengshan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/mipmap-xxhdpi/fengshan.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/mipmap-xxhdpi/ic_load_err.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/mipmap-xxhdpi/ic_load_err.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/mipmap-xxhdpi/icon_no_net.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/mipmap-xxhdpi/icon_no_net.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/mipmap-xxhdpi/leaf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/mipmap-xxhdpi/leaf.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/mipmap-xxhdpi/leaf_kuang.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/mipmap-xxhdpi/leaf_kuang.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/mipmap-xxhdpi/no_result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/mipmap-xxhdpi/no_result.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/mipmap-xxhdpi/share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/baseproject/src/main/res/mipmap-xxhdpi/share.png
--------------------------------------------------------------------------------
/baseproject/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 | 64dp
9 |
10 |
11 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/baseproject/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BaseProject
3 |
4 |
5 | Hello blank fragment
6 | MainActivity
7 | Settings
8 |
9 |
--------------------------------------------------------------------------------
/baseproject/src/main/resources/TestShiro.ini:
--------------------------------------------------------------------------------
1 | #[main]
2 | myRealm = test.DatabaseRealm
3 | credentialsMatcher = test.MyCredentialsMatcher
4 | myRealm.credentialsMatcher = $credentialsMatcher
5 | securityManager.realms = $myRealm
6 | securityManager.sessionManager.globalSessionTimeout = 1800000
7 |
8 | [users]
9 | javass = cc,role1
10 |
11 | [roles]
12 | role1 = p1,p2
--------------------------------------------------------------------------------
/baseproject/src/main/resources/shiro.ini:
--------------------------------------------------------------------------------
1 | #配置凭证匹配器
2 | credentialsMatcher=org.apache.shiro.authc.credential.HashedCredentialsMatcher
3 | #设置算法名称
4 | credentialsMatcher.hashAlgorithmName=MD5
5 | #设置迭代的次数
6 | credentialsMatcher.hashIterations=2
7 | #配置realm
8 | customRealm=com.realm.CustomRealm
9 | #配置realm的凭证匹配器属性
10 | customRealm.credentialsMatcher=$credentialsMatcher
11 | #将customRealm注入securityManager
12 | securityManager.realm=$customRealm
--------------------------------------------------------------------------------
/baseproject/src/test/java/com/cg/baseproject/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.cg.baseproject;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | apply from: "config.gradle"
3 |
4 | buildscript {
5 | repositories {
6 | google()
7 | maven { url "https://maven.aliyun.com/repository/google" }
8 | maven { url "https://maven.aliyun.com/repository/public" }
9 | maven { url "https://maven.aliyun.com/repository/public" }
10 | jcenter()
11 | mavenCentral()
12 | maven { url "https://jitpack.io" }
13 | }
14 | dependencies {
15 | classpath 'com.android.tools.build:gradle:3.6.3'
16 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' // Add this line
17 | }
18 | }
19 |
20 | allprojects {
21 | repositories {
22 | google()
23 | maven { url "https://maven.aliyun.com/repository/google" }
24 | maven { url "https://maven.aliyun.com/repository/public" }
25 | maven { url "https://maven.aliyun.com/repository/public" }
26 | jcenter()
27 | mavenCentral()
28 | maven { url "https://jitpack.io" }
29 | }
30 | }
31 |
32 | task clean(type: Delete) {
33 | delete rootProject.buildDir
34 | }
35 |
--------------------------------------------------------------------------------
/doc/GitHubPictures/Mark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/Mark.png
--------------------------------------------------------------------------------
/doc/GitHubPictures/ResolutionShow/720.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/ResolutionShow/720.png
--------------------------------------------------------------------------------
/doc/GitHubPictures/ResolutionShow/P9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/ResolutionShow/P9.png
--------------------------------------------------------------------------------
/doc/GitHubPictures/ResolutionShow/Pixcel2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/ResolutionShow/Pixcel2.png
--------------------------------------------------------------------------------
/doc/GitHubPictures/ResolutionShow/Pixsel_XL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/ResolutionShow/Pixsel_XL.png
--------------------------------------------------------------------------------
/doc/GitHubPictures/ResolutionShow/S7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/ResolutionShow/S7.png
--------------------------------------------------------------------------------
/doc/GitHubPictures/ResolutionShow/Tools_Class.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/ResolutionShow/Tools_Class.jpg
--------------------------------------------------------------------------------
/doc/GitHubPictures/ResolutionShow/resolution_compare.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/ResolutionShow/resolution_compare.jpg
--------------------------------------------------------------------------------
/doc/GitHubPictures/ResolutionShow/support_resolution.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/ResolutionShow/support_resolution.jpg
--------------------------------------------------------------------------------
/doc/GitHubPictures/ResolutionTools.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/ResolutionTools.png
--------------------------------------------------------------------------------
/doc/GitHubPictures/RetrofitExceptionHandle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/RetrofitExceptionHandle.png
--------------------------------------------------------------------------------
/doc/GitHubPictures/api.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/api.png
--------------------------------------------------------------------------------
/doc/GitHubPictures/compare.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/compare.png
--------------------------------------------------------------------------------
/doc/GitHubPictures/dimens.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/dimens.png
--------------------------------------------------------------------------------
/doc/GitHubPictures/mark_compare.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/mark_compare.jpg
--------------------------------------------------------------------------------
/doc/GitHubPictures/mark_layout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/mark_layout.png
--------------------------------------------------------------------------------
/doc/GitHubPictures/project_res.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/project_res.png
--------------------------------------------------------------------------------
/doc/GitHubPictures/分辨率适配.pxcp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/GitHubPictures/分辨率适配.pxcp
--------------------------------------------------------------------------------
/doc/Tools/ResolutionAdaption.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/Tools/ResolutionAdaption.jar
--------------------------------------------------------------------------------
/doc/docs/说明文档.pxcp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/doc/docs/说明文档.pxcp
--------------------------------------------------------------------------------
/doc/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 | 64dp
9 |
10 |
11 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | #android.useAndroidX=true
15 | #android.enableJetifier=true
16 |
17 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
18 | android.useAndroidX=true
19 | # Automatically convert third-party libraries to use AndroidX
20 | android.enableJetifier=true
21 |
22 |
23 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fly803/BaseProject/9fbcf16953e1098c78f33bd818cbe7624235489a/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Dec 12 23:08:04 CST 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':baseproject'
2 |
--------------------------------------------------------------------------------