void onMessage(ByteBuffer bytes);
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/LocaleHelperLib/src/main/java/com/yc/localelib/listener/OnLocaleChangedListener.java:
--------------------------------------------------------------------------------
1 | package com.yc.localelib.listener;
2 |
3 | import java.util.Locale;
4 |
5 | /**
6 | *
7 | * @author yangchong
8 | * email : yangchong211@163.com
9 | * time : 2018/5/11
10 | * desc : 变化监听器
11 | * revise :
12 | *
13 | */
14 | public interface OnLocaleChangedListener {
15 |
16 | /**
17 | * 当前应用语种发生变化时回调
18 | *
19 | * @param oldLocale 旧语种
20 | * @param newLocale 新语种
21 | */
22 | void onAppLocaleChange(Locale oldLocale, Locale newLocale);
23 |
24 | /**
25 | * 手机系统语种发生变化时回调
26 | *
27 | * @param oldLocale 旧语种
28 | * @param newLocale 新语种
29 | */
30 | void onSystemLocaleChange(Locale oldLocale, Locale newLocale);
31 | }
--------------------------------------------------------------------------------
/ZxingServerLib/src/main/java/com/yc/zxingserver/scan/CaptureManager.java:
--------------------------------------------------------------------------------
1 | package com.yc.zxingserver.scan;
2 |
3 |
4 | import com.yc.zxingserver.camera.CameraManager;
5 |
6 | public interface CaptureManager {
7 |
8 | /**
9 | * Get {@link CameraManager}
10 | * @return {@link CameraManager}
11 | */
12 | CameraManager getCameraManager();
13 |
14 | /**
15 | * Get {@link BeepManager}
16 | * @return {@link BeepManager}
17 | */
18 | BeepManager getBeepManager();
19 |
20 | /**
21 | * Get {@link AmbientLightManager}
22 | * @return {@link AmbientLightManager}
23 | */
24 | AmbientLightManager getAmbientLightManager();
25 |
26 | /**
27 | * Get {@link InactivityTimer}
28 | * @return {@link InactivityTimer}
29 | */
30 | InactivityTimer getInactivityTimer();
31 | }
32 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/AppTraceTool/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 |
--------------------------------------------------------------------------------
/LongAliveLib/src/main/java/androidx/core/app/SafeJobIntentService.java:
--------------------------------------------------------------------------------
1 | package androidx.core.app;
2 |
3 | import android.os.Build;
4 |
5 | /**
6 | * https://github.com/evernote/android-job/
7 | */
8 | public abstract class SafeJobIntentService extends JobIntentService {
9 |
10 | @Override
11 | GenericWorkItem dequeueWork() {
12 | try {
13 | return super.dequeueWork();
14 | } catch (Throwable e) {
15 | e.printStackTrace();
16 | return null;
17 | }
18 | }
19 |
20 | @Override
21 | public void onCreate() {
22 | super.onCreate();
23 | // override mJobImpl with safe class to ignore SecurityException
24 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
25 | mJobImpl = new SafeJobServiceEngineImpl(this);
26 | } else {
27 | mJobImpl = null;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/ycbjie/ycgroupadapter/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.ycbjie.ycgroupadapter;
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("com.ycbjie.ycgroupadapter", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/LocaleHelperLib/src/androidTest/java/com/yc/localelib/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.yc.localelib;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
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 | assertEquals("com.yc.localelib.test", appContext.getPackageName());
25 | }
26 | }
--------------------------------------------------------------------------------
/InterceptorTime/src/main/java/com/yc/interceptortime/InterceptorManager.java:
--------------------------------------------------------------------------------
1 | package com.yc.interceptortime;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 | import java.util.concurrent.atomic.AtomicLong;
6 |
7 | /**
8 | * @author : yangchong
9 | * @email : yangchong211@163.com
10 | * @time : 2017/5/18
11 | * @desc : 拦截器管理者
12 | * revise :
13 | */
14 | public class InterceptorManager extends BaseInterceptor {
15 |
16 | private static volatile InterceptorManager singleton = null;
17 |
18 | public static InterceptorManager getInstance() {
19 | if (singleton == null) {
20 | synchronized (InterceptorManager.class) {
21 | if (singleton == null) {
22 | singleton = new InterceptorManager();
23 | }
24 | }
25 | }
26 | return singleton;
27 | }
28 |
29 | private InterceptorManager() {
30 |
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/NtpTimeLib/src/main/java/com/yc/ntptime/BootCompletedReceiver.java:
--------------------------------------------------------------------------------
1 | package com.yc.ntptime;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 |
7 | import com.yc.toolutils.AppLogUtils;
8 |
9 |
10 | /**
11 | *
12 | * @author yangchong
13 | * email : yangchong211@163.com
14 | * time : 2018/5/11
15 | * desc : 广播
16 | * revise :
17 | *
18 | */
19 | public class BootCompletedReceiver extends BroadcastReceiver {
20 |
21 | private static final String TAG = BootCompletedReceiver.class.getSimpleName();
22 |
23 | @Override
24 | public void onReceive(Context context, Intent intent) {
25 | AppLogUtils.i(TAG, "clearing ntp time disk cache as we've detected a boot");
26 | if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
27 | NtpGetTime.clearCachedInfo();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ZxingServerLib/src/main/res/layout/zxl_capture.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
16 |
17 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_text_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_car_picture_footer.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/NtpTimeLib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/AppTraceTool/src/main/java/com/yc/tracesdk/SLogTimeTraceFactory.java:
--------------------------------------------------------------------------------
1 | package com.yc.tracesdk;
2 |
3 | public class SLogTimeTraceFactory {
4 | static class SLogPrinterHolder {
5 | static final InterPrinter sPrinter = new SLogPrinter();
6 | }
7 |
8 | public static TimeTrace countByMilliseconds(String event, boolean startCount) {
9 | return new TimeTrace(
10 | event, SLogPrinterHolder.sPrinter, TimerHolder.MILLIS_TIMER, startCount);
11 | }
12 |
13 | public static TimeTrace countByMilliseconds(String event) {
14 | return countByMilliseconds(event, true);
15 | }
16 |
17 | public static TimeTrace countByNanoseconds(String event, boolean startCount) {
18 | return new TimeTrace(
19 | event, SLogPrinterHolder.sPrinter, TimerHolder.NANO_TIMER, startCount);
20 | }
21 |
22 | public static TimeTrace countByNanoseconds(String event) {
23 | return countByNanoseconds(event, true);
24 | }
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/AppTraceTool/src/main/java/com/yc/tracesdk/TimeTraceFactory.java:
--------------------------------------------------------------------------------
1 | package com.yc.tracesdk;
2 |
3 | public class TimeTraceFactory {
4 |
5 | static class LogcatPrinterHolder {
6 | static final InterPrinter sPrinter = new LogcatPrinter();
7 | }
8 |
9 | public static TimeTrace countByMilliseconds(String event, boolean startCount) {
10 | return new TimeTrace(
11 | event, LogcatPrinterHolder.sPrinter, TimerHolder.MILLIS_TIMER, startCount);
12 | }
13 |
14 | public static TimeTrace countByMilliseconds(String event) {
15 | return countByMilliseconds(event, true);
16 | }
17 |
18 | public static TimeTrace countByNanoseconds(String event, boolean startCount) {
19 | return new TimeTrace(
20 | event, LogcatPrinterHolder.sPrinter, TimerHolder.NANO_TIMER, startCount);
21 | }
22 |
23 | public static TimeTrace countByNanoseconds(String event) {
24 | return countByNanoseconds(event, true);
25 | }
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/AppTraceTool/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/CountTimerLib/src/main/java/com/yc/timerlib/view/OnFinishListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2017 yangchong211(github.com/yangchong211)
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 | package com.yc.timerlib.view;
17 |
18 | /**
19 | *
20 | * @author yangchong
21 | * blog : https://github.com/yangchong211/YCStatusBar
22 | * time : 2017/5/18
23 | * desc : 倒计时自定义控件监听listener
24 | * revise:
25 | *
26 | */
27 | public interface OnFinishListener {
28 | /**
29 | * 结束监听
30 | */
31 | void finish();
32 | }
33 |
--------------------------------------------------------------------------------
/NtpTimeLib/src/main/java/com/yc/ntptime/NtpServerException.java:
--------------------------------------------------------------------------------
1 | package com.yc.ntptime;
2 |
3 | import java.io.IOException;
4 | import java.util.Locale;
5 |
6 | /**
7 | *
8 | * @author yangchong
9 | * email : yangchong211@163.com
10 | * time : 2018/5/11
11 | * desc : 自定义异常
12 | * revise :
13 | *
14 | */
15 | public class NtpServerException extends IOException {
16 |
17 | public final String property;
18 | public final float expectedValue;
19 | public final float actualValue;
20 |
21 | NtpServerException(String detailMessage) {
22 | super(detailMessage);
23 | this.property = "na";
24 | this.expectedValue = 0F;
25 | this.actualValue = 0F;
26 | }
27 |
28 | NtpServerException(String message, String property, float actualValue, float expectedValue) {
29 | super(String.format(Locale.getDefault(), message, property, actualValue, expectedValue));
30 | this.property = property;
31 | this.actualValue = actualValue;
32 | this.expectedValue = expectedValue;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/ZxingServerLib/src/main/java/com/yc/zxingserver/camera/open/OpenCamera.java:
--------------------------------------------------------------------------------
1 | package com.yc.zxingserver.camera.open;
2 |
3 | import android.hardware.Camera;
4 |
5 | /**
6 | * Represents an open {@link Camera} and its metadata, like facing direction and orientation.
7 | */
8 | public final class OpenCamera {
9 |
10 | private final int index;
11 | private final Camera camera;
12 | private final CameraFacing facing;
13 | private final int orientation;
14 |
15 | public OpenCamera(int index, Camera camera, CameraFacing facing, int orientation) {
16 | this.index = index;
17 | this.camera = camera;
18 | this.facing = facing;
19 | this.orientation = orientation;
20 | }
21 |
22 | public Camera getCamera() {
23 | return camera;
24 | }
25 |
26 | public CameraFacing getFacing() {
27 | return facing;
28 | }
29 |
30 | public int getOrientation() {
31 | return orientation;
32 | }
33 |
34 | @Override
35 | public String toString() {
36 | return "Camera #" + index + " : " + facing + ',' + orientation;
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/SocketIoLib/src/main/java/com/yc/socket/SocketEventConstant.java:
--------------------------------------------------------------------------------
1 | package com.yc.socket;
2 |
3 |
4 | /**
5 | * 默认的一些事件名称常量
6 | */
7 | public class SocketEventConstant {
8 | public static final String EVENT_ERROR = "error";
9 |
10 | public static final String EVENT_MESSAGE = "message";
11 |
12 | public static final String EVENT_CONNECT_ERROR = "connect_error";
13 |
14 | public static final String EVENT_CONNECT_TIMEOUT = "connect_timeout";
15 |
16 | public static final String EVENT_RECONNECT = "reconnect";
17 |
18 | public static final String EVENT_RECONNECT_ERROR = "reconnect_error";
19 |
20 | public static final String EVENT_RECONNECT_FAILED = "reconnect_failed";
21 |
22 | public static final String EVENT_RECONNECT_ATTEMPT = "reconnect_attempt";
23 |
24 | public static final String EVENT_RECONNECTING = "reconnecting";
25 |
26 | public static final String EVENT_DISCONNECT = "disconnect";
27 |
28 | public static final String EVENT_CONNECT = "connect";
29 |
30 | public static final String EVENT_PING = "ping";
31 |
32 | public static final String EVENT_PONG = "pong";
33 | }
34 |
--------------------------------------------------------------------------------
/LocalShareLib/src/main/java/com/yc/ycshare/ShareContentType.java:
--------------------------------------------------------------------------------
1 | package com.yc.ycshare;
2 |
3 |
4 | import androidx.annotation.StringDef;
5 |
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 |
9 | /**
10 | *
11 | * @author yangchong
12 | * email : yangchong211@163.com
13 | * time : 2019/5/11
14 | * desc : 分享类型
15 | * revise :
16 | * GitHub : https://github.com/yangchong211/YCToolLib
17 | *
18 | */
19 | @StringDef({ShareContentType.TEXT, ShareContentType.IMAGE,
20 | ShareContentType.AUDIO, ShareContentType.VIDEO, ShareContentType.FILE})
21 | @Retention(RetentionPolicy.SOURCE)
22 | public @interface ShareContentType {
23 | /**
24 | * Share Text
25 | */
26 | String TEXT = "text/plain";
27 |
28 | /**
29 | * Share Image
30 | */
31 | String IMAGE = "image/*";
32 |
33 | /**
34 | * Share Audio
35 | */
36 | String AUDIO = "audio/*";
37 |
38 | /**
39 | * Share Video
40 | */
41 | String VIDEO = "video/*";
42 |
43 | /**
44 | * Share File
45 | */
46 | String FILE = "*/*";
47 | }
48 |
--------------------------------------------------------------------------------
/EasyTtsPlayer/src/main/java/com/yc/audioplayer/powerful/inter/InterAudio.java:
--------------------------------------------------------------------------------
1 | package com.yc.audioplayer.powerful.inter;
2 |
3 | import android.content.Context;
4 |
5 | import com.yc.audioplayer.powerful.bean.AudioPlayData;
6 |
7 | /**
8 | *
9 | * @author yangchong
10 | * email : yangchong211@163.com
11 | * GitHub : ...
12 | * time : 2018/8/6
13 | * desc : 音频播放接口定义
14 | * revise:
15 | *
16 | */
17 | public interface InterAudio {
18 |
19 | void init(InterPlayListener next, Context context);
20 |
21 | /**
22 | * 播放数据
23 | *
24 | * @param data {@link AudioPlayData}
25 | */
26 | void play(AudioPlayData data);
27 |
28 | /**
29 | * 停止播放
30 | */
31 | void stop();
32 |
33 | /**
34 | * 释放音频内容
35 | */
36 | void release();
37 |
38 | /**
39 | * 暂停播放
40 | */
41 | void pause();
42 |
43 | /**
44 | * 回复播放
45 | */
46 | void resumeSpeaking();
47 |
48 | /**
49 | * 是否正在播放
50 | *
51 | * @return true 是 false 否
52 | */
53 | boolean isPlaying();
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/ZxingServerLib/src/main/java/com/yc/zxingserver/camera/FrontLightMode.java:
--------------------------------------------------------------------------------
1 | package com.yc.zxingserver.camera;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.preference.PreferenceManager;
6 |
7 | import com.yc.zxingserver.scan.Preferences;
8 |
9 | /**
10 | * Enumerates settings of the preference controlling the front light.
11 | */
12 | public enum FrontLightMode {
13 |
14 | /** Always on. */
15 | ON,
16 | /** On only when ambient light is low. */
17 | AUTO,
18 | /** Always off. */
19 | OFF;
20 |
21 | private static FrontLightMode parse(String modeString) {
22 | return modeString == null ? AUTO : valueOf(modeString);
23 | }
24 |
25 | public static FrontLightMode readPref(SharedPreferences sharedPrefs) {
26 | return parse(sharedPrefs.getString(Preferences.KEY_FRONT_LIGHT_MODE, AUTO.toString()));
27 | }
28 |
29 | public static void put(Context context, FrontLightMode mode) {
30 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
31 | prefs.edit().putString(Preferences.KEY_FRONT_LIGHT_MODE, mode.toString()).commit();
32 | }
33 |
34 | }
--------------------------------------------------------------------------------
/InterceptorTime/src/main/java/com/yc/interceptortime/BaseParam.java:
--------------------------------------------------------------------------------
1 | package com.yc.interceptortime;
2 |
3 |
4 | import java.io.Serializable;
5 |
6 | /**
7 | * @author : yangchong
8 | * @email : yangchong211@163.com
9 | * @time : 2017/5/18
10 | * @desc : 参数
11 | * revise :
12 | */
13 | public class BaseParam implements Serializable {
14 |
15 | private long timeout = 30 * 1000;
16 | /**
17 | * 主要是用于全局监听中,通过该字段区分不同的方法
18 | */
19 | private String methodName;
20 |
21 | public BaseParam(String methodName) {
22 | this.methodName = methodName;
23 | }
24 |
25 | public long getTimeout() {
26 | return timeout;
27 | }
28 |
29 | public void setTimeout(long timeout) {
30 | this.timeout = timeout;
31 | }
32 |
33 | public String getMethodName() {
34 | return methodName;
35 | }
36 |
37 | public void setMethodName(String methodName) {
38 | this.methodName = methodName;
39 | }
40 |
41 | @Override
42 | public String toString() {
43 | return "BasePm{" +
44 | "timeout=" + timeout +
45 | ", methodName='" + methodName + '\'' +
46 | '}';
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/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 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 | android.enableAapt2=true
19 | # Automatically convert third-party libraries to use AndroidX
20 | android.enableJetifier=true
21 | android.useAndroidX=true
22 |
23 |
--------------------------------------------------------------------------------
/EasyTtsPlayer/src/main/java/com/yc/audioplayer/easy/InterTtsPlayer.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2017 yangchong211(github.com/yangchong211)
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.yc.audioplayer.easy;
18 |
19 |
20 | /**
21 | *
22 | * @author 杨充
23 | * blog : https://github.com/yangchong211
24 | * time : 2019/12/23
25 | * desc :
26 | * revise:
27 | *
28 | */
29 | public interface InterTtsPlayer {
30 |
31 | void speak(final String content);
32 |
33 | void pause();
34 |
35 | void resume();
36 |
37 | void setSpeechRate(float newRate);
38 |
39 | void setSpeechPitch(float newPitch);
40 |
41 | void release();
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/SocketIoLib/src/main/java/com/yc/socket/MessageEntity.java:
--------------------------------------------------------------------------------
1 | package com.yc.socket;
2 |
3 | /**
4 | * 需要发送的消息
5 | */
6 | public class MessageEntity {
7 | private String methodName;
8 | private Object[] data;
9 | private MessageAck ack;
10 |
11 | public String getMethodName() {
12 | return methodName;
13 | }
14 |
15 | public void setMethodName(String methodName) {
16 | this.methodName = methodName;
17 | }
18 |
19 | public Object[] getData() {
20 | return data;
21 | }
22 |
23 | public void setData(Object[] data) {
24 | this.data = data;
25 | }
26 |
27 | public MessageAck getAck() {
28 | return ack;
29 | }
30 |
31 | public void setAck(MessageAck ack) {
32 | this.ack = ack;
33 | }
34 |
35 | public MessageEntity(String methodName) {
36 | this.methodName = methodName;
37 | }
38 |
39 | public MessageEntity(String methodName, Object... data) {
40 | this.methodName = methodName;
41 | this.data = data;
42 | }
43 |
44 | public MessageEntity(String methodName, Object[] data, MessageAck ack) {
45 | this.methodName = methodName;
46 | this.data = data;
47 | this.ack = ack;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/TransitionHelper/src/main/java/com/yc/transition/TransitionAnimation.java:
--------------------------------------------------------------------------------
1 | package com.yc.transition;
2 |
3 | import android.animation.Animator;
4 |
5 | import java.lang.ref.WeakReference;
6 |
7 | /**
8 | *
9 | * @author : yangchong
10 | * email : yangchong211@163.com
11 | * time : 2018/8/11
12 | * desc : 动画监听类
13 | * revise :
14 | *
15 | */
16 | public class TransitionAnimation implements Animator.AnimatorListener {
17 |
18 | private final WeakReference weakCallback;
19 |
20 | public TransitionAnimation(TransitionCallback transitionCallback) {
21 | weakCallback = new WeakReference<>(transitionCallback);
22 | }
23 |
24 | @Override
25 | public void onAnimationStart(Animator animation) {
26 |
27 | }
28 |
29 | @Override
30 | public void onAnimationEnd(Animator animation) {
31 | TransitionCallback callback = weakCallback.get();
32 | if (callback != null) {
33 | callback.onTransitionStop();
34 | }
35 | }
36 |
37 | @Override
38 | public void onAnimationCancel(Animator animation) {
39 |
40 | }
41 |
42 | @Override
43 | public void onAnimationRepeat(Animator animation) {
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/NtpTimeLib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
3 | //迁移到jitpack
4 | apply plugin: 'com.github.dcendents.android-maven'
5 |
6 | android {
7 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
8 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
9 | defaultConfig {
10 | minSdkVersion rootProject.ext.android["minSdkVersion"]
11 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
12 | versionCode rootProject.ext.android["versionCode"]
13 | versionName rootProject.ext.android["versionName"]
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 |
22 | compileOptions {
23 | sourceCompatibility JavaVersion.VERSION_1_8
24 | targetCompatibility JavaVersion.VERSION_1_8
25 | }
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(dir: 'libs', include: ['*.jar'])
30 | //工具类utils:https://github.com/yangchong211/YCCommonLib
31 | implementation 'com.github.yangchong211.YCCommonLib:ToolUtilsLib:1.4.9'
32 | }
33 |
--------------------------------------------------------------------------------
/CountTimerLib/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
5 | //迁移到jitpack
6 | apply plugin: 'com.github.dcendents.android-maven'
7 |
8 | android {
9 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
10 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
11 | defaultConfig {
12 | minSdkVersion rootProject.ext.android["minSdkVersion"]
13 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
14 | versionCode rootProject.ext.android["versionCode"]
15 | versionName rootProject.ext.android["versionName"]
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_1_8
26 | targetCompatibility JavaVersion.VERSION_1_8
27 | }
28 | }
29 |
30 | dependencies {
31 | implementation fileTree(dir: 'libs', include: ['*.jar'])
32 | implementation(rootProject.ext.dependencies["appcompat"])
33 | implementation(rootProject.ext.dependencies["annotation"])
34 | }
--------------------------------------------------------------------------------
/LooperThread/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
5 | //迁移到jitpack
6 | apply plugin: 'com.github.dcendents.android-maven'
7 |
8 | android {
9 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
10 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
11 | defaultConfig {
12 | minSdkVersion rootProject.ext.android["minSdkVersion"]
13 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
14 | versionCode rootProject.ext.android["versionCode"]
15 | versionName rootProject.ext.android["versionName"]
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_1_8
26 | targetCompatibility JavaVersion.VERSION_1_8
27 | }
28 | }
29 |
30 | dependencies {
31 | implementation fileTree(dir: 'libs', include: ['*.jar'])
32 | implementation(rootProject.ext.dependencies["appcompat"])
33 | implementation(rootProject.ext.dependencies["annotation"])
34 | }
--------------------------------------------------------------------------------
/SerialTaskLib/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
5 | //迁移到jitpack
6 | apply plugin: 'com.github.dcendents.android-maven'
7 |
8 | android {
9 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
10 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
11 | defaultConfig {
12 | minSdkVersion rootProject.ext.android["minSdkVersion"]
13 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
14 | versionCode rootProject.ext.android["versionCode"]
15 | versionName rootProject.ext.android["versionName"]
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_1_8
26 | targetCompatibility JavaVersion.VERSION_1_8
27 | }
28 | }
29 |
30 | dependencies {
31 | implementation fileTree(dir: 'libs', include: ['*.jar'])
32 | implementation(rootProject.ext.dependencies["appcompat"])
33 | implementation(rootProject.ext.dependencies["annotation"])
34 | }
--------------------------------------------------------------------------------
/TransitionHelper/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
5 | //迁移到jitpack
6 | apply plugin: 'com.github.dcendents.android-maven'
7 |
8 | android {
9 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
10 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
11 | defaultConfig {
12 | minSdkVersion rootProject.ext.android["minSdkVersion"]
13 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
14 | versionCode rootProject.ext.android["versionCode"]
15 | versionName rootProject.ext.android["versionName"]
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_1_8
26 | targetCompatibility JavaVersion.VERSION_1_8
27 | }
28 | }
29 |
30 | dependencies {
31 | implementation fileTree(dir: 'libs', include: ['*.jar'])
32 | implementation(rootProject.ext.dependencies["appcompat"])
33 | implementation(rootProject.ext.dependencies["annotation"])
34 | }
--------------------------------------------------------------------------------
/LocaleHelperLib/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
5 | //迁移到jitpack
6 | apply plugin: 'com.github.dcendents.android-maven'
7 |
8 |
9 | android {
10 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
11 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
12 | defaultConfig {
13 | minSdkVersion rootProject.ext.android["minSdkVersion"]
14 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
15 | versionCode rootProject.ext.android["versionCode"]
16 | versionName rootProject.ext.android["versionName"]
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | compileOptions {
26 | sourceCompatibility JavaVersion.VERSION_1_8
27 | targetCompatibility JavaVersion.VERSION_1_8
28 | }
29 | }
30 |
31 | dependencies {
32 | implementation fileTree(dir: 'libs', include: ['*.jar'])
33 | implementation(rootProject.ext.dependencies["appcompat"])
34 | implementation(rootProject.ext.dependencies["annotation"])
35 | }
--------------------------------------------------------------------------------
/LocalShareLib/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 | ### Example user template template
10 | ### Example user template
11 |
12 | # IntelliJ project files
13 | .idea
14 | *.iml
15 | out
16 | gen### Android template
17 | # Built application files
18 | *.apk
19 | *.ap_
20 |
21 | # Files for the ART/Dalvik VM
22 | *.dex
23 |
24 | # Java class files
25 | *.class
26 |
27 | # Generated files
28 | bin/
29 | gen/
30 | out/
31 |
32 | # Gradle files
33 | .gradle/
34 | build/
35 |
36 | # Local configuration file (sdk path, etc)
37 | local.properties
38 |
39 | # Proguard folder generated by Eclipse
40 | proguard/
41 |
42 | # Log Files
43 | *.log
44 |
45 | # Android Studio Navigation editor temp files
46 | .navigation/
47 |
48 | # Android Studio captures folder
49 | captures/
50 |
51 | .idea/workspace.xml
52 | .idea/tasks.xml
53 | .idea/gradle.xml
54 | .idea/dictionaries
55 | .idea/libraries
56 |
57 | # Keystore files
58 | # Uncomment the following line if you do not want to check your keystore files in.
59 | #*.jks
60 |
61 | # Google Services (e.g. APIs or Firebase)
62 | google-services.json
63 |
64 | # Freeline
65 | freeline.py
66 | freeline/
67 | freeline_project_description.json
68 |
69 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 | .idea
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # IntelliJ
36 | *.iml
37 | .idea/workspace.xml
38 | .idea/tasks.xml
39 | .idea/gradle.xml
40 | .idea/assetWizardSettings.xml
41 | .idea/dictionaries
42 | .idea/libraries
43 | .idea/caches
44 |
45 | # Keystore files
46 | # Uncomment the following line if you do not want to check your keystore files in.
47 | #*.jks
48 |
49 | # External native build folder generated in Android Studio 2.2 and later
50 | .externalNativeBuild
51 |
52 | # Google Services (e.g. APIs or Firebase)
53 | google-services.json
54 |
55 | # Freeline
56 | freeline.py
57 | freeline/
58 | freeline_project_description.json
59 |
60 | # fastlane
61 | fastlane/report.xml
62 | fastlane/Preview.html
63 | fastlane/screenshots
64 | fastlane/test_output
65 | fastlane/readme.md
66 |
--------------------------------------------------------------------------------
/AppProcessLib/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
5 | apply plugin: 'com.github.dcendents.android-maven'
6 |
7 | android {
8 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
9 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
10 | defaultConfig {
11 | minSdkVersion rootProject.ext.android["minSdkVersion"]
12 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
13 | versionCode rootProject.ext.android["versionCode"]
14 | versionName rootProject.ext.android["versionName"]
15 | }
16 |
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | compileOptions {
24 | sourceCompatibility JavaVersion.VERSION_1_8
25 | targetCompatibility JavaVersion.VERSION_1_8
26 | }
27 | }
28 |
29 | dependencies {
30 | implementation fileTree(dir: 'libs', include: ['*.jar'])
31 | implementation(rootProject.ext.dependencies["appcompat"])
32 | implementation(rootProject.ext.dependencies["annotation"])
33 | implementation(rootProject.ext.dependencies["lifecycleRuntime"])
34 | }
--------------------------------------------------------------------------------
/AutoCloserLib/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
5 | //迁移到jitpack
6 | apply plugin: 'com.github.dcendents.android-maven'
7 |
8 |
9 | android {
10 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
11 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
12 | defaultConfig {
13 | minSdkVersion rootProject.ext.android["minSdkVersion"]
14 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
15 | versionCode rootProject.ext.android["versionCode"]
16 | versionName rootProject.ext.android["versionName"]
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | compileOptions {
26 | sourceCompatibility JavaVersion.VERSION_1_8
27 | targetCompatibility JavaVersion.VERSION_1_8
28 | }
29 | }
30 |
31 | dependencies {
32 | implementation fileTree(dir: 'libs', include: ['*.jar'])
33 | implementation(rootProject.ext.dependencies["appcompat"])
34 | implementation(rootProject.ext.dependencies["annotation"])
35 | implementation project(path: ':AppProcessLib')
36 | }
--------------------------------------------------------------------------------
/AppTraceTool/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | .idea/
16 |
17 |
18 |
19 | # Built application files
20 | *.apk
21 | *.ap_
22 |
23 | # Files for the ART/Dalvik VM
24 | *.dex
25 |
26 | # Java class files
27 | *.class
28 |
29 | # Generated files
30 | bin/
31 | gen/
32 | out/
33 |
34 | # Gradle files
35 | .gradle/
36 | build/
37 |
38 | # Local configuration file (sdk path, etc)
39 | local.properties
40 |
41 | # Proguard folder generated by Eclipse
42 | proguard/
43 |
44 | # Log Files
45 | *.log
46 |
47 | # Android Studio Navigation editor temp files
48 | .navigation/
49 |
50 | # Android Studio captures folder
51 | captures/
52 |
53 | # Intellij
54 | *.iml
55 | .idea/workspace.xml
56 | .idea/tasks.xml
57 | .idea/gradle.xml
58 | .idea/dictionaries
59 | .idea/libraries
60 |
61 | # Keystore files
62 | *.jks
63 |
64 | # External native build folder generated in Android Studio 2.2 and later
65 | .externalNativeBuild
66 |
67 | # Google Services (e.g. APIs or Firebase)
68 | google-services.json
69 |
70 | # Freeline
71 | freeline.py
72 | freeline/
73 | freeline_project_description.json
74 | .idea/
75 |
76 |
77 |
--------------------------------------------------------------------------------
/CountTimerLib/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | .idea/
16 |
17 |
18 |
19 | # Built application files
20 | *.apk
21 | *.ap_
22 |
23 | # Files for the ART/Dalvik VM
24 | *.dex
25 |
26 | # Java class files
27 | *.class
28 |
29 | # Generated files
30 | bin/
31 | gen/
32 | out/
33 |
34 | # Gradle files
35 | .gradle/
36 | build/
37 |
38 | # Local configuration file (sdk path, etc)
39 | local.properties
40 |
41 | # Proguard folder generated by Eclipse
42 | proguard/
43 |
44 | # Log Files
45 | *.log
46 |
47 | # Android Studio Navigation editor temp files
48 | .navigation/
49 |
50 | # Android Studio captures folder
51 | captures/
52 |
53 | # Intellij
54 | *.iml
55 | .idea/workspace.xml
56 | .idea/tasks.xml
57 | .idea/gradle.xml
58 | .idea/dictionaries
59 | .idea/libraries
60 |
61 | # Keystore files
62 | *.jks
63 |
64 | # External native build folder generated in Android Studio 2.2 and later
65 | .externalNativeBuild
66 |
67 | # Google Services (e.g. APIs or Firebase)
68 | google-services.json
69 |
70 | # Freeline
71 | freeline.py
72 | freeline/
73 | freeline_project_description.json
74 | .idea/
75 |
76 |
77 |
--------------------------------------------------------------------------------
/LongAliveLib/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | .idea/
16 |
17 |
18 |
19 | # Built application files
20 | *.apk
21 | *.ap_
22 |
23 | # Files for the ART/Dalvik VM
24 | *.dex
25 |
26 | # Java class files
27 | *.class
28 |
29 | # Generated files
30 | bin/
31 | gen/
32 | out/
33 |
34 | # Gradle files
35 | .gradle/
36 | build/
37 |
38 | # Local configuration file (sdk path, etc)
39 | local.properties
40 |
41 | # Proguard folder generated by Eclipse
42 | proguard/
43 |
44 | # Log Files
45 | *.log
46 |
47 | # Android Studio Navigation editor temp files
48 | .navigation/
49 |
50 | # Android Studio captures folder
51 | captures/
52 |
53 | # Intellij
54 | *.iml
55 | .idea/workspace.xml
56 | .idea/tasks.xml
57 | .idea/gradle.xml
58 | .idea/dictionaries
59 | .idea/libraries
60 |
61 | # Keystore files
62 | *.jks
63 |
64 | # External native build folder generated in Android Studio 2.2 and later
65 | .externalNativeBuild
66 |
67 | # Google Services (e.g. APIs or Firebase)
68 | google-services.json
69 |
70 | # Freeline
71 | freeline.py
72 | freeline/
73 | freeline_project_description.json
74 | .idea/
75 |
76 |
77 |
--------------------------------------------------------------------------------
/NtpTimeLib/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | .idea/
16 |
17 |
18 |
19 | # Built application files
20 | *.apk
21 | *.ap_
22 |
23 | # Files for the ART/Dalvik VM
24 | *.dex
25 |
26 | # Java class files
27 | *.class
28 |
29 | # Generated files
30 | bin/
31 | gen/
32 | out/
33 |
34 | # Gradle files
35 | .gradle/
36 | build/
37 |
38 | # Local configuration file (sdk path, etc)
39 | local.properties
40 |
41 | # Proguard folder generated by Eclipse
42 | proguard/
43 |
44 | # Log Files
45 | *.log
46 |
47 | # Android Studio Navigation editor temp files
48 | .navigation/
49 |
50 | # Android Studio captures folder
51 | captures/
52 |
53 | # Intellij
54 | *.iml
55 | .idea/workspace.xml
56 | .idea/tasks.xml
57 | .idea/gradle.xml
58 | .idea/dictionaries
59 | .idea/libraries
60 |
61 | # Keystore files
62 | *.jks
63 |
64 | # External native build folder generated in Android Studio 2.2 and later
65 | .externalNativeBuild
66 |
67 | # Google Services (e.g. APIs or Firebase)
68 | google-services.json
69 |
70 | # Freeline
71 | freeline.py
72 | freeline/
73 | freeline_project_description.json
74 | .idea/
75 |
76 |
77 |
--------------------------------------------------------------------------------
/SerialTaskLib/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | .idea/
16 |
17 |
18 |
19 | # Built application files
20 | *.apk
21 | *.ap_
22 |
23 | # Files for the ART/Dalvik VM
24 | *.dex
25 |
26 | # Java class files
27 | *.class
28 |
29 | # Generated files
30 | bin/
31 | gen/
32 | out/
33 |
34 | # Gradle files
35 | .gradle/
36 | build/
37 |
38 | # Local configuration file (sdk path, etc)
39 | local.properties
40 |
41 | # Proguard folder generated by Eclipse
42 | proguard/
43 |
44 | # Log Files
45 | *.log
46 |
47 | # Android Studio Navigation editor temp files
48 | .navigation/
49 |
50 | # Android Studio captures folder
51 | captures/
52 |
53 | # Intellij
54 | *.iml
55 | .idea/workspace.xml
56 | .idea/tasks.xml
57 | .idea/gradle.xml
58 | .idea/dictionaries
59 | .idea/libraries
60 |
61 | # Keystore files
62 | *.jks
63 |
64 | # External native build folder generated in Android Studio 2.2 and later
65 | .externalNativeBuild
66 |
67 | # Google Services (e.g. APIs or Firebase)
68 | google-services.json
69 |
70 | # Freeline
71 | freeline.py
72 | freeline/
73 | freeline_project_description.json
74 | .idea/
75 |
76 |
77 |
--------------------------------------------------------------------------------
/SocketIoLib/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | .idea/
16 |
17 |
18 |
19 | # Built application files
20 | *.apk
21 | *.ap_
22 |
23 | # Files for the ART/Dalvik VM
24 | *.dex
25 |
26 | # Java class files
27 | *.class
28 |
29 | # Generated files
30 | bin/
31 | gen/
32 | out/
33 |
34 | # Gradle files
35 | .gradle/
36 | build/
37 |
38 | # Local configuration file (sdk path, etc)
39 | local.properties
40 |
41 | # Proguard folder generated by Eclipse
42 | proguard/
43 |
44 | # Log Files
45 | *.log
46 |
47 | # Android Studio Navigation editor temp files
48 | .navigation/
49 |
50 | # Android Studio captures folder
51 | captures/
52 |
53 | # Intellij
54 | *.iml
55 | .idea/workspace.xml
56 | .idea/tasks.xml
57 | .idea/gradle.xml
58 | .idea/dictionaries
59 | .idea/libraries
60 |
61 | # Keystore files
62 | *.jks
63 |
64 | # External native build folder generated in Android Studio 2.2 and later
65 | .externalNativeBuild
66 |
67 | # Google Services (e.g. APIs or Firebase)
68 | google-services.json
69 |
70 | # Freeline
71 | freeline.py
72 | freeline/
73 | freeline_project_description.json
74 | .idea/
75 |
76 |
77 |
--------------------------------------------------------------------------------
/WebSocketLib/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | .idea/
16 |
17 |
18 |
19 | # Built application files
20 | *.apk
21 | *.ap_
22 |
23 | # Files for the ART/Dalvik VM
24 | *.dex
25 |
26 | # Java class files
27 | *.class
28 |
29 | # Generated files
30 | bin/
31 | gen/
32 | out/
33 |
34 | # Gradle files
35 | .gradle/
36 | build/
37 |
38 | # Local configuration file (sdk path, etc)
39 | local.properties
40 |
41 | # Proguard folder generated by Eclipse
42 | proguard/
43 |
44 | # Log Files
45 | *.log
46 |
47 | # Android Studio Navigation editor temp files
48 | .navigation/
49 |
50 | # Android Studio captures folder
51 | captures/
52 |
53 | # Intellij
54 | *.iml
55 | .idea/workspace.xml
56 | .idea/tasks.xml
57 | .idea/gradle.xml
58 | .idea/dictionaries
59 | .idea/libraries
60 |
61 | # Keystore files
62 | *.jks
63 |
64 | # External native build folder generated in Android Studio 2.2 and later
65 | .externalNativeBuild
66 |
67 | # Google Services (e.g. APIs or Firebase)
68 | google-services.json
69 |
70 | # Freeline
71 | freeline.py
72 | freeline/
73 | freeline_project_description.json
74 | .idea/
75 |
76 |
77 |
--------------------------------------------------------------------------------
/ZxingServerLib/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | .idea/
16 |
17 |
18 |
19 | # Built application files
20 | *.apk
21 | *.ap_
22 |
23 | # Files for the ART/Dalvik VM
24 | *.dex
25 |
26 | # Java class files
27 | *.class
28 |
29 | # Generated files
30 | bin/
31 | gen/
32 | out/
33 |
34 | # Gradle files
35 | .gradle/
36 | build/
37 |
38 | # Local configuration file (sdk path, etc)
39 | local.properties
40 |
41 | # Proguard folder generated by Eclipse
42 | proguard/
43 |
44 | # Log Files
45 | *.log
46 |
47 | # Android Studio Navigation editor temp files
48 | .navigation/
49 |
50 | # Android Studio captures folder
51 | captures/
52 |
53 | # Intellij
54 | *.iml
55 | .idea/workspace.xml
56 | .idea/tasks.xml
57 | .idea/gradle.xml
58 | .idea/dictionaries
59 | .idea/libraries
60 |
61 | # Keystore files
62 | *.jks
63 |
64 | # External native build folder generated in Android Studio 2.2 and later
65 | .externalNativeBuild
66 |
67 | # Google Services (e.g. APIs or Firebase)
68 | google-services.json
69 |
70 | # Freeline
71 | freeline.py
72 | freeline/
73 | freeline_project_description.json
74 | .idea/
75 |
76 |
77 |
--------------------------------------------------------------------------------
/LocaleHelperLib/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | .idea/
16 |
17 |
18 |
19 | # Built application files
20 | *.apk
21 | *.ap_
22 |
23 | # Files for the ART/Dalvik VM
24 | *.dex
25 |
26 | # Java class files
27 | *.class
28 |
29 | # Generated files
30 | bin/
31 | gen/
32 | out/
33 |
34 | # Gradle files
35 | .gradle/
36 | build/
37 |
38 | # Local configuration file (sdk path, etc)
39 | local.properties
40 |
41 | # Proguard folder generated by Eclipse
42 | proguard/
43 |
44 | # Log Files
45 | *.log
46 |
47 | # Android Studio Navigation editor temp files
48 | .navigation/
49 |
50 | # Android Studio captures folder
51 | captures/
52 |
53 | # Intellij
54 | *.iml
55 | .idea/workspace.xml
56 | .idea/tasks.xml
57 | .idea/gradle.xml
58 | .idea/dictionaries
59 | .idea/libraries
60 |
61 | # Keystore files
62 | *.jks
63 |
64 | # External native build folder generated in Android Studio 2.2 and later
65 | .externalNativeBuild
66 |
67 | # Google Services (e.g. APIs or Firebase)
68 | google-services.json
69 |
70 | # Freeline
71 | freeline.py
72 | freeline/
73 | freeline_project_description.json
74 | .idea/
75 |
76 |
77 |
--------------------------------------------------------------------------------
/InterceptorTime/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
5 | //迁移到jitpack
6 | apply plugin: 'com.github.dcendents.android-maven'
7 |
8 | android {
9 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
10 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
11 | defaultConfig {
12 | minSdkVersion rootProject.ext.android["minSdkVersion"]
13 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
14 | versionCode rootProject.ext.android["versionCode"]
15 | versionName rootProject.ext.android["versionName"]
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_1_8
26 | targetCompatibility JavaVersion.VERSION_1_8
27 | }
28 | }
29 |
30 | dependencies {
31 | implementation fileTree(dir: 'libs', include: ['*.jar'])
32 | implementation(rootProject.ext.dependencies["appcompat"])
33 | implementation(rootProject.ext.dependencies["annotation"])
34 | //工具类utils
35 | implementation 'com.github.yangchong211.YCCommonLib:ToolUtilsLib:1.4.9'
36 | }
--------------------------------------------------------------------------------
/WebSocketLib/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
5 | //迁移到jitpack
6 | apply plugin: 'com.github.dcendents.android-maven'
7 |
8 | android {
9 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
10 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
11 | defaultConfig {
12 | minSdkVersion rootProject.ext.android["minSdkVersion"]
13 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
14 | versionCode rootProject.ext.android["versionCode"]
15 | versionName rootProject.ext.android["versionName"]
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_1_8
26 | targetCompatibility JavaVersion.VERSION_1_8
27 | }
28 | }
29 |
30 |
31 | dependencies {
32 | implementation fileTree(dir: 'libs', include: ['*.jar'])
33 | implementation(rootProject.ext.dependencies["okhttp"])
34 | //工具类utils
35 | implementation 'com.github.yangchong211.YCCommonLib:ToolUtilsLib:1.4.9'
36 | implementation 'com.squareup.okhttp3:mockwebserver:3.10.0'
37 | }
--------------------------------------------------------------------------------
/InterceptorTime/src/main/java/com/yc/interceptortime/MonitorBean.java:
--------------------------------------------------------------------------------
1 | package com.yc.interceptortime;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * 监控耗时的实体
7 | */
8 | public class MonitorBean implements Serializable {
9 |
10 | private long cos;
11 | private String methodName;
12 | private BaseParam param;
13 | private BaseResult result;
14 |
15 | public long getCos() {
16 | return cos;
17 | }
18 |
19 | public void setCos(long cos) {
20 | this.cos = cos;
21 | }
22 |
23 | public String getMethodName() {
24 | return methodName;
25 | }
26 |
27 | public void setMethodName(String methodName) {
28 | this.methodName = methodName;
29 | }
30 |
31 | public BaseParam getParam() {
32 | return param;
33 | }
34 |
35 | public void setParam(BaseParam param) {
36 | this.param = param;
37 | }
38 |
39 | public BaseResult getResult() {
40 | return result;
41 | }
42 |
43 | public void setResult(BaseResult result) {
44 | this.result = result;
45 | }
46 |
47 | @Override
48 | public String toString() {
49 | return "MonitorBean{" +
50 | "方法耗时cos=" + cos +
51 | ", methodName='" + methodName + '\'' +
52 | ", param=" + param +
53 | ", result=" + result +
54 | '}';
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/CountTimerLib/src/main/res/values/attrs.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 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/SocketIoLib/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
5 | //迁移到jitpack
6 | apply plugin: 'com.github.dcendents.android-maven'
7 |
8 | android {
9 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
10 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
11 | defaultConfig {
12 | minSdkVersion rootProject.ext.android["minSdkVersion"]
13 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
14 | versionCode rootProject.ext.android["versionCode"]
15 | versionName rootProject.ext.android["versionName"]
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_1_8
26 | targetCompatibility JavaVersion.VERSION_1_8
27 | }
28 | }
29 |
30 |
31 | ext{
32 | socketIoVersion = "1.0.0"
33 | SocketIoServiceDependencies = [
34 | socketio : "io.socket:socket.io-client:${socketIoVersion}",
35 | ]
36 | }
37 |
38 |
39 | dependencies {
40 | implementation fileTree(dir: 'libs', include: ['*.jar'])
41 | implementation project.ext.SocketIoServiceDependencies['socketio']
42 | implementation 'com.github.yangchong211.YCThreadPool:EasyExecutor:1.3.8'
43 | }
--------------------------------------------------------------------------------
/NtpTimeLib/src/main/java/com/yc/ntptime/SpCacheImpl.java:
--------------------------------------------------------------------------------
1 | package com.yc.ntptime;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 |
6 | import static android.content.Context.MODE_PRIVATE;
7 | /**
8 | *
9 | * @author yangchong
10 | * email : yangchong211@163.com
11 | * time : 2018/5/11
12 | * desc : sp缓存接口实现类
13 | * revise :
14 | *
15 | */
16 | public class SpCacheImpl implements CacheInterface {
17 |
18 | private static final String KEY_CACHED_SHARED_PREFS = "com.yc.ntptime.shared_preferences";
19 | private final SharedPreferences sharedPreferences;
20 |
21 | public SpCacheImpl(Context context) {
22 | sharedPreferences = context.getSharedPreferences(KEY_CACHED_SHARED_PREFS, MODE_PRIVATE);
23 | }
24 |
25 | @Override
26 | public void put(String key, long value) {
27 | sharedPreferences.edit().putLong(key, value).apply();
28 | }
29 |
30 | @Override
31 | public long get(String key, long defaultValue) {
32 | return sharedPreferences.getLong(key, defaultValue);
33 | }
34 |
35 | @Override
36 | public void clear() {
37 | remove(CacheInterface.KEY_CACHED_BOOT_TIME);
38 | remove(CacheInterface.KEY_CACHED_DEVICE_UPTIME);
39 | remove(CacheInterface.KEY_CACHED_NTP_TIME);
40 | }
41 |
42 | private void remove(String keyCachedBootTime) {
43 | sharedPreferences.edit().remove(keyCachedBootTime).apply();
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/EasyTtsPlayer/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
3 |
4 | android {
5 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
6 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
7 | defaultConfig {
8 | minSdkVersion rootProject.ext.android["minSdkVersion"]
9 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
10 | versionCode rootProject.ext.android["versionCode"]
11 | versionName rootProject.ext.android["versionName"]
12 | }
13 |
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | compileOptions {
21 | sourceCompatibility JavaVersion.VERSION_1_8
22 | targetCompatibility JavaVersion.VERSION_1_8
23 | }
24 | }
25 |
26 | dependencies {
27 | implementation fileTree(dir: "libs", include: ["*.jar"])
28 | implementation(rootProject.ext.dependencies["appcompat"])
29 | implementation(rootProject.ext.dependencies["media"])
30 | //通用组件接口库
31 | implementation 'com.github.yangchong211.YCCommonLib:AppCommonInter:1.4.4'
32 | //轻量级异步线程封装库:https://github.com/yangchong211/YCThreadPool
33 | implementation 'com.github.yangchong211.YCThreadPool:EasyExecutor:1.3.8'
34 | //采用compileOnly依赖
35 | compileOnly("com.google.android.exoplayer:exoplayer:2.11.3")
36 | }
37 |
--------------------------------------------------------------------------------
/LooperThread/src/main/java/com/yc/looperthread/TimerLoopThread.java:
--------------------------------------------------------------------------------
1 | package com.yc.looperthread;
2 |
3 | import android.util.Log;
4 |
5 | import java.util.Timer;
6 | import java.util.TimerTask;
7 | import java.util.concurrent.locks.ReentrantLock;
8 |
9 | /**
10 | * 使用Timer实现定时性周期性任务轮训
11 | */
12 | public class TimerLoopThread extends AbsPollingThread {
13 |
14 | private final ReentrantLock commitLock = new ReentrantLock();
15 | private Timer timer;
16 | @Override
17 | public void release() {
18 | super.release();
19 | //销毁的时候,释放timer,避免造成内存泄漏
20 | if (timer != null) {
21 | timer.cancel();
22 | timer = null;
23 | }
24 | }
25 |
26 | @Override
27 | public void doAction() {
28 | Log.v(TAG, "timer doAction-> " + count.getAndIncrement());
29 | }
30 |
31 | @Override
32 | public void startPolling() {
33 | timer = new Timer();
34 | timer.schedule(new CommitTimer(), 0, getSleepTime());
35 | }
36 |
37 | private class CommitTimer extends TimerTask {
38 | @Override
39 | public void run() {
40 | commitLock.lock();
41 | try {
42 | // 轮询的代码
43 | if (beginRead && isLoop()) {
44 | doAction();
45 | }
46 | } catch (Exception ex) {
47 | ex.printStackTrace();
48 | } finally {
49 | commitLock.unlock();
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/LocalShareLib/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
5 | //迁移到jitpack
6 | apply plugin: 'com.github.dcendents.android-maven'
7 |
8 | android {
9 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
10 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
11 | defaultConfig {
12 | minSdkVersion rootProject.ext.android["minSdkVersion"]
13 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
14 | versionCode rootProject.ext.android["versionCode"]
15 | versionName rootProject.ext.android["versionName"]
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_1_8
26 | targetCompatibility JavaVersion.VERSION_1_8
27 | }
28 | }
29 |
30 | dependencies {
31 | implementation fileTree(dir: 'libs', include: ['*.jar'])
32 | implementation(rootProject.ext.dependencies["appcompat"])
33 | implementation(rootProject.ext.dependencies["annotation"])
34 | //implementation project(path: ':ToolUtilsLib')
35 | //store磁盘分区库
36 | implementation 'com.github.yangchong211.YCCommonLib:ToolUtilsLib:1.4.9'
37 | //store磁盘分区库
38 | implementation 'com.github.yangchong211.YCCommonLib:AppMediaStore:1.4.9'
39 | }
--------------------------------------------------------------------------------
/LongAliveLib/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
5 | //迁移到jitpack
6 | apply plugin: 'com.github.dcendents.android-maven'
7 |
8 | android {
9 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
10 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
11 | defaultConfig {
12 | minSdkVersion rootProject.ext.android["minSdkVersion"]
13 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
14 | versionCode rootProject.ext.android["versionCode"]
15 | versionName rootProject.ext.android["versionName"]
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_1_8
26 | targetCompatibility JavaVersion.VERSION_1_8
27 | }
28 | }
29 |
30 | dependencies {
31 | implementation fileTree(dir: 'libs', include: ['*.jar'])
32 | implementation(rootProject.ext.dependencies["appcompat"])
33 | implementation(rootProject.ext.dependencies["annotation"])
34 | implementation(rootProject.ext.dependencies["core"])
35 | // api project(path: ':AppCommonInter')
36 | implementation 'com.github.yangchong211.YCCommonLib:AppCommonInter:1.4.9'
37 | implementation 'com.github.yangchong211.YCThreadPool:EasyExecutor:1.3.8'
38 | }
--------------------------------------------------------------------------------
/ZxingServerLib/src/main/java/com/yc/zxingserver/camera/PreviewCallback.java:
--------------------------------------------------------------------------------
1 | package com.yc.zxingserver.camera;
2 | import android.graphics.Point;
3 | import android.hardware.Camera;
4 | import android.os.Handler;
5 | import android.os.Message;
6 |
7 | import com.yc.toolutils.AppLogUtils;
8 |
9 |
10 | @SuppressWarnings("deprecation") // camera APIs
11 | final class PreviewCallback implements Camera.PreviewCallback {
12 |
13 | private final CameraConfigurationManager configManager;
14 | private Handler previewHandler;
15 | private int previewMessage;
16 |
17 | PreviewCallback(CameraConfigurationManager configManager) {
18 | this.configManager = configManager;
19 | }
20 |
21 | void setHandler(Handler previewHandler, int previewMessage) {
22 | this.previewHandler = previewHandler;
23 | this.previewMessage = previewMessage;
24 | }
25 |
26 | @Override
27 | public void onPreviewFrame(byte[] data, Camera camera) {
28 | Point cameraResolution = configManager.getCameraResolution();
29 | Handler thePreviewHandler = previewHandler;
30 | if (cameraResolution != null && thePreviewHandler != null) {
31 | Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x,
32 | cameraResolution.y, data);
33 | message.sendToTarget();
34 | previewHandler = null;
35 | } else {
36 | AppLogUtils.d( "Got preview callback, but no handler or resolution available");
37 | }
38 | }
39 |
40 | }
--------------------------------------------------------------------------------
/AppProcessLib/src/main/java/com/yc/appprocesslib/ProcessInitializer.java:
--------------------------------------------------------------------------------
1 | package com.yc.appprocesslib;
2 |
3 | import android.content.ContentProvider;
4 | import android.content.ContentValues;
5 | import android.database.Cursor;
6 | import android.net.Uri;
7 |
8 | import androidx.annotation.NonNull;
9 | import androidx.annotation.Nullable;
10 |
11 |
12 | /**
13 | * @author: 杨充
14 | * @email : yangchong211@163.com
15 | * @time : 2018/04/15
16 | * @desc : 初始化
17 | * @revise :
18 | * GitHub :https://github.com/yangchong211/YCEfficient
19 | */
20 | public class ProcessInitializer extends ContentProvider {
21 | @Override
22 | public boolean onCreate() {
23 | AppStateMonitor.getInstance().init(getContext());
24 | return true;
25 | }
26 |
27 | @Nullable
28 | @Override
29 | public Cursor query(@NonNull Uri uri, String[] strings, String s, String[] strings1,
30 | String s1) {
31 | return null;
32 | }
33 |
34 | @Nullable
35 | @Override
36 | public String getType(@NonNull Uri uri) {
37 | return null;
38 | }
39 |
40 | @Nullable
41 | @Override
42 | public Uri insert(@NonNull Uri uri, ContentValues contentValues) {
43 | return null;
44 | }
45 |
46 | @Override
47 | public int delete(@NonNull Uri uri, String s, String[] strings) {
48 | return 0;
49 | }
50 |
51 | @Override
52 | public int update(@NonNull Uri uri, ContentValues contentValues, String s, String[] strings) {
53 | return 0;
54 | }
55 | }
56 |
57 |
--------------------------------------------------------------------------------
/AppTraceTool/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
3 | //迁移到jitpack
4 | apply plugin: 'com.github.dcendents.android-maven'
5 |
6 | def releaseTime() {
7 | return new Date().format("yyyyMMddHHmm", TimeZone.getTimeZone("PRC"))
8 | }
9 |
10 | android {
11 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
12 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
13 |
14 | defaultConfig {
15 | //applicationId "com.ddtaxi.common.tracesdk"
16 | minSdkVersion rootProject.ext.android["minSdkVersion"]
17 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
18 | versionCode rootProject.ext.android["versionCode"]
19 | versionName rootProject.ext.android["versionName"]
20 |
21 | buildConfigField "String", "BUILD_VERSION", "\"${releaseTime()}\""
22 | }
23 |
24 | buildTypes {
25 | release {
26 | //minifyEnabled true
27 | //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
28 | }
29 | }
30 | compileOptions {
31 | sourceCompatibility JavaVersion.VERSION_1_8
32 | targetCompatibility JavaVersion.VERSION_1_8
33 | }
34 | }
35 |
36 | dependencies {
37 | implementation fileTree(dir: 'libs', include: ['*.jar'])
38 | implementation(rootProject.ext.dependencies["annotation"])
39 | //implementation project(path: ':AppLogLib')
40 | implementation 'com.github.yangchong211.YCCommonLib:AppLogLib:1.4.9'
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/ycbjie/ycgroupadapter/GroupEntity.java:
--------------------------------------------------------------------------------
1 | package com.ycbjie.ycgroupadapter;
2 |
3 | import java.util.ArrayList;
4 |
5 | /**
6 | * 组数据的实体类
7 | */
8 | public class GroupEntity {
9 |
10 | private String header;
11 | private String footer;
12 | private ArrayList children;
13 | private boolean isExpand;
14 |
15 | public GroupEntity(String header, String footer, ArrayList children) {
16 | this.header = header;
17 | this.footer = footer;
18 | this.children = children;
19 | }
20 |
21 | public GroupEntity(String header, String footer, ArrayList children, boolean isExpand) {
22 | this.header = header;
23 | this.footer = footer;
24 | this.children = children;
25 | this.isExpand = isExpand;
26 | }
27 |
28 | public String getHeader() {
29 | return header;
30 | }
31 |
32 | public void setHeader(String header) {
33 | this.header = header;
34 | }
35 |
36 | public String getFooter() {
37 | return footer;
38 | }
39 |
40 | public void setFooter(String footer) {
41 | this.footer = footer;
42 | }
43 |
44 | public ArrayList getChildren() {
45 | return children;
46 | }
47 |
48 | public void setChildren(ArrayList children) {
49 | this.children = children;
50 | }
51 |
52 |
53 | public boolean isExpand() {
54 | return isExpand;
55 | }
56 |
57 | public void setExpand(boolean expand) {
58 | isExpand = expand;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/AppProcessLib/src/main/java/com/yc/appprocesslib/BackgroundThread.java:
--------------------------------------------------------------------------------
1 |
2 | package com.yc.appprocesslib;
3 |
4 | import android.os.Handler;
5 | import android.os.HandlerThread;
6 | import android.os.Looper;
7 |
8 | /**
9 | * @author: 杨充
10 | * @email : yangchong211@163.com
11 | * @time : 2018/04/15
12 | * @desc : Shared singleton background thread for each process.
13 | * @revise :
14 | * GitHub :https://github.com/yangchong211/YCEfficient
15 | */
16 | public final class BackgroundThread extends HandlerThread {
17 |
18 | private static BackgroundThread sInstance;
19 | private static Handler sHandler;
20 |
21 | private BackgroundThread() {
22 | super("BackgroundThread", android.os.Process.THREAD_PRIORITY_BACKGROUND);
23 | }
24 |
25 | private static void ensureThreadLocked() {
26 | if (sInstance == null) {
27 | synchronized (BackgroundThread.class) {
28 | if (sInstance == null) {
29 | //创建一个HandlerThread对象
30 | sInstance = new BackgroundThread();
31 | sInstance.start();
32 | //获取该thread的独有looper对象
33 | final Looper looper = sInstance.getLooper();
34 | sHandler = new Handler(looper);
35 | }
36 | }
37 | }
38 | }
39 |
40 | public static BackgroundThread get() {
41 | synchronized (BackgroundThread.class) {
42 | ensureThreadLocked();
43 | return sInstance;
44 | }
45 | }
46 |
47 | public Handler getHandler() {
48 | return sHandler;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/ZXingCodeLib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
3 | //迁移到jitpack
4 | apply plugin: 'com.github.dcendents.android-maven'
5 |
6 | android {
7 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
8 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
9 |
10 | defaultConfig {
11 | minSdkVersion rootProject.ext.android["minSdkVersion"]
12 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
13 | versionCode rootProject.ext.android["versionCode"]
14 | versionName rootProject.ext.android["versionName"]
15 | multiDexEnabled true
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 |
26 | //jdk1.8
27 | compileOptions {
28 | sourceCompatibility JavaVersion.VERSION_1_8
29 | targetCompatibility JavaVersion.VERSION_1_8
30 | }
31 | }
32 |
33 | dependencies {
34 | implementation fileTree(dir: "libs", include: ["*.jar"])
35 | implementation(rootProject.ext.dependencies["appcompat"])
36 | implementation(rootProject.ext.dependencies["annotation"])
37 | implementation 'com.google.zxing:core:3.3.3'
38 | implementation 'com.github.yangchong211.YCCommonLib:ToolUtilsLib:1.4.9'
39 | implementation 'com.github.yangchong211.YCCommonLib:AppEncryptLib:1.4.9'
40 | // implementation project(path: ':ToolUtilsLib')
41 | // implementation project(path: ':AppEncryptLib')
42 | }
--------------------------------------------------------------------------------
/LocaleHelperLib/src/main/java/com/yc/localelib/observer/ActivityCallback.java:
--------------------------------------------------------------------------------
1 | package com.yc.localelib.observer;
2 |
3 | import android.app.Activity;
4 | import android.app.Application;
5 | import android.os.Bundle;
6 |
7 | import com.yc.localelib.service.LocaleService;
8 |
9 | /**
10 | *
11 | * @author yangchong
12 | * email : yangchong211@163.com
13 | * time : 2018/5/11
14 | * desc : 生命周期监听器
15 | * revise :
16 | *
17 | */
18 | public final class ActivityCallback implements Application.ActivityLifecycleCallbacks {
19 |
20 | public static void inject(Application application) {
21 | application.registerActivityLifecycleCallbacks(new ActivityCallback());
22 | }
23 |
24 | @Override
25 | public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
26 | LocaleService.getInstance().refreshLocale(activity);
27 | LocaleService.getInstance().refreshLocale(activity.getApplication());
28 | }
29 |
30 | @Override
31 | public void onActivityStarted(Activity activity) {}
32 |
33 | @Override
34 | public void onActivityResumed(Activity activity) {
35 | LocaleService.getInstance().refreshLocale(activity);
36 | LocaleService.getInstance().refreshLocale(activity.getApplication());
37 | }
38 |
39 | @Override
40 | public void onActivityPaused(Activity activity) {}
41 |
42 | @Override
43 | public void onActivityStopped(Activity activity) {}
44 |
45 | @Override
46 | public void onActivityDestroyed(Activity activity) {}
47 |
48 | @Override
49 | public void onActivitySaveInstanceState(Activity activity, Bundle outState) {}
50 | }
--------------------------------------------------------------------------------
/ZxingServerLib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply from: rootProject.projectDir.absolutePath + "/yc.gradle"
3 | //迁移到jitpack
4 | apply plugin: 'com.github.dcendents.android-maven'
5 |
6 | android {
7 | compileSdkVersion rootProject.ext.android["compileSdkVersion"]
8 | //buildToolsVersion rootProject.ext.android["buildToolsVersion"]
9 |
10 | defaultConfig {
11 | minSdkVersion rootProject.ext.android["minSdkVersion"]
12 | targetSdkVersion rootProject.ext.android["targetSdkVersion"]
13 | versionCode rootProject.ext.android["versionCode"]
14 | versionName rootProject.ext.android["versionName"]
15 | multiDexEnabled true
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 |
26 | //jdk1.8
27 | compileOptions {
28 | sourceCompatibility JavaVersion.VERSION_1_8
29 | targetCompatibility JavaVersion.VERSION_1_8
30 | }
31 | }
32 |
33 | dependencies {
34 | implementation fileTree(dir: "libs", include: ["*.jar"])
35 | implementation(rootProject.ext.dependencies["appcompat"])
36 | implementation(rootProject.ext.dependencies["annotation"])
37 | implementation 'com.google.zxing:core:3.3.3'
38 | implementation 'com.github.yangchong211.YCCommonLib:ToolUtilsLib:1.4.9'
39 | implementation 'com.github.yangchong211.YCCommonLib:AppEncryptLib:1.4.9'
40 | // implementation project(path: ':ToolUtilsLib')
41 | implementation project(path: ':ZXingCodeLib')
42 | // implementation project(path: ':AppEncryptLib')
43 | }
--------------------------------------------------------------------------------
/TransitionHelper/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
29 |
--------------------------------------------------------------------------------
/ZXingCodeLib/src/main/java/com/yc/zxingcodelib/ZxingImageUtils.java:
--------------------------------------------------------------------------------
1 | package com.yc.zxingcodelib;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.BitmapFactory;
5 |
6 | /**
7 | *
8 | * @author yangchong
9 | * email : yangchong211@163.com
10 | * time : 2020/6/6
11 | * desc : 二维码图片压缩工具类
12 | * revise:
13 | *
14 | */
15 | public class ZxingImageUtils {
16 |
17 | /**
18 | * 压缩图片
19 | */
20 | public static Bitmap compressBitmap(String path, int reqWidth, int reqHeight){
21 | BitmapFactory.Options newOpts = new BitmapFactory.Options();
22 | // 开始读入图片,此时把options.inJustDecodeBounds 设回true了
23 | //获取原始图片大小
24 | newOpts.inJustDecodeBounds = true;
25 | // 此时返回bm为空
26 | BitmapFactory.decodeFile(path, newOpts);
27 | float width = newOpts.outWidth;
28 | float height = newOpts.outHeight;
29 | // 缩放比,由于是固定比例缩放,只用高或者宽其中一个数据进行计算即可
30 | // wSize=1表示不缩放
31 | int wSize = 1;
32 | if (width > reqWidth) {
33 | // 如果宽度大的话根据宽度固定大小缩放
34 | wSize = (int) (width / reqWidth);
35 | }
36 | // wSize=1表示不缩放
37 | int hSize = 1;
38 | // 如果高度高的话根据宽度固定大小缩放
39 | if (height > reqHeight) {
40 | hSize = (int) (height / reqHeight);
41 | }
42 | int size = Math.max(wSize,hSize);
43 | if (size <= 0){
44 | size = 1;
45 | }
46 | // 设置缩放比例
47 | newOpts.inSampleSize = size;
48 | // 重新读入图片,注意此时已经把options.inJustDecodeBounds 设回false了
49 | newOpts.inJustDecodeBounds = false;
50 | return BitmapFactory.decodeFile(path, newOpts);
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/NtpTimeLib/README.md:
--------------------------------------------------------------------------------
1 | # 校正系统时间方案
2 | #### 目录介绍
3 | - 01.基础概念
4 | - 02.常见思路和做法
5 | - 03.Api调用说明
6 | - 04.测试case罗列
7 | - 05.遇到的坑分析
8 |
9 |
10 |
11 | ### 01.基础概念
12 | - 先说下业务场景
13 | - 在开发过程中我们常常需要获取系统时间。Android系统的自动确认时间,是由系统通过访问厂家的NTP服务器的时间,然后修改后得到的。
14 | - 所以当没有网络或者在内网环境下的时候,系统无法访问到NTP服务器,便会造成系统时间错误。所以这个时候我们就需要程序去修改系统的时间,或者获取一个正确的时间来代替系统时间。
15 | - NTP服务器
16 | - 用来使计算机时间同步化的一种协议,它可以使计算机对其服务器或时钟源(如石英钟,GPS等等)做同步化,它可以提供高精准度的时间校正(LAN上与标准间差小于1毫秒,WAN上几十毫秒)且可介由加密确认的方式来防止恶毒的协议攻击。
17 | - 时间按NTP服务器的等级传播。按照离外部UTC源的远近把所有服务器归入不同的Stratum(层)中。
18 |
19 |
20 |
21 | ### 02.常见思路和做法
22 | - 根据不同的情况,实现了如下两种解决方案:
23 | - 获取NTP服务器时间代替系统时间。
24 | - 优点:无需Root,适用于任何手机及系统。缺点:需要可以访问外部网络,内网环境下则需要一台自己的NTP服务器。
25 | - 获取网页时间代替系统时间。
26 | - 优点:无需Root,适用于任何手机及系统,适用于任何网络环境。缺点:需要一条额外的线程,去维护时间准确,容易造成误差。
27 |
28 |
29 |
30 | ### 03.Api调用说明
31 | - 注意两点:
32 | - 设置时区为北京时间:GMT-8为北京时间;中国科学技术大学NTP服务器:time.ustc.edu.cn
33 | - 初始化Api说明
34 | ```
35 | try {
36 | NtpGetTime.build()
37 | .withNtpHost("time.ustc.edu.cn")
38 | .withSharedPreferencesCache(MainApplication.getInstance())
39 | .withConnectionTimeout(30000)
40 | .initialize();
41 | } catch (IOException e) {
42 | e.printStackTrace();
43 | AppLogUtils.e("something went wrong when trying to initialize NtpGetTime "+ e);
44 | }
45 | ```
46 | - 如何获取校对后的真实时间
47 | ```
48 | if (!NtpGetTime.isInitialized()) {
49 | return;
50 | }
51 | //获取校对后时间
52 | Date trueTime = NtpGetTime.now();
53 | //获取当前设备时间
54 | Date deviceTime = new Date();
55 | ```
56 |
57 |
58 | ### 04.测试case罗列
59 | - 修改手机或者硬件设备时间信息,然后调用该库获取校对时间,查看是否准确获取最新北京时间。
60 |
61 |
62 | ### 05.遇到的坑分析
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/ZxingServerLib/src/main/res/values/attrs.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 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/WebSocketLib/README.md:
--------------------------------------------------------------------------------
1 | # websocket长连接服务
2 |
3 | #使用办法
4 |
5 | // WebSocketSetting webSocketSetting = new WebSocketSetting();
6 | // 重连次数
7 | // webSocketSetting.setReconnectFrequency(10);
8 | // webSocketSetting.setConnectUrl("wss://echo.websocket.org");
9 | // 心跳包间隔秒
10 | // webSocketSetting.setConnectionLostTimeout(5);
11 | // 设置监听
12 | // SocketCallBackManager.getInstance().addListener(new ISocketListener() {
13 | // @Override
14 | // public void onConnected() {
15 | // Log.i("MainActivity", "onConnected()");
16 | // }
17 | //
18 | // @Override
19 | // public void onConnectFailed(Throwable e) {
20 | // Log.e("MainActivity", "onConnectFailed() " + e.getMessage());
21 | // }
22 | //
23 | // @Override
24 | // public void onDisconnect() {
25 | // Log.e("MainActivity", "onDisconnect() ");
26 | // }
27 | //
28 | // @Override
29 | // public void onMessage(String message) {
30 | // Log.e("MainActivity", "onMessage() string " + message);
31 | // }
32 | //
33 | // @Override
34 | // public void onMessage(ByteBuffer bytes) {
35 | // Log.e("MainActivity", "onMessage() ByteBuffer " + bytes.array().length);
36 | // }
37 | // });
38 | // 开始连接
39 | // WebSocketClientManager.getInstance().connect(webSocketSetting);
40 | // 发送文本消息
41 | // WebSocketClientManager.getInstance().send("你好啊服务端");
42 | // 发送字节流
43 | // WebSocketClientManager.getInstance().send(bytes);
--------------------------------------------------------------------------------
/TransitionHelper/src/main/java/com/yc/transition/TransitionParam.java:
--------------------------------------------------------------------------------
1 | package com.yc.transition;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | /**
7 | *
8 | * @author : yangchong
9 | * email : yangchong211@163.com
10 | * time : 2018/8/11
11 | * desc : 参数值
12 | * revise :
13 | *
14 | */
15 | public class TransitionParam implements Parcelable {
16 |
17 | public int width;
18 | public int height;
19 | public int left;
20 | public int right;
21 | public int top;
22 | public int bottom;
23 |
24 | @Override
25 | public int describeContents() {
26 | return 0;
27 | }
28 |
29 | @Override
30 | public void writeToParcel(Parcel dest, int flags) {
31 | dest.writeInt(this.width);
32 | dest.writeInt(this.height);
33 | dest.writeInt(this.left);
34 | dest.writeInt(this.right);
35 | dest.writeInt(this.top);
36 | dest.writeInt(this.bottom);
37 | }
38 |
39 | public TransitionParam() {
40 | }
41 |
42 | protected TransitionParam(Parcel in) {
43 | this.width = in.readInt();
44 | this.height = in.readInt();
45 | this.left = in.readInt();
46 | this.right = in.readInt();
47 | this.top = in.readInt();
48 | this.bottom = in.readInt();
49 | }
50 |
51 | public static final Creator CREATOR = new Creator() {
52 | @Override
53 | public TransitionParam createFromParcel(Parcel source) {
54 | return new TransitionParam(source);
55 | }
56 |
57 | @Override
58 | public TransitionParam[] newArray(int size) {
59 | return new TransitionParam[size];
60 | }
61 | };
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/ZXingCodeLib/src/main/java/com/yc/zxingcodelib/DecodeManager.java:
--------------------------------------------------------------------------------
1 | package com.yc.zxingcodelib;
2 | import android.content.Intent;
3 | import android.net.Uri;
4 |
5 | import com.google.zxing.BarcodeFormat;
6 |
7 | import java.util.Arrays;
8 | import java.util.EnumSet;
9 | import java.util.HashMap;
10 | import java.util.List;
11 | import java.util.Map;
12 | import java.util.Set;
13 | import java.util.regex.Pattern;
14 |
15 | public final class DecodeManager {
16 |
17 | private static final Pattern COMMA_PATTERN = Pattern.compile(",");
18 |
19 | public static final Set PRODUCT_FORMATS;
20 | public static final Set INDUSTRIAL_FORMATS;
21 | public static final Set ONE_D_FORMATS;
22 | public static final Set QR_CODE_FORMATS = EnumSet.of(BarcodeFormat.QR_CODE);
23 | public static final Set DATA_MATRIX_FORMATS = EnumSet.of(BarcodeFormat.DATA_MATRIX);
24 | public static final Set AZTEC_FORMATS = EnumSet.of(BarcodeFormat.AZTEC);
25 | public static final Set PDF417_FORMATS = EnumSet.of(BarcodeFormat.PDF_417);
26 | static {
27 | PRODUCT_FORMATS = EnumSet.of(BarcodeFormat.UPC_A,
28 | BarcodeFormat.UPC_E,
29 | BarcodeFormat.EAN_13,
30 | BarcodeFormat.EAN_8,
31 | BarcodeFormat.RSS_14,
32 | BarcodeFormat.RSS_EXPANDED);
33 | INDUSTRIAL_FORMATS = EnumSet.of(BarcodeFormat.CODE_39,
34 | BarcodeFormat.CODE_93,
35 | BarcodeFormat.CODE_128,
36 | BarcodeFormat.ITF,
37 | BarcodeFormat.CODABAR);
38 | ONE_D_FORMATS = EnumSet.copyOf(PRODUCT_FORMATS);
39 | ONE_D_FORMATS.addAll(INDUSTRIAL_FORMATS);
40 | }
41 |
42 | }
--------------------------------------------------------------------------------
/LooperThread/src/main/java/com/yc/looperthread/HandlerLoopThread.java:
--------------------------------------------------------------------------------
1 | package com.yc.looperthread;
2 |
3 | import android.os.Handler;
4 | import android.os.HandlerThread;
5 | import android.os.Message;
6 | import android.util.Log;
7 |
8 | /**
9 | * 使用Handler不断发送消息来实现轮训
10 | */
11 | public class HandlerLoopThread extends AbsPollingThread {
12 |
13 | private static final int MSG_GET_COMPARE_RESULT = 520;
14 | private Handler handler;
15 |
16 | @Override
17 | public void release() {
18 | super.release();
19 | if (handler != null){
20 | handler.removeCallbacksAndMessages(null);
21 | handler = null;
22 | }
23 | }
24 |
25 | @Override
26 | public void beginLoop() {
27 | super.beginLoop();
28 | handler.sendEmptyMessageDelayed(MSG_GET_COMPARE_RESULT, 0);
29 | }
30 |
31 | @Override
32 | public void startPolling() {
33 | HandlerThread handlerThread = new HandlerThread("LooperThread");
34 | handlerThread.start();
35 | handler = new Handler(handlerThread.getLooper()) {
36 | @Override
37 | public void handleMessage(Message msg) {
38 | super.handleMessage(msg);
39 | if (msg.what == MSG_GET_COMPARE_RESULT) {
40 | // 轮询的代码
41 | if (beginRead && isLoop()) {
42 | doAction();
43 | //向MessageQueue中添加延时消息,后重复执行以上任务
44 | handler.sendEmptyMessageDelayed(MSG_GET_COMPARE_RESULT, getSleepTime());
45 | }
46 | }
47 | }
48 | };
49 | }
50 |
51 | @Override
52 | public void doAction() {
53 | Log.v(TAG, "handler doAction-> " + count.getAndIncrement());
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/ZxingServerLib/src/main/res/layout/easy_capture_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
16 |
21 |
28 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/LooperThread/src/main/java/com/yc/looperthread/AbsPollingThread.java:
--------------------------------------------------------------------------------
1 | package com.yc.looperthread;
2 |
3 | import android.util.Log;
4 |
5 | import java.util.Timer;
6 | import java.util.TimerTask;
7 | import java.util.concurrent.atomic.AtomicBoolean;
8 | import java.util.concurrent.atomic.AtomicLong;
9 | import java.util.concurrent.locks.ReentrantLock;
10 |
11 | public abstract class AbsPollingThread implements IDoAction {
12 |
13 | protected static final String TAG = AbsPollingThread.class.getSimpleName();
14 | protected final AtomicLong count = new AtomicLong(0);
15 | private final AtomicBoolean isStart = new AtomicBoolean(false);
16 | protected volatile boolean beginRead = false;
17 |
18 | @Override
19 | public void startThread() {
20 | //防止多次启动
21 | if (!isStart.get()) {
22 | Log.v(TAG, "startThread");
23 | startPolling();
24 | isStart.set(true);
25 | }
26 | }
27 |
28 | @Override
29 | public void beginLoop() {
30 | Log.v(TAG, "beginLoop");
31 | //每次开启循环的时候都要检测一下线程是否需要跑起来
32 | startThread();
33 | beginRead = true;
34 | }
35 |
36 | @Override
37 | public void endLoop() {
38 | Log.v(TAG, "endRead");
39 | beginRead = false;
40 | }
41 |
42 | @Override
43 | public void release() {
44 | Log.v(TAG, "release");
45 | beginRead = false;
46 | isStart.set(false);
47 | }
48 |
49 | public abstract void startPolling();
50 |
51 | /**
52 | * 默认条件是true
53 | *
54 | * @return 布尔值
55 | */
56 | public boolean isLoop() {
57 | return true;
58 | }
59 |
60 | /**
61 | * 默认睡眠时间是100毫秒,子类可以重写该方法
62 | *
63 | * @return 时间
64 | */
65 | public long getSleepTime() {
66 | return 100;
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/WebSocketLib/src/main/java/com/yc/websocket/SocketCallBackManager.java:
--------------------------------------------------------------------------------
1 | package com.yc.websocket;
2 |
3 | import java.nio.ByteBuffer;
4 | import java.util.ArrayList;
5 | import java.util.List;
6 |
7 | public class SocketCallBackManager {
8 |
9 | private List listeners = new ArrayList<>();
10 |
11 | private SocketCallBackManager() {
12 | }
13 |
14 | public static SocketCallBackManager getInstance() {
15 | return SocketCallBackManagerHolder.INSTANCE;
16 | }
17 |
18 | private static class SocketCallBackManagerHolder {
19 | static SocketCallBackManager INSTANCE = new SocketCallBackManager();
20 |
21 | }
22 |
23 | public void addListener(ISocketListener listener) {
24 | listeners.add(listener);
25 | }
26 |
27 | public void removeListener(ISocketListener listener) {
28 | listeners.remove(listener);
29 | }
30 |
31 |
32 | public void notifyConnected() {
33 | for (int i = 0; i < listeners.size(); i++) {
34 | listeners.get(i).onConnected();
35 | }
36 | }
37 |
38 |
39 | public void notifyDisConnected() {
40 | for (int i = 0; i < listeners.size(); i++) {
41 | listeners.get(i).onDisconnect();
42 | }
43 | }
44 |
45 | public void notifyConnectFailed(Throwable e) {
46 | for (int i = 0; i < listeners.size(); i++) {
47 | listeners.get(i).onConnectFailed(e);
48 | }
49 | }
50 |
51 |
52 | public void notifyReciveString(String msg) {
53 | for (int i = 0; i < listeners.size(); i++) {
54 | listeners.get(i).onMessage(msg);
55 | }
56 | }
57 |
58 | public void notifyReciveBytes(ByteBuffer byteBuffer) {
59 | for (int i = 0; i < listeners.size(); i++) {
60 | listeners.get(i).onMessage(byteBuffer);
61 | }
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/LongAliveLib/src/main/java/com/yc/longalive/LongAliveConstant.java:
--------------------------------------------------------------------------------
1 | package com.yc.longalive;
2 |
3 | /**
4 | *
5 | * @author yangchong
6 | * email : yangchong211@163.com
7 | * time : 2017/5/11
8 | * desc : 常量
9 | * revise :
10 | * GitHub :
11 | *
12 | */
13 | public final class LongAliveConstant {
14 | public static final String LONGEVITY_MONITOR_NAME = "longevity_monitor";
15 | public static final String LONGEVITY_MONITOR_KEY_TIMESTAMP = "ts";
16 | public static final String LONGEVITY_MONITOR_KEY_PID = "pid";
17 | public static final String LONGEVITY_MONITOR_KEY_SCREEN_STATE = "screen_state";
18 | public static final String LONGEVITY_MONITOR_EVENT_SLEEP = "longevity_monitor_event_sleep";
19 | public static final String LONGEVITY_MONITOR_EVENT_SYSTEM_KILL = "longevity_monitor_event_system_kill";
20 | public static final String LONGEVITY_MONITOR_EVENT_USER_KILL = "longevity_monitor_event_user_kill";
21 | public static final String LONGEVITY_MONITOR_EVENT_SLEEP_TYPE_SLEEP = "longevity_monitor_event_sleep_type_sleep";
22 | public static final String LONGEVITY_MONITOR_EVENT_SLEEP_TYPE_KILL = "longevity_monitor_event_sleep_type_kill";
23 | public static final String LONGEVITY_MONITOR_PARAM_FIELD_EVENT = "event";
24 | public static final String LONGEVITY_MONITOR_PARAM_FIELD_TYPE = "type";
25 | public static final String LONGEVITY_MONITOR_PARAM_FIELD_PERIOD = "period";
26 | public static final String LONGEVITY_MONITOR_PARAM_FIELD_TS = "ts";
27 | public static final String LONGEVITY_MONITOR_PARAM_FIELD_TS_LAST = "ts_last";
28 | public static final int LONGEVITY_SCREEN_STATE_ON = 1;
29 | public static final int LONGEVITY_SCREEN_STATE_OFF = 2;
30 | public static final int LONGEVITY_SCREEN_STATE_NO_VALUE = 3;
31 |
32 | public LongAliveConstant() {
33 | }
34 | }
35 |
36 |
--------------------------------------------------------------------------------
/LooperThread/src/main/java/com/yc/looperthread/ScheduledLoopThread.java:
--------------------------------------------------------------------------------
1 | package com.yc.looperthread;
2 |
3 | import android.util.Log;
4 |
5 | import java.util.concurrent.Executors;
6 | import java.util.concurrent.ScheduledExecutorService;
7 | import java.util.concurrent.TimeUnit;
8 |
9 | /**
10 | * 使用ScheduledExecutorService实现轮询
11 | */
12 | public class ScheduledLoopThread extends AbsPollingThread {
13 |
14 | private ScheduledExecutorService scheduledExecutorService;
15 |
16 | @Override
17 | public void release() {
18 | super.release();
19 | scheduledExecutorService.shutdownNow();
20 | scheduledExecutorService = null;
21 | }
22 |
23 | @Override
24 | public void doAction() {
25 | Log.v(TAG, "scheduled doAction-> " + count.getAndIncrement());
26 | }
27 |
28 | @Override
29 | public void startPolling() {
30 | scheduledExecutorService = Executors.newScheduledThreadPool(1);
31 | //固定速率计时器( scheduleAtFixedRate() )基于开始时间(因此每个迭代将在startTime + iterationNumber * delayTime处执行)。
32 | scheduledExecutorService.scheduleAtFixedRate(() -> {
33 | //如果此执行器已关闭,则返回true。
34 | if (!scheduledExecutorService.isShutdown()) {
35 | // 轮询的代码
36 | if (beginRead && isLoop()) {
37 | doAction();
38 | }
39 | }
40 | }, 0, getSleepTime(), TimeUnit.MILLISECONDS);
41 |
42 |
43 | //固定延迟计时器( schedule() )基于前一次执行(因此每次迭代将在lastExecutionTime + delayTime处执行)。
44 | // scheduledExecutorService.schedule(() -> {
45 | // //如果此执行器已关闭,则返回true。
46 | // if (!scheduledExecutorService.isShutdown()) {
47 | // // 轮询的代码
48 | // if (beginRead && isLoop()) {
49 | // doAction();
50 | // }
51 | // }
52 | // }, getSleepTime(), TimeUnit.MILLISECONDS);
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/LooperThread/src/main/java/com/yc/looperthread/WhileLoopThread.java:
--------------------------------------------------------------------------------
1 | package com.yc.looperthread;
2 |
3 | import android.util.Log;
4 |
5 | import java.util.Timer;
6 | import java.util.TimerTask;
7 | import java.util.concurrent.locks.ReentrantLock;
8 |
9 | /**
10 | * 使用while实现定时性周期性任务轮训
11 | */
12 | public class WhileLoopThread extends AbsPollingThread {
13 |
14 | private Thread thread;
15 |
16 |
17 | @Override
18 | public void release() {
19 | super.release();
20 | //中断可以理解为线程的一个标志位,它表示了一个运行中的线程是否被其他线程进行了中断操作。
21 | try {
22 | thread.interrupt();
23 | } catch (Exception e){
24 | e.printStackTrace();
25 | } finally {
26 | thread = null;
27 | }
28 | }
29 |
30 | private final Runnable runnable = new Runnable() {
31 | @Override
32 | public void run() {
33 | while (thread != null && !thread.isInterrupted()) {
34 | while (beginRead && isLoop()) {
35 | try {
36 | doAction();
37 | } catch (Exception e) {
38 | e.printStackTrace();
39 | } finally {
40 | try {
41 | //thread.wait(getSleepTime());
42 | //线程轮训的方式中延时操作阻塞了线程
43 | Thread.sleep(getSleepTime());
44 | } catch (InterruptedException e) {
45 | e.printStackTrace();
46 | }
47 | }
48 | }
49 | }
50 | }
51 | };
52 |
53 | @Override
54 | public void doAction() {
55 | Log.v(TAG, "thread doAction-> " + count.getAndIncrement());
56 | }
57 |
58 | @Override
59 | public void startPolling() {
60 | thread = new Thread(runnable);
61 | thread.start();
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/SerialTaskLib/src/main/java/com/yc/serialtasklib/Dispatcher.java:
--------------------------------------------------------------------------------
1 | package com.yc.serialtasklib;
2 |
3 |
4 | import android.os.AsyncTask;
5 | import java.util.concurrent.Executor;
6 |
7 | public class Dispatcher {
8 |
9 | public Dispatcher() {
10 |
11 | }
12 |
13 | public static Executor singleGroup() {
14 | return AsyncTask.SERIAL_EXECUTOR;
15 | }
16 |
17 | public static Executor poolGroup() {
18 | return AsyncTask.THREAD_POOL_EXECUTOR;
19 | }
20 |
21 | public static void async(Runnable task) {
22 | async(poolGroup(), task);
23 | }
24 |
25 | public static void async(Executor threadGroup, Runnable task) {
26 | (new InnerAsyncTask0()).executeOnExecutor(threadGroup, new Runnable[]{task});
27 | }
28 |
29 | public static void async(IDispatchRunnable task) {
30 | async(poolGroup(), task);
31 | }
32 |
33 | public static void async(Executor threadGroup, IDispatchRunnable task) {
34 | (new InnerAsyncTask1()).executeOnExecutor(threadGroup, new IDispatchRunnable[]{task});
35 | }
36 |
37 | private static class InnerAsyncTask1 extends AsyncTask {
38 | private InnerAsyncTask1() {
39 | }
40 |
41 | @Override
42 | protected IDispatchRunnable doInBackground(IDispatchRunnable... tasks) {
43 | tasks[0].onWorkThread();
44 | return tasks[0];
45 | }
46 |
47 | @Override
48 | protected void onPostExecute(IDispatchRunnable task) {
49 | task.onMainThread();
50 | }
51 | }
52 |
53 | private static class InnerAsyncTask0 extends AsyncTask {
54 | private InnerAsyncTask0() {
55 | }
56 |
57 | @Override
58 | protected Void doInBackground(Runnable... tasks) {
59 | tasks[0].run();
60 | return null;
61 | }
62 | }
63 | }
64 |
65 |
--------------------------------------------------------------------------------
/app/src/main/java/com/ycbjie/ycgroupadapter/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.ycbjie.ycgroupadapter;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.view.View;
6 |
7 | import androidx.appcompat.app.AppCompatActivity;
8 |
9 | import com.yc.zxingserver.demo.EasyCaptureActivity;
10 |
11 | public class MainActivity extends AppCompatActivity implements View.OnClickListener {
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.activity_main);
17 |
18 | findViewById(R.id.tv_1).setOnClickListener(this);
19 | findViewById(R.id.tv_2).setOnClickListener(this);
20 | findViewById(R.id.tv_3).setOnClickListener(this);
21 | findViewById(R.id.tv_4).setOnClickListener(this);
22 | findViewById(R.id.tv_5).setOnClickListener(this);
23 | findViewById(R.id.tv_6).setOnClickListener(this);
24 | }
25 |
26 | @Override
27 | public void onClick(View view) {
28 | switch (view.getId()){
29 | case R.id.tv_1:
30 | startActivity(new Intent(this, EasyCaptureActivity.class));
31 | break;
32 | case R.id.tv_2:
33 | startActivity(new Intent(this,SecondActivity.class));
34 | break;
35 | case R.id.tv_3:
36 | startActivity(new Intent(this,ThirdActivity.class));
37 | break;
38 | case R.id.tv_4:
39 | startActivity(new Intent(this,FourActivity.class));
40 | break;
41 | case R.id.tv_5:
42 | startActivity(new Intent(this,FiveActivity.class));
43 | break;
44 | case R.id.tv_6:
45 | startActivity(new Intent(this,SixActivity.class));
46 | break;
47 | default:
48 | break;
49 | }
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/TransitionHelper/README.md:
--------------------------------------------------------------------------------
1 | # 悬浮窗工具库
2 | #### 目录介绍
3 | - 01.基础概念介绍
4 | - 02.常见思路和做法
5 | - 03.Api调用说明
6 | - 04.遇到的坑分析
7 | - 05.其他问题说明
8 |
9 |
10 |
11 | ### 01.基础概念说明
12 | #### 1.1 什么是转场动画
13 | - Activity 和 Fragment 变换是建立在名叫 Transitions 的安卓新特性之上的。为在不同的 UI 状态之间产生动画效果提供了非常方便的 API。
14 | - Transition 可以被用来实现 Activity 或者 Fragment 切换时的异常复杂的动画效果。
15 |
16 |
17 | #### 1.2 转场动画概念
18 | - 转场动画核心概念
19 | - 场景(scenes)和变换(transitions)。场景(scenes)定义了当前的 UI 状态;变换(transitions)则定义了在不同场景之间动画变化的过程。
20 | - 当一个场景改变的时候,transition 主要负责:
21 | - (1)捕捉在开始场景和结束场景中每个 View 的状态。(2)根据视图一个场景移动到另一个场景的差异创建一个 Animator。
22 |
23 |
24 | #### 1.3 转场动画场景
25 | - 转场动画听名字就知道它的使用场景了,转场、转场自然是用在场景转换的时候:
26 | - 转场效果我们一般用在 Activity 切换时的动画效果上;
27 | - 共享元素一般我们使用在转换的前后两个页面有共同元素时;
28 | - 同时也可以在 Activity 布局发生场景变化时,让其中的 View 产生相应的过渡动画。
29 | - 在介绍 activity 的切换动画之前我们先来说明一下实现切换 activity 的两种方式:
30 | - 调用 startActivity 方法启动一个新的 Activity 并跳转其页面。这涉及到了旧的 Activity 的退出动画和新的 Activity 的显示动画。
31 | - 调用 finish 方法销毁当前的 Activity 返回上一个 Activity 界面。这涉及到了当前 Activity 的退出动画和前一个 Activity 的显示动画。
32 |
33 |
34 |
35 |
36 | ### 02.常见思路和做法
37 | #### 2.1 转场动画实现的几种方式
38 | - 第一种:activity.overridePendingTransition(R.anim.fade_in, R.anim.fade_out),这个是在startActivity 方法或者是 finish 方法调用之后立即执行。
39 | - 第二种:使用 style 的方式定义 Activity 的切换动画。这里的 windowAnimationStyle 就是我们定义 Activity 切换动画的 style,设置这个动画文件则可以为Activity 的跳转配置动画效果。
40 | - 第三种:使用 ActivityOptions 切换动画实现 Activity 跳转动画。Material Design转场动画,三种进入和退出过渡动画效果(Explode,Slide,Fade),然后开启activity时传递ActivityOptions.makeSceneTransitionAnimation
41 | - 第四种:使用 ActivityOptions 动画共享组件的方式实现跳转 Activity 动画。需要注意共享视图设置的transitionName保持一致
42 | - 第五种:使用 ActivityOptions 之后内置的动画效果通过 style 的方式。
43 | - 关于转场动画,可以看看这篇博客:[Android动画系列---转场动画详解](https://www.jianshu.com/p/78fdcceb9a59)
44 |
45 |
46 | #### 2.2 Transition实现原理
47 |
48 |
49 |
50 | #### 2.3 View到Activity动画
51 | -
52 |
53 |
54 |
55 | ### 03.Api调用说明
56 |
57 |
58 |
59 | ### 04.遇到的坑分析
60 |
61 |
62 |
63 |
64 | ### 05.其他问题说明
65 |
66 |
67 |
68 |
69 | ### 参考博客
70 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/InterceptorTime/src/main/java/com/yc/interceptortime/BaseResult.java:
--------------------------------------------------------------------------------
1 | package com.yc.interceptortime;
2 |
3 |
4 | import java.io.Serializable;
5 |
6 | /**
7 | * @author : yangchong
8 | * @email : yangchong211@163.com
9 | * @time : 2017/5/18
10 | * @desc : 结果
11 | * revise :
12 | */
13 | public class BaseResult implements Serializable {
14 |
15 | protected boolean success;
16 | protected String errMsg;
17 | protected Exception exception;
18 | protected long timeCos;
19 |
20 | public BaseResult() {
21 |
22 | }
23 |
24 | public BaseResult(boolean success, String errMsg, Exception exception) {
25 | this.success = success;
26 | this.errMsg = errMsg;
27 | this.exception = exception;
28 | }
29 |
30 | public BaseResult(boolean success, String errMsg, Exception exception, long timeCos) {
31 | this.success = success;
32 | this.errMsg = errMsg;
33 | this.exception = exception;
34 | this.timeCos = timeCos;
35 | }
36 |
37 | public boolean isSuccess() {
38 | return success;
39 | }
40 |
41 | public void setSuccess(boolean success) {
42 | this.success = success;
43 | }
44 |
45 | public Exception getException() {
46 | return exception;
47 | }
48 |
49 | public void setException(Exception exception) {
50 | this.exception = exception;
51 | }
52 |
53 | public String getErrMsg() {
54 | return errMsg;
55 | }
56 |
57 | public void setErrMsg(String errMsg) {
58 | this.errMsg = errMsg;
59 | }
60 |
61 | public long getTimeCos() {
62 | return timeCos;
63 | }
64 |
65 | public void setTimeCos(long timeCos) {
66 | this.timeCos = timeCos;
67 | }
68 |
69 | @Override
70 | public String toString() {
71 | return "BaseRt{" +
72 | "success=" + success +
73 | ", errMsg='" + errMsg + '\'' +
74 | ", exception=" + exception +
75 | ", timeCos=" + timeCos +
76 | '}';
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/AppTraceTool/src/main/java/com/yc/tracesdk/TimeTrace.java:
--------------------------------------------------------------------------------
1 | package com.yc.tracesdk;
2 |
3 | public class TimeTrace {
4 | private static final String TAG = "TimeTrace";
5 |
6 | private final String mEvent;
7 | private final InterPrinter mPrinter;
8 | private final InterTimer mTimer;
9 |
10 | private long mStartTraceTime;
11 | private long mLastTraceTime;
12 | private boolean mStarted;
13 |
14 | TimeTrace(String event, InterPrinter printer, InterTimer timer) {
15 | mEvent = event;
16 | mPrinter = printer;
17 | mTimer = timer;
18 | }
19 |
20 | TimeTrace(String event, InterPrinter printer, InterTimer timer, boolean startCount) {
21 | this(event, printer, timer);
22 | if (startCount) {
23 | start();
24 | }
25 | }
26 |
27 |
28 | /**
29 | * start count.
30 | */
31 | public void start() {
32 | if (!mPrinter.enable()) {
33 | return;
34 | }
35 | mStartTraceTime = mTimer.currentTime();
36 | mLastTraceTime = mStartTraceTime;
37 | mStarted = true;
38 | }
39 |
40 | /**
41 | * all count stopped & count all time cost.
42 | */
43 | public void end() {
44 | if (!mStarted) {
45 | return;
46 | }
47 |
48 | mPrinter.print(TAG, "[%s][END][%d %s]",
49 | mEvent, mTimer.currentTime() - mStartTraceTime, mTimer.unitName());
50 | mStarted = false;
51 | mStartTraceTime = 0;
52 | mLastTraceTime = 0;
53 | }
54 |
55 | /**
56 | * time cost from last step.
57 | */
58 | public void step(String format, Object... args) {
59 | if (!mStarted) {
60 | return;
61 | }
62 |
63 | String msg;
64 | if (args != null && args.length > 0) {
65 | msg = String.format(format, args);
66 | } else {
67 | msg = format;
68 | }
69 |
70 | long curTime = mTimer.currentTime();
71 | mPrinter.print(TAG, "[%s][STEP][%d %s] %s",
72 | mEvent, curTime - mLastTraceTime, mTimer.unitName(), msg);
73 | mLastTraceTime = curTime;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/CountTimerLib/src/main/java/com/yc/timerlib/view/CountDownState.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2017 yangchong211(github.com/yangchong211)
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 | package com.yc.timerlib.view;
17 |
18 |
19 | import android.os.Parcel;
20 | import android.os.Parcelable;
21 | import android.view.View;
22 |
23 | /**
24 | *
25 | * @author yangchong
26 | * blog : https://github.com/yangchong211/YCStatusBar
27 | * time : 2017/5/18
28 | * desc : 自定义BaseSavedState
29 | * revise:
30 | *
31 | */
32 | public class CountDownState extends View.BaseSavedState {
33 |
34 | int mLoadingTime;
35 | int mLocation;
36 | boolean isRunning;
37 |
38 | public static final Creator CREATOR
39 | = new Creator() {
40 | @Override
41 | public CountDownState createFromParcel(Parcel in) {
42 | return new CountDownState(in);
43 | }
44 |
45 | @Override
46 | public CountDownState[] newArray(int size) {
47 | return new CountDownState[size];
48 | }
49 | };
50 |
51 | CountDownState(Parcelable superState) {
52 | super(superState);
53 | }
54 |
55 | CountDownState(Parcel source) {
56 | super(source);
57 | mLoadingTime = source.readInt();
58 | mLocation = source.readInt();
59 | isRunning = source.readInt() == 1;
60 | }
61 |
62 | @Override public void writeToParcel(Parcel out, int flags) {
63 | super.writeToParcel(out, flags);
64 | out.writeInt(mLoadingTime);
65 | out.writeInt(mLocation);
66 | out.writeInt(isRunning ? 1 : 0);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/ZxingServerLib/src/main/java/com/yc/zxingserver/scan/Preferences.java:
--------------------------------------------------------------------------------
1 | package com.yc.zxingserver.scan;
2 |
3 | public final class Preferences {
4 |
5 | public static final String KEY_DECODE_1D_PRODUCT = "preferences_decode_1D_product";
6 | public static final String KEY_DECODE_1D_INDUSTRIAL = "preferences_decode_1D_industrial";
7 | public static final String KEY_DECODE_QR = "preferences_decode_QR";
8 | public static final String KEY_DECODE_DATA_MATRIX = "preferences_decode_Data_Matrix";
9 | public static final String KEY_DECODE_AZTEC = "preferences_decode_Aztec";
10 | public static final String KEY_DECODE_PDF417 = "preferences_decode_PDF417";
11 |
12 | public static final String KEY_CUSTOM_PRODUCT_SEARCH = "preferences_custom_product_search";
13 |
14 | public static final String KEY_PLAY_BEEP = "preferences_play_beep";
15 | public static final String KEY_VIBRATE = "preferences_vibrate";
16 | public static final String KEY_COPY_TO_CLIPBOARD = "preferences_copy_to_clipboard";
17 | public static final String KEY_FRONT_LIGHT_MODE = "preferences_front_light_mode";
18 | public static final String KEY_BULK_MODE = "preferences_bulk_mode";
19 | public static final String KEY_REMEMBER_DUPLICATES = "preferences_remember_duplicates";
20 | public static final String KEY_ENABLE_HISTORY = "preferences_history";
21 | public static final String KEY_SUPPLEMENTAL = "preferences_supplemental";
22 | public static final String KEY_AUTO_FOCUS = "preferences_auto_focus";
23 | public static final String KEY_INVERT_SCAN = "preferences_invert_scan";
24 | public static final String KEY_SEARCH_COUNTRY = "preferences_search_country";
25 | public static final String KEY_DISABLE_AUTO_ORIENTATION = "preferences_orientation";
26 |
27 | public static final String KEY_DISABLE_CONTINUOUS_FOCUS = "preferences_disable_continuous_focus";
28 | public static final String KEY_DISABLE_EXPOSURE = "preferences_disable_exposure";
29 | public static final String KEY_DISABLE_METERING = "preferences_disable_metering";
30 | public static final String KEY_DISABLE_BARCODE_SCENE_MODE = "preferences_disable_barcode_scene_mode";
31 | public static final String KEY_AUTO_OPEN_WEB = "preferences_auto_open_web";
32 |
33 |
34 | }
--------------------------------------------------------------------------------
/EasyTtsPlayer/src/main/java/com/yc/audioplayer/powerful/service/AudioServiceProvider.java:
--------------------------------------------------------------------------------
1 | package com.yc.audioplayer.powerful.service;
2 |
3 | import android.content.Context;
4 |
5 | import com.yc.audioplayer.powerful.bean.AudioPlayData;
6 | import com.yc.audioplayer.powerful.bean.TtsPlayerConfig;
7 | import com.yc.audioplayer.powerful.inter.PlayStateListener;
8 |
9 | /**
10 | *
11 | * @author yangchong
12 | * email : yangchong211@163.com
13 | * GitHub : https://github.com/yangchong211/YCVideoPlayer
14 | * time : 2018/8/6
15 | * desc : provider接口
16 | * revise:
17 | *
18 | */
19 | public interface AudioServiceProvider {
20 |
21 | /**
22 | * 初始化语音服务
23 | *
24 | * @param context {@link Context}
25 | * @param config {@link TtsPlayerConfig}
26 | */
27 | void init(Context context , TtsPlayerConfig config);
28 |
29 | /**
30 | * 是否已经初始化
31 | *
32 | * @return true 是
33 | */
34 | boolean isInit();
35 |
36 | /**
37 | * 获取配置config
38 | * @return config
39 | */
40 | TtsPlayerConfig getConfig();
41 |
42 | /**
43 | * 停止播放
44 | */
45 | void stop();
46 |
47 | /**
48 | * 暂停播放
49 | */
50 | void pause();
51 |
52 | /**
53 | * 恢复播放
54 | */
55 | void resume();
56 |
57 | /**
58 | * 销毁播放
59 | */
60 | void release();
61 |
62 | /**
63 | * 是否正在播放
64 | *
65 | * @return true 正在播放
66 | */
67 | boolean isPlaying();
68 |
69 | /**
70 | * 播放数据
71 | *
72 | * @param data {@link AudioPlayData}
73 | */
74 | void play(AudioPlayData data);
75 |
76 | /**
77 | * 播放tts
78 | *
79 | * @param tts tts文本
80 | */
81 | void playTts(String tts);
82 |
83 |
84 | /**
85 | * 播放音频资源
86 | *
87 | * @param url 网络资源
88 | */
89 | void playUrl(String url);
90 |
91 | /**
92 | * 播放音频资源
93 | *
94 | * @param rawId 资源文件
95 | */
96 | void playAudioResource(int rawId);
97 |
98 | /**
99 | * 监听单条PlayData播放状态
100 | *
101 | * @param playStateListener 监听器
102 | */
103 | void setPlayStateListener(PlayStateListener playStateListener);
104 |
105 | }
106 |
--------------------------------------------------------------------------------
/InterceptorTime/src/main/java/com/yc/interceptortime/TimeTestDemo.java:
--------------------------------------------------------------------------------
1 | package com.yc.interceptortime;
2 |
3 | public class TimeTestDemo {
4 |
5 |
6 | /**
7 | * 使用案例1: 这种是使用单利对象调用
8 | *
9 | * @return BaseResult
10 | */
11 | public BaseResult testMethodSync() {
12 | InterceptorManager instance = InterceptorManager.getInstance();
13 | BaseParam baseParam = new BaseParam("doubi");
14 | baseParam.setTimeout(5000);
15 | return (BaseResult) instance.handleInterceptor(baseParam, new ResultCallback() {
16 | @Override
17 | public BaseResult getResult() {
18 | BaseResult baseRt = new BaseResult();
19 | try {
20 | //这个地方做业务逻辑处理
21 | Thread.sleep(6000);
22 | //插入成功
23 | baseRt.setSuccess(true);
24 | } catch (Exception e) {
25 | e.printStackTrace();
26 | baseRt.setSuccess(false);
27 | baseRt.setException(e);
28 | baseRt.setErrMsg(e.toString());
29 | }
30 | return baseRt;
31 | }
32 | });
33 | }
34 |
35 | /**
36 | * 使用案例2: 这种是继承使用
37 | *
38 | * @return BaseResult
39 | */
40 | public static class Test1 extends BaseInterceptor {
41 |
42 | public BaseResult testMethodSync2() {
43 | BaseParam baseParam = new BaseParam("doubi");
44 | baseParam.setTimeout(5000);
45 | return (BaseResult) handleInterceptor(baseParam, new ResultCallback() {
46 | @Override
47 | public BaseResult getResult() {
48 | BaseResult baseRt = new BaseResult();
49 | try {
50 | //这个地方做业务逻辑处理
51 | Thread.sleep(6000);
52 | //插入成功
53 | baseRt.setSuccess(true);
54 | } catch (Exception e) {
55 | e.printStackTrace();
56 | baseRt.setSuccess(false);
57 | baseRt.setException(e);
58 | baseRt.setErrMsg(e.toString());
59 | }
60 | return baseRt;
61 | }
62 | });
63 | }
64 | }
65 |
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
19 |
20 |
28 |
29 |
37 |
38 |
46 |
47 |
55 |
56 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/ZxingServerLib/src/main/java/com/yc/zxingserver/camera/open/OpenCameraInterface.java:
--------------------------------------------------------------------------------
1 | package com.yc.zxingserver.camera.open;
2 |
3 | import android.hardware.Camera;
4 |
5 | import com.yc.toolutils.AppLogUtils;
6 |
7 | public final class OpenCameraInterface {
8 |
9 | /**
10 | * For {@link #open(int)}, means no preference for which camera to open.
11 | */
12 | public static final int NO_REQUESTED_CAMERA = -1;
13 |
14 | private OpenCameraInterface() {
15 | }
16 |
17 | /**
18 | * Opens the requested camera with {@link Camera#open(int)}, if one exists.
19 | *
20 | * @param cameraId camera ID of the camera to use. A negative value
21 | * or {@link #NO_REQUESTED_CAMERA} means "no preference", in which case a rear-facing
22 | * camera is returned if possible or else any camera
23 | * @return handle to {@link OpenCamera} that was opened
24 | */
25 | public static OpenCamera open(int cameraId) {
26 |
27 | int numCameras = Camera.getNumberOfCameras();
28 | if (numCameras == 0) {
29 | AppLogUtils.w( "No cameras!");
30 | return null;
31 | }
32 | if (cameraId >= numCameras) {
33 | AppLogUtils.w( "Requested camera does not exist: " + cameraId);
34 | return null;
35 | }
36 |
37 | if (cameraId <= NO_REQUESTED_CAMERA) {
38 | cameraId = 0;
39 | while (cameraId < numCameras) {
40 | Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
41 | Camera.getCameraInfo(cameraId, cameraInfo);
42 | if (CameraFacing.values()[cameraInfo.facing] == CameraFacing.BACK) {
43 | break;
44 | }
45 | cameraId++;
46 | }
47 | if (cameraId == numCameras) {
48 | AppLogUtils.i("No camera facing " + CameraFacing.BACK + "; returning camera #0");
49 | cameraId = 0;
50 | }
51 | }
52 | AppLogUtils.i("Opening camera #" + cameraId);
53 | Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
54 | Camera.getCameraInfo(cameraId, cameraInfo);
55 | Camera camera = Camera.open(cameraId);
56 | if (camera == null) {
57 | return null;
58 | }
59 | return new OpenCamera(cameraId,
60 | camera,
61 | CameraFacing.values()[cameraInfo.facing],
62 | cameraInfo.orientation);
63 | }
64 |
65 | }
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 |
4 | /* +++++++++ 框架基础工具库 +++++++++ */
5 | include ':ZxingServerLib', ':WebSocketLib', ':SocketIoLib', ':SerialTaskLib', ':EasySocket',
6 | ':LocaleHelperLib', ':CountTimerLib', ':LocalShareLib', ':NtpTimeLib',':InterceptorTime',
7 | ':AnimatorToolLib', ':AppTraceTool', ':LongAliveLib', ':EasyExecutor',':AdbHelper',
8 | ':ThreadPoolLib', ':AutoCloserLib', ':AppProcessLib',':KeyEventLib',':LooperThread',
9 | ':AnimatorHelper', ':ThreadDebugLib', ':LiveDataBus', ':AppUpdateLib', ':UsbInterface',
10 | ':ZXingCodeLib', ':TransitionHelper', ':AnimBaseHelper'
11 | project(':ZxingServerLib').projectDir = new File('ZxingServerLib')
12 | project(':ZXingCodeLib').projectDir = new File('ZXingCodeLib')
13 | project(':WebSocketLib').projectDir = new File('WebSocketLib')
14 | project(':SocketIoLib').projectDir = new File('SocketIoLib')
15 | project(':SerialTaskLib').projectDir = new File('SerialTaskLib')
16 | project(':KeyEventLib').projectDir = new File('KeyEventLib')
17 | project(':LocaleHelperLib').projectDir = new File('LocaleHelperLib')
18 | project(':CountTimerLib').projectDir = new File('CountTimerLib')
19 | project(':AnimatorToolLib').projectDir = new File('AnimatorToolLib')
20 | project(':AppTraceTool').projectDir = new File('AppTraceTool')
21 | project(':LongAliveLib').projectDir = new File('LongAliveLib')
22 | project(':ThreadPoolLib').projectDir = new File('ThreadPoolLib')
23 | project(':AutoCloserLib').projectDir = new File('AutoCloserLib')
24 | project(':AppProcessLib').projectDir = new File('AppProcessLib')
25 | project(':EasyExecutor').projectDir = new File('EasyExecutor')
26 | project(':LocalShareLib').projectDir = new File('LocalShareLib')
27 | project(':AnimatorHelper').projectDir = new File('AnimatorHelper')
28 | project(':ThreadDebugLib').projectDir = new File('ThreadDebugLib')
29 | project(':LiveDataBus').projectDir = new File('LiveDataBus')
30 | project(':NtpTimeLib').projectDir = new File('NtpTimeLib')
31 | project(':UsbInterface').projectDir = new File('UsbInterface')
32 | project(':AppUpdateLib').projectDir = new File('AppUpdateLib')
33 | project(':TransitionHelper').projectDir = new File('TransitionHelper')
34 | project(':AnimBaseHelper').projectDir = new File('AnimBaseHelper')
35 | project(':EasySocket').projectDir = new File('EasySocket')
36 | project(':LooperThread').projectDir = new File('LooperThread')
37 | project(':InterceptorTime').projectDir = new File('InterceptorTime')
38 | project(':AdbHelper').projectDir = new File('AdbHelper')
39 |
40 |
41 | include ':EasyTtsPlayer'
42 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 29
5 | defaultConfig {
6 | applicationId "com.ycbjie.ycgroupadapter"
7 | minSdkVersion 17
8 | targetSdkVersion 29
9 | versionCode 1
10 | versionName "1.0"
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 | compileOptions {
21 | sourceCompatibility JavaVersion.VERSION_1_8
22 | targetCompatibility JavaVersion.VERSION_1_8
23 | }
24 | }
25 |
26 | dependencies {
27 | implementation fileTree(dir: 'libs', include: ['*.jar'])
28 | implementation 'androidx.appcompat:appcompat:1.1.0'
29 | implementation 'androidx.recyclerview:recyclerview:1.1.0'
30 | implementation 'com.github.yangchong211:YCGroupAdapter:1.0.6'
31 |
32 | implementation project(path: ':ZxingServerLib')
33 | implementation project(path: ':ZXingCodeLib')
34 |
35 |
36 | implementation 'com.github.yangchong211.YCCommonLib:AppCommonInter:1.4.4'
37 | implementation 'com.github.yangchong211.YCToolLib:InterceptorTime:1.0.8'
38 | implementation 'com.github.yangchong211.YCToolLib:SocketIoLib:1.0.8'
39 | implementation 'com.github.yangchong211.YCToolLib:AppProcessLib:1.0.8'
40 | implementation 'com.github.yangchong211.YCToolLib:WebSocketLib:1.0.8'
41 | implementation 'com.github.yangchong211.YCToolLib:CountTimerLib:1.0.8'
42 | implementation 'com.github.yangchong211.YCToolLib:AutoCloserLib:1.0.8'
43 | implementation 'com.github.yangchong211.YCToolLib:AppTraceTool:1.0.8'
44 | // implementation 'com.github.yangchong211.YCToolLib:ZxingServerLib:1.0.8'
45 | // implementation 'com.github.yangchong211.YCToolLib:ZXingCodeLib:1.0.8'
46 | implementation 'com.github.yangchong211.YCToolLib:LocaleHelperLib:1.0.8'
47 | implementation 'com.github.yangchong211.YCToolLib:LooperThread:1.0.8'
48 | implementation 'com.github.yangchong211.YCToolLib:TransitionHelper:1.0.8'
49 | implementation 'com.github.yangchong211.YCToolLib:NtpTimeLib:1.0.8'
50 | implementation 'com.github.yangchong211.YCToolLib:LongAliveLib:1.0.8'
51 | implementation 'com.github.yangchong211.YCToolLib:AppTraceTool:1.0.8'
52 | implementation 'com.github.yangchong211.YCToolLib:SerialTaskLib:1.0.8'
53 | implementation project(path: ':EasyTtsPlayer')
54 |
55 | }
56 |
57 |
58 |
--------------------------------------------------------------------------------
/LooperThread/src/main/java/com/yc/looperthread/AbsLoopThread.java:
--------------------------------------------------------------------------------
1 | package com.yc.looperthread;
2 |
3 | import android.util.Log;
4 |
5 | import java.util.concurrent.atomic.AtomicBoolean;
6 |
7 | /**
8 | * 使用Thread.sleep实现轮询。一直做while循环
9 | */
10 | public abstract class AbsLoopThread extends Thread implements IDoAction {
11 |
12 | static final String TAG = AbsLoopThread.class.getSimpleName();
13 | private volatile boolean beginRead = false;
14 | private final AtomicBoolean isStart = new AtomicBoolean(false);
15 |
16 | @Override
17 | public void run() {
18 | super.run();
19 | while (!interrupted()) {
20 | while (beginRead && isLoop()) {
21 | try {
22 | doAction();
23 | } catch (Exception e) {
24 | e.printStackTrace();
25 | } finally {
26 | try {
27 | //线程轮训的方式中延时操作阻塞了线程
28 | Thread.sleep(getSleepTime());
29 | } catch (InterruptedException e) {
30 | e.printStackTrace();
31 | }
32 | }
33 | }
34 | }
35 | }
36 |
37 | /**
38 | * 启动线程
39 | */
40 | @Override
41 | public void startThread() {
42 | //防止多次启动
43 | if (!isStart.get()) {
44 | Log.v(TAG, "startThread");
45 | start();
46 | isStart.set(true);
47 | }
48 | }
49 |
50 |
51 | /**
52 | * 开始循环
53 | */
54 | @Override
55 | public void beginLoop() {
56 | Log.v(TAG, "beginLoop");
57 | //每次开启循环的时候都要检测一下线程是否需要跑起来
58 | startThread();
59 | beginRead = true;
60 | }
61 |
62 | /**
63 | * 暂停循环
64 | */
65 | @Override
66 | public void endLoop() {
67 | Log.v(TAG, "endRead");
68 | beginRead = false;
69 | }
70 |
71 | /**
72 | * 释放线程。如果线程释放了,则没有办法再次start,除非是创建新的线程
73 | */
74 | @Override
75 | public void release() {
76 | Log.v(TAG, "release");
77 | beginRead = false;
78 | //中断可以理解为线程的一个标志位,它表示了一个运行中的线程是否被其他线程进行了中断操作。
79 | interrupt();
80 | //使用stop方法强行终止线程(不推荐使用,可能发生不可预料的结果)
81 | //stop();
82 | }
83 |
84 | /**
85 | * 默认条件是true
86 | *
87 | * @return 布尔值
88 | */
89 | public boolean isLoop() {
90 | return true;
91 | }
92 |
93 | /**
94 | * 默认睡眠时间是100毫秒,子类可以重写该方法
95 | *
96 | * @return 时间
97 | */
98 | public long getSleepTime() {
99 | return 100;
100 | }
101 |
102 | }
103 |
--------------------------------------------------------------------------------
/ZxingServerLib/src/main/java/com/yc/zxingserver/demo/EasyCaptureActivity.java:
--------------------------------------------------------------------------------
1 | package com.yc.zxingserver.demo;
2 |
3 | import static com.yc.zxingcodelib.DecodeManager.QR_CODE_FORMATS;
4 |
5 | import android.os.Bundle;
6 | import androidx.appcompat.widget.Toolbar;
7 |
8 | import android.util.Log;
9 | import android.view.View;
10 | import android.widget.ImageView;
11 | import android.widget.TextView;
12 | import android.widget.Toast;
13 |
14 | import com.yc.zxingserver.R;
15 | import com.yc.zxingserver.camera.FrontLightMode;
16 | import com.yc.zxingserver.scan.CaptureActivity;
17 | import com.yc.zxingserver.scan.DecodeFormatManager;
18 |
19 |
20 | public class EasyCaptureActivity extends CaptureActivity {
21 |
22 | public static final String KEY_TITLE = "key_title";
23 | @Override
24 | public int getLayoutId() {
25 | return R.layout.easy_capture_activity;
26 | }
27 |
28 | @Override
29 | public void onCreate(Bundle icicle) {
30 | super.onCreate(icicle);
31 | Toolbar toolbar = findViewById(R.id.toolbar);
32 | TextView tvTitle = findViewById(R.id.tvTitle);
33 | ImageView mIvLeft = findViewById(R.id.ivLeft);
34 | tvTitle.setText("二维码扫描");
35 | getCaptureHelper()
36 | //设置只识别二维码会提升速度
37 | .decodeFormats(QR_CODE_FORMATS)
38 | .playBeep(true)
39 | .vibrate(true);
40 |
41 | //获取CaptureHelper,里面有扫码相关的配置设置
42 | getCaptureHelper().playBeep(false)//播放音效
43 | .vibrate(true)//震动
44 | .supportVerticalCode(true)//支持扫垂直条码,建议有此需求时才使用。
45 | // .decodeFormats(DecodeFormatManager.QR_CODE_FORMATS)//设置只识别二维码会提升速度
46 | // .framingRectRatio(0.9f)//设置识别区域比例,范围建议在0.625 ~ 1.0之间。非全屏识别时才有效
47 | // .framingRectVerticalOffset(0)//设置识别区域垂直方向偏移量,非全屏识别时才有效
48 | // .framingRectHorizontalOffset(0)//设置识别区域水平方向偏移量,非全屏识别时才有效
49 | .frontLightMode(FrontLightMode.AUTO)//设置闪光灯模式
50 | .tooDarkLux(45f)//设置光线太暗时,自动触发开启闪光灯的照度值
51 | .brightEnoughLux(100f)//设置光线足够明亮时,自动触发关闭闪光灯的照度值
52 | .continuousScan(true)//是否连扫
53 | .supportLuminanceInvert(true);//是否支持识别反色码(黑白反色的码),增加识别率
54 |
55 | mIvLeft.setOnClickListener(new View.OnClickListener() {
56 | @Override
57 | public void onClick(View v) {
58 | onBackPressed();
59 | }
60 | });
61 | }
62 |
63 | /**
64 | * 扫码结果回调
65 | * @param result 扫码结果
66 | * @return
67 | */
68 | @Override
69 | public boolean onResultCallback(String result) {
70 | Log.d("扫码结果:",result);
71 | return true;
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/WebSocketLib/src/main/java/com/yc/websocket/MockWebSocketServer.java:
--------------------------------------------------------------------------------
1 | package com.yc.websocket;
2 |
3 |
4 | import com.yc.toolutils.AppLogUtils;
5 |
6 | import okhttp3.Response;
7 | import okhttp3.WebSocket;
8 | import okhttp3.WebSocketListener;
9 | import okhttp3.mockwebserver.MockResponse;
10 | import okhttp3.mockwebserver.MockWebServer;
11 | import okio.ByteString;
12 |
13 | public class MockWebSocketServer {
14 |
15 | private static MockWebServer mockWebServer;
16 |
17 | public static void mockWebSocket() {
18 | if (mockWebServer != null) {
19 | return;
20 | }
21 | mockWebServer = new MockWebServer();
22 | mockWebServer.enqueue(new MockResponse().withWebSocketUpgrade(new WebSocketListener() {
23 | @Override
24 | public void onOpen(WebSocket webSocket, Response response) {
25 | super.onOpen(webSocket, response);
26 | AppLogUtils.i("MockWebSocketServer", "onOpen: " + response.toString());
27 | }
28 |
29 | @Override
30 | public void onMessage(WebSocket webSocket, String text) {
31 | super.onMessage(webSocket, text);
32 | AppLogUtils.i("MockWebSocketServer", "onMessage: " + text);
33 | webSocket.send("你好客户端: " + text);
34 | }
35 |
36 | @Override
37 | public void onMessage(WebSocket webSocket, ByteString bytes) {
38 | super.onMessage(webSocket, bytes);
39 | AppLogUtils.i("MockWebSocketServer", "onMessage: " + bytes.size());
40 | }
41 |
42 | @Override
43 | public void onClosing(WebSocket webSocket, int code, String reason) {
44 | super.onClosing(webSocket, code, reason);
45 | AppLogUtils.i("MockWebSocketServer", "onClosing: " + reason);
46 | }
47 |
48 | @Override
49 | public void onClosed(WebSocket webSocket, int code, String reason) {
50 | super.onClosed(webSocket, code, reason);
51 | AppLogUtils.i("MockWebSocketServer", "onClosed: " + reason);
52 | }
53 |
54 | @Override
55 | public void onFailure(WebSocket webSocket, Throwable t, Response response) {
56 | super.onFailure(webSocket, t, response);
57 | AppLogUtils.i("MockWebSocketServer", "onFailure: " + response + "Throwable: " + webSocket);
58 | }
59 | }));
60 |
61 | }
62 |
63 | public static String getWsUrl() {
64 | String url = "ws:" + mockWebServer.getHostName() + ":" + mockWebServer.getPort();
65 | AppLogUtils.i("MockWebSocketServer", url);
66 | return url;
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/InterceptorTime/src/main/java/com/yc/interceptortime/InterceptorBean.java:
--------------------------------------------------------------------------------
1 | package com.yc.interceptortime;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * @author : yangchong
7 | * @email : yangchong211@163.com
8 | * @time : 2017/5/18
9 | * @desc : 拦截器实体bean
10 | * revise :
11 | */
12 | public class InterceptorBean implements Serializable {
13 |
14 | private long beginTime;
15 | private long endTime;
16 | private long id;
17 | private String methodName;
18 | private Exception exception;
19 | private BaseParam param;
20 | private BaseResult result;
21 | private boolean isBefore = true;
22 |
23 | public InterceptorBean() {
24 | }
25 |
26 | public long getBeginTime() {
27 | return this.beginTime;
28 | }
29 |
30 | public void setBeginTime(long beginTime) {
31 | this.beginTime = beginTime;
32 | }
33 |
34 | public long getEndTime() {
35 | return this.endTime;
36 | }
37 |
38 | public void setEndTime(long endTime) {
39 | this.endTime = endTime;
40 | }
41 |
42 | public long getId() {
43 | return this.id;
44 | }
45 |
46 | public void setId(long id) {
47 | this.id = id;
48 | }
49 |
50 | public String getMethodName() {
51 | return this.methodName;
52 | }
53 |
54 | public void setMethodName(String methodName) {
55 | this.methodName = methodName;
56 | }
57 |
58 | public Exception getException() {
59 | return this.exception;
60 | }
61 |
62 | public void setException(Exception exception) {
63 | this.exception = exception;
64 | }
65 |
66 | public BaseParam getParam() {
67 | return this.param;
68 | }
69 |
70 | public void setParam(BaseParam param) {
71 | this.param = param;
72 | }
73 |
74 | public BaseResult getResult() {
75 | return this.result;
76 | }
77 |
78 | public void setResult(BaseResult result) {
79 | this.result = result;
80 | }
81 |
82 | public boolean isBefore() {
83 | return this.isBefore;
84 | }
85 |
86 | public void setBefore(boolean before) {
87 | this.isBefore = before;
88 | }
89 |
90 | @Override
91 | public String toString() {
92 | return "InterceptorBean{" +
93 | "beginTime=" + beginTime +
94 | ", endTime=" + endTime +
95 | ", id=" + id +
96 | ", methodName='" + methodName + '\'' +
97 | ", exception=" + exception +
98 | ", param=" + param +
99 | ", result=" + result +
100 | ", isBefore=" + isBefore +
101 | '}';
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/WebSocketLib/src/main/java/com/yc/websocket/NetworkChangedReceiver.java:
--------------------------------------------------------------------------------
1 | package com.yc.websocket;
2 |
3 | import android.Manifest;
4 | import android.content.BroadcastReceiver;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.pm.PackageManager;
8 | import android.net.ConnectivityManager;
9 | import android.net.NetworkInfo;
10 | import android.os.Build;
11 |
12 | /**
13 | * 监听网络变化广播,网络变化时自动重连
14 | */
15 | public class NetworkChangedReceiver extends BroadcastReceiver {
16 |
17 | private static final String TAG = "NetworkChangedReceiver";
18 |
19 | public NetworkChangedReceiver() {
20 |
21 | }
22 |
23 | @Override
24 | public void onReceive(Context context, Intent intent) {
25 | if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) {
26 | ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
27 | if (manager == null) return;
28 | try {
29 | if (checkPermission(context, Manifest.permission.ACCESS_NETWORK_STATE)) {
30 | NetworkInfo activeNetwork = manager.getActiveNetworkInfo();
31 | if (activeNetwork != null) {
32 | if (activeNetwork.isConnected()) {
33 | if (activeNetwork.getType() == ConnectivityManager.TYPE_WIFI) {
34 | WebSocketLog.i(TAG, "网络连接发生变化,当前WiFi连接可用");
35 | } else if (activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE) {
36 | WebSocketLog.i(TAG, "网络连接发生变化,当前移动连接可用");
37 | }
38 | if (WebSocketClientManager.getInstance().needAutoRetryConnect()) {
39 | WebSocketLog.i(TAG, "需要重连");
40 | WebSocketClientManager.getInstance().reconnect();
41 | } else {
42 | WebSocketLog.i(TAG, "不需要重连");
43 | }
44 | } else {
45 | WebSocketLog.i(TAG, "当前没有可用网络");
46 | }
47 | }
48 | }
49 | } catch (Exception e) {
50 | WebSocketLog.e(TAG, "网络状态获取错误", e);
51 | }
52 | }
53 | }
54 |
55 | /**
56 | * 判断是否有权限
57 | */
58 | private static boolean checkPermission(Context context, String permission) {
59 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
60 | return PackageManager.PERMISSION_GRANTED == context.getPackageManager()
61 | .checkPermission(permission, context.getPackageName());
62 | }
63 | return true;
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/LocaleHelperLib/src/main/java/com/yc/localelib/utils/LocaleSpUtils.java:
--------------------------------------------------------------------------------
1 | package com.yc.localelib.utils;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.text.TextUtils;
6 |
7 | import com.yc.localelib.service.LocaleService;
8 |
9 | import java.util.Locale;
10 |
11 | /**
12 | *
13 | * @author yangchong
14 | * email : yangchong211@163.com
15 | * time : 2018/5/11
16 | * desc : 配置保存类
17 | * revise :
18 | *
19 | */
20 | public final class LocaleSpUtils {
21 |
22 | private static final String KEY_LANGUAGE = "key_language";
23 | private static final String KEY_COUNTRY = "key_country";
24 | private static String sSharedPreferencesName = "language_setting";
25 | private static volatile Locale sCurrentLanguage;
26 |
27 | private LocaleSpUtils(){
28 |
29 | }
30 |
31 | /**
32 | * 设置保存的 SharedPreferences 文件名(请在 Application 初始化之前设置,可以放在 Application 中的代码块或者静态代码块)
33 | */
34 | public static synchronized void setSharedPreferencesName(String name) {
35 | sSharedPreferencesName = name;
36 | }
37 |
38 | private static synchronized SharedPreferences getSharedPreferences(Context context) {
39 | return context.getSharedPreferences(sSharedPreferencesName, Context.MODE_PRIVATE);
40 | }
41 |
42 | public static synchronized void setAppLanguage(Context context, Locale locale) {
43 | sCurrentLanguage = locale;
44 | getSharedPreferences(context).edit()
45 | .putString(KEY_LANGUAGE, locale.getLanguage())
46 | .putString(KEY_COUNTRY, locale.getCountry())
47 | .apply();
48 | }
49 |
50 | public static synchronized Locale getAppLanguage(Context context) {
51 | if (sCurrentLanguage == null) {
52 | String language = getSharedPreferences(context).getString(KEY_LANGUAGE, null);
53 | String country = getSharedPreferences(context).getString(KEY_COUNTRY, null);
54 | if (!TextUtils.isEmpty(language)) {
55 | sCurrentLanguage = new Locale(language, country);
56 | } else {
57 | sCurrentLanguage = LocaleToolUtils.getLocale(context);
58 | }
59 | }
60 | return sCurrentLanguage;
61 | }
62 |
63 | public static synchronized boolean isSystemLanguage(Context context) {
64 | String language = getSharedPreferences(context).getString(KEY_LANGUAGE, null);
65 | return language == null || "".equals(language);
66 | }
67 |
68 | public static synchronized void clearLanguage(Context context) {
69 | sCurrentLanguage = LocaleService.getInstance().getSystemLocale();
70 | getSharedPreferences(context).edit()
71 | .remove(KEY_LANGUAGE)
72 | .remove(KEY_COUNTRY)
73 | .apply();
74 | }
75 | }
--------------------------------------------------------------------------------