更新UI视图
This commit is contained in:
parent
bc252041d3
commit
00d0871809
@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Fri Mar 07 03:14:48 GMT 2025
|
#Fri Mar 07 04:36:05 GMT 2025
|
||||||
stageCount=3
|
stageCount=3
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=2.0
|
baseVersion=2.0
|
||||||
publishVersion=2.0.2
|
publishVersion=2.0.2
|
||||||
buildCount=5
|
buildCount=7
|
||||||
baseBetaVersion=2.0.3
|
baseBetaVersion=2.0.3
|
||||||
|
@ -13,7 +13,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import cc.winboll.studio.appbase.beans.WinBollNewsBean;
|
import cc.winboll.studio.appbase.beans.WinBollNewsBean;
|
||||||
import cc.winboll.studio.appbase.services.MainService;
|
import cc.winboll.studio.appbase.services.MainService;
|
||||||
import cc.winboll.studio.appbase.widgets.WinBollNewsWidget;
|
import cc.winboll.studio.appbase.widgets.APPNewsWidget;
|
||||||
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 com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
@ -95,10 +95,10 @@ public class MainReceiver extends BroadcastReceiver {
|
|||||||
sbLine.append(appName);
|
sbLine.append(appName);
|
||||||
appWinBollNewsBean.setMessage(sbLine.toString());
|
appWinBollNewsBean.setMessage(sbLine.toString());
|
||||||
|
|
||||||
WinBollNewsWidget.addWinBollNewsBean(context, appWinBollNewsBean);
|
APPNewsWidget.addWinBollNewsBean(context, appWinBollNewsBean);
|
||||||
|
|
||||||
Intent intentWidget = new Intent(context, WinBollNewsWidget.class);
|
Intent intentWidget = new Intent(context, APPNewsWidget.class);
|
||||||
intentWidget.setAction(WinBollNewsWidget.ACTION_RELOAD_REPORT);
|
intentWidget.setAction(APPNewsWidget.ACTION_RELOAD_REPORT);
|
||||||
context.sendBroadcast(intentWidget);
|
context.sendBroadcast(intentWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ 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;
|
||||||
import cc.winboll.studio.appbase.threads.MainServiceThread;
|
import cc.winboll.studio.appbase.threads.MainServiceThread;
|
||||||
import cc.winboll.studio.appbase.widgets.WinBollNewsWidget;
|
import cc.winboll.studio.appbase.widgets.APPNewsWidget;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import cc.winboll.studio.libappbase.sos.APPModel;
|
import cc.winboll.studio.libappbase.sos.APPModel;
|
||||||
@ -101,8 +101,8 @@ public class MainService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 启动小部件
|
// 启动小部件
|
||||||
Intent intentTimeWidget = new Intent(this, WinBollNewsWidget.class);
|
Intent intentTimeWidget = new Intent(this, APPNewsWidget.class);
|
||||||
intentTimeWidget.setAction(WinBollNewsWidget.ACTION_RELOAD_REPORT);
|
intentTimeWidget.setAction(APPNewsWidget.ACTION_RELOAD_REPORT);
|
||||||
this.sendBroadcast(intentTimeWidget);
|
this.sendBroadcast(intentTimeWidget);
|
||||||
|
|
||||||
startMainServiceThread();
|
startMainServiceThread();
|
||||||
@ -211,8 +211,8 @@ public class MainService extends Service {
|
|||||||
bindService(intentService, sosConnection, Context.BIND_IMPORTANT);
|
bindService(intentService, sosConnection, Context.BIND_IMPORTANT);
|
||||||
mSOSConnectionList.add(sosConnection);
|
mSOSConnectionList.add(sosConnection);
|
||||||
|
|
||||||
Intent intentWidget = new Intent(this, WinBollNewsWidget.class);
|
Intent intentWidget = new Intent(this, APPNewsWidget.class);
|
||||||
intentWidget.setAction(WinBollNewsWidget.ACTION_WAKEUP_SERVICE);
|
intentWidget.setAction(APPNewsWidget.ACTION_WAKEUP_SERVICE);
|
||||||
APPModel appSOSBean = new APPModel(bean.getAppPackageName(), bean.getAppMainServiveName());
|
APPModel appSOSBean = new APPModel(bean.getAppPackageName(), bean.getAppMainServiveName());
|
||||||
intentWidget.putExtra("APPSOSBean", appSOSBean.toString());
|
intentWidget.putExtra("APPSOSBean", appSOSBean.toString());
|
||||||
sendBroadcast(intentWidget);
|
sendBroadcast(intentWidget);
|
||||||
|
@ -20,10 +20,11 @@ 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.APPModel;
|
||||||
|
import cc.winboll.studio.libappbase.sos.WinBoll;
|
||||||
|
|
||||||
public class WinBollNewsWidget extends AppWidgetProvider {
|
public class APPNewsWidget extends AppWidgetProvider {
|
||||||
|
|
||||||
public static final String TAG = "WinBollNewsWidget";
|
public static final String TAG = "APPNewsWidget";
|
||||||
|
|
||||||
public static final String ACTION_WAKEUP_SERVICE = "cc.winboll.studio.appbase.widgets.WinBollNewsWidget.ACTION_WAKEUP_SERVICE";
|
public static final String ACTION_WAKEUP_SERVICE = "cc.winboll.studio.appbase.widgets.WinBollNewsWidget.ACTION_WAKEUP_SERVICE";
|
||||||
public static final String ACTION_RELOAD_REPORT = "cc.winboll.studio.appbase.widgets.WinBollNewsWidget.ACTION_RELOAD_REPORT";
|
public static final String ACTION_RELOAD_REPORT = "cc.winboll.studio.appbase.widgets.WinBollNewsWidget.ACTION_RELOAD_REPORT";
|
||||||
@ -49,25 +50,25 @@ public class WinBollNewsWidget extends AppWidgetProvider {
|
|||||||
if (intent.getAction().equals(ACTION_RELOAD_REPORT)) {
|
if (intent.getAction().equals(ACTION_RELOAD_REPORT)) {
|
||||||
LogUtils.d(TAG, "ACTION_RELOAD_REPORT");
|
LogUtils.d(TAG, "ACTION_RELOAD_REPORT");
|
||||||
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||||
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, WinBollNewsWidget.class));
|
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, APPNewsWidget.class));
|
||||||
for (int appWidgetId : appWidgetIds) {
|
for (int appWidgetId : appWidgetIds) {
|
||||||
updateAppWidget(context, appWidgetManager, appWidgetId);
|
updateAppWidget(context, appWidgetManager, appWidgetId);
|
||||||
}
|
}
|
||||||
}else if (intent.getAction().equals(ACTION_WAKEUP_SERVICE)) {
|
}else if (intent.getAction().equals(ACTION_WAKEUP_SERVICE)) {
|
||||||
LogUtils.d(TAG, "ACTION_WAKEUP_SERVICE");
|
LogUtils.d(TAG, "ACTION_WAKEUP_SERVICE");
|
||||||
String szWinBollNewsBean = intent.getStringExtra("WinBollNewsBean");
|
String szAPPModel = intent.getStringExtra(WinBoll.EXTRA_APPMODEL);
|
||||||
LogUtils.d(TAG, String.format("szWinBollNewsBean %s", szWinBollNewsBean));
|
LogUtils.d(TAG, String.format("szAPPModel %s", szAPPModel));
|
||||||
if (szWinBollNewsBean != null && !szWinBollNewsBean.equals("")) {
|
if (szAPPModel != null && !szAPPModel.equals("")) {
|
||||||
try {
|
try {
|
||||||
APPModel bean = APPModel.parseStringToBean(szWinBollNewsBean, APPModel.class);
|
APPModel bean = APPModel.parseStringToBean(szAPPModel, APPModel.class);
|
||||||
if (bean != null) {
|
if (bean != null) {
|
||||||
String szNewsPackageName = bean.getAppPackageName();
|
String szAppPackageName = bean.getAppPackageName();
|
||||||
LogUtils.d(TAG, String.format("szNewsPackageName %s", szNewsPackageName));
|
LogUtils.d(TAG, String.format("szAppPackageName %s", szAppPackageName));
|
||||||
String szNewsClassName = bean.getAppMainServiveName();
|
String szAppMainServiveName = bean.getAppMainServiveName();
|
||||||
LogUtils.d(TAG, String.format("szNewsClassName %s", szNewsClassName));
|
LogUtils.d(TAG, String.format("szAppMainServiveName %s", szAppMainServiveName));
|
||||||
|
|
||||||
|
|
||||||
String appName = AppUtils.getAppNameByPackageName(context, szNewsPackageName);
|
String appName = AppUtils.getAppNameByPackageName(context, szAppPackageName);
|
||||||
LogUtils.d(TAG, String.format("appName %s", appName));
|
LogUtils.d(TAG, String.format("appName %s", appName));
|
||||||
WinBollNewsBean winBollNewsBean = new WinBollNewsBean(appName);
|
WinBollNewsBean winBollNewsBean = new WinBollNewsBean(appName);
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||||
@ -82,7 +83,7 @@ public class WinBollNewsWidget extends AppWidgetProvider {
|
|||||||
addWinBollNewsBean(context, winBollNewsBean);
|
addWinBollNewsBean(context, winBollNewsBean);
|
||||||
|
|
||||||
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||||
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, WinBollNewsWidget.class));
|
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, APPNewsWidget.class));
|
||||||
for (int appWidgetId : appWidgetIds) {
|
for (int appWidgetId : appWidgetIds) {
|
||||||
updateAppWidget(context, appWidgetManager, appWidgetId);
|
updateAppWidget(context, appWidgetManager, appWidgetId);
|
||||||
}
|
}
|
||||||
@ -156,8 +157,8 @@ public class WinBollNewsWidget extends AppWidgetProvider {
|
|||||||
if (_CurrentPageIndex > 0) {
|
if (_CurrentPageIndex > 0) {
|
||||||
_CurrentPageIndex = _CurrentPageIndex - 1;
|
_CurrentPageIndex = _CurrentPageIndex - 1;
|
||||||
}
|
}
|
||||||
Intent intentWidget = new Intent(context, WinBollNewsWidget.class);
|
Intent intentWidget = new Intent(context, APPNewsWidget.class);
|
||||||
intentWidget.setAction(WinBollNewsWidget.ACTION_RELOAD_REPORT);
|
intentWidget.setAction(APPNewsWidget.ACTION_RELOAD_REPORT);
|
||||||
context.sendBroadcast(intentWidget);
|
context.sendBroadcast(intentWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,8 +168,8 @@ public class WinBollNewsWidget extends AppWidgetProvider {
|
|||||||
if ((_CurrentPageIndex + 1) * _OnePageLinesCount < _WinBollNewsBeanList.size()) {
|
if ((_CurrentPageIndex + 1) * _OnePageLinesCount < _WinBollNewsBeanList.size()) {
|
||||||
_CurrentPageIndex = _CurrentPageIndex + 1;
|
_CurrentPageIndex = _CurrentPageIndex + 1;
|
||||||
}
|
}
|
||||||
Intent intentWidget = new Intent(context, WinBollNewsWidget.class);
|
Intent intentWidget = new Intent(context, APPNewsWidget.class);
|
||||||
intentWidget.setAction(WinBollNewsWidget.ACTION_RELOAD_REPORT);
|
intentWidget.setAction(APPNewsWidget.ACTION_RELOAD_REPORT);
|
||||||
context.sendBroadcast(intentWidget);
|
context.sendBroadcast(intentWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,10 +25,10 @@ public class WinBollNewsWidgetClickListener extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
if (action.equals(ACTION_PRE)) {
|
if (action.equals(ACTION_PRE)) {
|
||||||
LogUtils.d(TAG, "ACTION_PRE");
|
LogUtils.d(TAG, "ACTION_PRE");
|
||||||
WinBollNewsWidget.prePage(context);
|
APPNewsWidget.prePage(context);
|
||||||
} else if (action.equals(ACTION_NEXT)) {
|
} else if (action.equals(ACTION_NEXT)) {
|
||||||
LogUtils.d(TAG, "ACTION_NEXT");
|
LogUtils.d(TAG, "ACTION_NEXT");
|
||||||
WinBollNewsWidget.nextPage(context);
|
APPNewsWidget.nextPage(context);
|
||||||
} else {
|
} else {
|
||||||
LogUtils.d(TAG, String.format("action %s", action));
|
LogUtils.d(TAG, String.format("action %s", action));
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,27 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:gravity="center">
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/activitymainToolbar1"/>
|
android:id="@+id/activitymainToolbar1"/>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1.0">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -27,9 +37,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Android版本10的代号是“Q”,API级别是29。 Android 10开始谷歌不再公开使用甜品作为版本代号,但内部仍保留了大量与“Q”相关的元素。Android 10本身并没有严格对应某个特定的Java版本,但在开发Android 10应用时,通常可以使用Java 8或更高版本。
|
android:text="Android版本10的代号是“Q”,API级别是29。 Android 10开始谷歌不再公开使用甜品作为版本代号,但内部仍保留了大量与“Q”相关的元素。Android 10本身并没有严格对应某个特定的Java版本,但在开发Android 10应用时,通常可以使用Java 8或更高版本。 Java 8为Android开发带来了诸如Lambda表达式、方法引用等新特性,能提高开发效率和代码可读性,与Android 10开发适配良好。Java 9及更高版本也可用于Android 10开发,能使用一些新的语言特性和API,但可能需要注意兼容性和配置问题。"/>
|
||||||
|
|
||||||
Java 8为Android开发带来了诸如Lambda表达式、方法引用等新特性,能提高开发效率和代码可读性,与Android 10开发适配良好。Java 9及更高版本也可用于Android 10开发,能使用一些新的语言特性和API,但可能需要注意兼容性和配置问题。"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
@ -138,8 +146,7 @@ Java 8为Android开发带来了诸如Lambda表达式、方法引用等新特性
|
|||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
<cc.winboll.studio.libappbase.LogView
|
<cc.winboll.studio.libappbase.LogView
|
||||||
android:layout_weight="1.0"
|
android:layout_height="500dp"
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:id="@+id/activitymainLogView1"/>
|
android:id="@+id/activitymainLogView1"/>
|
||||||
|
|
||||||
@ -147,3 +154,7 @@ Java 8为Android开发带来了诸如Lambda表达式、方法引用等新特性
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Fri Mar 07 03:14:48 GMT 2025
|
#Fri Mar 07 04:36:05 GMT 2025
|
||||||
stageCount=3
|
stageCount=3
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=2.0
|
baseVersion=2.0
|
||||||
publishVersion=2.0.2
|
publishVersion=2.0.2
|
||||||
buildCount=5
|
buildCount=7
|
||||||
baseBetaVersion=2.0.3
|
baseBetaVersion=2.0.3
|
||||||
|
@ -14,7 +14,7 @@ public class WinBoll {
|
|||||||
public static final String TAG = "WinBoll";
|
public static final String TAG = "WinBoll";
|
||||||
|
|
||||||
public static final String ACTION_BIND = WinBoll.class.getName() + ".ACTION_BIND";
|
public static final String ACTION_BIND = WinBoll.class.getName() + ".ACTION_BIND";
|
||||||
public static final String EXTRA_APPMODEL = "EXTRA_APP";
|
public static final String EXTRA_APPMODEL = "EXTRA_APPMODEL";
|
||||||
|
|
||||||
public static void bindToAPPBase(Context context, String appMainService) {
|
public static void bindToAPPBase(Context context, String appMainService) {
|
||||||
String toPackage = "cc.winboll.studio.appbase";
|
String toPackage = "cc.winboll.studio.appbase";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user