sos报告部件重构
This commit is contained in:
parent
7b05d613e4
commit
6378433424
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Sun Feb 16 12:53:20 GMT 2025
|
||||
#Mon Feb 17 03:10:13 GMT 2025
|
||||
stageCount=2
|
||||
libraryProject=libappbase
|
||||
baseVersion=1.5
|
||||
publishVersion=1.5.1
|
||||
buildCount=168
|
||||
buildCount=184
|
||||
baseBetaVersion=1.5.2
|
||||
|
@ -17,6 +17,7 @@ import cc.winboll.studio.libappbase.SOS;
|
||||
import cc.winboll.studio.libappbase.SimpleOperateSignalCenterService;
|
||||
import cc.winboll.studio.libappbase.widgets.APPSOSReportWidget;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import cc.winboll.studio.libappbase.bean.APPSOSBean;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@ -81,7 +82,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
public void onSOS(View view) {
|
||||
Intent intent = new Intent(this, TestService.class);
|
||||
stopService(intent);
|
||||
SOS.sosWinBollService(this, TestService.class);
|
||||
SOS.sosWinBollService(this, new APPSOSBean(getPackageName(), TestService.class.getName()));
|
||||
|
||||
// Intent intentTimeWidget = new Intent(this, TimeWidget.class);
|
||||
// intentTimeWidget.setAction(TimeWidget.UPDATE_TIME_ACTION);
|
||||
|
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Sun Feb 16 12:53:20 GMT 2025
|
||||
#Mon Feb 17 03:10:13 GMT 2025
|
||||
stageCount=2
|
||||
libraryProject=libappbase
|
||||
baseVersion=1.5
|
||||
publishVersion=1.5.1
|
||||
buildCount=168
|
||||
buildCount=184
|
||||
baseBetaVersion=1.5.2
|
||||
|
@ -11,15 +11,17 @@ import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
|
||||
public class AppUtils {
|
||||
|
||||
public static final String TAG = "AppUtils";
|
||||
|
||||
public static String getAppNameByPackageName(Context context, String packageName) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
try {
|
||||
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0);
|
||||
return (String) packageManager.getApplicationLabel(applicationInfo);
|
||||
} catch (NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,18 +7,17 @@ package cc.winboll.studio.libappbase;
|
||||
*/
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import cc.winboll.studio.libappbase.bean.APPSOSBean;
|
||||
|
||||
public class SOS {
|
||||
|
||||
public static final String TAG = "SOS";
|
||||
public static final String ACTION_SOS = "cc.winboll.studio.libappbase.WinBoll.ACTION_SOS";
|
||||
|
||||
public static void sosWinBollService(Context context, Class<?> clazz) {
|
||||
public static void sosWinBollService(Context context, APPSOSBean bean) {
|
||||
Intent intent = new Intent(ACTION_SOS);
|
||||
intent.putExtra("sos", "SOS");
|
||||
intent.putExtra("sosPackage", context.getPackageName());
|
||||
intent.putExtra("sosCalssType", "Service");
|
||||
intent.putExtra("sosClassName", clazz.getName());
|
||||
intent.putExtra("SOS", "Service");
|
||||
intent.putExtra("APPSOSBean", bean.toString());
|
||||
String szToPackage = "";
|
||||
if (GlobalApplication.isDebuging()) {
|
||||
szToPackage = "cc.winboll.studio.appbase.beta";
|
||||
|
@ -0,0 +1,87 @@
|
||||
package cc.winboll.studio.libappbase.bean;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/17 00:29:29
|
||||
* @Describe APPSOSReportBean
|
||||
*/
|
||||
import android.util.JsonReader;
|
||||
import android.util.JsonWriter;
|
||||
import cc.winboll.studio.libappbase.BaseBean;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class APPSOSBean extends BaseBean {
|
||||
|
||||
public static final String TAG = "APPSOSBean";
|
||||
|
||||
protected String sosPackage;
|
||||
protected String sosClassName;
|
||||
|
||||
public APPSOSBean() {
|
||||
this.sosPackage = "";
|
||||
this.sosClassName = "";
|
||||
}
|
||||
|
||||
public APPSOSBean(String sosPackage, String sosClassName) {
|
||||
this.sosPackage = sosPackage;
|
||||
this.sosClassName = sosClassName;
|
||||
}
|
||||
|
||||
public void setSosPackage(String sosPackage) {
|
||||
this.sosPackage = sosPackage;
|
||||
}
|
||||
|
||||
public String getSosPackage() {
|
||||
return sosPackage;
|
||||
}
|
||||
|
||||
public void setSosClassName(String sosClassName) {
|
||||
this.sosClassName = sosClassName;
|
||||
}
|
||||
|
||||
public String getSosClassName() {
|
||||
return sosClassName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return APPSOSBean.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
||||
super.writeThisToJsonWriter(jsonWriter);
|
||||
jsonWriter.name("sosPackage").value(getSosPackage());
|
||||
jsonWriter.name("sosClassName").value(getSosClassName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
|
||||
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
|
||||
if (name.equals("sosPackage")) {
|
||||
setSosPackage(jsonReader.nextString());
|
||||
} else if (name.equals("sosClassName")) {
|
||||
setSosClassName(jsonReader.nextString());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException {
|
||||
jsonReader.beginObject();
|
||||
while (jsonReader.hasNext()) {
|
||||
String name = jsonReader.nextName();
|
||||
if (!initObjectsFromJsonReader(jsonReader, name)) {
|
||||
jsonReader.skipValue();
|
||||
}
|
||||
}
|
||||
// 结束 JSON 对象
|
||||
jsonReader.endObject();
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package cc.winboll.studio.libappbase.bean;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/17 10:05:09
|
||||
* @Describe APPSOSReportBean
|
||||
*/
|
||||
import android.util.JsonReader;
|
||||
import android.util.JsonWriter;
|
||||
import cc.winboll.studio.libappbase.BaseBean;
|
||||
import java.io.IOException;
|
||||
|
||||
public class APPSOSReportBean extends BaseBean {
|
||||
|
||||
public static final String TAG = "APPSOSReportBean";
|
||||
|
||||
protected String sosReport;
|
||||
|
||||
public APPSOSReportBean() {
|
||||
this.sosReport = "";
|
||||
}
|
||||
|
||||
public APPSOSReportBean(String sosReport) {
|
||||
this.sosReport = sosReport;
|
||||
}
|
||||
|
||||
public void setSosReport(String sosReport) {
|
||||
this.sosReport = sosReport;
|
||||
}
|
||||
|
||||
public String getSosReport() {
|
||||
return sosReport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return APPSOSReportBean.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
||||
super.writeThisToJsonWriter(jsonWriter);
|
||||
jsonWriter.name("sosReport").value(getSosReport());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
|
||||
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
|
||||
if (name.equals("sosReport")) {
|
||||
setSosReport(jsonReader.nextString());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException {
|
||||
jsonReader.beginObject();
|
||||
while (jsonReader.hasNext()) {
|
||||
String name = jsonReader.nextName();
|
||||
if (!initObjectsFromJsonReader(jsonReader, name)) {
|
||||
jsonReader.skipValue();
|
||||
}
|
||||
}
|
||||
// 结束 JSON 对象
|
||||
jsonReader.endObject();
|
||||
return this;
|
||||
}
|
||||
}
|
@ -8,6 +8,11 @@ import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.WinBoll;
|
||||
import cc.winboll.studio.libappbase.AppUtils;
|
||||
import cc.winboll.studio.libappbase.widgets.APPSOSReportWidget;
|
||||
import cc.winboll.studio.libappbase.bean.APPSOSBean;
|
||||
import java.io.IOException;
|
||||
import cc.winboll.studio.libappbase.bean.APPSOSReportBean;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
@ -25,31 +30,45 @@ public class WinBollReceiver extends BroadcastReceiver {
|
||||
if (action.equals(WinBoll.ACTION_SOS)) {
|
||||
LogUtils.d(TAG, String.format("context.getPackageName() %s", context.getPackageName()));
|
||||
LogUtils.d(TAG, String.format("action %s", action));
|
||||
String sos = intent.getStringExtra("sos");
|
||||
LogUtils.d(TAG, String.format("sos %s", sos));
|
||||
if (sos != null && sos.equals("SOS")) {
|
||||
String sosCalssType = intent.getStringExtra("sosCalssType");
|
||||
LogUtils.d(TAG, String.format("sosCalssType %s", sosCalssType));
|
||||
if (sosCalssType != null && sosCalssType.equals("Service")) {
|
||||
String sosPackage = intent.getStringExtra("sosPackage");
|
||||
LogUtils.d(TAG, String.format("sosPackage %s", sosPackage));
|
||||
String SOS = intent.getStringExtra("SOS");
|
||||
LogUtils.d(TAG, String.format("SOS %s", SOS));
|
||||
if (SOS != null && SOS.equals("Service")) {
|
||||
String szAPPSOSBean = intent.getStringExtra("APPSOSBean");
|
||||
LogUtils.d(TAG, String.format("szAPPSOSBean %s", szAPPSOSBean));
|
||||
if (szAPPSOSBean != null) {
|
||||
try {
|
||||
APPSOSBean bean = APPSOSBean.parseStringToBean(szAPPSOSBean, APPSOSBean.class);
|
||||
if (bean != null) {
|
||||
String sosPackage = bean.getSosPackage();
|
||||
LogUtils.d(TAG, String.format("sosPackage %s", sosPackage));
|
||||
String sosClassName = bean.getSosClassName();
|
||||
LogUtils.d(TAG, String.format("sosClassName %s", sosClassName));
|
||||
|
||||
String sosClassName = intent.getStringExtra("sosClassName");
|
||||
LogUtils.d(TAG, String.format("sosClassName %s", sosClassName));
|
||||
Intent intentService = new Intent();
|
||||
intentService.setComponent(new ComponentName(sosPackage, sosClassName));
|
||||
context.startService(intentService);
|
||||
|
||||
Intent intentService = new Intent();
|
||||
intentService.setComponent(new ComponentName(sosPackage, sosClassName));
|
||||
context.startService(intentService);
|
||||
LogUtils.d(TAG, String.format("context.startService(intentService);"));
|
||||
|
||||
String appName = AppUtils.getAppNameByPackageName(context, sosPackage);
|
||||
LogUtils.d(TAG, String.format("appName %s", appName));
|
||||
Intent intentAPPSOSReportWidget = new Intent(context, APPSOSReportWidget.class);
|
||||
intentAPPSOSReportWidget.setAction(APPSOSReportWidget.ACTION_ADD_SOS_REPORT);
|
||||
intentAPPSOSReportWidget.putExtra("appName", appName);
|
||||
context.sendBroadcast(intentAPPSOSReportWidget);
|
||||
|
||||
}
|
||||
String appName = AppUtils.getAppNameByPackageName(context, sosPackage);
|
||||
LogUtils.d(TAG, String.format("appName %s", appName));
|
||||
APPSOSReportBean appSOSReportBean = new APPSOSReportBean(appName);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||
String currentTime = sdf.format(new Date());
|
||||
StringBuilder sbLine = new StringBuilder();
|
||||
sbLine.append("[");
|
||||
sbLine.append(currentTime);
|
||||
sbLine.append("] Power to ");
|
||||
sbLine.append(appName);
|
||||
appSOSReportBean.setSosReport(sbLine.toString());
|
||||
|
||||
Intent intentAPPSOSReportWidget = new Intent(context, APPSOSReportWidget.class);
|
||||
intentAPPSOSReportWidget.setAction(APPSOSReportWidget.ACTION_ADD_SOS_REPORT);
|
||||
intentAPPSOSReportWidget.putExtra("APPSOSReportBean", appSOSReportBean.toString());
|
||||
context.sendBroadcast(intentAPPSOSReportWidget);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -16,6 +16,8 @@ import cc.winboll.studio.libappbase.R;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import cc.winboll.studio.libappbase.bean.APPSOSReportBean;
|
||||
import java.io.IOException;
|
||||
|
||||
public class APPSOSReportWidget extends AppWidgetProvider {
|
||||
|
||||
@ -24,45 +26,78 @@ public class APPSOSReportWidget extends AppWidgetProvider {
|
||||
public static final String ACTION_ADD_SOS_REPORT = "cc.winboll.studio.libappbase.widgets.APPSOSReportWidget.ACTION_ADD_SOS_REPORT";
|
||||
public static final String ACTION_RELOAD_SOS_REPORT = "cc.winboll.studio.libappbase.widgets.APPSOSReportWidget.ACTION_RELOAD_SOS_REPORT";
|
||||
|
||||
volatile static ArrayList<String> _Message;
|
||||
volatile static ArrayList<APPSOSReportBean> _APPSOSReportBeanList;
|
||||
final static int _MAX_PAGES = 10;
|
||||
final static int _OnePageLinesCount = 5;
|
||||
volatile static int _CurrentPageIndex = 0;
|
||||
|
||||
@Override
|
||||
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
||||
initAPPSOSReportBeanList(context);
|
||||
for (int appWidgetId : appWidgetIds) {
|
||||
updateAppWidget(context, appWidgetManager, appWidgetId, "");
|
||||
updateAppWidget(context, appWidgetManager, appWidgetId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
super.onReceive(context, intent);
|
||||
initAPPSOSReportBeanList(context);
|
||||
if (intent.getAction().equals(ACTION_ADD_SOS_REPORT)) {
|
||||
LogUtils.d(TAG, "ACTION_ADD_SOS_REPORT");
|
||||
String sosAppName = intent.getStringExtra("appName");
|
||||
LogUtils.d(TAG, String.format("sosAppName %s", sosAppName));
|
||||
|
||||
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, APPSOSReportWidget.class));
|
||||
for (int appWidgetId : appWidgetIds) {
|
||||
updateAppWidget(context, appWidgetManager, appWidgetId, sosAppName);
|
||||
String szAPPSOSReportBean = intent.getStringExtra("APPSOSReportBean");
|
||||
LogUtils.d(TAG, String.format("szAPPSOSBean %s", szAPPSOSReportBean));
|
||||
try {
|
||||
APPSOSReportBean bean = APPSOSReportBean.parseStringToBean(szAPPSOSReportBean, APPSOSReportBean.class);
|
||||
if (bean != null) {
|
||||
addAPPSOSReportBean(context, bean);
|
||||
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, APPSOSReportWidget.class));
|
||||
for (int appWidgetId : appWidgetIds) {
|
||||
updateAppWidget(context, appWidgetManager, appWidgetId);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||
}
|
||||
} else if (intent.getAction().equals(ACTION_RELOAD_SOS_REPORT)) {
|
||||
LogUtils.d(TAG, "ACTION_RELOAD_SOS_REPORT");
|
||||
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, APPSOSReportWidget.class));
|
||||
for (int appWidgetId : appWidgetIds) {
|
||||
updateAppWidget(context, appWidgetManager, appWidgetId, "");
|
||||
updateAppWidget(context, appWidgetManager, appWidgetId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId, String sosAppName) {
|
||||
LogUtils.d(TAG, "updateAppWidget(...)");
|
||||
//
|
||||
// 加入新报告信息
|
||||
//
|
||||
void addAPPSOSReportBean(Context context, APPSOSReportBean bean) {
|
||||
initAPPSOSReportBeanList(context);
|
||||
_APPSOSReportBeanList.add(0, bean);
|
||||
// 控制记录总数
|
||||
while (_APPSOSReportBeanList.size() > _MAX_PAGES * _OnePageLinesCount) {
|
||||
_APPSOSReportBeanList.remove(_APPSOSReportBeanList.size() - 1);
|
||||
}
|
||||
APPSOSReportBean.saveBeanList(context, _APPSOSReportBeanList, APPSOSReportBean.class);
|
||||
}
|
||||
|
||||
void initAPPSOSReportBeanList(Context context) {
|
||||
if (_APPSOSReportBeanList == null) {
|
||||
_APPSOSReportBeanList = new ArrayList<APPSOSReportBean>();
|
||||
APPSOSReportBean.loadBeanList(context, _APPSOSReportBeanList, APPSOSReportBean.class);
|
||||
}
|
||||
if (_APPSOSReportBeanList == null) {
|
||||
_APPSOSReportBeanList = new ArrayList<APPSOSReportBean>();
|
||||
APPSOSReportBean.saveBeanList(context, _APPSOSReportBeanList, APPSOSReportBean.class);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) {
|
||||
LogUtils.d(TAG, "updateAppWidget(...)");
|
||||
|
||||
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
|
||||
//设置按钮点击事件
|
||||
Intent intentPre = new Intent(context, WidgetButtonClickListener.class);
|
||||
@ -74,24 +109,6 @@ public class APPSOSReportWidget extends AppWidgetProvider {
|
||||
PendingIntent pendingIntentNext = PendingIntent.getBroadcast(context, 0, intentNext, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
views.setOnClickPendingIntent(R.id.widget_button_next, pendingIntentNext);
|
||||
|
||||
// 加入新消息
|
||||
if (sosAppName != null && !sosAppName.equals("")) {
|
||||
if (_Message == null) {
|
||||
_Message = new ArrayList<String>();
|
||||
}
|
||||
// 获取当前时间并设置到TextView
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||
String currentTime = sdf.format(new Date());
|
||||
StringBuilder sbLine = new StringBuilder();
|
||||
sbLine.append("[");
|
||||
sbLine.append(currentTime);
|
||||
sbLine.append("] Power to ");
|
||||
sbLine.append(sosAppName);
|
||||
_Message.add(0, sbLine.toString());
|
||||
while (_Message.size() > _MAX_PAGES * _OnePageLinesCount) { // 控制显示在6行
|
||||
_Message.remove(_Message.size() - 1);
|
||||
}
|
||||
}
|
||||
views.setTextViewText(R.id.infoTextView, getPageInfo());
|
||||
views.setTextViewText(R.id.sosReportTextView, getMessage());
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views);
|
||||
@ -99,11 +116,11 @@ public class APPSOSReportWidget extends AppWidgetProvider {
|
||||
|
||||
public static String getMessage() {
|
||||
ArrayList<String> msgTemp = new ArrayList<String>();
|
||||
if (_Message != null) {
|
||||
if (_APPSOSReportBeanList != null) {
|
||||
int start = _OnePageLinesCount * _CurrentPageIndex;
|
||||
start = _Message.size() > start ? start : _Message.size() - 1;
|
||||
for (int i = start, j = 0; i < _Message.size() && j < _OnePageLinesCount; i++, j++) {
|
||||
msgTemp.add(_Message.get(i));
|
||||
start = _APPSOSReportBeanList.size() > start ? start : _APPSOSReportBeanList.size() - 1;
|
||||
for (int i = start, j = 0; i < _APPSOSReportBeanList.size() && j < _OnePageLinesCount; i++, j++) {
|
||||
msgTemp.add(_APPSOSReportBeanList.get(i).getSosReport());
|
||||
}
|
||||
String message = String.join("\n", msgTemp);
|
||||
return message;
|
||||
@ -112,7 +129,7 @@ public class APPSOSReportWidget extends AppWidgetProvider {
|
||||
}
|
||||
|
||||
public static void prePage(Context context) {
|
||||
if (_Message != null) {
|
||||
if (_APPSOSReportBeanList != null) {
|
||||
if (_CurrentPageIndex > 0) {
|
||||
_CurrentPageIndex = _CurrentPageIndex - 1;
|
||||
}
|
||||
@ -123,8 +140,8 @@ public class APPSOSReportWidget extends AppWidgetProvider {
|
||||
}
|
||||
|
||||
public static void nextPage(Context context) {
|
||||
if (_Message != null) {
|
||||
if ((_CurrentPageIndex + 1) * _OnePageLinesCount < _Message.size()) {
|
||||
if (_APPSOSReportBeanList != null) {
|
||||
if ((_CurrentPageIndex + 1) * _OnePageLinesCount < _APPSOSReportBeanList.size()) {
|
||||
_CurrentPageIndex = _CurrentPageIndex + 1;
|
||||
}
|
||||
Intent intentAPPSOSReportWidget = new Intent(context, APPSOSReportWidget.class);
|
||||
@ -134,11 +151,11 @@ public class APPSOSReportWidget extends AppWidgetProvider {
|
||||
}
|
||||
|
||||
String getPageInfo() {
|
||||
if (_Message == null) {
|
||||
if (_APPSOSReportBeanList == null) {
|
||||
return "0/0";
|
||||
}
|
||||
int leftCount = _Message.size() % _OnePageLinesCount;
|
||||
int currentPageCount = _Message.size() / _OnePageLinesCount + (leftCount == 0 ?0: 1);
|
||||
int leftCount = _APPSOSReportBeanList.size() % _OnePageLinesCount;
|
||||
int currentPageCount = _APPSOSReportBeanList.size() / _OnePageLinesCount + (leftCount == 0 ?0: 1);
|
||||
return String.format("%d/%d", _CurrentPageIndex + 1, currentPageCount);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user