mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-30 03:27:34 +01:00
Avoid boxing
This commit is contained in:
parent
ce2f984e9f
commit
f142003f09
@ -88,7 +88,7 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
|||||||
|
|
||||||
protected void refreshList() {
|
protected void refreshList() {
|
||||||
appList.clear();
|
appList.clear();
|
||||||
ArrayList uuids = AppManagerActivity.getUuidsFromFile(getSortFilename());
|
ArrayList<UUID> uuids = AppManagerActivity.getUuidsFromFile(getSortFilename());
|
||||||
List<GBDeviceApp> systemApps = getSystemAppsInCategory();
|
List<GBDeviceApp> systemApps = getSystemAppsInCategory();
|
||||||
boolean needsRewrite = false;
|
boolean needsRewrite = false;
|
||||||
for (GBDeviceApp systemApp : systemApps) {
|
for (GBDeviceApp systemApp : systemApps) {
|
||||||
@ -106,11 +106,11 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
|||||||
private void refreshListFromPebble(Intent intent) {
|
private void refreshListFromPebble(Intent intent) {
|
||||||
appList.clear();
|
appList.clear();
|
||||||
int appCount = intent.getIntExtra("app_count", 0);
|
int appCount = intent.getIntExtra("app_count", 0);
|
||||||
for (Integer i = 0; i < appCount; i++) {
|
for (int i = 0; i < appCount; i++) {
|
||||||
String appName = intent.getStringExtra("app_name" + i.toString());
|
String appName = intent.getStringExtra("app_name" + i);
|
||||||
String appCreator = intent.getStringExtra("app_creator" + i.toString());
|
String appCreator = intent.getStringExtra("app_creator" + i);
|
||||||
UUID uuid = UUID.fromString(intent.getStringExtra("app_uuid" + i.toString()));
|
UUID uuid = UUID.fromString(intent.getStringExtra("app_uuid" + i));
|
||||||
GBDeviceApp.Type appType = GBDeviceApp.Type.values()[intent.getIntExtra("app_type" + i.toString(), 0)];
|
GBDeviceApp.Type appType = GBDeviceApp.Type.values()[intent.getIntExtra("app_type" + i, 0)];
|
||||||
|
|
||||||
GBDeviceApp app = new GBDeviceApp(uuid, appName, appCreator, "", appType);
|
GBDeviceApp app = new GBDeviceApp(uuid, appName, appCreator, "", appType);
|
||||||
app.setOnDevice(true);
|
app.setOnDevice(true);
|
||||||
|
@ -255,7 +255,7 @@ public class HPlusCoordinator extends AbstractDeviceCoordinator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static byte getAllDayHR(String address) {
|
public static byte getAllDayHR(String address) {
|
||||||
Boolean value = (prefs.getBoolean(HPlusConstants.PREF_HPLUS_ALLDAYHR, true));
|
boolean value = (prefs.getBoolean(HPlusConstants.PREF_HPLUS_ALLDAYHR, true));
|
||||||
|
|
||||||
if(value){
|
if(value){
|
||||||
return HPlusConstants.ARG_HEARTRATE_ALLDAY_ON;
|
return HPlusConstants.ARG_HEARTRATE_ALLDAY_ON;
|
||||||
|
@ -71,9 +71,9 @@ public class CalendarEvents {
|
|||||||
private boolean fetchSystemEvents(Context mContext) {
|
private boolean fetchSystemEvents(Context mContext) {
|
||||||
|
|
||||||
Calendar cal = GregorianCalendar.getInstance();
|
Calendar cal = GregorianCalendar.getInstance();
|
||||||
Long dtStart = cal.getTimeInMillis();
|
long dtStart = cal.getTimeInMillis();
|
||||||
cal.add(Calendar.DATE, lookahead_days);
|
cal.add(Calendar.DATE, lookahead_days);
|
||||||
Long dtEnd = cal.getTimeInMillis();
|
long dtEnd = cal.getTimeInMillis();
|
||||||
|
|
||||||
Uri.Builder eventsUriBuilder = Instances.CONTENT_URI.buildUpon();
|
Uri.Builder eventsUriBuilder = Instances.CONTENT_URI.buildUpon();
|
||||||
ContentUris.appendId(eventsUriBuilder, dtStart);
|
ContentUris.appendId(eventsUriBuilder, dtStart);
|
||||||
|
@ -241,11 +241,11 @@ public abstract class AbstractDeviceSupport implements DeviceSupport {
|
|||||||
Intent appInfoIntent = new Intent(AbstractAppManagerFragment.ACTION_REFRESH_APPLIST);
|
Intent appInfoIntent = new Intent(AbstractAppManagerFragment.ACTION_REFRESH_APPLIST);
|
||||||
int appCount = appInfoEvent.apps.length;
|
int appCount = appInfoEvent.apps.length;
|
||||||
appInfoIntent.putExtra("app_count", appCount);
|
appInfoIntent.putExtra("app_count", appCount);
|
||||||
for (Integer i = 0; i < appCount; i++) {
|
for (int i = 0; i < appCount; i++) {
|
||||||
appInfoIntent.putExtra("app_name" + i.toString(), appInfoEvent.apps[i].getName());
|
appInfoIntent.putExtra("app_name" + i, appInfoEvent.apps[i].getName());
|
||||||
appInfoIntent.putExtra("app_creator" + i.toString(), appInfoEvent.apps[i].getCreator());
|
appInfoIntent.putExtra("app_creator" + i, appInfoEvent.apps[i].getCreator());
|
||||||
appInfoIntent.putExtra("app_uuid" + i.toString(), appInfoEvent.apps[i].getUUID().toString());
|
appInfoIntent.putExtra("app_uuid" + i, appInfoEvent.apps[i].getUUID().toString());
|
||||||
appInfoIntent.putExtra("app_type" + i.toString(), appInfoEvent.apps[i].getType().ordinal());
|
appInfoIntent.putExtra("app_type" + i, appInfoEvent.apps[i].getType().ordinal());
|
||||||
}
|
}
|
||||||
LocalBroadcastManager.getInstance(context).sendBroadcast(appInfoIntent);
|
LocalBroadcastManager.getInstance(context).sendBroadcast(appInfoIntent);
|
||||||
}
|
}
|
||||||
|
@ -542,7 +542,7 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_SET_HEARTRATE_MEASUREMENT_INTERVAL: {
|
case ACTION_SET_HEARTRATE_MEASUREMENT_INTERVAL: {
|
||||||
Integer seconds = intent.getIntExtra(EXTRA_INTERVAL_SECONDS, 0);
|
int seconds = intent.getIntExtra(EXTRA_INTERVAL_SECONDS, 0);
|
||||||
mDeviceSupport.onSetHeartRateMeasurementInterval(seconds);
|
mDeviceSupport.onSetHeartRateMeasurementInterval(seconds);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -497,7 +497,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
title = notificationSpec.title;
|
title = notificationSpec.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
Long ts = System.currentTimeMillis();
|
long ts = System.currentTimeMillis();
|
||||||
if (mFwMajor < 3) {
|
if (mFwMajor < 3) {
|
||||||
ts += (SimpleTimeZone.getDefault().getOffset(ts));
|
ts += (SimpleTimeZone.getDefault().getOffset(ts));
|
||||||
}
|
}
|
||||||
@ -514,7 +514,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
notificationSpec.sourceName, hasHandle, notificationSpec.cannedReplies);
|
notificationSpec.sourceName, hasHandle, notificationSpec.cannedReplies);
|
||||||
} else {
|
} else {
|
||||||
// 1.x notification on FW 2.X
|
// 1.x notification on FW 2.X
|
||||||
String[] parts = {title, notificationSpec.body, ts.toString(), subtitle};
|
String[] parts = {title, notificationSpec.body, String.valueOf(ts), subtitle};
|
||||||
// be aware that type is at this point always NOTIFICATION_EMAIL
|
// be aware that type is at this point always NOTIFICATION_EMAIL
|
||||||
return encodeMessage(ENDPOINT_NOTIFICATION, NOTIFICATION_EMAIL, 0, parts);
|
return encodeMessage(ENDPOINT_NOTIFICATION, NOTIFICATION_EMAIL, 0, parts);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ public class GB {
|
|||||||
text += ": " + context.getString(R.string.battery) + " " + device.getBatteryLevel() + "%";
|
text += ": " + context.getString(R.string.battery) + " " + device.getBatteryLevel() + "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean connected = device.isInitialized();
|
boolean connected = device.isInitialized();
|
||||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID);
|
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID);
|
||||||
builder.setContentTitle(deviceName)
|
builder.setContentTitle(deviceName)
|
||||||
.setTicker(deviceName + " - " + text)
|
.setTicker(deviceName + " - " + text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user