├── settings.gradle
├── templates
├── TinFragment
│ ├── root
│ │ ├── src
│ │ │ └── app_package
│ │ │ │ ├── TinFragment.kt.ftl
│ │ │ │ ├── TinView.kt.ftl
│ │ │ │ ├── TinPresenter.kt.ftl
│ │ │ │ ├── TinView.java.ftl
│ │ │ │ ├── TinPresenter.java.ftl
│ │ │ │ └── TinFragment.java.ftl
│ │ ├── AndroidManifest.xml.ftl
│ │ └── res
│ │ │ └── layout
│ │ │ └── simple.xml.ftl
│ ├── template_tin_activity.png
│ ├── globals.xml.ftl
│ ├── recipe.xml.ftl
│ └── template.xml
├── TinActivity
│ ├── root
│ │ ├── src
│ │ │ └── app_package
│ │ │ │ ├── TinView.kt.ftl
│ │ │ │ ├── TinPresenter.kt.ftl
│ │ │ │ ├── TinView.java.ftl
│ │ │ │ ├── TinPresenter.java.ftl
│ │ │ │ ├── TinActivity.java.ftl
│ │ │ │ └── TinActivity.kt.ftl
│ │ ├── AndroidManifest.xml.ftl
│ │ └── res
│ │ │ └── layout
│ │ │ └── simple.xml.ftl
│ ├── template_tin_activity.png
│ ├── globals.xml.ftl
│ ├── recipe.xml.ftl
│ └── template.xml
├── templates.zip
├── LhhActivity
│ ├── template_lhh_activity.png
│ ├── root
│ │ ├── src
│ │ │ └── app_package
│ │ │ │ ├── SimpleActivity.kt.ftl
│ │ │ │ └── SimpleActivity.java.ftl
│ │ ├── AndroidManifest.xml.ftl
│ │ └── res
│ │ │ └── layout
│ │ │ └── simple.xml.ftl
│ ├── globals.xml.ftl
│ ├── recipe.xml.ftl
│ └── template.xml
└── LhhFragment
│ ├── root
│ ├── src
│ │ └── app_package
│ │ │ ├── LhhFragment.kt.ftl
│ │ │ └── LhhFragment.java.ftl
│ └── res
│ │ └── layout
│ │ └── simple.xml.ftl
│ ├── template_lhh_activity.png
│ ├── globals.xml.ftl
│ ├── recipe.xml.ftl
│ └── template.xml
├── app
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── drawable-xxhdpi
│ │ │ │ └── fanhui.png
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── xml
│ │ │ │ └── network_security_config.xml
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── dimens.xml
│ │ │ ├── drawable
│ │ │ │ ├── shape_rectangle_round_8.xml
│ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── layout
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── tool_bar.xml
│ │ │ │ └── dialog_progress.xml
│ │ │ └── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ ├── java
│ │ │ └── me
│ │ │ │ └── soushin
│ │ │ │ └── tinmvp
│ │ │ │ ├── Utils
│ │ │ │ ├── DataUtils.java
│ │ │ │ ├── TimeUtils.java
│ │ │ │ ├── DialogUtils.java
│ │ │ │ ├── TitleBarUtils.java
│ │ │ │ ├── GsonUtils.java
│ │ │ │ ├── AppUtils.java
│ │ │ │ ├── SharedUtils.java
│ │ │ │ └── ActivityUtils.java
│ │ │ │ ├── module
│ │ │ │ └── main
│ │ │ │ │ ├── MainView.java
│ │ │ │ │ ├── MainPresenter.java
│ │ │ │ │ └── MainActivity.java
│ │ │ │ ├── Configure.java
│ │ │ │ ├── base
│ │ │ │ ├── BaseView.java
│ │ │ │ ├── BasePresenter.java
│ │ │ │ ├── BaseDialog.java
│ │ │ │ ├── BaseActivity.java
│ │ │ │ └── BaseFragment.java
│ │ │ │ ├── model
│ │ │ │ ├── ResultModel.java
│ │ │ │ └── SubcribeModel.java
│ │ │ │ ├── widget
│ │ │ │ ├── ToolHolder.java
│ │ │ │ ├── ProgressDialog.java
│ │ │ │ ├── ToastStyle.java
│ │ │ │ └── InitProvider.java
│ │ │ │ ├── App.java
│ │ │ │ ├── ActivityLifeCycleCallBackIml.java
│ │ │ │ └── network
│ │ │ │ ├── HttpClient.java
│ │ │ │ └── TokenInterceptor.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── me
│ │ │ └── soushin
│ │ │ └── tinmvp
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── me
│ │ └── soushin
│ │ └── tinmvp
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── gradle.properties
├── gradlew.bat
├── README.md
├── gradlew
└── config.gradle
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/templates/TinFragment/root/src/app_package/TinFragment.kt.ftl:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/templates/TinActivity/root/src/app_package/TinView.kt.ftl:
--------------------------------------------------------------------------------
1 | package ${contractPackageName}
2 |
3 |
--------------------------------------------------------------------------------
/templates/TinFragment/root/src/app_package/TinView.kt.ftl:
--------------------------------------------------------------------------------
1 | package ${contractPackageName}
2 |
3 |
--------------------------------------------------------------------------------
/templates/templates.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/templates/templates.zip
--------------------------------------------------------------------------------
/templates/TinActivity/root/src/app_package/TinPresenter.kt.ftl:
--------------------------------------------------------------------------------
1 | package ${presenterPackageName}
2 |
3 |
--------------------------------------------------------------------------------
/templates/TinFragment/root/src/app_package/TinPresenter.kt.ftl:
--------------------------------------------------------------------------------
1 | package ${presenterPackageName}
2 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/fanhui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/app/src/main/res/drawable-xxhdpi/fanhui.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/templates/LhhActivity/template_lhh_activity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/templates/LhhActivity/template_lhh_activity.png
--------------------------------------------------------------------------------
/templates/LhhFragment/root/src/app_package/LhhFragment.kt.ftl:
--------------------------------------------------------------------------------
1 | package ${fragmentPackageName}
2 |
3 | class ${pageName}Fragment{
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/templates/LhhFragment/template_lhh_activity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/templates/LhhFragment/template_lhh_activity.png
--------------------------------------------------------------------------------
/templates/TinActivity/template_tin_activity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/templates/TinActivity/template_tin_activity.png
--------------------------------------------------------------------------------
/templates/TinFragment/template_tin_activity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/templates/TinFragment/template_tin_activity.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/932707629/TinMvp/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/templates/TinActivity/root/src/app_package/TinView.java.ftl:
--------------------------------------------------------------------------------
1 | package ${viewPackageName};
2 |
3 | public interface ${pageName}View extends BaseView {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/templates/TinFragment/root/src/app_package/TinView.java.ftl:
--------------------------------------------------------------------------------
1 | package ${viewPackageName};
2 |
3 | public interface ${pageName}View extends BaseView {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/templates/LhhActivity/root/src/app_package/SimpleActivity.kt.ftl:
--------------------------------------------------------------------------------
1 | package ${ativityPackageName};
2 |
3 |
4 | class ${pageName}Activity : BaseActivity() {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/templates/TinActivity/root/src/app_package/TinPresenter.java.ftl:
--------------------------------------------------------------------------------
1 | package ${presenterPackageName};
2 |
3 | public class ${pageName}Presenter extends BasePresenter<${pageName}View> {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/templates/TinFragment/root/src/app_package/TinPresenter.java.ftl:
--------------------------------------------------------------------------------
1 | package ${presenterPackageName};
2 |
3 | public class ${pageName}Presenter extends BasePresenter<${pageName}View> {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TinMvp
3 |
4 |
5 | Hello blank fragment
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/Utils/DataUtils.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.Utils;
2 |
3 |
4 | /**
5 | * 数据工具类
6 | *
7 | * @author SouShin
8 | * @time 2018/11/14 14:51
9 | */
10 | public class DataUtils {
11 |
12 |
13 |
14 |
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/module/main/MainView.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.module.main;
2 |
3 | import me.soushin.tinmvp.base.BaseView;
4 |
5 | /**
6 | * Created by SouShin on 2018/10/171342.
7 | */
8 | public interface MainView extends BaseView {
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_rectangle_round_8.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/templates/TinFragment/root/AndroidManifest.xml.ftl:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/Configure.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp;
2 |
3 |
4 | /**
5 | * 全局配置类
6 | * @author SouShin
7 | * @time 2018/11/19 14:45
8 | */
9 | public class Configure {
10 | public static String BASE_URL="http://www.weather.com.cn/data/sk/";///101110101.html
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/module/main/MainPresenter.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.module.main;
2 |
3 | import me.soushin.tinmvp.base.BasePresenter;
4 |
5 | /**
6 | * Created by SouShin on 2018/10/171343.
7 | * Presenter
8 | */
9 | public class MainPresenter extends BasePresenter {
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/templates/LhhActivity/root/AndroidManifest.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/base/BaseView.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.base;
2 |
3 | import me.soushin.tinmvp.widget.ProgressDialog;
4 |
5 | /**
6 | * View处理基类
7 | * @author SouShin
8 | * @time 2018/11/15 14:19
9 | */
10 | public interface BaseView {
11 | void initView();
12 | void showToasty(String msg);
13 | ProgressDialog getLoading(String msg);
14 | }
15 |
--------------------------------------------------------------------------------
/templates/TinActivity/root/AndroidManifest.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/templates/LhhActivity/root/res/layout/simple.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/templates/LhhFragment/root/res/layout/simple.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/templates/TinActivity/root/res/layout/simple.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/templates/TinFragment/root/res/layout/simple.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/templates/LhhFragment/globals.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <#include "root://activities/common/common_globals.xml.ftl" />
9 |
10 |
--------------------------------------------------------------------------------
/templates/TinFragment/globals.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <#include "root://activities/common/common_globals.xml.ftl" />
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #2F98E9
4 | #2F98E9
5 | #FF4081
6 | #fff
7 | #000
8 |
9 | #333333
10 | #232323
11 | #bbbbbb
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/test/java/me/soushin/tinmvp/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp;
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() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/templates/LhhActivity/globals.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | <#include "../common/common_globals.xml.ftl" />
11 |
12 |
--------------------------------------------------------------------------------
/templates/LhhActivity/root/src/app_package/SimpleActivity.java.ftl:
--------------------------------------------------------------------------------
1 | package ${ativityPackageName};
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 |
6 | public class ${pageName}Activity extends BaseActivity {
7 |
8 | @Override
9 | protected int getLayout() {
10 | return R.layout.${activityLayoutName};
11 | }
12 |
13 | @Override
14 | protected void initView(@Nullable Bundle savedInstanceState) {
15 |
16 | }
17 |
18 | @Override
19 | protected void initListener() {
20 |
21 | }
22 |
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/templates/TinActivity/globals.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | <#include "../common/common_globals.xml.ftl" />
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/model/ResultModel.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.model;
2 |
3 | import com.zhouyou.http.model.ApiResult;
4 |
5 | /**
6 | * 说好的返回Api
7 | * @author SouShin
8 | * @time 2018/11/21 13:50
9 | */
10 | public class ResultModel extends ApiResult {
11 | T weatherinfo;
12 |
13 | @Override
14 | public T getData() {
15 | return weatherinfo;
16 | }
17 |
18 | @Override
19 | public void setData(T data) {
20 | this.weatherinfo=data;
21 | }
22 |
23 | @Override
24 | public boolean isOk() {
25 | return weatherinfo!=null;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/Utils/TimeUtils.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.Utils;
2 |
3 | import android.annotation.SuppressLint;
4 |
5 | import java.text.SimpleDateFormat;
6 | import java.util.Date;
7 |
8 | /**
9 | * 时间转换类
10 | *
11 | * Author: nanchen
12 | * Email: liushilin520@foxmail.com
13 | * Date: 2017-06-23 13:19
14 | */
15 |
16 | public class TimeUtils {
17 |
18 | public static String getNowStrTime(){
19 | long time = System.currentTimeMillis();
20 | @SuppressLint("SimpleDateFormat")
21 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
22 | return sdf.format(new Date(time));
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/templates/TinActivity/root/src/app_package/TinActivity.java.ftl:
--------------------------------------------------------------------------------
1 | package ${ativityPackageName};
2 |
3 |
4 | public class ${pageName}Activity extends BaseActivity<${pageName}View, ${pageName}Presenter> implements ${pageName}View {
5 | @Override
6 | protected ${pageName}Presenter createPresenter() {
7 | return new ${pageName}Presenter();
8 | }
9 | @Override
10 | protected int getLayoutId() {
11 | return R.layout.${activityLayoutName};
12 | }
13 |
14 | @Override
15 | protected void bindView() {
16 | getPresenter().subscribe(this);
17 | }
18 |
19 | @Override
20 | public void initView() {
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/templates/TinFragment/root/src/app_package/TinFragment.java.ftl:
--------------------------------------------------------------------------------
1 | package ${fragmentPackageName};
2 |
3 |
4 | public class ${pageName}Fragment extends BaseFragment<${pageName}View, ${pageName}Presenter> implements ${pageName}View {
5 |
6 | @Override
7 | protected ${pageName}Presenter createPresenter() {
8 | return new ${pageName}Presenter();
9 | }
10 | @Override
11 | protected int getLayoutId() {
12 | return R.layout.${fragmentLayoutName};
13 | }
14 |
15 | @Override
16 | protected void bindView() {
17 | getPresenter().subscribe(this);
18 | }
19 |
20 | @Override
21 | public void initView() {
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/base/BasePresenter.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.base;
2 |
3 | /**
4 | * 逻辑处理基类
5 | */
6 | public abstract class BasePresenter {
7 | private V View;
8 |
9 | /**
10 | * 绑定View
11 | * 设置状态栏
12 | * 调用initView()
13 | * @param View
14 | */
15 | public void subscribe(V View){
16 | this.View= View;
17 | getView().initView();
18 | }
19 |
20 | /**
21 | * 解绑
22 | */
23 | public void unsubscribe(){
24 | View = null;
25 | }
26 |
27 | /**
28 | * 获取View
29 | * @return
30 | */
31 | protected V getView(){
32 | return View;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/templates/LhhFragment/recipe.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 | <#import "root://activities/common/kotlin_macros.ftl" as kt>
3 |
4 |
5 | <#if needFragment && generateFragmentLayout>
6 |
8 |
9 | #if>
10 |
11 | <#if needFragment>
12 |
14 |
15 | #if>
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/templates/TinActivity/root/src/app_package/TinActivity.kt.ftl:
--------------------------------------------------------------------------------
1 | package ${escapeKotlinIdentifiers(packageName)}
2 |
3 | import ${superClassFqcn}
4 | import android.os.Bundle
5 | <#if (includeCppSupport!false) && generateLayout>
6 | import kotlinx.android.synthetic.main.${layoutName}.*
7 | #if>
8 |
9 | class ${activityClass} : ${superClass}() {
10 |
11 | override fun onCreate(savedInstanceState: Bundle?) {
12 | super.onCreate(savedInstanceState)
13 | <#if generateLayout>
14 | setContentView(R.layout.${layoutName})
15 | <#include "../../../../common/jni_code_usage.kt.ftl">
16 | <#elseif includeCppSupport!false>
17 |
18 | // Example of a call to a native method
19 | android.util.Log.d("${activityClass}", stringFromJNI())
20 | #if>
21 | }
22 | <#include "../../../../common/jni_code_snippet.kt.ftl">
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/widget/ToolHolder.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.widget;
2 |
3 | import android.support.constraint.ConstraintLayout;
4 | import android.view.View;
5 | import android.widget.ImageView;
6 | import android.widget.TextView;
7 | import butterknife.BindView;
8 | import butterknife.ButterKnife;
9 | import butterknife.Unbinder;
10 | import me.soushin.tinmvp.R;
11 |
12 | /**
13 | * 标题栏
14 | * @auther SouShin
15 | * @time 2019/1/24 09:11
16 | */
17 | public class ToolHolder {
18 | @BindView(R.id.img_back)
19 | public ImageView imgBack;
20 | @BindView(R.id.tv_title)
21 | public TextView tvTitle;
22 | @BindView(R.id.toolbar)
23 | public ConstraintLayout toolbar;
24 | public Unbinder unbinder;
25 |
26 | public ToolHolder(View view) {
27 | unbinder=ButterKnife.bind(this, view);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/me/soushin/tinmvp/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("soushin.mvpdemo", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/model/SubcribeModel.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.model;
2 |
3 | import io.reactivex.disposables.Disposable;
4 |
5 | /**
6 | * 订阅关系
7 | * @auther SouShin
8 | * @time 2019/2/25 14:20
9 | */
10 | public class SubcribeModel {
11 |
12 | public SubcribeModel() {
13 | }
14 |
15 | public SubcribeModel(String className, Disposable mDisposable) {
16 | this.className = className;
17 | this.mDisposable = mDisposable;
18 | }
19 |
20 | private String className;
21 | private Disposable mDisposable;
22 |
23 |
24 | public String getClassName() {
25 | return className;
26 | }
27 |
28 | public void setClassName(String className) {
29 | this.className = className;
30 | }
31 |
32 | public Disposable getmDisposable() {
33 | return mDisposable;
34 | }
35 |
36 | public void setmDisposable(Disposable mDisposable) {
37 | this.mDisposable = mDisposable;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/widget/ProgressDialog.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.widget;
2 |
3 | import android.app.Dialog;
4 | import android.content.Context;
5 | import android.widget.ProgressBar;
6 | import android.widget.TextView;
7 |
8 | import com.zhouyou.http.subsciber.IProgressDialog;
9 |
10 | import butterknife.BindView;
11 | import me.soushin.tinmvp.R;
12 | import me.soushin.tinmvp.base.BaseDialog;
13 |
14 | /**
15 | * 加载等待框
16 | *
17 | * @author SouShin
18 | * @time 2018/10/31 9:49
19 | */
20 | public class ProgressDialog extends BaseDialog implements IProgressDialog {
21 |
22 | @BindView(R.id.pb_progress)
23 | ProgressBar pbProgress;
24 | @BindView(R.id.tv_progress)
25 | TextView tvProgress;
26 |
27 | public ProgressDialog(Context context, String msg) {
28 | super(context, R.layout.dialog_progress);
29 | tvProgress.setText(msg);
30 | setCancelable(false);
31 | setCanceledOnTouchOutside(false);
32 | }
33 |
34 | @Override
35 | public Dialog getDialog() {
36 | return this;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/templates/LhhActivity/recipe.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 | <#import "root://activities/common/kotlin_macros.ftl" as kt>
3 |
4 | <#include "../common/recipe_manifest.xml.ftl" />
5 | <@kt.addAllKotlinDependencies />
6 |
7 | <#if needActivity>
8 |
10 | #if>
11 |
12 | <#if needActivity && generateActivityLayout>
13 |
15 |
16 | #if>
17 |
18 | <#if needActivity>
19 |
21 |
22 | #if>
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/module/main/MainActivity.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.module.main;
2 |
3 | import me.soushin.tinmvp.R;
4 | import me.soushin.tinmvp.Utils.ActivityUtils;
5 | import me.soushin.tinmvp.Utils.AppUtils;
6 | import me.soushin.tinmvp.base.BaseActivity;
7 |
8 | /**
9 | * View
10 | */
11 | public class MainActivity extends BaseActivity implements MainView {
12 |
13 | @Override
14 | protected MainPresenter createPresenter() {
15 | return new MainPresenter();
16 | }
17 |
18 | @Override
19 | protected int getLayoutId() {
20 | return R.layout.activity_main;
21 | }
22 |
23 | @Override
24 | protected void bindView() {
25 | getPresenter().subscribe(this);
26 | }
27 |
28 | @Override
29 | public void initView() {
30 |
31 | }
32 |
33 | @Override
34 | public void onBackPressedSupport() {
35 | // onBackPressed()已停用 请使用onBackPressedSupport代替
36 | if (AppUtils.doubleClickExit()) {
37 | ActivityUtils.AppExit(getActivity());
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
21 |
22 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tool_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
19 |
20 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/App.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 | import android.support.multidex.MultiDex;
6 |
7 | import com.blankj.ALog;
8 | import com.hjq.toast.ToastUtils;
9 | import com.zhouyou.http.EasyHttp;
10 | import com.zhouyou.http.cache.converter.SerializableDiskConverter;
11 | import com.zhouyou.http.cookie.CookieManger;
12 |
13 | import io.reactivex.Observable;
14 | import io.reactivex.Observer;
15 | import io.reactivex.disposables.Disposable;
16 | import io.reactivex.functions.Consumer;
17 | import io.reactivex.schedulers.Schedulers;
18 | import io.reactivex.subjects.Subject;
19 | import me.jessyan.autosize.AutoSizeConfig;
20 | import me.soushin.tinmvp.network.TokenInterceptor;
21 | import me.soushin.tinmvp.widget.ToastStyle;
22 |
23 | /**
24 | * @auther SouShin
25 | * @time 2019/4/18 17:13
26 | */
27 | public class App extends Application {
28 | private static App app;
29 |
30 | @Override
31 | public void onCreate() {
32 | super.onCreate();
33 | app = this;
34 | }
35 |
36 | /**
37 | * 获取app示例
38 | *
39 | * @return
40 | */
41 | public static App getApp() {
42 | return app;
43 | }
44 |
45 | @Override
46 | protected void attachBaseContext(Context base) {
47 | super.attachBaseContext(base);
48 | MultiDex.install(base);
49 | }
50 |
51 |
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/base/BaseDialog.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.base;
2 |
3 | import android.app.Dialog;
4 | import android.content.Context;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 |
8 | import butterknife.ButterKnife;
9 | import butterknife.Unbinder;
10 | import me.soushin.tinmvp.R;
11 | import me.soushin.tinmvp.Utils.DialogUtils;
12 |
13 | /**
14 | * Created by SouShin on 2018/8/111736.
15 | * 自定义dialog的基类
16 | */
17 | public class BaseDialog extends Dialog {
18 | private Context mContext;
19 | private Unbinder unbinder;
20 |
21 | public BaseDialog(Context context, int layoutId) {
22 | this(context, layoutId, R.style.CustomDialog);
23 | }
24 |
25 | public BaseDialog(Context context, int layoutId, int styleId) {
26 | super(context, styleId);
27 | this.mContext = context;
28 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
29 | View view = inflater.inflate(layoutId, null);
30 | this.setContentView(view);
31 | DialogUtils.addDialog(this);
32 | unbinder = ButterKnife.bind(this);
33 | }
34 |
35 | protected Context getContext_() {
36 | return this.mContext;
37 | }
38 |
39 | @Override
40 | public void dismiss() {
41 | super.dismiss();
42 | if (unbinder != null) {
43 | unbinder.unbind();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/Utils/DialogUtils.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.Utils;
2 |
3 | import android.app.Dialog;
4 |
5 | import com.zhouyou.http.EasyHttp;
6 |
7 | import java.util.ArrayList;
8 | import java.util.Iterator;
9 | import java.util.List;
10 |
11 | import me.soushin.tinmvp.base.BaseDialog;
12 | import me.soushin.tinmvp.model.SubcribeModel;
13 | import me.soushin.tinmvp.widget.ProgressDialog;
14 |
15 | /**
16 | * @auther SouShin
17 | * @time 2019/2/22 10:37
18 | */
19 | public class DialogUtils {
20 | private static List dialogList = new ArrayList<>();
21 |
22 | /**
23 | * @param msg
24 | * @return
25 | */
26 | public static ProgressDialog getLoading(String msg) {
27 | return new ProgressDialog(ActivityUtils.currentActivity(), msg);
28 | }
29 |
30 | /**
31 | * 关闭弹出框
32 | * 最好在onDestroy里调用一下这个方法
33 | */
34 | public static void disDialog() {
35 | Iterator it = dialogList.iterator();
36 | while (it.hasNext()) {
37 | BaseDialog dialog = it.next();
38 | disDialog(dialog);
39 | it.remove();
40 | }
41 | }
42 |
43 | public static void addDialog(BaseDialog dialog) {
44 | dialogList.add(dialog);
45 | }
46 |
47 | public static void disDialog(Dialog dialog) {
48 | if (dialog != null && dialog.isShowing()) {
49 | dialog.dismiss();
50 | }
51 | }
52 |
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/templates/LhhFragment/root/src/app_package/LhhFragment.java.ftl:
--------------------------------------------------------------------------------
1 | package ${fragmentPackageName};
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 |
6 | public class ${pageName}Fragment extends BaseFragment {
7 |
8 | @Override
9 | public int initLayout() {
10 | return R.layout.${fragmentLayoutName};
11 | }
12 |
13 | @Override
14 | protected void initView(@Nullable Bundle savedInstanceState) {
15 |
16 | }
17 |
18 | @Override
19 | protected void initListener() {
20 |
21 | }
22 |
23 | @Override
24 | public void onLazyInitView(@Nullable Bundle savedInstanceState) {
25 | super.onLazyInitView(savedInstanceState);
26 | // 只有第一次可见时调用
27 | // ALog.i("懒加载",getClass().getSimpleName());
28 | }
29 |
30 | @Override
31 | public void onSupportVisible() {
32 | super.onSupportVisible();
33 | // ALog.i("fragment可见",getClass().getSimpleName());
34 | }
35 |
36 | @Override
37 | public void onSupportInvisible() {
38 | super.onSupportInvisible();
39 | // ALog.i("fragment隐藏",getClass().getSimpleName());
40 | }
41 |
42 | @Override
43 | public void initImmersionBar() {
44 | // 新手指引: fragment里设置沉浸标题栏之前必须先在宿主Activity里调用ImmersionBar.with(this).init();
45 | }
46 |
47 | @Override
48 | public boolean immersionBarEnabled() {
49 | // 当为true的时候才可以执行initImmersionBar方法
50 | return false;
51 | }
52 |
53 |
54 | }
--------------------------------------------------------------------------------
/templates/TinFragment/recipe.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 | <#import "root://activities/common/kotlin_macros.ftl" as kt>
3 |
4 | <@kt.addAllKotlinDependencies />
5 |
6 | <#if needFragment && generateFragmentLayout>
7 |
9 |
10 | #if>
11 |
12 | <#if needFragment>
13 |
15 |
16 | #if>
17 |
18 | <#if needView>
19 |
21 |
22 | #if>
23 |
24 | <#if needPresenter>
25 |
27 |
28 | #if>
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/widget/ToastStyle.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.widget;
2 |
3 | import android.view.Gravity;
4 |
5 | import com.hjq.toast.IToastStyle;
6 |
7 | /**
8 | * 自定义Toast样式
9 | *
10 | * @auther SouShin
11 | * @time 2018/12/27 09:45
12 | */
13 | public class ToastStyle implements IToastStyle {
14 |
15 | @Override
16 | public int getGravity() {
17 | return Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM;
18 | }
19 |
20 | @Override
21 | public int getXOffset() {
22 | return 0;
23 | }
24 |
25 | @Override
26 | public int getYOffset() {
27 | return 240;
28 | }
29 |
30 | @Override
31 | public int getZ() {
32 | return 30;
33 | }
34 |
35 | @Override
36 | public int getCornerRadius() {
37 | return 5;
38 | }
39 |
40 | @Override
41 | public int getBackgroundColor() {
42 | return 0XEE575757;
43 | }
44 |
45 | @Override
46 | public int getTextColor() {
47 | return 0XFFFFFFFF;
48 | }
49 |
50 | @Override
51 | public float getTextSize() {
52 | return 14;
53 | }
54 |
55 | @Override
56 | public int getMaxLines() {
57 | return 3;
58 | }
59 |
60 | @Override
61 | public int getPaddingLeft() {
62 | return 20;
63 | }
64 |
65 | @Override
66 | public int getPaddingTop() {
67 | return 8;
68 | }
69 |
70 | @Override
71 | public int getPaddingRight() {
72 | return getPaddingLeft();
73 | }
74 |
75 | @Override
76 | public int getPaddingBottom() {
77 | return getPaddingTop();
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/templates/TinActivity/recipe.xml.ftl:
--------------------------------------------------------------------------------
1 |
2 | <#import "root://activities/common/kotlin_macros.ftl" as kt>
3 |
4 | <@kt.addAllKotlinDependencies />
5 | <#if needActivity>
6 |
8 | #if>
9 |
10 | <#if needActivity && generateActivityLayout>
11 |
13 |
14 | #if>
15 |
16 | <#if needActivity>
17 |
19 |
20 | #if>
21 |
22 | <#if needView>
23 |
25 |
26 | #if>
27 |
28 | <#if needPresenter>
29 |
31 |
32 | #if>
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/base/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.base;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.AppCompatActivity;
6 |
7 | import com.blankj.ALog;
8 | import com.hjq.toast.ToastUtils;
9 |
10 | import butterknife.ButterKnife;
11 | import butterknife.Unbinder;
12 | import me.soushin.tinmvp.Utils.DialogUtils;
13 | import me.soushin.tinmvp.widget.ProgressDialog;
14 | import me.yokeyword.fragmentation.SupportActivity;
15 |
16 | /**
17 | * Activity基类
18 | *
19 | * @author SouShin
20 | * @time 2018/11/16 14:05
21 | */
22 | public abstract class BaseActivity> extends SupportActivity {
23 | private P presenter;
24 | private Unbinder unbinder;
25 |
26 | @Override
27 | protected void onCreate(@Nullable Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(getLayoutId());
30 | unbinder = ButterKnife.bind(this);
31 | presenter = createPresenter();
32 | bindView();
33 | }
34 |
35 | protected abstract P createPresenter();
36 |
37 | protected abstract int getLayoutId();
38 |
39 | //这个方法是为了让用户不要忘了绑定BaseView
40 | protected abstract void bindView();
41 |
42 | protected P getPresenter() {
43 | return presenter;
44 | }
45 |
46 | public AppCompatActivity getActivity() {
47 | return this;
48 | }
49 |
50 | public void showToasty(String msg) {
51 | ToastUtils.show(msg);
52 | }
53 |
54 | public ProgressDialog getLoading(String msg){
55 | return DialogUtils.getLoading(msg);
56 | }
57 |
58 | @Override
59 | protected void onDestroy() {
60 | super.onDestroy();
61 | unbinder.unbind();
62 | if (getPresenter() != null) {
63 | getPresenter().unsubscribe();
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/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/layout/dialog_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
20 |
21 |
31 |
32 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/templates/LhhActivity/template.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
20 |
21 |
22 |
29 |
30 |
36 |
37 |
46 |
47 |
54 |
55 |
63 |
64 |
65 |
66 |
67 | template_lhh_activity.png
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
18 |
19 |
22 |
23 |
26 |
27 |
30 |
31 |
34 |
35 |
38 |
41 |
42 |
47 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/templates/LhhFragment/template.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
20 |
21 |
28 |
29 |
35 |
36 |
45 |
46 |
53 |
54 |
55 |
63 |
64 |
65 |
66 |
67 | template_lhh_activity.png
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/Utils/TitleBarUtils.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.Utils;
2 |
3 | import android.app.Activity;
4 | import android.view.View;
5 |
6 | import com.gyf.barlibrary.ImmersionBar;
7 |
8 | import me.soushin.tinmvp.R;
9 | import me.soushin.tinmvp.widget.ToolHolder;
10 |
11 | /**
12 | * 标题栏工具类
13 | * 标题栏样式较多,可以把所有样式放到这里,方便调用
14 | *
15 | * @auther SouShin
16 | * @time 2019/1/24 09:16
17 | */
18 | public class TitleBarUtils {
19 | private ToolHolder toolHolder;
20 | /**
21 | * 适用于有标题栏有状态栏的情况
22 | * BarParams里面有ImmersionBar各项设置详细说明
23 | * ImmersionBar是设置标题栏和状态栏背景的工具类(https://github.com/gyf-dev/ImmersionBar)
24 | * 支持设置标题栏和状态栏渐变/纯色/白底黑字
25 | *
26 | * @param activity 上下文
27 | * @param isBack 需/不需要返回按钮
28 | * @param title 标题
29 | */
30 |
31 | public void setToolBar(final Activity activity, boolean isBack, String title) {
32 | View toolBar = activity.findViewById(R.id.toolbar);
33 | if (toolBar==null){
34 | throw new NullPointerException("新手指引:请在activity布局文件里添加");
35 | }
36 | ImmersionBar.with(activity)
37 | .statusBarColor(R.color.colorPrimary)
38 | .titleBar(toolBar)
39 | .init();
40 | toolHolder = new ToolHolder(toolBar);
41 | toolHolder.tvTitle.setText(title);
42 | toolHolder.imgBack.setVisibility(isBack ? View.VISIBLE : View.GONE);
43 | toolHolder.imgBack.setOnClickListener(new View.OnClickListener() {
44 | @Override
45 | public void onClick(View v) {
46 | activity.onBackPressed();
47 | }
48 | });
49 | }
50 |
51 | /**
52 | * 适用于无标题栏只有状态栏的情况
53 | * 包括设置状态栏透明
54 | * statusBarDarkFont(true,1) 状态栏黑字
55 | * fitsSystemWindows(true)解决布局与状态栏重叠问题
56 | * @param activity 上下文
57 | */
58 | public void setToolBar(Activity activity){
59 | ImmersionBar.with(activity)
60 | .statusBarColor(R.color.colorAccent)
61 | .fitsSystemWindows(true)
62 | .init();
63 | }
64 |
65 | /**
66 | * 解除绑定
67 | */
68 | public void Unbind(){
69 | if (toolHolder!=null){
70 | toolHolder.unbinder.unbind();
71 | toolHolder.unbinder=null;
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 | 0dp
8 | 1dp
9 | 2dp
10 | 3dp
11 | 4dp
12 | 5dp
13 | 8dp
14 | 10dp
15 | 12dp
16 | 13dp
17 |
18 | 15dp
19 | 18dp
20 |
21 | 20dp
22 | 25dp
23 | 30dp
24 | 32dp
25 | 35dp
26 | 40dp
27 | 45dp
28 | 50dp
29 | 55dp
30 |
31 | 60dp
32 | 70dp
33 | 74dp
34 | 75dp
35 | 78dp
36 | 80dp
37 | 85dp
38 |
39 | 90dp
40 | 100dp
41 | 105dp
42 | 120dp
43 | 125dp
44 | 150dp
45 | 180dp
46 | 200dp
47 | 240dp
48 | 250dp
49 | 300dp
50 |
51 |
52 | 10sp
53 | 12sp
54 | 13sp
55 | 14sp
56 | 15sp
57 | 16sp
58 | 17sp
59 | 18sp
60 | 20sp
61 | 24sp
62 | 30sp
63 |
64 | 1px
65 |
66 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
5 | defaultConfig {
6 | applicationId "me.soushin.tinmvp"
7 | minSdkVersion rootProject.ext.android["minSdkVersion"]
8 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
9 | versionCode rootProject.ext.android["versionCode"]
10 | versionName rootProject.ext.android["versionName"]
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | multiDexEnabled true
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | android.applicationVariants.all { variant ->
21 | variant.outputs.all {
22 | // 自定义文件名{示例:AppName-Flavor-debug-v1.0.0_201807301409}
23 | outputFileName = "tinmvp-${variant.flavorName}-${variant.buildType.name}-v${variant.versionName}_${buildTime()}.apk"
24 | }
25 | }
26 | }
27 |
28 | def buildTime() {
29 | def date = new Date()
30 | def formattedDate = date.format('yyyyMMdd')
31 | return formattedDate
32 | }
33 |
34 | dependencies {
35 | implementation fileTree(dir: 'libs', include: ['*.jar'])
36 | implementation rootProject.ext.dependencies["appcompat-v7"]
37 | implementation rootProject.ext.dependencies["recyclerview-v7"]
38 | implementation rootProject.ext.dependencies["constraint-layout"]
39 | implementation rootProject.ext.dependencies["alog"]
40 | implementation rootProject.ext.dependencies["autosize"]
41 | implementation rootProject.ext.dependencies["BaseRecyclerViewAdapterHelper"]
42 | implementation rootProject.ext.dependencies["rxeasyhttp"]
43 | implementation rootProject.ext.dependencies["glide"]
44 | implementation rootProject.ext.dependencies["eventbus"]
45 | implementation rootProject.ext.dependencies["rxpermissions"]
46 | implementation rootProject.ext.dependencies["immersionbar"]
47 | implementation rootProject.ext.dependencies["butterknife"]
48 | implementation rootProject.ext.dependencies["fragmentation"]
49 | implementation rootProject.ext.dependencies["ToastUtils"]
50 | annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
51 | testImplementation rootProject.ext.dependencies["junit"]
52 | androidTestImplementation rootProject.ext.dependencies["runner"]
53 | androidTestImplementation rootProject.ext.dependencies["espresso-core"]
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/ActivityLifeCycleCallBackIml.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp;
2 |
3 | import android.app.Activity;
4 | import android.app.Application;
5 | import android.os.Bundle;
6 | import com.blankj.ALog;
7 | import com.gyf.barlibrary.ImmersionBar;
8 | import me.soushin.tinmvp.Utils.ActivityUtils;
9 | import me.soushin.tinmvp.Utils.AppUtils;
10 | import me.soushin.tinmvp.Utils.DialogUtils;
11 | import me.soushin.tinmvp.Utils.TitleBarUtils;
12 | import me.soushin.tinmvp.module.main.MainActivity;
13 | import me.soushin.tinmvp.network.HttpClient;
14 |
15 | /**
16 | * activity生命周期管理类
17 | * 你想象力有多丰富,这里就有多强大,
18 | * 以前放到BaseActivity的操作都可以放到这里
19 | * 使用:registerActivityLifecycleCallbacks(new ActivityLifeCycleCallBackIml());
20 | *
21 | * @author SouShin
22 | * @time 2018/12/10 15:38
23 | */
24 | public class ActivityLifeCycleCallBackIml implements Application.ActivityLifecycleCallbacks {
25 | private TitleBarUtils titleBar;
26 | @Override
27 | public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
28 | ALog.i("activity生命周期管理类",activity.getLocalClassName());
29 | ActivityUtils.addActivity(activity);
30 | }
31 |
32 | @Override
33 | public void onActivityStarted(final Activity activity) {
34 | // ALog.i("activity生命周期管理类", "onActivityStarted");
35 | //这里根据不同的activity显示不同的topBar
36 | titleBar=new TitleBarUtils();
37 | if (activity instanceof MainActivity) {
38 | titleBar.setToolBar(activity,false,AppUtils.getString(R.string.app_name));
39 | }
40 | }
41 |
42 | @Override
43 | public void onActivityResumed(Activity activity) {
44 | // ALog.i("activity生命周期管理类", "onActivityResumed");
45 | }
46 |
47 | @Override
48 | public void onActivityPaused(Activity activity) {
49 | // ALog.i("activity生命周期管理类", "onActivityPaused");
50 | }
51 |
52 | @Override
53 | public void onActivityStopped(Activity activity) {
54 | // ALog.i("activity生命周期管理类", "onActivityStopped");
55 | }
56 |
57 | @Override
58 | public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
59 | // ALog.i("activity生命周期管理类", "onActivitySaveInstanceState");
60 | }
61 |
62 | @Override
63 | public void onActivityDestroyed(Activity activity) {
64 | ALog.i("activity生命周期管理类", "onActivityDestroyed");
65 | ImmersionBar.with(activity).destroy(); //必须调用该方法,防止内存泄漏
66 | ActivityUtils.removeActivity(activity);
67 | HttpClient.disposeRequest(activity.getLocalClassName());
68 | DialogUtils.disDialog();
69 | titleBar.Unbind();
70 | titleBar=null;
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/app/src/main/java/me/soushin/tinmvp/Utils/GsonUtils.java:
--------------------------------------------------------------------------------
1 | package me.soushin.tinmvp.Utils;
2 |
3 | import com.google.gson.Gson;
4 | import com.google.gson.JsonArray;
5 | import com.google.gson.JsonElement;
6 | import com.google.gson.JsonParser;
7 | import com.google.gson.reflect.TypeToken;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | /**
14 | * author : guof
15 | * Description :
16 | * date : 2018/8/6
17 | * Copyright (c) 2014-2017 银湾技术二部
18 | */
19 |
20 | public class GsonUtils {
21 | private static Gson gson;
22 |
23 | public static Gson getGson() {
24 | if (gson == null) {
25 | gson = new Gson();
26 | }
27 | return gson;
28 | }
29 |
30 | /**
31 | * 将object对象转成json字符串
32 | *
33 | * @param object
34 | * @return
35 | */
36 | public static String toString(Object object) {
37 | return getGson().toJson(object);
38 | }
39 |
40 | /**
41 | * 将gsonString转成泛型bean
42 | *
43 | * @param gsonString
44 | * @param cls
45 | * @return
46 | */
47 | public static T toBean(String gsonString, Class cls) {
48 | return getGson().fromJson(gsonString, cls);
49 | }
50 |
51 | /**
52 | * 转成list
53 | * 此方法不可用
54 | * 泛型在编译期类型被擦除导致报错
55 | * @param gsonString
56 | * @param cls
57 | * @return
58 | public static List toList(String gsonString, Class cls) {
59 | return getGson().fromJson(gsonString, new TypeToken>() {}.getType());
60 | }*/
61 |
62 | /**
63 | * 转成list
64 | * 解决泛型问题
65 | * @param json
66 | * @param cls
67 | * @param
68 | * @return
69 | */
70 | public static List toList(String json, Class cls) {
71 | List list = new ArrayList();
72 | JsonArray array = new JsonParser().parse(json).getAsJsonArray();
73 | for(final JsonElement elem : array){
74 | list.add(getGson().fromJson(elem, cls));
75 | }
76 | return list;
77 | }
78 |
79 | /**
80 | * 转成list中有map的
81 | *
82 | * @param gsonString
83 | * @return
84 | */
85 | public static List