city) {
27 | this.city = city;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/lib_wheel_picker/src/main/java/com/aigestudio/wheelpicker/widgets/IWheelHourPicker.java:
--------------------------------------------------------------------------------
1 | package com.aigestudio.wheelpicker.widgets;
2 |
3 | /**
4 | * 小时选择器方法接口
5 | *
6 | * Interface of WheelHourPicker
7 | *
8 | * @author AigeStudio 2016-07-12
9 | * @version 1
10 | */
11 | public interface IWheelHourPicker {
12 | /**
13 | * 获取小时选择器初始化时选择的小时
14 | *
15 | * @return 选择的小时
16 | */
17 | String getSelectedHour();
18 |
19 | /**
20 | * 设置小时选择器初始化时选择的小时
21 | *
22 | * @param hour 选择的小时
23 | */
24 | void setSelectedHour(String hour);
25 |
26 | /**
27 | * 获取当前选择的小时
28 | *
29 | * @return 当前选择的小时
30 | */
31 | String getCurrentHour();
32 | }
33 |
--------------------------------------------------------------------------------
/lib_wheel_picker/src/main/java/com/aigestudio/wheelpicker/widgets/IWheelMonthPicker.java:
--------------------------------------------------------------------------------
1 | package com.aigestudio.wheelpicker.widgets;
2 |
3 | /**
4 | * 月份选择器方法接口
5 | *
6 | * Interface of WheelMonthPicker
7 | *
8 | * @author AigeStudio 2016-07-12
9 | * @version 1
10 | */
11 | public interface IWheelMonthPicker {
12 | /**
13 | * 获取月份选择器初始化时选择的月份
14 | *
15 | * @return 选择的月份
16 | */
17 | int getSelectedMonth();
18 |
19 | /**
20 | * 设置月份选择器初始化时选择的月份
21 | *
22 | * @param month 选择的月份
23 | */
24 | void setSelectedMonth(int month);
25 |
26 | /**
27 | * 获取当前选择的月份
28 | *
29 | * @return 当前选择的月份
30 | */
31 | int getCurrentMonth();
32 | }
33 |
--------------------------------------------------------------------------------
/lib_wheel_picker/src/main/java/com/aigestudio/wheelpicker/widgets/IWheelMinutePicker.java:
--------------------------------------------------------------------------------
1 | package com.aigestudio.wheelpicker.widgets;
2 |
3 | /**
4 | * 分钟选择器方法接口
5 | *
6 | * Interface of WheelMinutePicker
7 | *
8 | * @author AigeStudio 2016-07-12
9 | * @version 1
10 | */
11 | public interface IWheelMinutePicker {
12 | /**
13 | * 获取分钟选择器初始化时选择的分钟
14 | *
15 | * @return 选择的分钟
16 | */
17 | String getSelectedMinute();
18 |
19 | /**
20 | * 设置分钟选择器初始化时选择的分钟
21 | *
22 | * @param minute 选择的分钟
23 | */
24 | void setSelectedMinute(String minute);
25 |
26 | /**
27 | * 获取当前选择的分钟
28 | *
29 | * @return 当前选择的分钟
30 | */
31 | String getCurrentMinute();
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/holder_banner.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/holder_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
--------------------------------------------------------------------------------
/lib_common/src/main/res/layout/dialog_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/lib_media_picker/src/main/res/layout/preview_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
9 |
10 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/style/app/AppCrashHandler.java:
--------------------------------------------------------------------------------
1 | package com.style.app;
2 |
3 | import android.os.Process;
4 | import android.util.Log;
5 |
6 | /**
7 | * Created by xiajun on 2017/12/22.
8 | * 由于 ActivityManager 时刻监听着进程,一旦发现进程被非正常Kill(不拦截崩溃时),它将会试图去重启这个进程。
9 | * 注意:自定义异常崩溃拦截会导致应用卡死,需要手动杀掉进程
10 | */
11 |
12 | public class AppCrashHandler implements Thread.UncaughtExceptionHandler {
13 | private final String TAG = this.getClass().getSimpleName();
14 |
15 | @Override
16 | public void uncaughtException(Thread thread, Throwable ex) {
17 | Log.e(TAG, "uncaughtException");
18 | ex.printStackTrace();
19 | //System.exit(0); //停止当前程序的虚拟机
20 | Process.sendSignal(Process.myPid(), Process.SIGNAL_KILL); //使用给定的PID终止进程
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/lib_common/src/main/java/com/style/http/exception/HttpResultException.java:
--------------------------------------------------------------------------------
1 | package com.style.http.exception;
2 |
3 |
4 |
5 | public class HttpResultException extends RuntimeException {
6 |
7 | public static final int NETWORK_ERROR = 9998; //网络异常
8 | public static final int SERVER_ERROR = 500; //服务器异常
9 | public static final int TOKEN_INVALID = 1000; //TOKEN无效
10 | public static final int TOKEN_EXPIRED = 1001; //TOKEN过期
11 | public int errorCode;
12 | public String msg;
13 |
14 | public HttpResultException(int code, String msg1) {
15 | this.errorCode = code;
16 | this.msg = msg1;
17 | }
18 |
19 | public static HttpResultException serverError() {
20 | return new HttpResultException(SERVER_ERROR, "服务器异常");
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/example/customView/WriteWordActivity.kt:
--------------------------------------------------------------------------------
1 | package example.customView
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 | import android.util.Log
6 |
7 | import com.style.framework.R
8 |
9 | class WriteWordActivity : AppCompatActivity() {
10 |
11 | override fun onCreate(savedInstanceState: Bundle?) {
12 | super.onCreate(savedInstanceState)
13 | setContentView(R.layout.activity_write_word)
14 |
15 | for (i in 1..5 step 2) {
16 | Log.e("WriteWordActivity", i.toString())
17 | }
18 | for (i in 1 until 5 step 2) {
19 | Log.e("WriteWordActivity", i.toString())
20 |
21 | }
22 | for (i in 10 downTo 1 step 2) {
23 | println("i=$i")
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/example/scroll/ScrollingActivity.kt:
--------------------------------------------------------------------------------
1 | package example.scroll
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 | import com.style.framework.databinding.ActivityScrollingBinding
6 |
7 | /**
8 | * app:layout_scrollFlags,设置为:scroll|enterAlways|snap 便是指定标题栏随屏幕滚动实现的属性。
9 | * scroll表示屏幕向上滑动时,标题栏同时向上滑动并隐藏;
10 | * enterAlways表示屏幕向下滑动时,标题栏同时向下活动并显示;
11 | * snap表示Toolbar没有完全显示或隐藏时,根据滚动距离,自动选择。
12 | */
13 | class ScrollingActivity : AppCompatActivity() {
14 |
15 | private lateinit var bd: ActivityScrollingBinding
16 |
17 | override fun onCreate(savedInstanceState: Bundle?) {
18 | super.onCreate(savedInstanceState)
19 | bd = ActivityScrollingBinding.inflate(layoutInflater)
20 | setContentView(bd.root)
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib_media_picker/src/main/java/com/dmcbig/mediapicker/data/LoaderM.java:
--------------------------------------------------------------------------------
1 | package com.dmcbig.mediapicker.data;
2 |
3 | import com.dmcbig.mediapicker.entity.Folder;
4 |
5 | import java.util.ArrayList;
6 |
7 | /**
8 | * Created by dmcBig on 2017/7/20.
9 | */
10 |
11 | public class LoaderM {
12 |
13 | public String getParent(String path) {
14 | String sp[]=path.split("/");
15 | return sp[sp.length-2];
16 | }
17 |
18 | public int hasDir(ArrayList folders, String dirName){
19 | for(int i = 0; i< folders.size(); i++){
20 | Folder folder = folders.get(i);
21 | if( folder.name.equals(dirName)) {
22 | return i;
23 | }
24 | }
25 | return -1;
26 | }
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tab_simple_fragment.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
14 |
15 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_add_address.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 | -
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/lib_common/src/main/java/com/style/data/db/FileDownloadStateDao.java:
--------------------------------------------------------------------------------
1 | package com.style.data.db;
2 |
3 | import androidx.room.*;
4 | import com.style.data.fileDown.FileDownloadStateBean;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | @Dao
10 | public interface FileDownloadStateDao {
11 | @Query("SELECT * FROM file_download")
12 | public List getAll();
13 |
14 | @Insert(onConflict = OnConflictStrategy.REPLACE)
15 | public long save(FileDownloadStateBean bean);
16 |
17 | @Update(onConflict = OnConflictStrategy.REPLACE)
18 | public int update(FileDownloadStateBean entity);
19 |
20 | @Query("UPDATE file_download SET status=:status,downloadSize=:downloadSize WHERE url=:url")
21 | public int update(int status, int downloadSize, String url);
22 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_scrolling.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/user_info.xml:
--------------------------------------------------------------------------------
1 |
24 |
--------------------------------------------------------------------------------
/lib_common/src/main/res/drawable/loading_animlist.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
9 |
12 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/lib_custom_view/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 |
4 | android {
5 | namespace "com.style.lib_custom_view"
6 | compileSdkVersion ANDROID_COMPILE_SDK_VERSION
7 | defaultConfig {
8 | minSdkVersion ANDROID_MIN_SDK_VERSION
9 | }
10 | buildTypes {
11 | preview {
12 | }
13 | }
14 | compileOptions {
15 | sourceCompatibility JavaVersion.VERSION_11
16 | targetCompatibility JavaVersion.VERSION_11
17 | }
18 | kotlinOptions {
19 | jvmTarget = JavaVersion.VERSION_11.toString()
20 | }
21 | ndkVersion '28.0.12674087 rc2'
22 | }
23 |
24 | dependencies {
25 | implementation "androidx.appcompat:appcompat:$appcompat_version"
26 | implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_video_recorder.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/property_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
10 |
11 |
17 |
18 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/banner_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/banner_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/scroll_stop_content_adapter.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
16 |
17 |
21 |
22 |
--------------------------------------------------------------------------------
/lib_common/src/main/java/com/style/http/response/BaseDataResponse.java:
--------------------------------------------------------------------------------
1 | package com.style.http.response;
2 |
3 | public class BaseDataResponse {
4 | public static final int SUCCESS = 0;
5 |
6 | public int code;
7 |
8 | public T data;
9 |
10 | public String msg;
11 |
12 | public void setCode(int code) {
13 | this.code = code;
14 | }
15 |
16 | public int getCode() {
17 | return this.code;
18 | }
19 |
20 | public void setMsg(String msg) {
21 | this.msg = msg;
22 | }
23 |
24 | public String getMsg() {
25 | return this.msg;
26 | }
27 |
28 | public T getData() {
29 | return data;
30 | }
31 |
32 | public void setData(T data) {
33 | this.data = data;
34 | }
35 |
36 | public boolean isOk() {
37 | return code == SUCCESS;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/lib_custom_view/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 |
--------------------------------------------------------------------------------
/lib_media_picker/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | namespace "com.dmcbig.mediapicker"
5 | compileSdkVersion ANDROID_COMPILE_SDK_VERSION
6 | defaultConfig {
7 | minSdkVersion ANDROID_MIN_SDK_VERSION
8 | }
9 | buildTypes {
10 | preview {
11 | }
12 | }
13 | }
14 |
15 | dependencies {
16 | implementation "androidx.appcompat:appcompat:$appcompat_version"
17 | implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
18 | implementation "com.github.bumptech.glide:glide:$glide_version"
19 | //api "com.squareup.okhttp3:okhttp:3.12.0"
20 | //该库依赖于其他版本okhttp,需要在其所在库工程明确指明okhttp版本或者去除okhttp依赖
21 | implementation("com.github.bumptech.glide:okhttp3-integration:$glide_version", {
22 | exclude module: "okhttp"
23 | })
24 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ndk/JniTest.java:
--------------------------------------------------------------------------------
1 | package com.ndk;
2 |
3 | import example.activity.JniTestActivity;
4 |
5 | /**
6 | * Created by xiajun on 2017/6/7.
7 | */
8 |
9 | public class JniTest {
10 | // Used to load the 'native-lib' library on application startup.
11 | static {
12 | System.loadLibrary("jni_test");
13 | }
14 |
15 |
16 | /**
17 | * A native method that is implemented by the 'native-lib' native library,
18 | * which is packaged with this application.
19 | */
20 | public static native String stringFromJNI();
21 |
22 | public static native void testShort(short s);
23 | public static native void testBasicDataType(short s, int i, long l, float f, double d, char c, boolean z, byte b);
24 | public static native void testJString(String str, Object obj, JniTestActivity.MyClass p, int[] arr);
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/lib_common/src/main/java/com/style/config/FileDirConfig.java:
--------------------------------------------------------------------------------
1 | package com.style.config;
2 |
3 |
4 | import android.os.Environment;
5 |
6 | public class FileDirConfig {
7 | /**
8 | * app文件根目录
9 | */
10 | public static final String DIR_APP = Environment.getExternalStorageDirectory() + "/aaaaStyle";
11 | /**
12 | * 图片保存目录
13 | */
14 | public static final String DIR_APP_IMAGE_CAMERA = DIR_APP + "/image";
15 | /**
16 | * 文件保存目录
17 | */
18 | public static final String DIR_APP_FILE = DIR_APP + "/file";
19 | /**
20 | * 文件缓存目录
21 | */
22 | public static final String DIR_CACHE = DIR_APP + "/cache";
23 | /**
24 | * 视频录制保存目录
25 | */
26 | public static final String DIR_VIDEO = DIR_APP + "/video";
27 |
28 | public static final String FILE_PROVIDER_AUTHORITY = "com.style.file.provider";
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/example/scroll/ScrollingParallaxActivity.kt:
--------------------------------------------------------------------------------
1 | package example.scroll
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 | import com.google.android.material.snackbar.Snackbar
6 | import com.style.framework.databinding.ActivityScrollingParallaxBinding
7 |
8 | class ScrollingParallaxActivity : AppCompatActivity() {
9 |
10 | private lateinit var bd: ActivityScrollingParallaxBinding
11 |
12 | override fun onCreate(savedInstanceState: Bundle?) {
13 | super.onCreate(savedInstanceState)
14 | bd = ActivityScrollingParallaxBinding.inflate(layoutInflater)
15 | setContentView(bd.root)
16 | bd.fab.setOnClickListener { view ->
17 | Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
18 | .setAction("Action", null).show()
19 | }
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_jni_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/lib_custom_view/src/main/java/com/style/view/systemHelper/NoScrollLinearLayoutManager.java:
--------------------------------------------------------------------------------
1 | package com.style.view.systemHelper;
2 |
3 | import android.content.Context;
4 | import androidx.recyclerview.widget.LinearLayoutManager;
5 |
6 | public class NoScrollLinearLayoutManager extends LinearLayoutManager {
7 | private boolean isScrollEnabled = true;
8 |
9 | public NoScrollLinearLayoutManager(Context context) {
10 | super(context);
11 | }
12 |
13 | public NoScrollLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
14 | super(context, orientation, reverseLayout);
15 | }
16 |
17 | public void setScrollEnabled(boolean flag) {
18 | this.isScrollEnabled = flag;
19 | }
20 |
21 | @Override
22 | public boolean canScrollVertically() {
23 | return isScrollEnabled && super.canScrollVertically();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/style/service/appNewVersion/DownNewAppServiceModel.java:
--------------------------------------------------------------------------------
1 | package com.style.service.appNewVersion;
2 |
3 |
4 | import android.annotation.SuppressLint;
5 | import android.app.Application;
6 | import androidx.lifecycle.MutableLiveData;
7 | import androidx.annotation.NonNull;
8 |
9 | import com.style.base.BaseServiceModel;
10 |
11 | import java.io.File;
12 |
13 | public class DownNewAppServiceModel extends BaseServiceModel {
14 | MutableLiveData downLoadNewVersionSuccess = new MutableLiveData<>();
15 |
16 | private File mAppFile;
17 |
18 | public DownNewAppServiceModel(@NonNull Application application) {
19 | super();
20 | }
21 |
22 | /**
23 | * 开始下载新版App
24 | * @param versionInfo
25 | */
26 | @SuppressLint("CheckResult")
27 | public void startDownloadApp(String versionInfo) {
28 | //执行子线程run中的代码逻辑
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_msg_to_sub.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
16 |
17 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/assets/interact.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 本地网页
5 |
18 |
19 |
20 |
21 |
22 | javascript调java
23 |
25 | 处理弹出框
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/file_down_list_activity.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
17 |
18 |
22 |
23 |
--------------------------------------------------------------------------------
/lib_common/src/main/java/com/style/utils/MyTimeCount.java:
--------------------------------------------------------------------------------
1 | package com.style.utils;
2 |
3 | import android.os.CountDownTimer;
4 | import android.widget.Button;
5 |
6 | public class MyTimeCount extends CountDownTimer {
7 | private Button button;
8 | private String countDownStr;
9 |
10 | public MyTimeCount(long millisInFuture, long countDownInterval) {
11 | super(millisInFuture, countDownInterval);// 参数依次为总时长,和计时的时间间隔
12 | }
13 |
14 | public void setButton(Button button, String countDownStr) {
15 | this.button = button;
16 | this.countDownStr = countDownStr;
17 | }
18 |
19 | @Override
20 | public void onFinish() {// 计时完毕时触发
21 | button.setText(countDownStr);
22 | button.setEnabled(true);
23 | }
24 |
25 | @Override
26 | public void onTick(long millisUntilFinished) {// 计时过程显示
27 | button.setEnabled(false);
28 | button.setText(String.valueOf(millisUntilFinished / 1000));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/lib_media_picker/src/main/java/com/dmcbig/mediapicker/OkHttpLibraryGlideModule.java:
--------------------------------------------------------------------------------
1 | package com.dmcbig.mediapicker;
2 |
3 | import android.content.Context;
4 | import androidx.annotation.NonNull;
5 |
6 | import com.bumptech.glide.Glide;
7 | import com.bumptech.glide.Registry;
8 | import com.bumptech.glide.annotation.GlideModule;
9 | import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader;
10 | import com.bumptech.glide.load.model.GlideUrl;
11 | import com.bumptech.glide.module.LibraryGlideModule;
12 |
13 | import java.io.InputStream;
14 |
15 | /**
16 | * Created by xiajun on 2018/9/21.
17 | */
18 | @GlideModule
19 | public class OkHttpLibraryGlideModule extends LibraryGlideModule {
20 | @Override
21 | public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
22 | registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/safe_keyboard_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
18 |
19 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_water_polo.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/style/app/MyAction.kt:
--------------------------------------------------------------------------------
1 | package com.style.app
2 |
3 |
4 | import android.os.Environment
5 |
6 | /**
7 | * 避免广播action重复混乱,广播action最好统一放在这里
8 | * Created by xiajun on 2016/11/25.
9 | */
10 |
11 | class MyAction {
12 |
13 |
14 | companion object {
15 |
16 | /**
17 | * 广播action
18 | */
19 | const val ACTION_REFRESH_CONVERSATION = "action.refresh.conversation"
20 | const val ACTION_FILE_PREPARE_DOWNLOAD = "action.file.prepare.download"
21 | const val ACTION_FILE_GET_FAIL = "action.file.get.fail"
22 | const val ACTION_FILE_CREATE_FAIL = "action.file.create.fail"
23 | const val ACTION_FILE_DOWNING = "action.file.downing"
24 | const val ACTION_FILE_CANCEL_DOWNLOAD = "action.file.cancel.download"
25 | const val ACTION_FILE_DOWN_COMPLETE = "action.file.down.complete"
26 | const val ACTION_FILE_DOWN_FAIL = "action.file.down.fail"
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/example/address/MyCallLog.java:
--------------------------------------------------------------------------------
1 | package example.address;
2 |
3 | public class MyCallLog {
4 |
5 | public String name;
6 | public String phone;
7 | public String type;
8 | public String date;
9 | public String city;
10 | public MyCallLog() {
11 | super();
12 | }
13 | public String getName() {
14 | return name;
15 | }
16 | public void setName(String name) {
17 | this.name = name;
18 | }
19 | public String getPhone() {
20 | return phone;
21 | }
22 | public void setPhone(String phone) {
23 | this.phone = phone;
24 | }
25 | public String getType() {
26 | return type;
27 | }
28 | public void setType(String type) {
29 | this.type = type;
30 | }
31 | public String getDate() {
32 | return date;
33 | }
34 | public void setDate(String date) {
35 | this.date = date;
36 | }
37 | public String getCity() {
38 | return city;
39 | }
40 | public void setCity(String city) {
41 | this.city = city;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/example/activity/ReadAssetsActivity.kt:
--------------------------------------------------------------------------------
1 | package example.activity;
2 |
3 | import android.os.Bundle
4 | import com.style.base.BaseTitleBarActivity
5 | import com.style.framework.R
6 | import com.style.framework.databinding.ActivityUserAgreeBinding
7 | import com.style.utils.AssetsUtil
8 | import java.io.IOException
9 |
10 | class ReadAssetsActivity : BaseTitleBarActivity() {
11 |
12 | private lateinit var bd: ActivityUserAgreeBinding
13 |
14 | override fun onCreate(arg0: Bundle?) {
15 | super.onCreate(arg0)
16 | bd = ActivityUserAgreeBinding.inflate(layoutInflater)
17 | setContentView(bd.root)
18 | setTitleBarTitle("用户协议")
19 | readData()
20 | }
21 |
22 | private fun readData() {
23 | try {
24 | bd.tvUseragree.text = AssetsUtil.getAssetsText(this, "useragree.txt")
25 | } catch (e: IOException) {
26 | e.printStackTrace()
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_image_scan.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
23 |
--------------------------------------------------------------------------------
/lib_media_picker/src/main/res/values-zh/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 媒体选择器
3 | 所有图片和视频
4 | 所有视频
5 | 所有图片
6 | 选择图片和视频
7 | 选择视频
8 | 选择图片
9 | 所有视频
10 | 已达到选择数量上限
11 | 请压缩和剪切后上传,文件最大只支持
12 | 请选择文件
13 | 完成
14 | 个
15 | 预览
16 | 选择
17 | 视频
18 | 需要打开读取存储权限
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_heart_line.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
18 |
19 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/java/example/encrypt/EncryptViewModel.java:
--------------------------------------------------------------------------------
1 | package example.encrypt;
2 |
3 | import android.app.Application;
4 | import androidx.annotation.NonNull;
5 |
6 | import com.style.base.BaseViewModel;
7 | import com.style.entity.UserInfo;
8 |
9 | /**
10 | * Created by xiajun on 2018/6/21.
11 | */
12 |
13 | public class EncryptViewModel extends BaseViewModel {
14 |
15 |
16 | public EncryptViewModel(@NonNull Application application) {
17 | super(application);
18 | }
19 |
20 | public void saveUser() {
21 | UserInfo user = new UserInfo("123456789", "zxcvbnm");
22 | user.setSex("男");
23 | user.setTelPhone("17364814713");
24 | user.setUserName("夏军");
25 | user.setSignKey("osfsnffnuj ekrfasfhaweoirwefnejfwefaslfheoifhefhnewfwfwfpenpnmsnmfnejfic");
26 | getPreferences().saveUserEncrypt(user);
27 | }
28 |
29 | public void getUser() {
30 | getPreferences().getUserDecrypt();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_pager_cards_fragments_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
18 |
19 |
24 |
25 |
--------------------------------------------------------------------------------
/lib_common/src/main/res/layout/common_loading_layout_network_error.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
25 |
--------------------------------------------------------------------------------
/lib_media_picker/src/main/java/com/dmcbig/mediapicker/adapter/SpacingDecoration.java:
--------------------------------------------------------------------------------
1 | package com.dmcbig.mediapicker.adapter;
2 |
3 | import android.graphics.Rect;
4 | import androidx.recyclerview.widget.RecyclerView;
5 |
6 | import android.view.View;
7 |
8 | /**
9 | * Created by dmcBig on 2017/7/11.
10 | */
11 |
12 | public class SpacingDecoration extends RecyclerView.ItemDecoration {
13 |
14 | private int space;
15 | private int spanCount;
16 |
17 | public SpacingDecoration(int spanCount,int space) {
18 | this.spanCount=spanCount;
19 | this.space=space;
20 | }
21 |
22 | @Override
23 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
24 | //不是第一个的格子都设一个左边和底部的间距
25 | outRect.left = space;
26 | outRect.bottom = space;
27 | int position = parent.getChildLayoutPosition(view);
28 | if(position%spanCount==0){
29 | outRect.left = 0;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/lib_zxing/src/main/java/com/google/zxing/camera/open/CameraFacing.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 ZXing authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.google.zxing.camera.open;
18 |
19 | /**
20 | * Enumeration of directions a camera may face: front or back.
21 | */
22 | public enum CameraFacing {
23 |
24 | BACK, // must be value 0!
25 | FRONT, // must be value 1!
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_report_trend.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
17 |
18 |
24 |
25 |
--------------------------------------------------------------------------------
/app/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | cmake_minimum_required(VERSION 3.4.1)
3 |
4 | add_library( jni_test
5 | SHARED
6 | ${CMAKE_SOURCE_DIR}/src/main/cpp/src/test/test.cpp
7 | ${CMAKE_SOURCE_DIR}/src/main/cpp/src/test/logUtil.cpp )
8 |
9 | include_directories(
10 | ${CMAKE_SOURCE_DIR}/src/main/cpp/include
11 | )
12 |
13 | find_library( log-lib
14 | log )
15 |
16 | target_link_libraries( jni_test
17 | # Links the target library to the log library
18 | # included in the NDK.
19 | ${log-lib})
20 |
21 | add_library( yuv420p_to_rgba
22 | SHARED
23 | ${CMAKE_SOURCE_DIR}/src/main/cpp/src/yuv/yuv420p_to_rgba.cpp
24 | ${CMAKE_SOURCE_DIR}/src/main/cpp/src/yuv/ImageUtil.cpp )
25 |
26 | find_library( log-lib
27 | log )
28 |
29 | target_link_libraries( yuv420p_to_rgba
30 | # Links the target library to the log library
31 | # included in the NDK.
32 | ${log-lib})
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_user_agree.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
11 |
12 |
17 |
18 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | import android.content.Context;
2 | import androidx.test.platform.app.InstrumentationRegistry;
3 | import androidx.test.ext.junit.runners.AndroidJUnit4;
4 |
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 |
8 | import static org.junit.Assert.*;
9 |
10 | /**
11 | * Instrumented test, which will execute on an Android device.
12 | *
13 | * @see Testing documentation
14 | */
15 | @RunWith(AndroidJUnit4.class)
16 | public class ExampleInstrumentedTest {
17 | @Test
18 | public void useAppContext() throws Exception {
19 | // Context of the app under test.
20 | Context appContext = InstrumentationRegistry.getTargetContext();
21 |
22 | assertEquals("com.style.framework", appContext.getPackageName());
23 | /*RetrofitImpl.getInstance().getPhoneInfo("17364814713").subscribe(s -> {
24 |
25 | Log.e("useAppContext", s);
26 | });*/
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/lib_common/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
11 |
12 |
17 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/java/example/customView/CustomViewFragmentAdapter.kt:
--------------------------------------------------------------------------------
1 | package example.customView
2 |
3 | import androidx.fragment.app.Fragment
4 | import androidx.fragment.app.FragmentManager
5 | import androidx.fragment.app.FragmentPagerAdapter
6 |
7 | class CustomViewFragmentAdapter : androidx.fragment.app.FragmentPagerAdapter {
8 | private val fragments: List
9 | private val titles: List
10 |
11 | constructor(fm: androidx.fragment.app.FragmentManager, fragments: List, titles: List) : super(fm) {
12 | this.fragments = fragments
13 | this.titles = titles
14 | }
15 |
16 | override fun getItem(position: Int): androidx.fragment.app.Fragment {
17 | return fragments[position]
18 | }
19 |
20 | override fun getCount(): Int {
21 | return titles.size
22 | }
23 |
24 | //此方法用来显示tab上的名字
25 | override fun getPageTitle(position: Int): CharSequence? {
26 | return titles[position % titles.size]
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/example/customView/fragment/CustomNotifyViewFragment.java:
--------------------------------------------------------------------------------
1 | package example.customView.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import com.style.base.BaseFragment;
9 | import com.style.framework.R;
10 | import com.style.view.other.CustomNotifyView;
11 |
12 | import org.jetbrains.annotations.NotNull;
13 | import org.jetbrains.annotations.Nullable;
14 |
15 | import java.util.Random;
16 |
17 |
18 | public class CustomNotifyViewFragment extends BaseFragment {
19 |
20 | @Nullable
21 | @Override
22 | public View onCreateView(@NotNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
23 | return inflater.inflate(R.layout.activity_notifyview, container, false);
24 | }
25 |
26 | @Override
27 | public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
28 | super.onViewCreated(view, savedInstanceState);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/example/address/MyRingtone.java:
--------------------------------------------------------------------------------
1 | package example.address;
2 |
3 | /**
4 | * Created by xiajun on 2018/7/5.
5 | */
6 |
7 | public class MyRingtone {
8 | public final String id;
9 | public final String name;
10 | public final String path;
11 | public final String is_ringtone;
12 | public final String is_notification;
13 |
14 | public MyRingtone(String id, String name, String path, String is_ringtone, String is_notification) {
15 | this.id = id;
16 | this.name = name;
17 | this.path = path;
18 | this.is_ringtone = is_ringtone;
19 | this.is_notification = is_notification;
20 | }
21 |
22 | @Override
23 | public String toString() {
24 | return "MyRingtone{" +
25 | "id='" + id + '\'' +
26 | ", name='" + name + '\'' +
27 | ", path='" + path + '\'' +
28 | ", is_ringtone='" + is_ringtone + '\'' +
29 | ", is_notification='" + is_notification + '\'' +
30 | '}';
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/adapter_publish_dynamic_picture.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
17 |
18 |
25 |
26 |
--------------------------------------------------------------------------------
/lib_custom_view/src/main/java/com/style/view/systemHelper/MyFrontTextView.java:
--------------------------------------------------------------------------------
1 | package com.style.view.systemHelper;
2 |
3 | import android.content.Context;
4 | import android.graphics.Typeface;
5 | import androidx.appcompat.widget.AppCompatTextView;
6 | import android.util.AttributeSet;
7 |
8 | public class MyFrontTextView extends AppCompatTextView {
9 |
10 | public MyFrontTextView(Context context) {
11 | super(context);
12 | setTypeface() ;
13 | }
14 |
15 | public MyFrontTextView(Context context, AttributeSet attrs) {
16 | super(context, attrs);
17 | setTypeface() ;
18 | }
19 |
20 | public MyFrontTextView(Context context, AttributeSet attrs, int defStyle) {
21 | super(context, attrs, defStyle);
22 | setTypeface() ;
23 | }
24 |
25 | private void setTypeface(){
26 | Typeface TEXT_TYPE = Typeface.createFromAsset(getContext().getAssets(), "fronts/black_simplified.TTF");
27 | // 如果自定义typeface初始化失败,就用原生的typeface
28 | if(TEXT_TYPE == null){
29 | setTypeface(getTypeface()) ;
30 | }else{
31 | setTypeface(TEXT_TYPE) ;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/style/service/suspendWindow/Constants.java:
--------------------------------------------------------------------------------
1 | package com.style.service.suspendWindow;
2 |
3 | public class Constants {
4 |
5 |
6 | public static final String ACTION_CALL_OUT_FAILED = "ACTION_CALL_OUT_FAILED";
7 | public static final String ACTION_CALL_HANGUP = "ACTION_CALL_HANGUP";
8 | public static final String ACTION_CALL_CONNECTED = "ACTION_CALL_CONNECTED";
9 | public static final String ACTION_CALL_TIME_UPDATE = "ACTION_CALL_TIME_UPDATE";
10 |
11 | public static final String ACTION_BUTEL_ROTATE = "action.butel.rotate";
12 | public static final String ACTION_BUTEL_OPEN_CAMERA = "action.butel.open.camera";
13 | public static final String ACTION_BUTEL_INIT_VEDIO_END = "action.butel.init.video.end";
14 | public static final String ACTION_BUTEL_SWIHCH_CAMERA = "action.butel.switch.camera";
15 | public static final String ACTION_BUTEL_REMOTE_CAMERA_ENABLED = "action.butel.OnRemoteCameraEnabled";
16 | public static final String ACTION_VIDEO_SET_CAMERA_ORIENTATION = "action.video.set.camera.orientation";
17 |
18 |
19 |
20 | }
--------------------------------------------------------------------------------
/app/src/main/java/example/customView/fragment/SoundWaveFragment.kt:
--------------------------------------------------------------------------------
1 | package example.customView.fragment
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import com.style.base.BaseFragment
8 | import com.style.framework.databinding.ActivitySoundWaveBinding
9 |
10 | class SoundWaveFragment : BaseFragment() {
11 |
12 | private lateinit var bd: ActivitySoundWaveBinding
13 |
14 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
15 | bd = ActivitySoundWaveBinding.inflate(inflater, container, false)
16 | return bd.root
17 | }
18 |
19 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
20 | super.onViewCreated(view, savedInstanceState)
21 | bd.btnStart.setOnClickListener { bd.customView2.start() }
22 | bd.btnPause.setOnClickListener { bd.customView2.pause() }
23 | bd.btnReset.setOnClickListener { bd.customView2.reset() }
24 |
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/style/service/appNewVersion/DownNewAppService.java:
--------------------------------------------------------------------------------
1 | package com.style.service.appNewVersion;
2 |
3 | import android.app.IntentService;
4 | import android.content.Intent;
5 | import android.os.IBinder;
6 | import androidx.annotation.Nullable;
7 |
8 | public class DownNewAppService extends IntentService {
9 | DownNewAppServiceModel mPresenter;
10 |
11 | public DownNewAppService() {
12 | super("balabalabala");
13 | }
14 |
15 | @Override
16 | public void onCreate() {
17 | super.onCreate();
18 | mPresenter = new DownNewAppServiceModel(getApplication());
19 | }
20 |
21 | @Nullable
22 | @Override
23 | public IBinder onBind(Intent intent) {
24 | return null;
25 | }
26 |
27 | @Override
28 | protected void onHandleIntent(@Nullable Intent intent) {
29 | String versionInfo = intent.getStringExtra("url");
30 | mPresenter.startDownloadApp(versionInfo);
31 | }
32 |
33 | @Override
34 | public void onDestroy() {
35 | super.onDestroy();
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/custom_view_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
20 |
21 |
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/style/data/singlePriorityTask/PrioritizedTask.kt:
--------------------------------------------------------------------------------
1 | package com.style.data.singlePriorityTask
2 |
3 | import android.util.Log
4 |
5 | class PrioritizedTask() : Runnable, Comparable {
6 |
7 | public var priority: Int = 0
8 | public lateinit var id: String
9 |
10 | constructor(id: String, priority: Int) : this() {
11 | this.id = id
12 | this.priority = priority
13 | }
14 |
15 | override fun run() {
16 | Log.e(id, toString())
17 | try {
18 | Thread.sleep(2)
19 | } catch (e: InterruptedException) {
20 | e.printStackTrace()
21 | }
22 | }
23 |
24 | override fun toString(): String {
25 | return "任务id:$id-->优先级:$priority"
26 | }
27 |
28 | override fun compareTo(other: PrioritizedTask): Int {
29 | if (priority < other.priority) {
30 | return -1
31 | } else {
32 | if (priority > other.priority) {
33 | return 1
34 | } else {
35 | return 0
36 | }
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/tablayout_with_viewpager2_activity.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
20 |
21 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/lib_video_record/src/main/res/layout/activity_play_video.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_test_gesture.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
18 |
19 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/lib_media_picker/src/main/res/drawable/action_btn.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
8 |
9 |
10 |
11 | -
12 |
13 |
14 |
15 |
16 |
17 |
18 | -
19 |
20 |
21 |
22 |
23 |
24 |
25 | -
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/lib_media_picker/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MediaPicker
3 | All Image and Video
4 | All Video
5 | All Image
6 | Select Image and Video
7 | Select Video
8 | Select Image
9 | All Video
10 | Has reached the maximum number of choices
11 | The maximum file size is only
12 | please select file
13 | done
14 |
15 | preview
16 | select
17 | video
18 | Need to open read storage permissions
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/example/customView/ReportTrendActivity.java:
--------------------------------------------------------------------------------
1 | package example.customView;
2 |
3 | import android.content.pm.ActivityInfo;
4 | import android.os.Bundle;
5 |
6 | import com.style.base.BaseTitleBarActivity;
7 | import com.style.framework.databinding.ActivityReportTrendBinding;
8 |
9 | import java.util.ArrayList;
10 | import java.util.Random;
11 |
12 | public class ReportTrendActivity extends BaseTitleBarActivity {
13 | ArrayList dataList = new ArrayList<>();
14 | private ActivityReportTrendBinding bd;
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
20 | bd = ActivityReportTrendBinding.inflate(getLayoutInflater());
21 | setContentView(bd.getRoot());
22 | }
23 |
24 | private void getData() {
25 | Random random = new Random(1);
26 | for (int i = 0; i < 2000; i++) {
27 | int k = random.nextInt(160) - 80;
28 | dataList.add(k);
29 | }
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/title_bar_main_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
16 |
17 |
28 |
29 |
--------------------------------------------------------------------------------
/lib_common/src/main/java/com/style/utils/MyTimeTask.java:
--------------------------------------------------------------------------------
1 | package com.style.utils;
2 |
3 | import android.os.AsyncTask;
4 | import android.widget.Button;
5 |
6 | public class MyTimeTask extends AsyncTask {
7 | private int count;
8 | private Button button;
9 | private String text;
10 |
11 | public MyTimeTask(int count, Button button, String string) {
12 | super();
13 | this.count = count;
14 | this.button = button;
15 | this.text = string;
16 | }
17 |
18 | @Override
19 | protected String doInBackground(Integer... arg0) {
20 | while (count > 0) {
21 | try {
22 | count -= arg0[0];
23 | publishProgress(count);
24 | Thread.sleep(1000);
25 | } catch (InterruptedException e) {
26 | e.printStackTrace();
27 | }
28 | }
29 |
30 | return text;
31 | }
32 |
33 | @Override
34 | protected void onProgressUpdate(Integer... values) {
35 | button.setText(values[0].toString());
36 | }
37 |
38 | @Override
39 | protected void onPostExecute(String result) {
40 | button.setText(result);
41 | button.setEnabled(true);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_qr_code_scan.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
14 |
15 |
21 |
22 |
23 |
27 |
28 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/example/db/TestRoomActivity.kt:
--------------------------------------------------------------------------------
1 | package example.db;
2 |
3 | import android.os.Bundle
4 | import androidx.lifecycle.ViewModelProvider
5 | import com.style.base.BaseTitleBarActivity
6 | import com.style.framework.databinding.ActivityTestRoomBinding
7 |
8 | class TestRoomActivity : BaseTitleBarActivity() {
9 |
10 | private lateinit var bd: ActivityTestRoomBinding
11 | private lateinit var mViewModel: TestRoomViewModel
12 |
13 | override fun onCreate(arg0: Bundle?) {
14 | super.onCreate(arg0)
15 | bd = ActivityTestRoomBinding.inflate(layoutInflater)
16 | setContentView(bd.root)
17 | setTitleBarTitle("room test")
18 | mViewModel = ViewModelProvider(this).get(TestRoomViewModel::class.java)
19 | bd.btnRoomInsertOne.setOnClickListener { mViewModel.saveOne() }
20 | bd.btnRoomInsertList.setOnClickListener { mViewModel.saveList() }
21 | bd.btnRoomQueryAll.setOnClickListener { mViewModel.queryAll() }
22 | bd.btnRoomClearTable.setOnClickListener { mViewModel.deleteAll() }
23 | bd.btnRoomQueryById.setOnClickListener { mViewModel.findById() }
24 | }
25 |
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/lib_common/src/main/res/layout/dialog_loading.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
19 |
20 |
28 |
--------------------------------------------------------------------------------
/lib_common/src/main/java/com/style/base/BaseFragment.java:
--------------------------------------------------------------------------------
1 | package com.style.base;
2 |
3 | import android.content.Intent;
4 |
5 | import androidx.annotation.StringRes;
6 | import androidx.fragment.app.Fragment;
7 |
8 | import com.style.toast.ToastManager;
9 | import com.style.utils.DeviceInfoUtil;
10 | import com.style.utils.LogManager;
11 |
12 | public abstract class BaseFragment extends Fragment {
13 |
14 | protected String TAG = this.getClass().getSimpleName();
15 |
16 | protected int getStatusHeight() {
17 | return DeviceInfoUtil.getStatusHeight(requireContext());
18 | }
19 |
20 | protected void skip(Class> cls) {
21 | if (isAdded())
22 | startActivity(new Intent(getContext(), cls));
23 | }
24 |
25 | protected void logE(String tag, String msg) {
26 | LogManager.logE(tag, msg);
27 | }
28 |
29 | protected void showToast(CharSequence str) {
30 | if (isAdded())
31 | ToastManager.showToast(getContext(), str);
32 | }
33 |
34 | protected void showToast(@StringRes int resId) {
35 | if (isAdded())
36 | ToastManager.showToast(getContext(), resId);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------