(getContext()) {
28 | @Override
29 | public void _onNext(ResponseBody responseBody) {
30 | Logger.i("getData success");
31 | try {
32 | CityInfo cityInfo = new CityInfo();
33 | String result = responseBody.string();
34 | if (!TextUtils.isEmpty(result) && result.contains("{") && result.contains("}")) {
35 | int start = result.indexOf("{");
36 | int end = result.indexOf("}");
37 | String content = result.substring(start, end + 1);
38 | JSONObject jsonObject = new JSONObject(content);
39 | String ipAddress = jsonObject.getString("cip");
40 | String cityId = jsonObject.getString("cid");
41 | String cityName = jsonObject.getString("cname");
42 | cityInfo.setCityId(cityId);
43 | cityInfo.setCityName(cityName);
44 | cityInfo.setIpAddress(ipAddress);
45 | }
46 | getView().handleCityInfoResult(cityInfo);
47 | } catch (IOException | JSONException e) {
48 | e.printStackTrace();
49 | }
50 | }
51 |
52 | @Override
53 | public void _onError(HttpException exception) {
54 | Logger.i(exception.getMessage());
55 | }
56 | });
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/bga_splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZhongHaoHero666/AgileFrameModelForAndroid/54d30b0c7b9ab04d4c26c135c4d39e2a151d6ff8/app/src/main/res/drawable-xxhdpi/bga_splash.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_greendao_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
20 |
21 |
22 |
28 |
29 |
35 |
36 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
24 |
25 |
26 |
33 |
34 |
41 |
42 |
49 |
50 |
57 |
58 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_mutiple_base_url_switch.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
21 |
22 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_mvptest.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_permiss_and_camera.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_use_event_bus.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_viewhelper_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
15 |
21 |
22 |
28 |
29 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZhongHaoHero666/AgileFrameModelForAndroid/54d30b0c7b9ab04d4c26c135c4d39e2a151d6ff8/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AgileFrameDemo
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/android/szh/agileframedemo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.android.szh.agileframedemo;
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 |
6 | repositories {
7 | google()
8 | jcenter()
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:3.2.0'
12 | classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
13 |
14 | classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
15 | // NOTE: Do not place your application dependencies here; they belong
16 | // in the individual module build.gradle files
17 | }
18 | }
19 |
20 | allprojects {
21 | repositories {
22 | google()
23 | jcenter()
24 | mavenCentral()
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/common/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/common/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
14 |
15 |
18 |
19 |
20 |
25 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/common/src/main/java/com/android/szh/common/abslistview/holder/AbsListViewHolder.java:
--------------------------------------------------------------------------------
1 | package com.android.szh.common.abslistview.holder;
2 |
3 | import android.support.annotation.LayoutRes;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.AbsListView;
8 |
9 | import com.android.szh.common.adapter.ViewHolder;
10 |
11 |
12 | /**
13 | * {@link AbsListView}的ViewHolder实现类
14 | *
15 | * Created by sunzhonghao on 2018/5/16.
16 | * desc: AbsListView 的ViewHolder实现类
17 | */
18 | public final class AbsListViewHolder {
19 |
20 | private final View mConvertView;
21 | private final ViewHolder mHolder;
22 |
23 | private AbsListViewHolder(ViewGroup parent, @LayoutRes int layoutId) {
24 | this.mConvertView = LayoutInflater.from(parent.getContext()).inflate(layoutId, parent, false);
25 | this.mConvertView.setTag(this);
26 | this.mHolder = ViewHolder.creat(mConvertView);
27 | }
28 |
29 | /**
30 | * 返回一个ViewHolder对象
31 | *
32 | * @param convertView
33 | * @param parent
34 | * @param layoutId
35 | * @return
36 | */
37 | public static AbsListViewHolder getViewHolder(View convertView, ViewGroup parent, @LayoutRes int layoutId) {
38 | if (convertView == null) {
39 | return new AbsListViewHolder(parent, layoutId);
40 | } else {
41 | return (AbsListViewHolder) convertView.getTag();
42 | }
43 | }
44 |
45 | public View getConvertView() {
46 | return mConvertView;
47 | }
48 |
49 | public ViewHolder getViewHolder() {
50 | return mHolder;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/common/src/main/java/com/android/szh/common/adapter/IAdapter.java:
--------------------------------------------------------------------------------
1 | package com.android.szh.common.adapter;
2 |
3 | import android.content.Context;
4 | import android.content.res.Resources;
5 | import android.support.annotation.LayoutRes;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Adapter数据操作接口
11 | *
12 | * Created by sunzhonghao
13 | * @date 2017/8/1 17:21
14 | */
15 | public interface IAdapter {
16 |
17 | /**
18 | * 返回{@link Context}对象
19 | */
20 | Context getContext();
21 |
22 | /**
23 | * 返回{@link Resources}对象
24 | */
25 | Resources getResources();
26 |
27 | /**
28 | * 返回数据源
29 | */
30 | List getDatas();
31 |
32 | /**
33 | * 刷新数据源
34 | */
35 | void refresh(List datas);
36 |
37 | /**
38 | * 添加数据
39 | */
40 | void add(DataType data);
41 |
42 | /**
43 | * 添加数据到指定位置
44 | */
45 | void add(int position, DataType data);
46 |
47 | /**
48 | * 添加数据集
49 | */
50 | void addAll(List datas);
51 |
52 | /**
53 | * 移除指定位置的数据
54 | */
55 | void remove(int position);
56 |
57 | /**
58 | * 移除指定数据
59 | */
60 | void remove(DataType data);
61 |
62 | /**
63 | * 移除指定数据集
64 | */
65 | void removeAll(List datas);
66 |
67 | /**
68 | * 清空数据源
69 | */
70 | void clear();
71 |
72 | /**
73 | * 返回Item布局资源ID(用于多类型ItemView)
74 | */
75 | @LayoutRes
76 | int getItemLayoutID(int viewType);
77 |
78 | /**
79 | * 返回Item布局资源ID(用于单类型ItemView)
80 | */
81 | @LayoutRes
82 | int getItemLayoutID();
83 |
84 | /**
85 | * 数据和事件绑定
86 | */
87 | void convert(ViewHolder holder, DataType data, int position);
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/common/src/main/java/com/android/szh/common/adapter/IRecycleViewAdapter.java:
--------------------------------------------------------------------------------
1 | package com.android.szh.common.adapter;
2 |
3 |
4 | import com.android.szh.common.recycleview.listener.OnItemClickListener;
5 | import com.android.szh.common.recycleview.listener.OnItemLongClickListener;
6 |
7 | /**
8 | * RecyclerView的Adapter数据操作接口
9 | *
10 | * Created by sunzhonghao
11 | * @date 2017/8/2 14:06
12 | */
13 | public interface IRecycleViewAdapter extends IAdapter {
14 |
15 | /**
16 | * 判断适配器的Item数量是否为0
17 | */
18 | boolean isEmpty();
19 |
20 | /**
21 | * 是否适配器中的所有项都是Enabled状态(即selectable和clickable)
22 | */
23 | boolean areAllItemsEnabled();
24 |
25 | /**
26 | * 指定位置的项是否是Enabled状态(即selectable和clickable)
27 | *
28 | * @param position 指定位置的索引
29 | */
30 | boolean isEnabled(int position);
31 |
32 | /**
33 | * 设置RecycleView的Item点击事件监听
34 | *
35 | * @param listener Item点击事件监听
36 | */
37 | void setOnItemClickListener(OnItemClickListener listener);
38 |
39 | /**
40 | * 设置RecycleView的Item长点击事件监听
41 | *
42 | * @param listener Item长点击事件监听
43 | */
44 | void setOnItemLongClickListener(OnItemLongClickListener listener);
45 |
46 | /**
47 | * 返回指定位置关联的数据
48 | *
49 | * @param position 指定位置的索引
50 | */
51 | DataType getItem(int position);
52 | }
53 |
--------------------------------------------------------------------------------
/common/src/main/java/com/android/szh/common/config/RoutePathConfig.java:
--------------------------------------------------------------------------------
1 | package com.android.szh.common.config;
2 |
3 | /**
4 | * Created by sunzhonghao on 2018/7/10.
5 | * desc:路由路径管理接口
6 | */
7 |
8 | public interface RoutePathConfig {
9 |
10 | /**
11 | * ARoute 组件化演示类路径
12 | */
13 | String ROUTE_USER_AROUTEDEMO = "/user/aroutedemo";
14 | }
15 |
--------------------------------------------------------------------------------
/common/src/main/java/com/android/szh/common/config/UrlConfig.java:
--------------------------------------------------------------------------------
1 | package com.android.szh.common.config;
2 |
3 | import com.android.szh.common.BuildConfig;
4 |
5 | /**
6 | * Created by sunzhonghao on 2018/5/17.
7 | * desc: 静态url 管理类
8 | */
9 |
10 | public class UrlConfig {
11 | /**
12 | * 正式域名
13 | */
14 | public static final String DOMAIN_ONLINE = "http://pv.sohu.com";
15 |
16 | /**
17 | * 测试域名
18 | */
19 | public static final String DOMAIN_TEST = "http://pv.sohu.com";
20 |
21 |
22 | /**
23 | * 正式域名_A(多个BaseUrl情况)
24 | */
25 | public static final String DOMAIN_ONLINE_A = "https://api.douban.com";
26 |
27 | /**
28 | * 测试域名_A(多个BaseUrl情况)
29 | */
30 | public static final String DOMAIN_TEST_A = "https://api.douban.com";
31 |
32 |
33 |
34 |
35 | /**
36 | * @return 当前环境baseUrl
37 | */
38 | public static String getDominUrl() {
39 | return BuildConfig.ONLINE ? DOMAIN_ONLINE : DOMAIN_TEST;
40 | }
41 |
42 | /**
43 | * @return 当前环境的另外一个baseUrl
44 | */
45 | public static String getDominUrlA() {
46 | return BuildConfig.ONLINE ? DOMAIN_ONLINE_A : DOMAIN_TEST_A;
47 | }
48 |
49 |
50 | //___________________________________BaseUrl 标识____________________________________________
51 | /**
52 | * BaseUrl_A 标识multiple
53 | */
54 | public static final String FLAG_MULTIPLE_BASE_URL_A = "FLAG_MULTIPLE_BASE_URL_A";
55 | /**
56 | * 切换baseUrl时的key
57 | */
58 | public static final String FLAG_MULTIPLE_BASE_URL_KEY = "Domain-Name:";
59 | }
60 |
--------------------------------------------------------------------------------
/common/src/main/java/com/android/szh/common/constant/PageJumpsKeys.java:
--------------------------------------------------------------------------------
1 | package com.android.szh.common.constant;
2 |
3 | /**
4 | * Created by sunzhonghao on 2018/7/10.
5 | * desc:页面跳转传递数据的key
6 | */
7 |
8 | public interface PageJumpsKeys {
9 | String KEY_AROUTER_DEMO_PAGE_DATA_1 = "key_arouter_demo_page_data_1";
10 | String KEY_AROUTER_DEMO_PAGE_DATA_2 = "key_arouter_demo_page_data_2";
11 | }
12 |
--------------------------------------------------------------------------------
/common/src/main/java/com/android/szh/common/constant/UserAvatorConfig.java:
--------------------------------------------------------------------------------
1 | package com.android.szh.common.constant;
2 |
3 | /**
4 | * Created by sunzhonghao on 2018/4/9.
5 | * desc:用户头像相关配置
6 | */
7 |
8 | public class UserAvatorConfig {
9 |
10 | public static final int REQUEST_IMAGE_ALBUM = 1;
11 | public static final int REQUEST_IMAGE_CAMERA = 2;
12 | public static final int REQUEST_IMAGE_PREVIEW = 3;
13 | public static final int REQUEST_BANK_CARD_INFO = 4;
14 | public static final int REQUEST_DRAWMONEY_INFO = 5;
15 | public static final int REQUEST_DRAWMONEY_MODIFY = 6;
16 | public static final int REQUEST_REDPACKET_EXCHANGE = 7;
17 | public static final int REQUEST_SELECT_BANKLIST = 10;
18 | public static final int REQUEST_SELECT_BANKNAME = 11;
19 | public static final int REQUEST_SELECT_BANKCITY = 12;
20 | public static final int REQUEST_SELECT_BANKBRANCH = 13;
21 |
22 | public static final int DEFAULT_HEADER_PHOTO_SIZE = 20 * 1024;// 默认头像最大大小
23 | }
24 |
--------------------------------------------------------------------------------
/common/src/main/java/com/android/szh/common/delegate/IAdapterDelegate.java:
--------------------------------------------------------------------------------
1 | package com.android.szh.common.delegate;
2 |
3 | /**
4 | * 适配器的代理相关方法接口
5 | *
6 | * @param 数据类型的泛型
7 | * Created by sunzhonghao
8 | * @date 2017/8/2 11:52
9 | */
10 | public interface IAdapterDelegate {
11 |
12 | /**
13 | * 添加{@link ItemViewDelegate}
14 | *
15 | * @param delegate {@link ItemViewDelegate}对象
16 | */
17 | void addItemViewDelegate(ItemViewDelegate delegate);
18 |
19 | /**
20 | * 添加{@link ItemViewDelegate}
21 | *
22 | * @param viewType ItemView的类型
23 | * @param delegate {@link ItemViewDelegate}对象
24 | */
25 | void addItemViewDelegate(int viewType, ItemViewDelegate delegate);
26 |
27 | /**
28 | * 删除{@link ItemViewDelegate}
29 | *
30 | * @param itemType ItemView的类型(SparseArrayCompat的Key)
31 | */
32 | ItemViewDelegateManager removeDelegate(int itemType);
33 |
34 | /**
35 | * 删除{@link ItemViewDelegate}
36 | *
37 | * @param delegate {@link ItemViewDelegate}对象(SparseArrayCompat的Value)
38 | */
39 | ItemViewDelegateManager removeDelegate(ItemViewDelegate delegate);
40 |
41 | /**
42 | * 是否使用{@link ItemViewDelegateManager}(即{@link ItemViewDelegate}的数量是否大于0)
43 | */
44 | boolean useItemViewDelegateManager();
45 | }
46 |
--------------------------------------------------------------------------------
/common/src/main/java/com/android/szh/common/delegate/ItemViewDelegate.java:
--------------------------------------------------------------------------------
1 | package com.android.szh.common.delegate;
2 |
3 |
4 | import com.android.szh.common.adapter.ViewHolder;
5 |
6 | /**
7 | * ItemView委托代理(用于处理不同ItemView并进行数据和事件绑定)
8 | *
9 | * @param 数据类型的泛型
10 | * Created by sunzhonghao
11 | * @date 2017/8/1 19:10
12 | */
13 | public interface ItemViewDelegate {
14 |
15 | /**
16 | * 返回Item布局资源ID
17 | */
18 | int getItemLayoutID();
19 |
20 | /**
21 | * 根据指定的位置数据和索引判断是否由当前{@link ItemViewDelegate}处理数据
22 | *
23 | * @param data 数据
24 | * @param position 位置索引
25 | */
26 | boolean isForViewType(DataType data, int position);
27 |
28 | /**
29 | * 数据和事件绑定
30 | *
31 | * @param holder {@link ViewHolder}对象
32 | * @param data 数据
33 | * @param position 位置索引
34 | */
35 | void convert(ViewHolder holder, DataType data, int position);
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/common/src/main/java/com/android/szh/common/dialog/BaseDialogProvider.java:
--------------------------------------------------------------------------------
1 | package com.android.szh.common.dialog;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * 加载对话框提供者
7 | *
8 | * @author sunzhonghao
9 | * @date 2018/7/11
10 | */
11 | public abstract class BaseDialogProvider