Compare commits
45 Commits
apputils-v
...
apputils-v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85f8466450 | ||
|
|
407f2b38ae | ||
|
|
550410d913 | ||
|
|
6daa3bbd0f | ||
|
|
8a29735130 | ||
|
|
272dd15427 | ||
|
|
5411d5e590 | ||
|
|
facf0b001d | ||
|
|
df58c0355c | ||
|
|
7c7b159a80 | ||
|
|
da23546bb4 | ||
|
|
e657e45218 | ||
|
|
c22946f0a5 | ||
|
|
1363a7dcce | ||
|
|
e0ca5725f1 | ||
|
|
3c4988532f | ||
|
|
b0a34579fa | ||
|
|
fe12cf7ffe | ||
|
|
3192ae55b1 | ||
|
|
67d91aaf6c | ||
|
|
dd08747edb | ||
|
|
e91bf7d422 | ||
|
|
a73b5a9199 | ||
|
|
fe943fef85 | ||
|
|
dc1b138dd7 | ||
|
|
e867433f9c | ||
|
|
33eb58f33c | ||
|
|
915c440cdd | ||
|
|
d21c92683d | ||
|
|
fe7ba6d38d | ||
|
|
b3548bf1df | ||
|
|
d4b8b3bb35 | ||
|
|
d6a0d86e24 | ||
|
|
20f1c29055 | ||
|
|
d8e7b35ec3 | ||
|
|
603640b3cb | ||
|
|
5b06ce9699 | ||
|
|
363fc6c7c1 | ||
|
|
7f43f8b5c5 | ||
|
|
a117e6e110 | ||
|
|
c1f576e343 | ||
|
|
1dad84b65e | ||
|
|
1ae377e665 | ||
|
|
02fa0a4134 | ||
|
|
a730aa3f92 |
@@ -18,8 +18,8 @@ def genVersionName(def versionName){
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 32
|
||||||
buildToolsVersion "30.0.3"
|
buildToolsVersion "32.0.0"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cc.winboll.studio.appbase"
|
applicationId "cc.winboll.studio.appbase"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Sat Mar 15 15:30:02 HKT 2025
|
#Mon Mar 24 08:04:35 HKT 2025
|
||||||
stageCount=3
|
stageCount=9
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=15.0
|
baseVersion=15.0
|
||||||
publishVersion=15.0.2
|
publishVersion=15.0.8
|
||||||
buildCount=0
|
buildCount=0
|
||||||
baseBetaVersion=15.0.3
|
baseBetaVersion=15.0.9
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
android:name=".App"
|
android:name=".App"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/MyAppTheme"
|
android:theme="@style/MyAPPBaseTheme"
|
||||||
android:resizeableActivity="true">
|
android:resizeableActivity="true">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -49,6 +49,12 @@
|
|||||||
android:name=".services.MainService"
|
android:name=".services.MainService"
|
||||||
android:exported="true"/>
|
android:exported="true"/>
|
||||||
|
|
||||||
|
<service android:name="cc.winboll.studio.appbase.services.TestDemoBindService"
|
||||||
|
android:exported="true"/>
|
||||||
|
|
||||||
|
<service android:name="cc.winboll.studio.appbase.services.TestDemoService"
|
||||||
|
android:exported="true"/>
|
||||||
|
|
||||||
<service android:name=".services.AssistantService"/>
|
<service android:name=".services.AssistantService"/>
|
||||||
|
|
||||||
<receiver android:name="cc.winboll.studio.appbase.receivers.MainReceiver">
|
<receiver android:name="cc.winboll.studio.appbase.receivers.MainReceiver">
|
||||||
@@ -81,13 +87,13 @@
|
|||||||
|
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<receiver android:name=".widgets.APPNewsWidgetClickListener">
|
<receiver android:name=".receivers.APPNewsWidgetClickListener">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|
||||||
<action android:name="cc.winboll.studio.appbase.widgets.APPNewsWidgetClickListener.ACTION_PRE"/>
|
<action android:name="cc.winboll.studio.appbase.receivers.APPNewsWidgetClickListener.ACTION_PRE"/>
|
||||||
|
|
||||||
<action android:name="cc.winboll.studio.appbase.widgets.APPNewsWidgetClickListener.ACTION_NEXT"/>
|
<action android:name="cc.winboll.studio.appbase.receivers.APPNewsWidgetClickListener.ACTION_NEXT"/>
|
||||||
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
@@ -97,12 +103,6 @@
|
|||||||
android:name="android.max_aspect"
|
android:name="android.max_aspect"
|
||||||
android:value="4.0"/>
|
android:value="4.0"/>
|
||||||
|
|
||||||
<service android:name="cc.winboll.studio.appbase.services.TestDemoBindService"
|
|
||||||
android:exported="true"/>
|
|
||||||
|
|
||||||
<service android:name="cc.winboll.studio.appbase.services.TestDemoService"
|
|
||||||
android:exported="true"/>
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class MainActivity extends Activity {
|
|||||||
startService(intentService);
|
startService(intentService);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTestSOS(View view) {
|
public void onTestDemoServiceSOS(View view) {
|
||||||
Intent intent = new Intent(this, TestDemoService.class);
|
Intent intent = new Intent(this, TestDemoService.class);
|
||||||
stopService(intent);
|
stopService(intent);
|
||||||
if (App.isDebuging()) {
|
if (App.isDebuging()) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ package cc.winboll.studio.appbase;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.service.quicksettings.Tile;
|
import android.service.quicksettings.Tile;
|
||||||
import android.service.quicksettings.TileService;
|
import android.service.quicksettings.TileService;
|
||||||
import cc.winboll.studio.appbase.beans.MainServiceBean;
|
import cc.winboll.studio.appbase.models.MainServiceBean;
|
||||||
import cc.winboll.studio.appbase.services.MainService;
|
import cc.winboll.studio.appbase.services.MainService;
|
||||||
|
|
||||||
public class MyTileService extends TileService {
|
public class MyTileService extends TileService {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package cc.winboll.studio.appbase.beans;
|
package cc.winboll.studio.appbase.models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package cc.winboll.studio.appbase.beans;
|
package cc.winboll.studio.appbase.models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package cc.winboll.studio.appbase.beans;
|
package cc.winboll.studio.appbase.models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package cc.winboll.studio.appbase.beans;
|
package cc.winboll.studio.appbase.models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package cc.winboll.studio.appbase.widgets;
|
package cc.winboll.studio.appbase.receivers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author ZhanGSKen@AliYun.Com
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
* @Date 2025/02/15 17:20:46
|
* @Date 2025/03/24 07:11:44
|
||||||
* @Describe WidgetButtonClickListener
|
|
||||||
*/
|
*/
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import cc.winboll.studio.appbase.widgets.APPNewsWidget;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
|
||||||
public class APPNewsWidgetClickListener extends BroadcastReceiver {
|
public class APPNewsWidgetClickListener extends BroadcastReceiver {
|
||||||
@@ -10,7 +10,7 @@ import android.content.ComponentName;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import cc.winboll.studio.appbase.beans.WinBollNewsBean;
|
import cc.winboll.studio.appbase.models.WinBollNewsBean;
|
||||||
import cc.winboll.studio.appbase.services.MainService;
|
import cc.winboll.studio.appbase.services.MainService;
|
||||||
import cc.winboll.studio.appbase.widgets.APPNewsWidget;
|
import cc.winboll.studio.appbase.widgets.APPNewsWidget;
|
||||||
import cc.winboll.studio.libappbase.AppUtils;
|
import cc.winboll.studio.libappbase.AppUtils;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import cc.winboll.studio.appbase.beans.MainServiceBean;
|
import cc.winboll.studio.appbase.models.MainServiceBean;
|
||||||
import cc.winboll.studio.appbase.services.AssistantService;
|
import cc.winboll.studio.appbase.services.AssistantService;
|
||||||
import cc.winboll.studio.appbase.services.MainService;
|
import cc.winboll.studio.appbase.services.MainService;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import android.content.ServiceConnection;
|
|||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import cc.winboll.studio.appbase.MyTileService;
|
import cc.winboll.studio.appbase.MyTileService;
|
||||||
import cc.winboll.studio.appbase.beans.MainServiceBean;
|
import cc.winboll.studio.appbase.models.MainServiceBean;
|
||||||
import cc.winboll.studio.appbase.handlers.MainServiceHandler;
|
import cc.winboll.studio.appbase.handlers.MainServiceHandler;
|
||||||
import cc.winboll.studio.appbase.receivers.MainReceiver;
|
import cc.winboll.studio.appbase.receivers.MainReceiver;
|
||||||
import cc.winboll.studio.appbase.services.AssistantService;
|
import cc.winboll.studio.appbase.services.AssistantService;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import cc.winboll.studio.appbase.beans.TestDemoBindServiceBean;
|
import cc.winboll.studio.appbase.models.TestDemoBindServiceBean;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.libappbase.sos.WinBoll;
|
import cc.winboll.studio.libappbase.sos.WinBoll;
|
||||||
import cc.winboll.studio.appbase.App;
|
import cc.winboll.studio.appbase.App;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import cc.winboll.studio.appbase.beans.TestDemoServiceBean;
|
import cc.winboll.studio.appbase.models.TestDemoServiceBean;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.libappbase.sos.WinBoll;
|
import cc.winboll.studio.libappbase.sos.WinBoll;
|
||||||
|
|
||||||
|
|||||||
@@ -12,15 +12,16 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
import cc.winboll.studio.appbase.R;
|
import cc.winboll.studio.appbase.R;
|
||||||
import cc.winboll.studio.appbase.beans.WinBollNewsBean;
|
import cc.winboll.studio.appbase.models.WinBollNewsBean;
|
||||||
|
import cc.winboll.studio.appbase.receivers.APPNewsWidgetClickListener;
|
||||||
import cc.winboll.studio.libappbase.AppUtils;
|
import cc.winboll.studio.libappbase.AppUtils;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import cc.winboll.studio.libappbase.sos.APPModel;
|
||||||
|
import cc.winboll.studio.libappbase.sos.WinBoll;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import cc.winboll.studio.libappbase.sos.APPModel;
|
|
||||||
import cc.winboll.studio.libappbase.sos.WinBoll;
|
|
||||||
|
|
||||||
public class APPNewsWidget extends AppWidgetProvider {
|
public class APPNewsWidget extends AppWidgetProvider {
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,26 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="right">
|
android:gravity="right">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="StartCenter"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:onClick="onStartCenter"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="StopCenter"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:onClick="onStopCenter"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<HorizontalScrollView
|
<HorizontalScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
@@ -105,54 +125,41 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</HorizontalScrollView>
|
</HorizontalScrollView>
|
||||||
|
|
||||||
<HorizontalScrollView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<LinearLayout
|
<HorizontalScrollView
|
||||||
android:orientation="horizontal"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<Button
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:orientation="horizontal"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:text="SartTestDemoBindService"
|
android:layout_height="wrap_content">
|
||||||
android:textAllCaps="false"
|
|
||||||
android:onClick="onSartTestDemoBindService"/>
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="StopTestDemoBindService"
|
android:text="SartTestDemoBindService"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:onClick="onStopTestDemoBindService"/>
|
android:onClick="onSartTestDemoBindService"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="StopTestDemoBindServiceNoSettings"
|
android:text="StopTestDemoBindService"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:onClick="onStopTestDemoBindServiceNoSettings"/>
|
android:onClick="onStopTestDemoBindService"/>
|
||||||
|
|
||||||
</LinearLayout>
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="StopTestDemoBindServiceNoSettings"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:onClick="onStopTestDemoBindServiceNoSettings"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</HorizontalScrollView>
|
</HorizontalScrollView>
|
||||||
|
|
||||||
<Button
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="StartCenter"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:onClick="onStartCenter"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="StopCenter"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:onClick="onStopCenter"/>
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -171,24 +178,24 @@
|
|||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="TestSOS"
|
android:text="TestDemoServiceSOS"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:onClick="onTestSOS"/>
|
android:onClick="onTestDemoServiceSOS"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
<cc.winboll.studio.libappbase.LogView
|
|
||||||
android:layout_height="500dp"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:id="@+id/activitymainLogView1"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
<cc.winboll.studio.libappbase.LogView
|
||||||
|
android:layout_height="300dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:id="@+id/activitymainLogView1"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#005800FF</color>
|
<color name="colorPrimary">#FF00B322</color>
|
||||||
<color name="colorPrimaryDark">#005800FF</color>
|
<color name="colorPrimaryDark">#FF005C12</color>
|
||||||
<color name="colorAccent">#005800FF</color>
|
<color name="colorAccent">#FF8DFFA2</color>
|
||||||
|
<color name="colorText">#FFFFFB8D</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<style name="MyAppTheme" parent="APPBaseTheme">
|
<style name="MyAPPBaseTheme" parent="APPBaseTheme">
|
||||||
<item name="attrColorPrimary">@color/colorPrimary</item>
|
<item name="attrColorPrimary">@color/colorPrimary</item>
|
||||||
<item name="themeGlobalCrashActivity">@style/MyGlobalCrashActivityTheme</item>
|
<item name="themeGlobalCrashActivity">@style/MyGlobalCrashActivityTheme</item>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ def genVersionName(def versionName){
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 32
|
||||||
buildToolsVersion "30.0.3"
|
buildToolsVersion "32.0.0"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cc.winboll.studio.apputils"
|
applicationId "cc.winboll.studio.apputils"
|
||||||
@@ -46,21 +46,4 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
api project(':libapputils')
|
api project(':libapputils')
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation 'cc.winboll.studio:libappbase:15.0.5'
|
|
||||||
|
|
||||||
// 二维码类库
|
|
||||||
implementation 'com.google.zxing:core:3.4.1'
|
|
||||||
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
|
|
||||||
|
|
||||||
// 网络连接类库
|
|
||||||
//implementation 'com.squareup.okhttp3:okhttp:4.4.1'
|
|
||||||
|
|
||||||
// Html 解析
|
|
||||||
//implementation 'org.jsoup:jsoup:1.13.1'
|
|
||||||
|
|
||||||
// SSH
|
|
||||||
//implementation 'com.jcraft:jsch:0.1.55'
|
|
||||||
|
|
||||||
// 应用介绍页类库
|
|
||||||
//implementation 'io.github.medyo:android-about-page:2.0.0'
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Tue Mar 18 10:38:22 HKT 2025
|
#Mon Mar 24 08:10:00 HKT 2025
|
||||||
stageCount=4
|
stageCount=11
|
||||||
libraryProject=libapputils
|
libraryProject=libapputils
|
||||||
baseVersion=15.0
|
baseVersion=15.0
|
||||||
publishVersion=15.0.3
|
publishVersion=15.0.10
|
||||||
buildCount=0
|
buildCount=0
|
||||||
baseBetaVersion=15.0.4
|
baseBetaVersion=15.0.11
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
<activity android:name=".TestStringToQrCodeViewActivity"/>
|
<activity android:name=".TestStringToQrCodeViewActivity"/>
|
||||||
|
|
||||||
|
<activity android:name=".TestBBMorseCodeActivity"/>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -77,7 +77,7 @@ public class App extends GlobalApplication {
|
|||||||
mMyActivityLifecycleCallbacks = new MyActivityLifecycleCallbacks();
|
mMyActivityLifecycleCallbacks = new MyActivityLifecycleCallbacks();
|
||||||
registerActivityLifecycleCallbacks(mMyActivityLifecycleCallbacks);
|
registerActivityLifecycleCallbacks(mMyActivityLifecycleCallbacks);
|
||||||
// 设置默认 WinBoll 应用 UI 类型
|
// 设置默认 WinBoll 应用 UI 类型
|
||||||
WinBollActivityManager.getInstance(this).setWinBollUI_TYPE(WinBollActivityManager.WinBollUI_TYPE.Service);
|
//WinBollActivityManager.getInstance(this).setWinBollUI_TYPE(WinBollActivityManager.WinBollUI_TYPE.Service);
|
||||||
//ToastUtils.show("WinBollUI_TYPE " + getWinBollUI_TYPE());
|
//ToastUtils.show("WinBollUI_TYPE " + getWinBollUI_TYPE());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ final public class MainActivity extends Activity implements IWinBollActivity {
|
|||||||
|
|
||||||
Toolbar mToolbar;
|
Toolbar mToolbar;
|
||||||
LogView mLogView;
|
LogView mLogView;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public Activity getActivity() {
|
// public Activity getActivity() {
|
||||||
return this;
|
// return this;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public APPInfo getAppInfo() {
|
public APPInfo getAppInfo() {
|
||||||
@@ -177,12 +177,12 @@ final public class MainActivity extends Activity implements IWinBollActivity {
|
|||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
super.onPostCreate(savedInstanceState);
|
super.onPostCreate(savedInstanceState);
|
||||||
// 缓存当前 activity
|
// 缓存当前 activity
|
||||||
WinBollActivityManager.getInstance(this).add(this);
|
//WinBollActivityManager.getInstance(this).add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
WinBollActivityManager.getInstance(this).registeRemove(this);
|
//WinBollActivityManager.getInstance(this).registeRemove(this);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ final public class MainActivity extends Activity implements IWinBollActivity {
|
|||||||
// startActivity(intent);
|
// startActivity(intent);
|
||||||
|
|
||||||
//WinBollActivityManager.getInstance().printAvtivityListInfo();
|
//WinBollActivityManager.getInstance().printAvtivityListInfo();
|
||||||
WinBollActivityManager.getInstance(this).startWinBollActivity(this, LogActivity.class);
|
//WinBollActivityManager.getInstance(this).startWinBollActivity(this, LogActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -268,7 +268,7 @@ final public class MainActivity extends Activity implements IWinBollActivity {
|
|||||||
AboutActivityFactory.showAboutActivity(this, getAppInfo());
|
AboutActivityFactory.showAboutActivity(this, getAppInfo());
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.item_teststringtoqrcodeview) {
|
} else if (item.getItemId() == R.id.item_teststringtoqrcodeview) {
|
||||||
WinBollActivityManager.getInstance(this).startWinBollActivity(this, TestStringToQrCodeViewActivity.class);
|
//WinBollActivityManager.getInstance(this).startWinBollActivity(this, TestStringToQrCodeViewActivity.class);
|
||||||
} else if (item.getItemId() == R.id.item_testqrcodedecodeactivity) {
|
} else if (item.getItemId() == R.id.item_testqrcodedecodeactivity) {
|
||||||
Intent intent = new Intent(this, QRCodeDecodeActivity.class);
|
Intent intent = new Intent(this, QRCodeDecodeActivity.class);
|
||||||
startActivityForResult(intent, REQUEST_QRCODEDECODE_ACTIVITY);
|
startActivityForResult(intent, REQUEST_QRCODEDECODE_ACTIVITY);
|
||||||
@@ -278,13 +278,13 @@ final public class MainActivity extends Activity implements IWinBollActivity {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.item_log) {
|
} else if (item.getItemId() == R.id.item_log) {
|
||||||
WinBollActivityManager.getInstance(this).startWinBollActivity(this, LogActivity.class);
|
//WinBollActivityManager.getInstance(this).startWinBollActivity(this, LogActivity.class);
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.item_exitdebug) {
|
} else if (item.getItemId() == R.id.item_exitdebug) {
|
||||||
//AboutView.setApp2NormalMode(this);
|
//AboutView.setApp2NormalMode(this);
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == android.R.id.home) {
|
} else if (item.getItemId() == android.R.id.home) {
|
||||||
WinBollActivityManager.getInstance(this).finish(this);
|
//WinBollActivityManager.getInstance(this).finish(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
@@ -301,7 +301,7 @@ final public class MainActivity extends Activity implements IWinBollActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onYes() {
|
public void onYes() {
|
||||||
WinBollActivityManager.getInstance(getApplicationContext()).finishAll();
|
//WinBollActivityManager.getInstance(getApplicationContext()).finishAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -314,12 +314,12 @@ final public class MainActivity extends Activity implements IWinBollActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (WinBollActivityManager.getInstance(getApplicationContext()).isFirstIWinBollActivity(this)) {
|
// if (WinBollActivityManager.getInstance(getApplicationContext()).isFirstIWinBollActivity(this)) {
|
||||||
exit();
|
// exit();
|
||||||
} else {
|
// } else {
|
||||||
WinBollActivityManager.getInstance(this).finish(this);
|
// WinBollActivityManager.getInstance(this).finish(this);
|
||||||
super.onBackPressed();
|
// super.onBackPressed();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTestAboutActivity(View view) {
|
public void onTestAboutActivity(View view) {
|
||||||
@@ -329,7 +329,7 @@ final public class MainActivity extends Activity implements IWinBollActivity {
|
|||||||
public void onTestJavascriptHtmlActivity(View view) {
|
public void onTestJavascriptHtmlActivity(View view) {
|
||||||
Intent intent = new Intent(this, AssetsHtmlActivity.class);
|
Intent intent = new Intent(this, AssetsHtmlActivity.class);
|
||||||
intent.putExtra(AssetsHtmlActivity.EXTRA_HTMLFILENAME, "javascript_test.html");
|
intent.putExtra(AssetsHtmlActivity.EXTRA_HTMLFILENAME, "javascript_test.html");
|
||||||
WinBollActivityManager.getInstance(this).startWinBollActivity(this, intent, AssetsHtmlActivity.class);
|
//WinBollActivityManager.getInstance(this).startWinBollActivity(this, intent, AssetsHtmlActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package cc.winboll.studio.apputils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/03/23 16:14:45
|
||||||
|
*/
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.Toolbar;
|
||||||
|
import cc.winboll.studio.libapputils.app.IWinBollActivity;
|
||||||
|
import cc.winboll.studio.libapputils.bean.APPInfo;
|
||||||
|
|
||||||
|
public class TestBBMorseCodeActivity extends Activity implements IWinBollActivity {
|
||||||
|
|
||||||
|
public static final String TAG = "TestBBMorseCodeActivity";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public APPInfo getAppInfo() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Toolbar initToolBar() {
|
||||||
|
return findViewById(R.id.activityteststringtoqrcodeviewToolbar1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnableDisplayHomeAsUp() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAddWinBollToolBar() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_testbbmorsecode);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,11 +17,11 @@ public class TestStringToQrCodeViewActivity extends Activity implements IWinBoll
|
|||||||
public static final String TAG = "TestStringToQrCodeViewActivity";
|
public static final String TAG = "TestStringToQrCodeViewActivity";
|
||||||
|
|
||||||
StringToQrCodeView mStringToQrCodeView;
|
StringToQrCodeView mStringToQrCodeView;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public Activity getActivity() {
|
// public Activity getActivity() {
|
||||||
return this;
|
// return this;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public APPInfo getAppInfo() {
|
public APPInfo getAppInfo() {
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -1,7 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<style name="MyUtilsTheme" parent="APPBaseTheme">
|
<style name="MyUtilsTheme" parent="UtilsTheme">
|
||||||
<item name="attrColorPrimary">@color/colorPrimary</item>
|
<item name="attrColorPrimary">@color/colorPrimary</item>
|
||||||
<item name="themeGlobalCrashActivity">@style/GlobalCrashActivityTheme</item>
|
<item name="themeGlobalCrashActivity">@style/MyUtilsGlobalCrashActivityTheme</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="MyUtilsGlobalCrashActivityTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
|
||||||
|
<item name="colorTittle">#FFF2F2F2</item>
|
||||||
|
<item name="colorTittleBackgound">#FF55ABF8</item>
|
||||||
|
<item name="colorText">#FF55ABF8</item>
|
||||||
|
<item name="colorTextBackgound">#FFF2F2F2</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
26
build.gradle
26
build.gradle
@@ -1,6 +1,12 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
// Nexus Maven 库地址
|
||||||
|
// "WinBoll Release"
|
||||||
|
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
|
||||||
|
// "WinBoll Snapshot"
|
||||||
|
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
|
||||||
|
|
||||||
maven { url 'https://maven.aliyun.com/repository/public/' }
|
maven { url 'https://maven.aliyun.com/repository/public/' }
|
||||||
maven { url 'https://maven.aliyun.com/repository/google/' }
|
maven { url 'https://maven.aliyun.com/repository/google/' }
|
||||||
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
|
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
|
||||||
@@ -9,13 +15,6 @@ buildscript {
|
|||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
|
|
||||||
// Nexus Maven 库地址
|
|
||||||
// "WinBoll Release"
|
|
||||||
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
|
|
||||||
// "WinBoll Snapshot"
|
|
||||||
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
|
|
||||||
|
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -27,6 +26,12 @@ buildscript {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
|
// Nexus Maven 库地址
|
||||||
|
// "WinBoll Release"
|
||||||
|
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
|
||||||
|
// "WinBoll Snapshot"
|
||||||
|
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
|
||||||
|
|
||||||
maven { url 'https://maven.aliyun.com/repository/public/' }
|
maven { url 'https://maven.aliyun.com/repository/public/' }
|
||||||
maven { url 'https://maven.aliyun.com/repository/google/' }
|
maven { url 'https://maven.aliyun.com/repository/google/' }
|
||||||
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
|
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
|
||||||
@@ -35,13 +40,6 @@ allprojects {
|
|||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
|
|
||||||
// Nexus Maven 库地址
|
|
||||||
// "WinBoll Release"
|
|
||||||
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
|
|
||||||
// "WinBoll Snapshot"
|
|
||||||
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
|
|
||||||
|
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
}
|
}
|
||||||
ext {
|
ext {
|
||||||
|
|||||||
@@ -17,3 +17,5 @@ org.gradle.jvmargs=-Xmx2048m
|
|||||||
android.useAndroidX=false
|
android.useAndroidX=false
|
||||||
# Automatically convert third-party libraries to use AndroidX
|
# Automatically convert third-party libraries to use AndroidX
|
||||||
android.enableJetifier=false
|
android.enableJetifier=false
|
||||||
|
# 保持与旧版Gradle插件的兼容
|
||||||
|
android.disableAutomaticComponentCreation=true
|
||||||
|
|||||||
@@ -17,3 +17,5 @@ org.gradle.jvmargs=-Xmx2048m
|
|||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
# Automatically convert third-party libraries to use AndroidX
|
# Automatically convert third-party libraries to use AndroidX
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
# 保持与旧版Gradle插件的兼容
|
||||||
|
android.disableAutomaticComponentCreation=true
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ apply from: '../.winboll/winboll_lib_build.gradle'
|
|||||||
apply from: '../.winboll/winboll_lint_build.gradle'
|
apply from: '../.winboll/winboll_lint_build.gradle'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 32
|
||||||
buildToolsVersion "30.0.3"
|
buildToolsVersion "32.0.0"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 26
|
minSdkVersion 26
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Sat Mar 15 15:29:07 HKT 2025
|
#Mon Mar 24 08:04:27 HKT 2025
|
||||||
stageCount=3
|
stageCount=9
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=15.0
|
baseVersion=15.0
|
||||||
publishVersion=15.0.2
|
publishVersion=15.0.8
|
||||||
buildCount=0
|
buildCount=0
|
||||||
baseBetaVersion=15.0.3
|
baseBetaVersion=15.0.9
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ public class LogView extends RelativeLayout {
|
|||||||
|
|
||||||
// 加载标签表
|
// 加载标签表
|
||||||
mListViewTags = findViewById(cc.winboll.studio.libappbase.R.id.tags_listview);
|
mListViewTags = findViewById(cc.winboll.studio.libappbase.R.id.tags_listview);
|
||||||
|
mListViewTags.setVerticalOffset(10);
|
||||||
mTAGListAdapter = new TAGListAdapter(mContext, mapTAGList);
|
mTAGListAdapter = new TAGListAdapter(mContext, mapTAGList);
|
||||||
mListViewTags.setAdapter(mTAGListAdapter);
|
mListViewTags.setAdapter(mTAGListAdapter);
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ import android.widget.ListView;
|
|||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
|
||||||
public class HorizontalListView extends ListView {
|
public class HorizontalListView extends ListView {
|
||||||
|
|
||||||
public static final String TAG = "HorizontalListView";
|
public static final String TAG = "HorizontalListView";
|
||||||
|
int verticalOffset = 0;
|
||||||
|
|
||||||
public HorizontalListView(Context context) {
|
public HorizontalListView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@@ -25,25 +27,10 @@ public class HorizontalListView extends ListView {
|
|||||||
public HorizontalListView(Context context, AttributeSet attrs, int defStyle) {
|
public HorizontalListView(Context context, AttributeSet attrs, int defStyle) {
|
||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
}
|
}
|
||||||
// @Override
|
|
||||||
// protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
public void setVerticalOffset(int verticalOffset) {
|
||||||
// super.onLayout(changed, l, t, r, b);
|
this.verticalOffset = verticalOffset;
|
||||||
// int childCount = getChildCount();
|
}
|
||||||
// int left = getPaddingLeft();
|
|
||||||
// // 获取HorizontalListView的高度
|
|
||||||
// int viewHeight = getMeasuredHeight() - getPaddingTop() - getPaddingBottom();
|
|
||||||
// for (int i = 0; i < childCount; i++) {
|
|
||||||
// View child = getChildAt(i);
|
|
||||||
// int width = child.getMeasuredWidth();
|
|
||||||
// int height = child.getMeasuredHeight();
|
|
||||||
// // 计算子项在垂直方向上的居中偏移量
|
|
||||||
// int verticalOffset = (viewHeight - height) / 2;
|
|
||||||
// // 设置子视图的位置,实现水平布局并垂直居中
|
|
||||||
// child.layout(left, getPaddingTop() + verticalOffset, left + width, getPaddingTop() + verticalOffset + height);
|
|
||||||
// left += width;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||||
@@ -52,7 +39,7 @@ public class HorizontalListView extends ListView {
|
|||||||
int left = getPaddingLeft();
|
int left = getPaddingLeft();
|
||||||
int viewHeight = getMeasuredHeight() - getPaddingTop() - getPaddingBottom();
|
int viewHeight = getMeasuredHeight() - getPaddingTop() - getPaddingBottom();
|
||||||
LogUtils.d(TAG, String.format("HorizontalListView的高度 %d", viewHeight));
|
LogUtils.d(TAG, String.format("HorizontalListView的高度 %d", viewHeight));
|
||||||
int verticalOffset = 20;
|
|
||||||
for (int i = 0; i < childCount; i++) {
|
for (int i = 0; i < childCount; i++) {
|
||||||
View child = getChildAt(i);
|
View child = getChildAt(i);
|
||||||
// 计算每个子视图的宽度和高度
|
// 计算每个子视图的宽度和高度
|
||||||
@@ -60,7 +47,7 @@ public class HorizontalListView extends ListView {
|
|||||||
int height = child.getMeasuredHeight();
|
int height = child.getMeasuredHeight();
|
||||||
//LogUtils.d(TAG, String.format("child : width %d , height %d", width, height));
|
//LogUtils.d(TAG, String.format("child : width %d , height %d", width, height));
|
||||||
// 设置子视图的位置,实现水平布局
|
// 设置子视图的位置,实现水平布局
|
||||||
|
|
||||||
child.layout(left, verticalOffset, left + width, verticalOffset + height);
|
child.layout(left, verticalOffset, left + width, verticalOffset + height);
|
||||||
left += width;
|
left += width;
|
||||||
}
|
}
|
||||||
@@ -68,15 +55,11 @@ public class HorizontalListView extends ListView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
|
||||||
int newHeightMeasureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
|
int newHeightMeasureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
|
||||||
//super.onMeasure(widthMeasureSpec, newHeightMeasureSpec);
|
//super.onMeasure(widthMeasureSpec, newHeightMeasureSpec);
|
||||||
int newWidthMeasureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
|
int newWidthMeasureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
|
||||||
//LogUtils.d(TAG, String.format("newWidthMeasureSpec %d, newHeightMeasureSpec %d", newWidthMeasureSpec, newHeightMeasureSpec));
|
//LogUtils.d(TAG, String.format("newWidthMeasureSpec %d, newHeightMeasureSpec %d", newWidthMeasureSpec, newHeightMeasureSpec));
|
||||||
super.onMeasure(newWidthMeasureSpec, newHeightMeasureSpec);
|
super.onMeasure(newWidthMeasureSpec, newHeightMeasureSpec);
|
||||||
|
|
||||||
// ViewGroup.LayoutParams params = getLayoutParams();
|
|
||||||
// params.width = getMeasuredWidth();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
libappbase/src/main/res/drawable/bg_border_round.xml
Normal file
13
libappbase/src/main/res/drawable/bg_border_round.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="#000000" /> <!-- 这里可调整边框宽度和颜色 -->
|
||||||
|
<solid android:color="@android:color/transparent" />
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="6dip"
|
||||||
|
android:bottomRightRadius="6dip"
|
||||||
|
android:topLeftRadius="6dip"
|
||||||
|
android:topRightRadius="6dip" />
|
||||||
|
</shape>
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
<shape android:shape="rectangle" >
|
<shape android:shape="rectangle" >
|
||||||
<gradient
|
<gradient
|
||||||
android:angle="270"
|
android:angle="270"
|
||||||
android:endColor="#0F000000"
|
android:endColor="@color/colorAccent"
|
||||||
android:startColor="#0F000000" />
|
android:startColor="@color/colorAccent" />
|
||||||
<corners
|
<corners
|
||||||
android:bottomLeftRadius="6dip"
|
android:bottomLeftRadius="6dip"
|
||||||
android:bottomRightRadius="6dip"
|
android:bottomRightRadius="6dip"
|
||||||
|
|||||||
@@ -5,18 +5,18 @@
|
|||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#FFEEEEEE">
|
android:background="@drawable/bg_border_round">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="24dp"
|
android:layout_height="@dimen/button_height"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:id="@+id/viewlogtagTextView1"/>
|
android:id="@+id/viewlogtagTextView1"/>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="24dp"
|
android:layout_height="@dimen/button_height"
|
||||||
android:id="@+id/viewlogtagCheckBox1"/>
|
android:id="@+id/viewlogtagCheckBox1"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -72,27 +72,29 @@
|
|||||||
android:layout_below="@+id/viewlogRelativeLayoutToolbar"
|
android:layout_below="@+id/viewlogRelativeLayoutToolbar"
|
||||||
android:id="@+id/viewlogLinearLayout1"
|
android:id="@+id/viewlogLinearLayout1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:background="#FFC0F4C2">
|
android:background="@drawable/bg_shadow">
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/button_height"
|
||||||
android:text="ALL"
|
android:text="ALL"
|
||||||
android:id="@+id/viewlogCheckBox1"/>
|
android:id="@+id/viewlogCheckBox1"
|
||||||
|
android:background="@drawable/bg_border_round"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"/>
|
||||||
|
|
||||||
<HorizontalScrollView
|
<HorizontalScrollView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/bg_border"
|
||||||
android:scrollbars="none"
|
android:scrollbars="none"
|
||||||
android:layout_weight="1.0"
|
android:padding="5dp"
|
||||||
android:background="#FF97F2E3">
|
android:layout_weight="1.0">
|
||||||
|
|
||||||
<cc.winboll.studio.libappbase.views.HorizontalListView
|
<cc.winboll.studio.libappbase.views.HorizontalListView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@drawable/view_border"
|
android:id="@+id/tags_listview"/>
|
||||||
android:id="@+id/tags_listview"
|
|
||||||
android:paddingLeft="10dp"/>
|
|
||||||
|
|
||||||
</HorizontalScrollView>
|
</HorizontalScrollView>
|
||||||
|
|
||||||
|
|||||||
9
libappbase/src/main/res/values/dimens.xml
Normal file
9
libappbase/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- 定义一个名为text_size_normal的尺寸,值为16sp -->
|
||||||
|
<dimen name="text_size_normal">16sp</dimen>
|
||||||
|
<!-- 定义一个名为margin_small的尺寸,值为8dp -->
|
||||||
|
<dimen name="margin_small">8dp</dimen>
|
||||||
|
<!-- 定义一个名为image_width的尺寸,值为200dp -->
|
||||||
|
<dimen name="button_height">24dp</dimen>
|
||||||
|
</resources>
|
||||||
@@ -4,8 +4,8 @@ apply from: '../.winboll/winboll_lib_build.gradle'
|
|||||||
apply from: '../.winboll/winboll_lint_build.gradle'
|
apply from: '../.winboll/winboll_lint_build.gradle'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 32
|
||||||
buildToolsVersion "30.0.3"
|
buildToolsVersion "32.0.0"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 26
|
minSdkVersion 26
|
||||||
@@ -21,18 +21,22 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation 'cc.winboll.studio:libappbase:15.0.5'
|
|
||||||
|
|
||||||
// 二维码类库
|
// 二维码类库
|
||||||
implementation 'com.google.zxing:core:3.4.1'
|
api 'com.google.zxing:core:3.4.1'
|
||||||
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
|
api 'com.journeyapps:zxing-android-embedded:3.6.0'
|
||||||
|
|
||||||
// 网络连接类库
|
// 网络连接类库
|
||||||
//implementation 'com.squareup.okhttp3:okhttp:4.4.1'
|
//api 'com.squareup.okhttp3:okhttp:4.4.1'
|
||||||
|
|
||||||
// Html 解析
|
// Html 解析
|
||||||
//implementation 'org.jsoup:jsoup:1.13.1'
|
//api 'org.jsoup:jsoup:1.13.1'
|
||||||
|
|
||||||
// SSH
|
// SSH
|
||||||
//implementation 'com.jcraft:jsch:0.1.55'
|
//api 'com.jcraft:jsch:0.1.55'
|
||||||
|
|
||||||
|
// 应用介绍页类库
|
||||||
|
//api 'io.github.medyo:android-about-page:2.0.0'
|
||||||
|
|
||||||
|
api 'cc.winboll.studio:libappbase:15.0.5'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Tue Mar 18 10:38:22 HKT 2025
|
#Mon Mar 24 08:10:00 HKT 2025
|
||||||
stageCount=4
|
stageCount=11
|
||||||
libraryProject=libapputils
|
libraryProject=libapputils
|
||||||
baseVersion=15.0
|
baseVersion=15.0
|
||||||
publishVersion=15.0.3
|
publishVersion=15.0.10
|
||||||
buildCount=0
|
buildCount=0
|
||||||
baseBetaVersion=15.0.4
|
baseBetaVersion=15.0.11
|
||||||
|
|||||||
@@ -5,14 +5,15 @@ package cc.winboll.studio.libapputils.activities;
|
|||||||
* @Date 2024/07/14 13:20:33
|
* @Date 2024/07/14 13:20:33
|
||||||
* @Describe 应用介绍页
|
* @Describe 应用介绍页
|
||||||
*/
|
*/
|
||||||
import cc.winboll.studio.libapputils.R;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Toolbar;
|
import android.widget.Toolbar;
|
||||||
|
import cc.winboll.studio.libapputils.R;
|
||||||
import cc.winboll.studio.libapputils.app.IWinBollActivity;
|
import cc.winboll.studio.libapputils.app.IWinBollActivity;
|
||||||
import cc.winboll.studio.libapputils.app.WinBollActivityManager;
|
import cc.winboll.studio.libapputils.app.WinBollActivityManager;
|
||||||
import cc.winboll.studio.libapputils.bean.APPInfo;
|
import cc.winboll.studio.libapputils.bean.APPInfo;
|
||||||
@@ -28,7 +29,7 @@ final public class AboutActivity extends Activity implements IWinBollActivity {
|
|||||||
APPInfo mAPPInfo;
|
APPInfo mAPPInfo;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Activity getActivity() {
|
public Context getApplicationContext() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,9 +85,9 @@ final public class AboutActivity extends Activity implements IWinBollActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == R.id.item_help) {
|
// if (item.getItemId() == R.id.item_help) {
|
||||||
WinBollActivityManager.getInstance(this).startWinBollActivity(this, AssetsHtmlActivity.class);
|
// WinBollActivityManager.getInstance(this).startWinBollActivity(this, AssetsHtmlActivity.class);
|
||||||
}
|
// }
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ public class AssetsHtmlActivity extends Activity implements IWinBollActivity {
|
|||||||
|
|
||||||
// Assets 文件夹里的 Html 文件的名称
|
// Assets 文件夹里的 Html 文件的名称
|
||||||
String mszHtmlFileName;
|
String mszHtmlFileName;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public Activity getActivity() {
|
// public Activity getActivity() {
|
||||||
return this;
|
// return this;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public APPInfo getAppInfo() {
|
public APPInfo getAppInfo() {
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ public class LogActivity extends Activity implements IWinBollActivity {
|
|||||||
public static final String TAG = "LogActivity";
|
public static final String TAG = "LogActivity";
|
||||||
|
|
||||||
LogView mLogView;
|
LogView mLogView;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public Activity getActivity() {
|
// public Activity getActivity() {
|
||||||
return this;
|
// return this;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public APPInfo getAppInfo() {
|
public APPInfo getAppInfo() {
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ public class QRCodeDecodeActivity extends Activity implements IWinBollActivity {
|
|||||||
TextView resultTextView;
|
TextView resultTextView;
|
||||||
DecoratedBarcodeView barcodeView;
|
DecoratedBarcodeView barcodeView;
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public Activity getActivity() {
|
// public Activity getActivity() {
|
||||||
return this;
|
// return this;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public APPInfo getAppInfo() {
|
public APPInfo getAppInfo() {
|
||||||
|
|||||||
@@ -49,6 +49,6 @@ public class AboutActivityFactory {
|
|||||||
|
|
||||||
Intent intent = new Intent(context, AboutActivity.class);
|
Intent intent = new Intent(context, AboutActivity.class);
|
||||||
intent.putExtra(AboutActivity.EXTRA_APPINFO, (appInfo == null) ? AboutActivityFactory.buildDefaultAPPInfo():appInfo);
|
intent.putExtra(AboutActivity.EXTRA_APPINFO, (appInfo == null) ? AboutActivityFactory.buildDefaultAPPInfo():appInfo);
|
||||||
WinBollActivityManager.getInstance(context).startWinBollActivity(context, intent, AboutActivity.class);
|
//WinBollActivityManager.getInstance(context).startWinBollActivity(context, intent, AboutActivity.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package cc.winboll.studio.libapputils.app;
|
|||||||
* @Date 2025/03/08 00:15:36
|
* @Date 2025/03/08 00:15:36
|
||||||
* @Describe WinBoll 活动窗口通用接口
|
* @Describe WinBoll 活动窗口通用接口
|
||||||
*/
|
*/
|
||||||
import android.app.Activity;
|
import android.content.Context;
|
||||||
import android.widget.Toolbar;
|
import android.widget.Toolbar;
|
||||||
import cc.winboll.studio.libapputils.bean.APPInfo;
|
import cc.winboll.studio.libapputils.bean.APPInfo;
|
||||||
|
|
||||||
@@ -13,8 +13,8 @@ public interface IWinBollActivity {
|
|||||||
|
|
||||||
public static final String TAG = "IWinBollActivity";
|
public static final String TAG = "IWinBollActivity";
|
||||||
|
|
||||||
// 获取当前具有 IWinBoll 特征的 AppCompatActivity 活动窗口
|
// 获取应用资源上下文
|
||||||
abstract public Activity getActivity();
|
//abstract public Context getApplicationContext();
|
||||||
abstract public APPInfo getAppInfo();
|
abstract public APPInfo getAppInfo();
|
||||||
abstract public String getTag();
|
abstract public String getTag();
|
||||||
abstract public Toolbar initToolBar();
|
abstract public Toolbar initToolBar();
|
||||||
|
|||||||
@@ -19,300 +19,300 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class WinBollActivityManager {
|
public class WinBollActivityManager {
|
||||||
|
|
||||||
public static final String TAG = "WinBollActivityManager";
|
// public static final String TAG = "WinBollActivityManager";
|
||||||
public static final String EXTRA_TAG = "EXTRA_TAG";
|
// public static final String EXTRA_TAG = "EXTRA_TAG";
|
||||||
|
//
|
||||||
public static enum WinBollUI_TYPE {
|
// public static enum WinBollUI_TYPE {
|
||||||
Aplication, // 退出应用后,保持最近任务栏任务记录主窗口
|
// Aplication, // 退出应用后,保持最近任务栏任务记录主窗口
|
||||||
Service // 退出应用后,清理所有最近任务栏任务记录窗口
|
// Service // 退出应用后,清理所有最近任务栏任务记录窗口
|
||||||
};
|
// };
|
||||||
|
//
|
||||||
// 应用类型标志
|
// // 应用类型标志
|
||||||
volatile static WinBollUI_TYPE _mWinBollUI_TYPE = WinBollUI_TYPE.Service;
|
// volatile static WinBollUI_TYPE _mWinBollUI_TYPE = WinBollUI_TYPE.Service;
|
||||||
|
//
|
||||||
Context mContext;
|
// Context mContext;
|
||||||
MyActivityLifecycleCallbacks mMyActivityLifecycleCallbacks;
|
// MyActivityLifecycleCallbacks mMyActivityLifecycleCallbacks;
|
||||||
static WinBollActivityManager _mWinBollActivityManager;
|
// static WinBollActivityManager _mWinBollActivityManager;
|
||||||
static Map<String, IWinBollActivity> _mapIWinBollList;
|
// static Map<String, IWinBollActivity> _mapIWinBollList;
|
||||||
IWinBollActivity firstIWinBollActivity;
|
// IWinBollActivity firstIWinBollActivity;
|
||||||
|
//
|
||||||
public WinBollActivityManager(Context context) {
|
// public WinBollActivityManager(Context context) {
|
||||||
mContext = context;
|
// mContext = context;
|
||||||
LogUtils.d(TAG, "WinBollActivityManager()");
|
// LogUtils.d(TAG, "WinBollActivityManager()");
|
||||||
_mapIWinBollList = new HashMap<String, IWinBollActivity>();
|
// _mapIWinBollList = new HashMap<String, IWinBollActivity>();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public static synchronized WinBollActivityManager getInstance(Context context) {
|
// public static synchronized WinBollActivityManager getInstance(Context context) {
|
||||||
LogUtils.d(TAG, "getInstance");
|
// LogUtils.d(TAG, "getInstance");
|
||||||
if (_mWinBollActivityManager == null) {
|
// if (_mWinBollActivityManager == null) {
|
||||||
LogUtils.d(TAG, "_mWinBollActivityManager == null");
|
// LogUtils.d(TAG, "_mWinBollActivityManager == null");
|
||||||
_mWinBollActivityManager = new WinBollActivityManager(context);
|
// _mWinBollActivityManager = new WinBollActivityManager(context);
|
||||||
}
|
// }
|
||||||
return _mWinBollActivityManager;
|
// return _mWinBollActivityManager;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//
|
// //
|
||||||
// 设置 WinBoll 应用 UI 类型
|
// // 设置 WinBoll 应用 UI 类型
|
||||||
//
|
// //
|
||||||
public synchronized static void setWinBollUI_TYPE(WinBollUI_TYPE mWinBollUI_TYPE) {
|
// public synchronized static void setWinBollUI_TYPE(WinBollUI_TYPE mWinBollUI_TYPE) {
|
||||||
_mWinBollUI_TYPE = mWinBollUI_TYPE;
|
// _mWinBollUI_TYPE = mWinBollUI_TYPE;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//
|
// //
|
||||||
// 获取 WinBoll 应用 UI 类型
|
// // 获取 WinBoll 应用 UI 类型
|
||||||
//
|
// //
|
||||||
public synchronized static WinBollUI_TYPE getWinBollUI_TYPE() {
|
// public synchronized static WinBollUI_TYPE getWinBollUI_TYPE() {
|
||||||
return _mWinBollUI_TYPE;
|
// return _mWinBollUI_TYPE;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//
|
// //
|
||||||
// 把Activity添加到管理中
|
// // 把Activity添加到管理中
|
||||||
//
|
// //
|
||||||
public <T extends IWinBollActivity> void add(T iWinBoll) {
|
// public <T extends IWinBollActivity> void add(T iWinBoll) {
|
||||||
if (isActive(iWinBoll.getTag())) {
|
// if (isActive(iWinBoll.getTag())) {
|
||||||
LogUtils.d(TAG, String.format("add(...) %s is active.", iWinBoll.getTag()));
|
// LogUtils.d(TAG, String.format("add(...) %s is active.", iWinBoll.getTag()));
|
||||||
} else {
|
// } else {
|
||||||
// 设置起始活动窗口,以便最后退出时提问
|
// // 设置起始活动窗口,以便最后退出时提问
|
||||||
if (firstIWinBollActivity == null && _mapIWinBollList.size() == 0) {
|
// if (firstIWinBollActivity == null && _mapIWinBollList.size() == 0) {
|
||||||
firstIWinBollActivity = iWinBoll;
|
// firstIWinBollActivity = iWinBoll;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 添加到活动窗口列表
|
// // 添加到活动窗口列表
|
||||||
_mapIWinBollList.put(iWinBoll.getTag(), iWinBoll);
|
// _mapIWinBollList.put(iWinBoll.getTag(), iWinBoll);
|
||||||
LogUtils.d(TAG, String.format("Add activity : %s\n_mapActivityList.size() : %d", iWinBoll.getTag(), _mapIWinBollList.size()));
|
// LogUtils.d(TAG, String.format("Add activity : %s\n_mapActivityList.size() : %d", iWinBoll.getTag(), _mapIWinBollList.size()));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
//
|
// //
|
||||||
// activity: 为 null 时,
|
// // activity: 为 null 时,
|
||||||
// intent.putExtra 函数 EXTRA_TAG 参数为 tag
|
// // intent.putExtra 函数 EXTRA_TAG 参数为 tag
|
||||||
// activity: 不为 null 时,
|
// // activity: 不为 null 时,
|
||||||
// intent.putExtra 函数 "tag" 参数为 activity.getTag()
|
// // intent.putExtra 函数 "tag" 参数为 activity.getTag()
|
||||||
//
|
// //
|
||||||
public <T extends IWinBollActivity> void startWinBollActivity(Context context, Class<T> clazz) {
|
// public <T extends IWinBollActivity> void startWinBollActivity(Context context, Class<T> clazz) {
|
||||||
try {
|
// try {
|
||||||
// 如果窗口已存在就重启窗口
|
// // 如果窗口已存在就重启窗口
|
||||||
String tag = clazz.newInstance().getTag();
|
// String tag = clazz.newInstance().getTag();
|
||||||
if (isActive(tag)) {
|
// if (isActive(tag)) {
|
||||||
resumeActivity(context, tag);
|
// resumeActivity(context, tag);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 新建一个任务窗口
|
// // 新建一个任务窗口
|
||||||
Intent intent = new Intent(context, clazz);
|
// Intent intent = new Intent(context, clazz);
|
||||||
//打开多任务窗口 flags
|
// //打开多任务窗口 flags
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
// intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
intent.putExtra(EXTRA_TAG, tag);
|
// intent.putExtra(EXTRA_TAG, tag);
|
||||||
mContext.startActivity(intent);
|
// mContext.startActivity(intent);
|
||||||
} catch (InstantiationException | IllegalAccessException e) {
|
// } catch (InstantiationException | IllegalAccessException e) {
|
||||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public <T extends IWinBollActivity> void startWinBollActivity(Context context, Intent intent, Class<T> clazz) {
|
// public <T extends IWinBollActivity> void startWinBollActivity(Context context, Intent intent, Class<T> clazz) {
|
||||||
try {
|
// try {
|
||||||
// 如果窗口已存在就重启窗口
|
// // 如果窗口已存在就重启窗口
|
||||||
String tag = clazz.newInstance().getTag();
|
// String tag = clazz.newInstance().getTag();
|
||||||
if (isActive(tag)) {
|
// if (isActive(tag)) {
|
||||||
resumeActivity(context, tag);
|
// resumeActivity(context, tag);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 新建一个任务窗口
|
// // 新建一个任务窗口
|
||||||
//Intent intent = new Intent(context, clazz);
|
// //Intent intent = new Intent(context, clazz);
|
||||||
//打开多任务窗口 flags
|
// //打开多任务窗口 flags
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
// intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
intent.putExtra(EXTRA_TAG, tag);
|
// intent.putExtra(EXTRA_TAG, tag);
|
||||||
mContext.startActivity(intent);
|
// mContext.startActivity(intent);
|
||||||
} catch (InstantiationException | IllegalAccessException e) {
|
// } catch (InstantiationException | IllegalAccessException e) {
|
||||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isFirstIWinBollActivity(IWinBollActivity iWinBollActivity) {
|
// public boolean isFirstIWinBollActivity(IWinBollActivity iWinBollActivity) {
|
||||||
return firstIWinBollActivity != null && firstIWinBollActivity == iWinBollActivity;
|
// return firstIWinBollActivity != null && firstIWinBollActivity == iWinBollActivity;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//
|
// //
|
||||||
// 判断 tag绑定的 MyActivity是否存在
|
// // 判断 tag绑定的 MyActivity是否存在
|
||||||
//
|
// //
|
||||||
public boolean isActive(String tag) {
|
// public boolean isActive(String tag) {
|
||||||
//printAvtivityListInfo();
|
// //printAvtivityListInfo();
|
||||||
IWinBollActivity iWinBoll = getIWinBoll(tag);
|
// IWinBollActivity iWinBoll = getIWinBoll(tag);
|
||||||
if (iWinBoll != null) {
|
// if (iWinBoll != null) {
|
||||||
LogUtils.d(TAG, "isActive(...) activity != null tag " + tag);
|
// LogUtils.d(TAG, "isActive(...) activity != null tag " + tag);
|
||||||
//ToastUtils.show("activity != null tag " + tag);
|
// //ToastUtils.show("activity != null tag " + tag);
|
||||||
//判断是否为 BaseActivity,如果已经销毁,则移除
|
// //判断是否为 BaseActivity,如果已经销毁,则移除
|
||||||
if (iWinBoll.getActivity().isFinishing() || iWinBoll.getActivity().isDestroyed()) {
|
// if (iWinBoll.getActivity().isFinishing() || iWinBoll.getActivity().isDestroyed()) {
|
||||||
_mapIWinBollList.remove(iWinBoll.getTag());
|
// _mapIWinBollList.remove(iWinBoll.getTag());
|
||||||
//_mWinBollActivityList.remove(activity);
|
// //_mWinBollActivityList.remove(activity);
|
||||||
LogUtils.d(TAG, String.format("isActive(...) remove activity.\ntag : %s", tag));
|
// LogUtils.d(TAG, String.format("isActive(...) remove activity.\ntag : %s", tag));
|
||||||
return false;
|
// return false;
|
||||||
} else {
|
// } else {
|
||||||
LogUtils.d(TAG, String.format("isActive(...) activity is exist.\ntag : %s", tag));
|
// LogUtils.d(TAG, String.format("isActive(...) activity is exist.\ntag : %s", tag));
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
LogUtils.d(TAG, String.format("isActive(...) activity == null\ntag : %s", tag));
|
// LogUtils.d(TAG, String.format("isActive(...) activity == null\ntag : %s", tag));
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
static IWinBollActivity getIWinBoll(String tag) {
|
// static IWinBollActivity getIWinBoll(String tag) {
|
||||||
return _mapIWinBollList.get(tag);
|
// return _mapIWinBollList.get(tag);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//
|
// //
|
||||||
// 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台
|
// // 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台
|
||||||
//
|
// //
|
||||||
public <T extends IWinBollActivity> void resumeActivity(Context context, String tag) {
|
// public <T extends IWinBollActivity> void resumeActivity(Context context, String tag) {
|
||||||
LogUtils.d(TAG, "resumeActivty");
|
// LogUtils.d(TAG, "resumeActivty");
|
||||||
T iWinBoll = (T)getIWinBoll(tag);
|
// T iWinBoll = (T)getIWinBoll(tag);
|
||||||
//LogUtils.d(TAG, "activity " + activity.getTag());
|
// //LogUtils.d(TAG, "activity " + activity.getTag());
|
||||||
if (iWinBoll != null && !iWinBoll.getActivity().isFinishing() && !iWinBoll.getActivity().isDestroyed()) {
|
// if (iWinBoll != null && !iWinBoll.getActivity().isFinishing() && !iWinBoll.getActivity().isDestroyed()) {
|
||||||
resumeActivity(context, iWinBoll);
|
// resumeActivity(context, iWinBoll);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//
|
// //
|
||||||
// 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台
|
// // 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台
|
||||||
//
|
// //
|
||||||
public <T extends IWinBollActivity> void resumeActivity(Context context, T iWinBoll) {
|
// public <T extends IWinBollActivity> void resumeActivity(Context context, T iWinBoll) {
|
||||||
ActivityManager am = (ActivityManager) iWinBoll.getActivity().getSystemService(Context.ACTIVITY_SERVICE);
|
// ActivityManager am = (ActivityManager) iWinBoll.getActivity().getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
//返回启动它的根任务(home 或者 MainActivity)
|
// //返回启动它的根任务(home 或者 MainActivity)
|
||||||
Intent intent = new Intent(context, iWinBoll.getClass());
|
// Intent intent = new Intent(context, iWinBoll.getClass());
|
||||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
|
// TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
|
||||||
stackBuilder.addNextIntentWithParentStack(intent);
|
// stackBuilder.addNextIntentWithParentStack(intent);
|
||||||
stackBuilder.startActivities();
|
// stackBuilder.startActivities();
|
||||||
//moveTaskToFront(YourTaskId, 0);
|
// //moveTaskToFront(YourTaskId, 0);
|
||||||
LogUtils.d(TAG, "am.moveTaskToFront");
|
// LogUtils.d(TAG, "am.moveTaskToFront");
|
||||||
//ToastUtils.show("resumeActivity am.moveTaskToFront");
|
// //ToastUtils.show("resumeActivity am.moveTaskToFront");
|
||||||
am.moveTaskToFront(iWinBoll.getActivity().getTaskId(), ActivityManager.MOVE_TASK_NO_USER_ACTION);
|
// am.moveTaskToFront(iWinBoll.getActivity().getTaskId(), ActivityManager.MOVE_TASK_NO_USER_ACTION);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
//
|
// //
|
||||||
// 结束所有 Activity
|
// // 结束所有 Activity
|
||||||
//
|
// //
|
||||||
public void finishAll() {
|
// public void finishAll() {
|
||||||
try {
|
// try {
|
||||||
for (String key : _mapIWinBollList.keySet()) {
|
// for (String key : _mapIWinBollList.keySet()) {
|
||||||
//System.out.println("Key: " + key + ", Value: " + _mapActivityList.get(key));
|
// //System.out.println("Key: " + key + ", Value: " + _mapActivityList.get(key));
|
||||||
IWinBollActivity iWinBoll = _mapIWinBollList.get(key);
|
// IWinBollActivity iWinBoll = _mapIWinBollList.get(key);
|
||||||
//ToastUtils.show("finishAll() activity");
|
// //ToastUtils.show("finishAll() activity");
|
||||||
if (iWinBoll != null && !iWinBoll.getActivity().isFinishing() && !iWinBoll.getActivity().isDestroyed()) {
|
// if (iWinBoll != null && !iWinBoll.getActivity().isFinishing() && !iWinBoll.getActivity().isDestroyed()) {
|
||||||
//ToastUtils.show("activity != null ...");
|
// //ToastUtils.show("activity != null ...");
|
||||||
if (getWinBollUI_TYPE() == WinBollUI_TYPE.Service) {
|
// if (getWinBollUI_TYPE() == WinBollUI_TYPE.Service) {
|
||||||
// 结束窗口和最近任务栏, 建议前台服务类应用使用,可以方便用户再次调用 UI 操作。
|
// // 结束窗口和最近任务栏, 建议前台服务类应用使用,可以方便用户再次调用 UI 操作。
|
||||||
iWinBoll.getActivity().finishAndRemoveTask();
|
// iWinBoll.getActivity().finishAndRemoveTask();
|
||||||
//ToastUtils.show("finishAll() activity.finishAndRemoveTask();");
|
// //ToastUtils.show("finishAll() activity.finishAndRemoveTask();");
|
||||||
} else if (getWinBollUI_TYPE() == WinBollUI_TYPE.Aplication) {
|
// } else if (getWinBollUI_TYPE() == WinBollUI_TYPE.Aplication) {
|
||||||
// 结束窗口保留最近任务栏,建议前台服务类应用使用,可以保持应用的系统自觉性。
|
// // 结束窗口保留最近任务栏,建议前台服务类应用使用,可以保持应用的系统自觉性。
|
||||||
iWinBoll.getActivity().finish();
|
// iWinBoll.getActivity().finish();
|
||||||
//ToastUtils.show("finishAll() activity.finish();");
|
// //ToastUtils.show("finishAll() activity.finish();");
|
||||||
} else {
|
// } else {
|
||||||
LogUtils.d(TAG, "WinBollApplication.WinBollUI_TYPE error.");
|
// LogUtils.d(TAG, "WinBollApplication.WinBollUI_TYPE error.");
|
||||||
//ToastUtils.show("WinBollApplication.WinBollUI_TYPE error.");
|
// //ToastUtils.show("WinBollApplication.WinBollUI_TYPE error.");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//
|
// //
|
||||||
// 结束指定Activity
|
// // 结束指定Activity
|
||||||
//
|
// //
|
||||||
public <T extends IWinBollActivity> void finish(T iWinBoll) {
|
// public <T extends IWinBollActivity> void finish(T iWinBoll) {
|
||||||
try {
|
// try {
|
||||||
if (iWinBoll != null && !iWinBoll.getActivity().isFinishing() && !iWinBoll.getActivity().isDestroyed()) {
|
// if (iWinBoll != null && !iWinBoll.getActivity().isFinishing() && !iWinBoll.getActivity().isDestroyed()) {
|
||||||
//根据tag 移除 MyActivity
|
// //根据tag 移除 MyActivity
|
||||||
//String tag= activity.getTag();
|
// //String tag= activity.getTag();
|
||||||
//_mWinBollActivityList.remove(tag);
|
// //_mWinBollActivityList.remove(tag);
|
||||||
//ToastUtils.show("remove");
|
// //ToastUtils.show("remove");
|
||||||
//ToastUtils.show("_mWinBollActivityArrayMap.size() " + Integer.toString(_mWinBollActivityArrayMap.size()));
|
// //ToastUtils.show("_mWinBollActivityArrayMap.size() " + Integer.toString(_mWinBollActivityArrayMap.size()));
|
||||||
|
//
|
||||||
// 窗口回调规则:
|
// // 窗口回调规则:
|
||||||
// [] 当前窗口位置 >> 调度出的窗口位置
|
// // [] 当前窗口位置 >> 调度出的窗口位置
|
||||||
// ★:[0] 1 2 3 4 >> 1
|
// // ★:[0] 1 2 3 4 >> 1
|
||||||
// ★:0 1 [2] 3 4 >> 1
|
// // ★:0 1 [2] 3 4 >> 1
|
||||||
// ★:0 1 2 [3] 4 >> 2
|
// // ★:0 1 2 [3] 4 >> 2
|
||||||
// ★:0 1 2 3 [4] >> 3
|
// // ★:0 1 2 3 [4] >> 3
|
||||||
// ★:[0] >> 直接关闭当前窗口
|
// // ★:[0] >> 直接关闭当前窗口
|
||||||
LogUtils.d(TAG, "finish no yet.");
|
// LogUtils.d(TAG, "finish no yet.");
|
||||||
IWinBollActivity preIWinBoll = getPreIWinBoll(iWinBoll);
|
// IWinBollActivity preIWinBoll = getPreIWinBoll(iWinBoll);
|
||||||
iWinBoll.getActivity().finish();
|
// iWinBoll.getActivity().finish();
|
||||||
if (preIWinBoll != null) {
|
// if (preIWinBoll != null) {
|
||||||
resumeActivity(mContext, preIWinBoll);
|
// resumeActivity(mContext, preIWinBoll);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//
|
// //
|
||||||
// 获取窗口队列中的前一个窗口
|
// // 获取窗口队列中的前一个窗口
|
||||||
//
|
// //
|
||||||
IWinBollActivity getPreIWinBoll(IWinBollActivity iWinBoll) {
|
// IWinBollActivity getPreIWinBoll(IWinBollActivity iWinBoll) {
|
||||||
try {
|
// try {
|
||||||
boolean bingo = false;
|
// boolean bingo = false;
|
||||||
IWinBollActivity preIWinBoll = null;
|
// IWinBollActivity preIWinBoll = null;
|
||||||
for (Map.Entry<String, IWinBollActivity> entity : _mapIWinBollList.entrySet()) {
|
// for (Map.Entry<String, IWinBollActivity> entity : _mapIWinBollList.entrySet()) {
|
||||||
if (entity.getKey().equals(iWinBoll.getTag())) {
|
// if (entity.getKey().equals(iWinBoll.getTag())) {
|
||||||
bingo = true;
|
// bingo = true;
|
||||||
LogUtils.d(TAG, "bingo");
|
// LogUtils.d(TAG, "bingo");
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
preIWinBoll = entity.getValue();
|
// preIWinBoll = entity.getValue();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (bingo) {
|
// if (bingo) {
|
||||||
return preIWinBoll;
|
// return preIWinBoll;
|
||||||
}
|
// }
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//
|
// //
|
||||||
// 从管理列表中移除管理项
|
// // 从管理列表中移除管理项
|
||||||
//
|
// //
|
||||||
public <T extends IWinBollActivity> boolean registeRemove(T activity) {
|
// public <T extends IWinBollActivity> boolean registeRemove(T activity) {
|
||||||
IWinBollActivity iWinBollTest = _mapIWinBollList.get(activity.getTag());
|
// IWinBollActivity iWinBollTest = _mapIWinBollList.get(activity.getTag());
|
||||||
if (iWinBollTest != null) {
|
// if (iWinBollTest != null) {
|
||||||
_mapIWinBollList.remove(activity.getTag());
|
// _mapIWinBollList.remove(activity.getTag());
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//
|
// //
|
||||||
// 打印管理列表项列表里的信息
|
// // 打印管理列表项列表里的信息
|
||||||
//
|
// //
|
||||||
public static void printIWinBollListInfo() {
|
// public static void printIWinBollListInfo() {
|
||||||
//LogUtils.d(TAG, "printAvtivityListInfo");
|
// //LogUtils.d(TAG, "printAvtivityListInfo");
|
||||||
if (!_mapIWinBollList.isEmpty()) {
|
// if (!_mapIWinBollList.isEmpty()) {
|
||||||
StringBuilder sb = new StringBuilder("Map entries : " + Integer.toString(_mapIWinBollList.size()));
|
// StringBuilder sb = new StringBuilder("Map entries : " + Integer.toString(_mapIWinBollList.size()));
|
||||||
Iterator<Map.Entry<String, IWinBollActivity>> iterator = _mapIWinBollList.entrySet().iterator();
|
// Iterator<Map.Entry<String, IWinBollActivity>> iterator = _mapIWinBollList.entrySet().iterator();
|
||||||
while (iterator.hasNext()) {
|
// while (iterator.hasNext()) {
|
||||||
Map.Entry<String, IWinBollActivity> entry = iterator.next();
|
// Map.Entry<String, IWinBollActivity> entry = iterator.next();
|
||||||
sb.append("\nKey: " + entry.getKey() + ", \nValue: " + entry.getValue().getTag());
|
// sb.append("\nKey: " + entry.getKey() + ", \nValue: " + entry.getValue().getTag());
|
||||||
//ToastUtils.show("\nKey: " + entry.getKey() + ", Value: " + entry.getValue().getTag());
|
// //ToastUtils.show("\nKey: " + entry.getKey() + ", Value: " + entry.getValue().getTag());
|
||||||
}
|
// }
|
||||||
sb.append("\nMap entries end.");
|
// sb.append("\nMap entries end.");
|
||||||
LogUtils.d(TAG, sb.toString());
|
// LogUtils.d(TAG, sb.toString());
|
||||||
} else {
|
// } else {
|
||||||
LogUtils.d(TAG, "The map is empty.");
|
// LogUtils.d(TAG, "The map is empty.");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,180 @@
|
|||||||
|
package cc.winboll.studio.libapputils.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen@AliYun.Com
|
||||||
|
* @Date 2025/03/23 16:17:54
|
||||||
|
* @Describe 哔哔振动响铃工具集
|
||||||
|
*/
|
||||||
|
import android.content.Context;
|
||||||
|
import android.media.MediaPlayer;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Vibrator;
|
||||||
|
import android.os.VibratorManager;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BBMorseCodeUtils {
|
||||||
|
|
||||||
|
public static final String TAG = "BBMorseCodeUtils";
|
||||||
|
|
||||||
|
// private static final int DOT_DURATION = 100; // 点时长 (ms)
|
||||||
|
// private static final int DASH_DURATION = 300; // 划时长 (ms)
|
||||||
|
// private static final int SYMBOL_GAP = 100; // 符号间隔 (ms)
|
||||||
|
// private static final int CHARACTER_GAP = 300; // 字符间隔 (ms)
|
||||||
|
// private static final int WORD_GAP = 700; // 单词间隔 (ms)
|
||||||
|
//
|
||||||
|
// private final Context context;
|
||||||
|
// private final Handler handler = new Handler();
|
||||||
|
// private boolean isPlaying = false;
|
||||||
|
//
|
||||||
|
// public BBMorseCodeUtils(Context context) {
|
||||||
|
// this.context = context.getApplicationContext();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void playMorseCode(String morseCode, boolean vibrateEnabled, boolean ringEnabled) {
|
||||||
|
// if (isPlaying) return;
|
||||||
|
// isPlaying = true;
|
||||||
|
//
|
||||||
|
// List<List<String>> words = parseMorseCode(morseCode);
|
||||||
|
// startSequence(words, vibrateEnabled, ringEnabled);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void startSequence(final List<List<String>> words, final boolean vibrateEnabled, final boolean ringEnabled) {
|
||||||
|
// final int[] wordIndex = {0};
|
||||||
|
// final int[] charIndex = {0};
|
||||||
|
// final int[] symbolIndex = {0};
|
||||||
|
//
|
||||||
|
// Runnable sequenceRunner = new Runnable() {
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// if (wordIndex[0] >= words.size()) {
|
||||||
|
// stop();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// List<String> characters = words.get(wordIndex[0]);
|
||||||
|
// if (charIndex[0] >= characters.size()) {
|
||||||
|
// charIndex[0] = 0;
|
||||||
|
// symbolIndex[0] = 0;
|
||||||
|
// wordIndex[0]++;
|
||||||
|
// handler.postDelayed(this, WORD_GAP);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String character = characters.get(charIndex[0]);
|
||||||
|
// if (symbolIndex[0] >= character.length()) {
|
||||||
|
// symbolIndex[0] = 0;
|
||||||
|
// charIndex[0]++;
|
||||||
|
// handler.postDelayed(this, CHARACTER_GAP);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// char symbol = character.charAt(symbolIndex[0]);
|
||||||
|
// symbolIndex[0]++;
|
||||||
|
//
|
||||||
|
// long duration = (symbol == '.') ? DOT_DURATION : DASH_DURATION;
|
||||||
|
//
|
||||||
|
// // 执行振动
|
||||||
|
// if (vibrateEnabled) {
|
||||||
|
// vibrate(duration);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 播放声音
|
||||||
|
// if (ringEnabled) {
|
||||||
|
// playSound(symbol, duration);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 安排下一个符号
|
||||||
|
// handler.postDelayed(this, duration + SYMBOL_GAP);
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// handler.post(sequenceRunner);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void vibrate(long duration) {
|
||||||
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
|
// VibratorManager vibratorManager = context.getSystemService(VibratorManager.class);
|
||||||
|
// Vibrator vibrator = vibratorManager.getDefaultVibrator();
|
||||||
|
// vibrator.vibrate(duration);
|
||||||
|
// } else {
|
||||||
|
// Vibrator vibrator = context.getSystemService(Vibrator.class);
|
||||||
|
// if (vibrator != null && vibrator.hasVibrator()) {
|
||||||
|
// vibrator.vibrate(duration);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void playSound(char symbol, long duration) {
|
||||||
|
// int soundRes = (symbol == '.') ? R.raw.morse_dot : R.raw.morse_dash;
|
||||||
|
// MediaPlayer mediaPlayer = MediaPlayer.create(context, soundRes);
|
||||||
|
//
|
||||||
|
// mediaPlayer.setOnPreparedListener(> {
|
||||||
|
// mp.start();
|
||||||
|
// handler.postDelayed(mp::stop, duration);
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// mediaPlayer.setOnCompletionListener(> {
|
||||||
|
// mp.release();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private List<List<String>> parseMorseCode(String code) {
|
||||||
|
// List<List<String>> words = new ArrayList<>();
|
||||||
|
// String[] wordParts = code.split("/");
|
||||||
|
//
|
||||||
|
// for (String word : wordParts) {
|
||||||
|
// String[] chars = word.trim().split("\\s+");
|
||||||
|
// words.add(new ArrayList<>(Arrays.asList(chars)));
|
||||||
|
// }
|
||||||
|
// return words;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void stop() {
|
||||||
|
// isPlaying = false;
|
||||||
|
// handler.removeCallbacksAndMessages(null);
|
||||||
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
|
// VibratorManager vibratorManager = context.getSystemService(VibratorManager.class);
|
||||||
|
// Vibrator vibrator = vibratorManager.getDefaultVibrator();
|
||||||
|
// vibrator.cancel();
|
||||||
|
// } else {
|
||||||
|
// Vibrator vibrator = context.getSystemService(Vibrator.class);
|
||||||
|
// if (vibrator != null) {
|
||||||
|
// vibrator.cancel();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用说明:
|
||||||
|
//
|
||||||
|
// 1. 在AndroidManifest.xml中添加权限:
|
||||||
|
//
|
||||||
|
// xml
|
||||||
|
//
|
||||||
|
// <uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// 2. 在res/raw目录下添加两个声音文件:
|
||||||
|
//
|
||||||
|
// - morse_dot.wav(短音)
|
||||||
|
//
|
||||||
|
// - morse_dash.wav(长音)
|
||||||
|
//
|
||||||
|
// 3. 使用示例:
|
||||||
|
//
|
||||||
|
// java
|
||||||
|
//
|
||||||
|
// MorsePlayer morsePlayer = new MorsePlayer(this);
|
||||||
|
//morsePlayer.playMorseCode(".... . / .- --", true, true);
|
||||||
|
//
|
||||||
|
// 停止播放
|
||||||
|
// morsePlayer.stop();
|
||||||
|
// MorsePlayer morsePlayer = new MorsePlayer(this);
|
||||||
|
//morsePlayer.playMorseCode(".... . / .- --", true, true);
|
||||||
|
//
|
||||||
|
//// 停止播放
|
||||||
|
//// morsePlayer.stop();
|
||||||
|
//
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<style name="UtilsTheme" parent="APPBaseTheme">
|
<style name="UtilsTheme" parent="@android:style/Theme.Holo.Light.NoActionBar">
|
||||||
<item name="attrColorPrimary">@color/colorPrimary</item>
|
|
||||||
<item name="themeGlobalCrashActivity">@style/GlobalCrashActivityTheme</item>
|
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user