mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Merge pull request 'fix typos in device independent comments' (#6279)
Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/6279
This commit is contained in:
+2
-2
@@ -172,7 +172,7 @@ public class CalendarSelectionActivity extends AbstractGBActivity {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
CalendarManager.CalendarEntry item = getItem(position);
|
||||
// Invert the checkbox on click before checking it's state below.
|
||||
// Invert the checkbox on click before checking its state below.
|
||||
CheckBox selected = (CheckBox) view.findViewById(R.id.item_checkbox);
|
||||
selected.toggle();
|
||||
|
||||
@@ -221,7 +221,7 @@ public class CalendarSelectionActivity extends AbstractGBActivity {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
int color = getItem(position);
|
||||
// Invert the checkbox on click before checking it's state below.
|
||||
// Invert the checkbox on click before checking its state below.
|
||||
CheckBox selected = (CheckBox) view.findViewById(R.id.item_event_color);
|
||||
selected.toggle();
|
||||
if (selected.isChecked()) {
|
||||
|
||||
+1
-1
@@ -184,7 +184,7 @@ public class DataManagementActivity extends AbstractGBActivity {
|
||||
File myPath = FileUtils.getExternalFilesDir();
|
||||
File myFile = new File(myPath, "Export_preference_" + FileUtils.makeValidFileName(dbDevice.getIdentifier()));
|
||||
|
||||
if (!myFile.exists()) { //first try to use file in new format de_ad_be_af, if doesn't exist use old format de:at:be:af
|
||||
if (!myFile.exists()) { //first try to use file in new format de_ad_be_af, if it doesn't exist use old format de:at:be:af
|
||||
myFile = new File(myPath, "Export_preference_" + dbDevice.getIdentifier());
|
||||
LOG.info("Trying to import with older filename");
|
||||
}else{
|
||||
|
||||
+2
-2
@@ -109,7 +109,7 @@ public class ExternalPebbleJSActivity extends AbstractGBActivity {
|
||||
}
|
||||
|
||||
Objects.requireNonNull(currentDevice, "Must provide a device when invoking this activity");
|
||||
Objects.requireNonNull(currentUUID, "Must provide a uuid when invoking this activity");
|
||||
Objects.requireNonNull(currentUUID, "Must provide an uuid when invoking this activity");
|
||||
|
||||
GBApplication.deviceService(currentDevice).onAppStart(currentUUID, true);
|
||||
|
||||
@@ -128,7 +128,7 @@ public class ExternalPebbleJSActivity extends AbstractGBActivity {
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
//needed to access the DOM
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
//needed for localstorage
|
||||
//needed for local storage
|
||||
webSettings.setDatabaseEnabled(true);
|
||||
//allow local js files access
|
||||
webSettings.setAllowContentAccess(true);
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class HeartRateUtils {
|
||||
public static final int MIN_HEART_RATE_VALUE = 10;
|
||||
|
||||
/**
|
||||
* The maxiumum gap between two hr measurements in which
|
||||
* The maximum gap between two hr measurements in which
|
||||
* we interpolate between the measurements. Otherwise, two
|
||||
* distinct measurements will be shown.
|
||||
*
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ public class AppManagerActivity extends AbstractGBActivity {
|
||||
fab.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// Set up the ViewPager with the sections adapter.
|
||||
// Set up the ViewPager with the section's adapter.
|
||||
ViewPager2 viewPager = findViewById(R.id.appmanager_pager);
|
||||
if (viewPager != null) {
|
||||
viewPager.setAdapter(new SectionsStateAdapter(this));
|
||||
|
||||
+4
-4
@@ -178,7 +178,7 @@ public abstract class AbstractActivityChartFragment<D extends ChartsData> extend
|
||||
|
||||
protected List<? extends ActivitySample> getAllSamplesHighRes(DBHandler db, GBDevice device, int tsFrom, int tsTo) {
|
||||
SampleProvider<? extends ActivitySample> provider = getProvider(db, device);
|
||||
// Only retrieve if the provider signals it has high res data, otherwise it is useless
|
||||
// Only retrieve if the provider signals it has high-res data, otherwise it is useless
|
||||
if (provider.hasHighResData())
|
||||
return provider.getAllActivitySamplesHighRes(tsFrom, tsTo);
|
||||
return null;
|
||||
@@ -190,14 +190,14 @@ public abstract class AbstractActivityChartFragment<D extends ChartsData> extend
|
||||
}
|
||||
|
||||
public DefaultChartsData<LineData> refresh(GBDevice gbDevice, List<? extends ActivitySample> samples) {
|
||||
// If there is no high res samples, all the samples are high res samples
|
||||
// If there is no high-res samples, all the samples are high-res samples
|
||||
return refresh(gbDevice, samples, samples);
|
||||
}
|
||||
|
||||
public DefaultChartsData<LineData> refresh(GBDevice gbDevice, List<? extends ActivitySample> samples, List<? extends ActivitySample> highResSamples) {
|
||||
TimestampTranslation tsTranslation = new TimestampTranslation();
|
||||
LOG.info("{}: number of samples: {}", getTitle(), samples.size());
|
||||
LOG.info("{}: number of high res samples: {}", getTitle(), highResSamples.size());
|
||||
LOG.info("{}: number of high-res samples: {}", getTitle(), highResSamples.size());
|
||||
LineData lineData;
|
||||
|
||||
if (samples.isEmpty()) {
|
||||
@@ -393,7 +393,7 @@ public abstract class AbstractActivityChartFragment<D extends ChartsData> extend
|
||||
protected abstract List<? extends ActivitySample> getSamples(DBHandler db, GBDevice device, int tsFrom, int tsTo);
|
||||
|
||||
/**
|
||||
* Implement this to supply high resolution data
|
||||
* Implement this to supply high-resolution data
|
||||
*/
|
||||
protected List<? extends ActivitySample> getSamplesHighRes(DBHandler db, GBDevice device, int tsFrom, int tsTo) {
|
||||
throw new NotImplementedException("High resolution samples have not been implemented for this chart.");
|
||||
|
||||
+2
-2
@@ -179,7 +179,7 @@ public class ActivityChartsActivity extends AbstractGBActivity implements Charts
|
||||
swipeLayout.setOnRefreshListener(this::fetchRecordedData);
|
||||
enableSwipeRefresh(true);
|
||||
|
||||
// Set up the ViewPager with the sections adapter.
|
||||
// Set up the ViewPager with the section's adapter.
|
||||
final ViewPager2 viewPager = findViewById(R.id.charts_pager);
|
||||
TabLayout tabLayout = findViewById(R.id.charts_pagerTabStrip);
|
||||
|
||||
@@ -425,7 +425,7 @@ public class ActivityChartsActivity extends AbstractGBActivity implements Charts
|
||||
}
|
||||
|
||||
/**
|
||||
* A dummy fragment to avoid a crash when we get a unknown tab position (eg. broken
|
||||
* A dummy fragment to avoid a crash when we get an unknown tab position (e.g. broken
|
||||
* preference migration).
|
||||
*/
|
||||
public static class UnknownFragment extends AbstractGBFragment {
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ public class ActivityListingChartFragment extends AbstractActivityChartFragment<
|
||||
if (mcd.getStepSessions().size() == 0) {
|
||||
getChartsHost().enableSwipeRefresh(true); //enable pull to refresh, might be needed
|
||||
} else {
|
||||
getChartsHost().enableSwipeRefresh(false); //disable pull to refresh as it collides with swipable view
|
||||
getChartsHost().enableSwipeRefresh(false); //disable pull to refresh as it collides with swipeable view
|
||||
}
|
||||
|
||||
Date activityDate = new Date(tsDateTo * 1000L);
|
||||
|
||||
+1
-1
@@ -270,7 +270,7 @@ public class BodyEnergyFragment extends AbstractChartFragment<BodyEnergyFragment
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an binned average body energy curve with an arbitrary bin size.
|
||||
* Build a binned average body energy curve with an arbitrary bin size.
|
||||
*
|
||||
* @param historicDays list of samples maps (timestamp -> energy)
|
||||
* @param binSizeMinutes width of a bin in minutes (must divide 24 hours evenly)
|
||||
|
||||
+1
-1
@@ -172,7 +172,7 @@ public class CaloriesPeriodFragment extends CaloriesFragment<CaloriesPeriodFragm
|
||||
caloriesChart.getAxisLeft().setAxisMaximum((float) Math.max(set.getYMax() * 1.1, CALORIES_GOAL));
|
||||
|
||||
BarData barData = new BarData(set);
|
||||
barData.setValueTextColor(TEXT_COLOR); //prevent tearing other graph elements with the black text. Another approach would be to hide the values cmpletely with data.setDrawValues(false);
|
||||
barData.setValueTextColor(TEXT_COLOR); //prevent tearing other graph elements with the black text. Another approach would be to hide the values completely with data.setDrawValues(false);
|
||||
barData.setValueTextSize(10f);
|
||||
if (TOTAL_DAYS > 7) {
|
||||
caloriesChart.setRenderer(new AngledLabelsChartRenderer(caloriesChart, caloriesChart.getAnimator(), caloriesChart.getViewPortHandler()));
|
||||
|
||||
+1
-1
@@ -379,7 +379,7 @@ public class LiveActivityFragment extends AbstractActivityChartFragment<ChartsDa
|
||||
GBApplication.deviceService(getChartsHost().getDevice()).onEnableRealtimeSteps(enable);
|
||||
GBApplication.deviceService(getChartsHost().getDevice()).onEnableRealtimeHeartRateMeasurement(enable);
|
||||
} catch (IllegalStateException e) {
|
||||
LOG.error("IllegalStateException catched, setting realtime tracking globally to {}", enable);
|
||||
LOG.error("IllegalStateException caught, setting realtime tracking globally to {}", enable);
|
||||
GBApplication.deviceService().onEnableRealtimeSteps(enable);
|
||||
GBApplication.deviceService().onEnableRealtimeHeartRateMeasurement(enable);
|
||||
}
|
||||
|
||||
+1
-1
@@ -217,7 +217,7 @@ public class LoadFragment extends AbstractChartFragment<LoadFragment.LoadsData>
|
||||
}
|
||||
});
|
||||
|
||||
// Daily load chart chart.
|
||||
// Daily load chart.
|
||||
BarDataSet set = new BarDataSet(dailyLoadEntries, "Load");
|
||||
set.setDrawValues(true);
|
||||
set.setColors(LOAD_COLOR);
|
||||
|
||||
+1
-1
@@ -312,7 +312,7 @@ public class PaiChartFragment extends AbstractChartFragment<PaiChartFragment.Pai
|
||||
set.setValueFormatter(getRoundFormatter());
|
||||
|
||||
BarData barData = new BarData(set);
|
||||
barData.setValueTextColor(TEXT_COLOR); //prevent tearing other graph elements with the black text. Another approach would be to hide the values cmpletely with data.setDrawValues(false);
|
||||
barData.setValueTextColor(TEXT_COLOR); //prevent tearing other graph elements with the black text. Another approach would be to hide the values completely with data.setDrawValues(false);
|
||||
barData.setValueTextSize(10f);
|
||||
|
||||
barChart.getAxisLeft().setAxisMaximum(Math.max(maxPai, getPaiTarget()) + 20);
|
||||
|
||||
+1
-1
@@ -323,7 +323,7 @@ public class SleepPeriodFragment extends SleepFragment<SleepPeriodFragment.MyCha
|
||||
set.setValueFormatter(getBarValueFormatter());
|
||||
|
||||
BarData barData = new BarData(set);
|
||||
barData.setValueTextColor(Color.GRAY); //prevent tearing other graph elements with the black text. Another approach would be to hide the values cmpletely with data.setDrawValues(false);
|
||||
barData.setValueTextColor(Color.GRAY); //prevent tearing other graph elements with the black text. Another approach would be to hide the values completely with data.setDrawValues(false);
|
||||
barData.setValueTextSize(10f);
|
||||
|
||||
barChart.getAxisLeft().setAxisMaximum(Math.max(set.getYMax(), mTargetValue) + 60);
|
||||
|
||||
+3
-3
@@ -80,8 +80,8 @@ public class StepStreaksDashboard extends MaterialDialogFragment {
|
||||
|
||||
}
|
||||
|
||||
//Calculates some stats for longest streak (daily steps goal being reached for subsequent days
|
||||
//without interruption (day with steps less then goal)
|
||||
//Calculates some stats for longest streak (daily steps goal being reached for subsequent days)
|
||||
//without interruption (day with steps less than goal)
|
||||
//Possible improvements/nice to haves:
|
||||
//- cache values until new activity fetch is performed
|
||||
//- read the goals from the USER_ATTRIBUTES table. But, this would also require to be able
|
||||
@@ -212,7 +212,7 @@ public class StepStreaksDashboard extends MaterialDialogFragment {
|
||||
total.setVisibility(View.VISIBLE);
|
||||
days_total_label.setText(R.string.steps_streaks_achievement_rate);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
//labels here have diferent meaning, so we must also add proper hint
|
||||
//labels here have different meaning, so we must also add proper hint
|
||||
days_total_label.setTooltipText(getString(R.string.steps_streaks_total_days_hint_totals));
|
||||
days_total.setTooltipText(getString(R.string.steps_streaks_total_days_hint_totals));
|
||||
date_total_label.setTooltipText(getString(R.string.steps_streaks_total_steps_hint_totals));
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ public class TemperatureChartFragment extends AbstractChartFragment<TemperatureC
|
||||
mTemperatureChart.getXAxis().setValueFormatter(temperatureData.getXValueFormatter());
|
||||
mTemperatureChart.getXAxis().setAvoidFirstLastClipping(true);
|
||||
|
||||
// Using approximately the range of survivable body-temperatures (in celsius), rounded to multiples of 5
|
||||
// Using approximately the range of survivable body-temperatures (in Celsius), rounded to multiples of 5
|
||||
final boolean isMetric = temperatureUnit == TemperatureUnit.CELSIUS;
|
||||
mTemperatureChart.getAxisLeft().setAxisMinimum((float) (isMetric ? 30f : celsiusToFahrenheit(30d)));
|
||||
mTemperatureChart.getAxisLeft().setAxisMaximum((float) (isMetric ? 45f : celsiusToFahrenheit(45f)));
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ public class DashboardHrvWidget extends AbstractGaugeWidget {
|
||||
final TimeSampleProvider<? extends HrvSummarySample> hrvSummarySampleProvider = dev.getDeviceCoordinator().getHrvSummarySampleProvider(dev, dbHandler.getDaoSession());
|
||||
|
||||
if (hrvSummarySampleProvider == null) {
|
||||
LOG.warn("Device {} does not has an hrv summary sample provider", dev);
|
||||
LOG.warn("Device {} does not have a hrv summary sample provider", dev);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -137,7 +137,7 @@ class DatabaseDebugFragment : AbstractDebugFragment() {
|
||||
}.setNegativeButton(R.string.cancel) { _, _ -> }.show()
|
||||
}
|
||||
|
||||
// TODO ability to run raw sql from the UI
|
||||
// TODO ability to run raw SQL from the UI
|
||||
private fun runSql() {
|
||||
try {
|
||||
GBApplication.acquireDB().use { db ->
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ public final class DeviceSettingsUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the the prefToHide preference if none of the preferences in the preferences list are
|
||||
* Hides the prefToHide preference if none of the preferences in the preferences list are
|
||||
* visible.
|
||||
*/
|
||||
public static void hidePrefIfNoneVisible(final DeviceSpecificSettingsHandler handler,
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ import java.util.Objects;
|
||||
* <p>
|
||||
* This class contains 2 types of screens:
|
||||
* - Root screens - the ones that are displayed in the first page of the device settings activity. These can be
|
||||
* normal preference screens / preferences, or dummy root screens (see {@link DeviceSpecificSettingsScreen}.
|
||||
* normal preference screens / preferences, or dummy root screens (see {@link DeviceSpecificSettingsScreen}).
|
||||
* - Sub-screens - a screen that is opened when one of the {@link DeviceSpecificSettingsScreen} is clicked.
|
||||
* <p>
|
||||
* There can be an arbitrary number of nested sub-screens, as long as they are all mapped by key in the
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ class FileInstallerActivity : AppCompatActivity() {
|
||||
|
||||
currentUri = intent.data ?: intent.getParcelableExtra(Intent.EXTRA_STREAM)
|
||||
|
||||
// Setup the RecyclerView
|
||||
// Set up the RecyclerView
|
||||
deviceAdapter = DeviceInstallAdapter { selectedDevice ->
|
||||
launchInstallActivity(selectedDevice, handlers[selectedDevice], currentUri)
|
||||
}
|
||||
|
||||
+1
-1
@@ -232,7 +232,7 @@ public class WorkoutValueFormatter {
|
||||
}
|
||||
}
|
||||
|
||||
if (unit.equals(UNIT_SECONDS) && !show_raw_data && showUnit) { //rather then plain seconds, show formatted duration
|
||||
if (unit.equals(UNIT_SECONDS) && !show_raw_data && showUnit) { //rather than plain seconds, show formatted duration
|
||||
return DateTimeUtils.formatDurationHoursMinutes((long) value, TimeUnit.SECONDS);
|
||||
}else if (unit.equals(UNIT_SECONDS_SPORT) && !show_raw_data && showUnit) {
|
||||
return DateTimeUtils.formatSportsDuration(Math.round(1000L * (double) value), TimeUnit.MILLISECONDS);
|
||||
|
||||
+4
-4
@@ -26,7 +26,7 @@ public class GadgetbridgeUpdate_131 implements DBUpdateScript {
|
||||
|
||||
private static void fixTimeStampOfGenericMetricSample(SQLiteDatabase db) {
|
||||
// GenericMetricSamples were originally stored with epoc seconds instead
|
||||
// of the usual epoc milli seconds
|
||||
// of the usual epoc milliseconds
|
||||
// epoc 31536000000 ms = epoc 31536000 s = year 1971
|
||||
String statement = String.format("UPDATE %1$s SET %2$s = %2$s * 1000 WHERE %2$s < 31536000000",
|
||||
GenericMetricSampleDao.TABLENAME,
|
||||
@@ -35,7 +35,7 @@ public class GadgetbridgeUpdate_131 implements DBUpdateScript {
|
||||
}
|
||||
|
||||
private static void copyTrainingLoadAcute(SQLiteDatabase db) {
|
||||
// one-off copy existing data so that vizualizations
|
||||
// one-off copy existing data so that visualizations
|
||||
// and migration can be tested before removing old code paths
|
||||
final String sql;
|
||||
sql = "INSERT OR IGNORE INTO GENERIC_METRIC_SAMPLE(TIMESTAMP, DEVICE_ID, USER_ID, METRIC_TYPE ,METRIC_SCORE, METRIC_EXTRA) "
|
||||
@@ -45,7 +45,7 @@ public class GadgetbridgeUpdate_131 implements DBUpdateScript {
|
||||
}
|
||||
|
||||
private static void copyTrainingLoadChronic(SQLiteDatabase db) {
|
||||
// one-off copy existing data so that vizualizations
|
||||
// one-off copy existing data so that visualizations
|
||||
// and migration can be tested before removing old code paths
|
||||
final String sql;
|
||||
sql = "INSERT OR IGNORE INTO GENERIC_METRIC_SAMPLE(TIMESTAMP, DEVICE_ID, USER_ID, METRIC_TYPE ,METRIC_SCORE, METRIC_EXTRA) "
|
||||
@@ -55,7 +55,7 @@ public class GadgetbridgeUpdate_131 implements DBUpdateScript {
|
||||
}
|
||||
|
||||
private static void copyRestingMetabolicRate(SQLiteDatabase db) {
|
||||
// one-off copy existing data so that vizualizations
|
||||
// one-off copy existing data so that visualizations
|
||||
// and migration can be tested before removing old code paths
|
||||
final String sql;
|
||||
sql = "INSERT OR IGNORE INTO GENERIC_METRIC_SAMPLE(TIMESTAMP, DEVICE_ID, USER_ID, METRIC_TYPE ,METRIC_SCORE, METRIC_EXTRA) "
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import nodomain.freeyourgadget.gadgetbridge.entities.AlarmDao;
|
||||
public class GadgetbridgeUpdate_24 implements DBUpdateScript {
|
||||
@Override
|
||||
public void upgradeSchema(SQLiteDatabase db) {
|
||||
// Probably it isbetter to hardcode then using constants since constants could change after refactoring and potentially break migration
|
||||
// Probably it is better to hardcode then using constants since constants could change after refactoring and potentially break migration
|
||||
db.execSQL("UPDATE DEVICE SET Type=170 where (Type=80 and Manufacturer like 'Fossil%')");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import nodomain.freeyourgadget.gadgetbridge.model.BatteryState;
|
||||
|
||||
/** This event is basically the same as GBDeviceEventBatteryInfo, but it will only update the fields
|
||||
* that are explicitly set. This can be used when the caller that is sending the event doesn't have
|
||||
* all of the battery state available to make the call. For example the device has a sent an event
|
||||
* all of the battery state available to make the call. For example the device has sent an event
|
||||
* that indicates the device has started charging, but does not send the current level. If that
|
||||
* caller tries to fetch the current state and resend it, there is a race condition that may cause a
|
||||
* concurrent update to be dropped.
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ public abstract class AbstractDeviceCoordinator implements DeviceCoordinator {
|
||||
protected Pattern supportedDeviceName = null;
|
||||
|
||||
/**
|
||||
* This method should return a Regexp pattern that will matched against a found device
|
||||
* This method should return a Regexp pattern that will be matched against a found device
|
||||
* to check whether this coordinator supports that device.
|
||||
* If more sophisticated logic is needed to determine device support, the supports(GBDeviceCandidate)
|
||||
* should be overridden.
|
||||
|
||||
@@ -41,7 +41,7 @@ public interface InstallHandler {
|
||||
/**
|
||||
* Checks whether the installation of the 'element' on the device is possible
|
||||
* and configures the InstallActivity accordingly (sets helpful texts,
|
||||
* enables/disables the "Install" button, etc.
|
||||
* enables/disables the "Install" button, etc.)
|
||||
* <p/>
|
||||
* Note: may only be called if #isValid previously returned true.
|
||||
*
|
||||
|
||||
+5
-5
@@ -210,7 +210,7 @@ public class NotificationListener extends NotificationListenerService {
|
||||
StatusBarNotification[] sbns = NotificationListener.this.getActiveNotifications();
|
||||
Long ts = mNotificationHandleLookup.lookup(handle);
|
||||
if (ts == null) {
|
||||
LOG.info("could not lookup handle for open action");
|
||||
LOG.info("could not look up handle for open action");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ public class NotificationListener extends NotificationListenerService {
|
||||
case ACTION_MUTE:
|
||||
String packageName = mPackageLookup.lookup(handle);
|
||||
if (packageName == null) {
|
||||
LOG.info("could not lookup handle for mute action");
|
||||
LOG.info("could not look up handle for mute action");
|
||||
break;
|
||||
}
|
||||
LOG.info("going to mute {}", packageName);
|
||||
@@ -245,7 +245,7 @@ public class NotificationListener extends NotificationListenerService {
|
||||
StatusBarNotification[] sbns = NotificationListener.this.getActiveNotifications();
|
||||
Long ts = mNotificationHandleLookup.lookup(handle);
|
||||
if (ts == null) {
|
||||
LOG.info("could not lookup handle for dismiss action");
|
||||
LOG.info("could not look up handle for dismiss action");
|
||||
break;
|
||||
}
|
||||
for (StatusBarNotification sbn : sbns) {
|
||||
@@ -737,7 +737,7 @@ public class NotificationListener extends NotificationListenerService {
|
||||
}
|
||||
|
||||
if (app.equals("com.microsoft.teams")) {
|
||||
// #5525 - microsoft teams spams notifications with slightly increasing timestamps
|
||||
// #5525 - Microsoft Teams spams notifications with slightly increasing timestamps
|
||||
// we use a different key for the burst prevention to prevent suppressing notifications
|
||||
final String burstPreventionKey = "call:" + app;
|
||||
final Long notificationBurstPreventionValue = notificationBurstPrevention.get(burstPreventionKey);
|
||||
@@ -745,7 +745,7 @@ public class NotificationListener extends NotificationListenerService {
|
||||
if (notificationBurstPreventionValue != null) {
|
||||
long diff = curTime - notificationBurstPreventionValue;
|
||||
if (diff < TimeUnit.SECONDS.toNanos(1)) {
|
||||
LOG.info("Ignoring burst call notification from microsoft teams, last one was {} ms ago", TimeUnit.NANOSECONDS.toMillis(diff));
|
||||
LOG.info("Ignoring burst call notification from Microsoft Teams, last one was {} ms ago", TimeUnit.NANOSECONDS.toMillis(diff));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -272,7 +272,7 @@ public class ActivitySummaryEntries {
|
||||
public static final String UNIT_LITER = "unit_liter";
|
||||
/// UNIX epoc seconds to be formated in local time without showing date
|
||||
public static final String UNIT_EPOC_TIME = "unit_epoc_time";
|
||||
/// display time including milli seconds if any
|
||||
/// display time including milliseconds if any
|
||||
public static final String UNIT_SECONDS_SPORT = "unit_sports_seconds";
|
||||
public static final String UNIT_FOOT = "ft";
|
||||
public static final String UNIT_FOOT_PER_HOUR = "foot_per_hour";
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ import nodomain.freeyourgadget.gadgetbridge.model.workout.Workout;
|
||||
|
||||
public interface ActivitySummaryParser {
|
||||
/**
|
||||
* Re-parse an existing {@link BaseActivitySummary}, updating it from the existing binary data.
|
||||
* Reparse an existing {@link BaseActivitySummary}, updating it from the existing binary data.
|
||||
*
|
||||
* @param summary the existing {@link BaseActivitySummary}. It's not guaranteed that it
|
||||
* contains any raw binary data.
|
||||
|
||||
@@ -90,7 +90,7 @@ public interface MetricSample extends TimeSample {
|
||||
/// @see FitHillScore#getLevel()
|
||||
GARMIN_HILL_STRENGTH(5, UNIT_NONE),
|
||||
/// This is a metabolic equivalent (MET) version of {@link #GENERIC_MAXIMUM_OXYGEN_UPTAKE}.
|
||||
/// Estimated using 24/7 monitoring instead of high resolution activity recordings.
|
||||
/// Estimated using 24/7 monitoring instead of high-resolution activity recordings.
|
||||
///
|
||||
/// @see FitMaxMetData#getVo2Max()
|
||||
/// @see FitMaxMetData#getMaxMetCategory()
|
||||
|
||||
@@ -370,8 +370,8 @@ class WeatherSpec() : Parcelable {
|
||||
var co: Float = -1f // Carbon Monoxide, mg/m^3
|
||||
var no2: Float = -1f // Nitrogen Dioxide, ug/m^3
|
||||
var o3: Float = -1f // Ozone, ug/m^3
|
||||
var pm10: Float = -1f // Particulate Matter, 10 microns or less in diameter, ug/m^3
|
||||
var pm25: Float = -1f // Particulate Matter, 2.5 microns or less in diameter, ug/m^3
|
||||
var pm10: Float = -1f // Particulate Matter, 10 microns or fewer in diameter, ug/m^3
|
||||
var pm25: Float = -1f // Particulate Matter, 2.5 microns or fewer in diameter, ug/m^3
|
||||
var so2: Float = -1f // Sulphur Dioxide, ug/m^3
|
||||
|
||||
// Air Quality Index values per pollutant
|
||||
|
||||
+2
-2
@@ -340,10 +340,10 @@ object WeatherMapper {
|
||||
2 = cloudy - cloud
|
||||
3 = overcast - two clouds
|
||||
4 = showers - cloud with rain
|
||||
5 = snow showers - showflake
|
||||
5 = snow showers - snowflake
|
||||
6 = fog - multiple lines showing "fog"
|
||||
|
||||
9 = thunder showers - lightning
|
||||
9 = thundershowers - lightning
|
||||
|
||||
14 = sleet - cloud with dots under
|
||||
|
||||
|
||||
+1
-1
@@ -610,7 +610,7 @@ public class PreferenceMigrator55 extends AbstractPreferenceMigrator {
|
||||
}
|
||||
|
||||
if (oldVersion < 19) {
|
||||
//remove old ble scanning prefences, now unsupported
|
||||
//remove old ble scanning preferences, now unsupported
|
||||
editor.remove("disable_new_ble_scanning");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -868,7 +868,7 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
||||
|
||||
/**
|
||||
* @param text original text
|
||||
* @return 'text' or a new String without non supported chars like emoticons, etc.
|
||||
* @return 'text' or a new String without non-supported chars like emoticons, etc.
|
||||
*/
|
||||
private String sanitizeNotifText(String text, GBDevice device) throws DeviceNotFoundException {
|
||||
if (text == null || text.length() == 0)
|
||||
@@ -968,7 +968,7 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
||||
|| (notificationSpec.type == NotificationType.GENERIC_SMS && notificationSpec.phoneNumber != null)) {
|
||||
// NOTE: maybe not where it belongs
|
||||
// I would rather like to save that as an array in SharedPreferences
|
||||
// this would work but I dont know how to do the same in the Settings Activity's xml
|
||||
// this would work but I don't know how to do the same in the Settings Activity's xXML
|
||||
ArrayList<String> replies = new ArrayList<>();
|
||||
for (int i = 1; i <= 16; i++) {
|
||||
String reply = devicePrefs.getString("canned_reply_" + i, null);
|
||||
|
||||
@@ -109,7 +109,7 @@ public interface DeviceSupport extends EventHandler {
|
||||
|
||||
/**
|
||||
* Returns true if a connection attempt shall be made automatically whenever
|
||||
* needed (e.g. when a notification shall be sent to the device while not connected.
|
||||
* needed (e.g. when a notification shall be sent to the device while not connected).
|
||||
*/
|
||||
boolean useAutoConnect();
|
||||
|
||||
|
||||
+2
-2
@@ -173,7 +173,7 @@ public class SleepAsAndroidSender {
|
||||
/**
|
||||
* Same as {@link #pauseTracking(long)} but pausing and resuming is controlled by a toggle
|
||||
*
|
||||
* @param suspended true if the tracking should be paused, false if should be resumed
|
||||
* @param suspended true if the tracking should be paused, false if it should be resumed
|
||||
*/
|
||||
public void pauseTracking(boolean suspended) {
|
||||
if (!isDeviceDefault() || !trackingOngoing) return;
|
||||
@@ -316,7 +316,7 @@ public class SleepAsAndroidSender {
|
||||
* On heart rate changed
|
||||
*
|
||||
* @param hr the heart rate
|
||||
* @param sendDelay the send delay in ms. If 0 the data will be send right away. Anything bigger will gather all the data then send it all after the specified interval
|
||||
* @param sendDelay the send delay in ms. If 0 the data will be sent right away. Anything bigger will gather all the data then send it all after the specified interval
|
||||
*/
|
||||
public void onHrChanged(float hr, long sendDelay) {
|
||||
if (!isDeviceDefault() || !isFeatureEnabled(SleepAsAndroidFeature.HEART_RATE) || !hasFeature(SleepAsAndroidFeature.HEART_RATE) || !trackingOngoing)
|
||||
|
||||
+1
-1
@@ -137,7 +137,7 @@ public abstract class AbstractBTBRDeviceSupport extends AbstractDeviceSupport im
|
||||
|
||||
@Override
|
||||
public boolean isConnected() {
|
||||
// in a multi-threaded environment the queue knows
|
||||
// in a multithreaded environment the queue knows
|
||||
// best about the up-to-date connection status
|
||||
return (mQueue != null) && mQueue.isConnected();
|
||||
}
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ public abstract class AbstractBTLESingleDeviceSupport extends AbstractBTLEDevice
|
||||
|
||||
@Override
|
||||
public boolean isConnected(){
|
||||
// in a multi-threaded environment the queue knows
|
||||
// in a multithreaded environment the queue knows
|
||||
// best about the up-to-date connection status
|
||||
return (mQueue != null) && mQueue.isConnected();
|
||||
}
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ public class BLETypeConversions {
|
||||
);
|
||||
|
||||
if (value.length > 7) {
|
||||
/* when we get a timezone offset via BLE, we cannot know which timeszone this is (only its offset), so
|
||||
/* when we get a timezone offset via BLE, we cannot know which timezone this is (only its offset), so
|
||||
set to UTC which does not use DST to prevent bugs when setting the raw offset below */
|
||||
TimeZone timeZone = TimeZone.getTimeZone("UTC");
|
||||
timeZone.setRawOffset(value[7] * 15 * 60 * 1000);
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public interface BTLEOperation {
|
||||
void perform() throws IOException;
|
||||
|
||||
/**
|
||||
* Returns a human readable name of this operation, to be used e.g. in log output.
|
||||
* Returns a human-readable name of this operation, to be used e.g. in log output.
|
||||
*/
|
||||
String getName();
|
||||
}
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public class Transaction extends AbstractTransaction {
|
||||
|
||||
/**
|
||||
* Returns whether the gatt callback should be modified for this transaction (either set, or
|
||||
* unset if {@code getGattCallback} is null.
|
||||
* unset if {@code getGattCallback} is null).
|
||||
*/
|
||||
public boolean isModifyGattCallback() {
|
||||
return modifyGattCallback;
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public abstract class AbstractBleProfile<T extends AbstractBTLESingleDeviceSuppo
|
||||
}
|
||||
|
||||
/**
|
||||
* All notifications should be sent through this methods to make them testable.
|
||||
* All notifications should be sent through this method to make them testable.
|
||||
* @param intent the intent to broadcast
|
||||
*/
|
||||
protected void notify(Intent intent) {
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ public class HealthThermometerProfile <T extends AbstractBTLESingleDeviceSupport
|
||||
private void handleTemperatureMeasurement(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, byte[] raw) {
|
||||
/*
|
||||
* This metadata contains as bits:
|
||||
* the unit (celsius (0) or fahrenheit (1)) (bit 7 (last bit))
|
||||
* the unit (Celsius (0) or Fahrenheit (1)) (bit 7 (last bit))
|
||||
* if a timestamp is present (1) or not present (0) (bit 6)
|
||||
* if a temperature type is present (1) or not present (0) (bit 5)
|
||||
*/
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ public class GBMusicControlReceiver extends BroadcastReceiver {
|
||||
final long eventTime = SystemClock.uptimeMillis();
|
||||
|
||||
if (prefs.getBoolean("pref_deprecated_media_control", false)) {
|
||||
// Deprecated path - mb_intents works for some players and not others, and vice-versa
|
||||
// Deprecated path - mb_intents works for some players and not others, and vice versa
|
||||
|
||||
if (prefs.getBoolean("mb_intents", false)) {
|
||||
String audioPlayer = getAudioPlayer(context);
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.AbstractDeviceSupport;
|
||||
|
||||
/**
|
||||
* An abstract base class for devices speaking a serial protocol, like via
|
||||
* an rfcomm bluetooth socket or a TCP socket.
|
||||
* a rfcomm bluetooth socket or a TCP socket.
|
||||
* <p/>
|
||||
* This class uses two helper classes to deal with that:
|
||||
* - GBDeviceIoThread, which creates and maintains the actual socket connection and implements the transport layer
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public final class ActivitySummaryUtils {
|
||||
|
||||
ActivityTrack activityTrack = activityTrackProvider.getActivityTrack(summary);
|
||||
if (activityTrack == null) {
|
||||
// Attempt to fallback to existing gpx file
|
||||
// Attempt to fall back to existing gpx file
|
||||
if (!(activityTrackProvider instanceof GpxActivityTrackProvider)) {
|
||||
activityTrack = new GpxActivityTrackProvider().getActivityTrack(summary);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class AlarmUtils {
|
||||
|
||||
/**
|
||||
* Creates a Calendar object representing the time of the given alarm (not taking the
|
||||
* day/date into account.
|
||||
* day/date into account).
|
||||
* @param alarm
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -108,7 +108,7 @@ public class EmojiConverter {
|
||||
}
|
||||
|
||||
public static synchronized EmojiManager getEmojiManager(final Context context) {
|
||||
// Do a lazy initialisation not to slowdown the startup and when it is needed
|
||||
// Do a lazy initialisation not to slow down the startup and when it is needed
|
||||
if (emojiManagerInstance == null) {
|
||||
emojiManagerInstance = EmojiManager.Companion.create(context, new GsonDeserializer());
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class FileUtils {
|
||||
);
|
||||
|
||||
/**
|
||||
* Copies the the given sourceFile to destFile, overwriting it, in case it exists.
|
||||
* Copies the given sourceFile to destFile, overwriting it, in case it exists.
|
||||
*/
|
||||
public static void copyFile(File sourceFile, File destFile) throws IOException {
|
||||
if (!sourceFile.exists()) {
|
||||
@@ -143,7 +143,7 @@ public class FileUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the content of a file to an uri,
|
||||
* Copies the content of a file to a uri,
|
||||
* which for example was retrieved using the storage access framework.
|
||||
* @param context the application context.
|
||||
* @param src the file from which the content should be copied.
|
||||
@@ -160,7 +160,7 @@ public class FileUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the textual contents of the given file. The contents is expected to be
|
||||
* Returns the textual contents of the given file. The content is expected to be
|
||||
* in UTF-8 encoding.
|
||||
* @param file the file to read
|
||||
* @return the file contents as a newline-delimited string
|
||||
|
||||
@@ -374,8 +374,8 @@ public class RtlUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function return the contextual state of a given character, depend of the previous
|
||||
* character state and the next charachter.
|
||||
* This function return the contextual state of a given character, depending on the previous
|
||||
* character state and the next character.
|
||||
* @param prevState - previous character state or isolated if none
|
||||
* @param curChar - the current character
|
||||
* @param nextChar - the next character or null if none
|
||||
@@ -404,7 +404,7 @@ public class RtlUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* this function convert given string to it's contextual form
|
||||
* this function convert given string to its contextual form
|
||||
* @param s - the given string
|
||||
* @return the contextual form of the string
|
||||
*/
|
||||
@@ -490,7 +490,7 @@ public class RtlUtils {
|
||||
/**
|
||||
* The function get a string and fix the rtl words.
|
||||
* since simple reverse puts the beginning of the text at the end, the text should have been from bottom to top.
|
||||
* To avoid that, we save the text in lines (line max size can be change in the settings)
|
||||
* To avoid that, we save the text in lines (line max size can be changed in the settings)
|
||||
* @param oldString - the string to fix.
|
||||
* @return a fix string.
|
||||
*/
|
||||
|
||||
@@ -49,7 +49,7 @@ public class StringUtils {
|
||||
|
||||
/**
|
||||
* Truncate a string to a certain maximum number of bytes, assuming UTF-8 encoding.
|
||||
* Does not include the null terminator. Due to multi-byte characters, it's possible
|
||||
* Does not include the null terminator. Due to multibyte characters, it's possible
|
||||
* that the resulting array is smaller than len, but never larger.
|
||||
*/
|
||||
public static byte[] truncateToBytes(final String s, final int len) {
|
||||
|
||||
+2
-2
@@ -138,8 +138,8 @@ public class LanguageUtils {
|
||||
}
|
||||
|
||||
if (!coordinator.supportsUnicodeEmojis(device)) {
|
||||
// For now, assume that if the device does not support unicode emoji, it also doesn't
|
||||
// support utf, so flatten to ASCII. This allows for devices that support unicode
|
||||
// For now, assume that if the device does not support Unicode emoji, it also doesn't
|
||||
// support utf, so flatten to ASCII. This allows for devices that support Unicode
|
||||
// characters to still use transliterators for languages not supported by the device,
|
||||
// and still get emoji
|
||||
// TODO: Maybe this should be configurable, or at least separate from the emoji setting
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import java.util.Objects;
|
||||
|
||||
public class ArmenianTransliterator implements Transliterator {
|
||||
// Transliteration map ordered by priority
|
||||
// Armenian has some rules regarding reading of 'ո' in the middle of the word it reads as english O
|
||||
// Armenian has some rules regarding reading of 'ո' in the middle of the word it reads as English O
|
||||
// But if word starts with it's read as sound of 'vo'
|
||||
// Or if it has 'ւ' symbol after it, then we should read it as 'u' (as double o in booze)
|
||||
private static final Map<String, String> transliterateMap = new LinkedHashMap<String, String>() {
|
||||
|
||||
Reference in New Issue
Block a user