├── app
├── .gitignore
├── debug.jks
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles_widget.xml
│ │ │ │ └── styles.xml
│ │ │ ├── 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
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── layout
│ │ │ │ ├── fragment_empty.xml
│ │ │ │ └── adapter_item_simple_list_2.xml
│ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ └── drawable
│ │ │ │ └── ic_launcher_background.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── xuexiang
│ │ │ │ └── templateproject
│ │ │ │ ├── activity
│ │ │ │ └── MainActivity.java
│ │ │ │ ├── fragment
│ │ │ │ ├── EmptyFragment.java
│ │ │ │ └── MainFragment.java
│ │ │ │ ├── MyApp.java
│ │ │ │ ├── utils
│ │ │ │ ├── service
│ │ │ │ │ └── JsonSerializationService.java
│ │ │ │ └── sdkinit
│ │ │ │ │ ├── XBasicLibInit.java
│ │ │ │ │ └── UMengInit.java
│ │ │ │ └── core
│ │ │ │ ├── SimpleListAdapter.java
│ │ │ │ ├── BaseActivity.java
│ │ │ │ ├── BaseContainerFragment.java
│ │ │ │ ├── BaseSimpleListFragment.java
│ │ │ │ └── BaseFragment.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── xuexiang
│ │ │ └── templateproject
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── xuexiang
│ │ └── templateproject
│ │ └── ExampleInstrumentedTest.java
├── channel
├── multiple-channel.gradle
├── x-library-simple.gradle
├── build.gradle
└── proguard-rules.pro
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .github
└── FUNDING.yml
├── .idea
├── copyright
│ ├── profiles_settings.xml
│ └── xuexiang.xml
└── gradle.xml
├── .gitignore
├── gradle.properties
├── gradlew.bat
├── README.md
├── gradlew
├── versions.gradle
└── LICENSE
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/app/debug.jks:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/TemplateSimpleProject/HEAD/app/debug.jks
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TemplateSimpleProject
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/TemplateSimpleProject/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | custom: https://gitee.com/xuexiangjys/Resource/blob/master/doc/sponsor.md
4 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/TemplateSimpleProject/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/TemplateSimpleProject/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/TemplateSimpleProject/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/TemplateSimpleProject/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/TemplateSimpleProject/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/TemplateSimpleProject/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/xuexiangjys/TemplateSimpleProject/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/xuexiangjys/TemplateSimpleProject/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/xuexiangjys/TemplateSimpleProject/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/xuexiangjys/TemplateSimpleProject/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 28 16:23:16 CST 2019
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-6.6.1-bin.zip
7 |
--------------------------------------------------------------------------------
/app/channel:
--------------------------------------------------------------------------------
1 | # 美团
2 | meituan
3 | # 三星
4 | samsungapps
5 | # 小米
6 | xiaomi
7 | # 91助手
8 | 91com
9 | # 魅族
10 | meizu
11 | # 豌豆荚
12 | wandou
13 | # Google Play
14 | googleplay
15 | # 百度
16 | baidu
17 | # 360
18 | 360cn
19 | # 应用宝
20 | myapp
21 | # 华为
22 | huawei
23 | # 蒲公英
24 | pgyer
25 | github
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /LocalRepository
4 | /keystores
5 | /local.properties
6 | /.idea/caches
7 | /.idea/codeStyles
8 | /.idea/inspectionProfiles
9 | /.idea/libraries
10 | /.idea/dictionaries
11 | /.idea/markdown-navigator
12 | /.idea/*.xml
13 | .DS_Store
14 | /build
15 | /captures
16 | .externalNativeBuild
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/multiple-channel.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'walle'
2 |
3 | walle {
4 | // 指定渠道包的输出路径
5 | apkOutputFolder = new File("${project.buildDir}/outputs/channels")
6 | // 定制渠道包的APK的文件名称
7 | apkFileNameFormat = '${appName}-${packageName}-${channel}-${buildType}-v${versionName}-${versionCode}-${buildTime}.apk'
8 | // 渠道配置文件
9 | channelFile = new File("${project.getProjectDir()}/channel")
10 | }
--------------------------------------------------------------------------------
/app/src/test/java/com/xuexiang/templateproject/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.xuexiang.templateproject;
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 | }
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/copyright/xuexiang.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/xuexiang/templateproject/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.xuexiang.templateproject;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.runner.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.assertEquals;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 |
25 | assertEquals("com.xuexiang.templateproject", appContext.getPackageName());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #299EE3
4 | #299EE3
5 | #299EE3
6 |
7 |
8 |
9 | @color/xui_config_color_white
10 | @color/xui_config_color_red
11 | @color/colorAccent
12 | #388E3C
13 | @color/xui_config_color_waring
14 | #353A3E
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_empty.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
22 |
23 |
--------------------------------------------------------------------------------
/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 |
15 | # 是否打包APK,打正式包时请设置为true,使用正式的签名
16 | isNeedPackage=false
17 | # 是否使用booster优化APK,这里需要注意gradle的版本,对于最新的gradle版本可能存在兼容问题
18 | isUseBooster=false
19 | android.precompileDependenciesResources=false
20 |
21 | android.useAndroidX=true
22 | android.enableJetifier=true
23 |
24 | android.enableD8=true
25 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles_widget.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
21 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xuexiang/templateproject/activity/MainActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com)
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 |
18 | package com.xuexiang.templateproject.activity;
19 |
20 | import android.os.Bundle;
21 |
22 | import com.xuexiang.templateproject.core.BaseActivity;
23 | import com.xuexiang.templateproject.fragment.MainFragment;
24 |
25 | /**
26 | * 程序入口,空壳容器
27 | *
28 | * @author xuexiang
29 | * @since 2019-07-07 23:53
30 | */
31 | public class MainActivity extends BaseActivity {
32 |
33 | @Override
34 | protected void onCreate(Bundle savedInstanceState) {
35 | super.onCreate(savedInstanceState);
36 | openPage(MainFragment.class);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
16 |
17 |
18 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/adapter_item_simple_list_2.xml:
--------------------------------------------------------------------------------
1 |
17 |
26 |
27 |
31 |
32 |
37 |
38 |
--------------------------------------------------------------------------------
/app/x-library-simple.gradle:
--------------------------------------------------------------------------------
1 | //引用XAOP插件
2 | apply plugin: 'com.xuexiang.xaop'
3 | //引用XRouter-plugin插件实现自动注册
4 | apply plugin: 'com.xuexiang.xrouter'
5 |
6 | //自动添加依赖
7 | project.configurations.each { configuration ->
8 | def dependencies = getProject().dependencies
9 | if (configuration.name == "implementation") {
10 | //为Project加入X-Library依赖
11 | //XUI框架
12 | configuration.dependencies.add(dependencies.create(deps.xlibrary.xui))
13 | configuration.dependencies.add(dependencies.create(deps.androidx.appcompat))
14 | configuration.dependencies.add(dependencies.create(deps.androidx.recyclerview))
15 | configuration.dependencies.add(dependencies.create(deps.androidx.design))
16 | configuration.dependencies.add(dependencies.create(deps.glide))
17 | //XUtil工具类
18 | configuration.dependencies.add(dependencies.create(deps.xlibrary.xutil_core))
19 | //XAOP切片
20 | configuration.dependencies.add(dependencies.create(deps.xlibrary.xaop_runtime))
21 | //XPage
22 | configuration.dependencies.add(dependencies.create(deps.xlibrary.xpage_lib))
23 | //XRouter
24 | configuration.dependencies.add(dependencies.create(deps.xlibrary.xrouter_runtime))
25 | }
26 |
27 | if (configuration.name == "annotationProcessor") {
28 | //XPage
29 | configuration.dependencies.add(dependencies.create(deps.xlibrary.xpage_compiler))
30 | //页面路由
31 | configuration.dependencies.add(dependencies.create(deps.xlibrary.xrouter_compiler))
32 | }
33 |
34 | if (configuration.name == "debugImplementation") {
35 | //内存泄漏监测leak
36 | configuration.dependencies.add(dependencies.create(deps.leakcanary))
37 | }
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xuexiang/templateproject/fragment/EmptyFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com)
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 |
18 | package com.xuexiang.templateproject.fragment;
19 |
20 | import android.view.LayoutInflater;
21 | import android.view.ViewGroup;
22 |
23 | import androidx.annotation.NonNull;
24 | import androidx.annotation.Nullable;
25 |
26 | import com.xuexiang.templateproject.core.BaseFragment;
27 | import com.xuexiang.templateproject.databinding.FragmentEmptyBinding;
28 | import com.xuexiang.xpage.annotation.Page;
29 |
30 | /**
31 | * 这个只是一个空壳Fragment,只是用于演示而已
32 | *
33 | * @author xuexiang
34 | * @since 2019-07-08 00:52
35 | */
36 | @Page(name = "空页面")
37 | public class EmptyFragment extends BaseFragment {
38 |
39 | @NonNull
40 | @Override
41 | protected FragmentEmptyBinding viewBindingInflate(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, boolean attachToRoot) {
42 | return FragmentEmptyBinding.inflate(inflater, container, attachToRoot);
43 | }
44 |
45 | /**
46 | * 初始化控件
47 | */
48 | @Override
49 | protected void initViews() {
50 |
51 | }
52 |
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xuexiang/templateproject/MyApp.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com)
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 |
18 | package com.xuexiang.templateproject;
19 |
20 | import android.app.Application;
21 | import android.content.Context;
22 |
23 | import androidx.multidex.MultiDex;
24 |
25 | import com.xuexiang.templateproject.utils.sdkinit.UMengInit;
26 | import com.xuexiang.templateproject.utils.sdkinit.XBasicLibInit;
27 |
28 | /**
29 | * @author xuexiang
30 | * @since 2018/11/7 下午1:12
31 | */
32 | public class MyApp extends Application {
33 |
34 | @Override
35 | protected void attachBaseContext(Context base) {
36 | super.attachBaseContext(base);
37 | //解决4.x运行崩溃的问题
38 | MultiDex.install(this);
39 | }
40 |
41 | @Override
42 | public void onCreate() {
43 | super.onCreate();
44 | initLibs();
45 | }
46 |
47 | /**
48 | * 初始化基础库
49 | */
50 | private void initLibs() {
51 | XBasicLibInit.init(this);
52 | UMengInit.init(this);
53 | }
54 |
55 |
56 | /**
57 | * @return 当前app是否是调试开发模式
58 | */
59 | public static boolean isDebug() {
60 | return BuildConfig.DEBUG;
61 | }
62 |
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xuexiang/templateproject/utils/service/JsonSerializationService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com)
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 |
18 | package com.xuexiang.templateproject.utils.service;
19 |
20 | import android.content.Context;
21 |
22 | import com.xuexiang.xrouter.annotation.Router;
23 | import com.xuexiang.xrouter.facade.service.SerializationService;
24 | import com.xuexiang.xutil.net.JsonUtil;
25 |
26 | import java.lang.reflect.Type;
27 |
28 | /**
29 | * @author XUE
30 | * @since 2019/3/27 16:39
31 | */
32 | @Router(path = "/service/json")
33 | public class JsonSerializationService implements SerializationService {
34 | /**
35 | * 对象序列化为json
36 | *
37 | * @param instance obj
38 | * @return json string
39 | */
40 | @Override
41 | public String object2Json(Object instance) {
42 | return JsonUtil.toJson(instance);
43 | }
44 |
45 | /**
46 | * json反序列化为对象
47 | *
48 | * @param input json string
49 | * @param clazz object type
50 | * @return instance of object
51 | */
52 | @Override
53 | public T parseObject(String input, Type clazz) {
54 | return JsonUtil.fromJson(input, clazz);
55 | }
56 |
57 | /**
58 | * 进程初始化的方法
59 | *
60 | * @param context 上下文
61 | */
62 | @Override
63 | public void init(Context context) {
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/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
20 |
21 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
39 |
40 |
41 |
44 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xuexiang/templateproject/fragment/MainFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com)
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 |
18 | package com.xuexiang.templateproject.fragment;
19 |
20 | import android.view.KeyEvent;
21 |
22 | import com.xuexiang.templateproject.core.BaseContainerFragment;
23 | import com.xuexiang.xpage.annotation.Page;
24 | import com.xuexiang.xpage.enums.CoreAnim;
25 | import com.xuexiang.xui.utils.XToastUtils;
26 | import com.xuexiang.xui.widget.actionbar.TitleBar;
27 | import com.xuexiang.xutil.XUtil;
28 | import com.xuexiang.xutil.common.ClickUtils;
29 |
30 | /**
31 | * @author xuexiang
32 | * @since 2018/11/7 下午1:16
33 | */
34 | @Page(name = "模版程序", anim = CoreAnim.none)
35 | public class MainFragment extends BaseContainerFragment implements ClickUtils.OnClick2ExitListener {
36 |
37 | @Override
38 | protected Class>[] getPagesClasses() {
39 | return new Class[] {
40 | //此处填写fragment
41 | EmptyFragment.class
42 | };
43 | }
44 |
45 | @Override
46 | protected TitleBar initTitle() {
47 | return super.initTitle().setLeftClickListener(view -> ClickUtils.exitBy2Click(2000, this));
48 | }
49 |
50 |
51 | /**
52 | * 菜单、返回键响应
53 | */
54 | @Override
55 | public boolean onKeyDown(int keyCode, KeyEvent event) {
56 | if (keyCode == KeyEvent.KEYCODE_BACK) {
57 | ClickUtils.exitBy2Click(2000, this);
58 | }
59 | return true;
60 | }
61 |
62 | @Override
63 | public void onRetry() {
64 | XToastUtils.toast("再按一次退出程序");
65 | }
66 |
67 | @Override
68 | public void onExit() {
69 | XUtil.exitApp();
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/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/src/main/java/com/xuexiang/templateproject/core/SimpleListAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com)
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 |
18 | package com.xuexiang.templateproject.core;
19 |
20 | import android.content.Context;
21 | import android.view.View;
22 | import android.widget.TextView;
23 |
24 | import com.xuexiang.templateproject.R;
25 | import com.xuexiang.xui.adapter.listview.BaseListAdapter;
26 | import com.xuexiang.xutil.common.StringUtils;
27 |
28 | import java.util.List;
29 | import java.util.Map;
30 |
31 | /**
32 | * 主副标题显示适配器
33 | *
34 | * @author xuexiang
35 | * @since 2018/12/19 上午12:19
36 | */
37 | public class SimpleListAdapter extends BaseListAdapter