1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-08-24 00:00:47 +02:00

Fixed a bunch of misspellings and formatting

This commit is contained in:
Bot 2020-08-26 05:34:41 +03:00 committed by TaaviE
parent c9d98e60a9
commit 40852d3641
28 changed files with 83 additions and 82 deletions

View File

@ -29,13 +29,14 @@ import android.preference.PreferenceManager;
import android.text.InputType;
import android.view.MenuItem;
import androidx.core.app.NavUtils;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Locale;
import androidx.core.app.NavUtils;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils;

View File

@ -29,6 +29,9 @@ import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.core.app.NavUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -36,8 +39,6 @@ import java.util.List;
import java.util.Objects;
import java.util.UUID;
import androidx.annotation.NonNull;
import androidx.core.app.NavUtils;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager;

View File

@ -364,7 +364,7 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
// enable touch gestures
chart.setTouchEnabled(true);
// commented out: this has weird bugs/sideeffects at least on WeekStepsCharts
// commented out: this has weird bugs/side-effects at least on WeekStepsCharts
// where only the first Day-label is drawn, because AxisRenderer.computeAxisValues(float,float)
// appears to have an overflow when calculating 'n' (number of entries)
// chart.getXAxis().setGranularity(60*5);

View File

@ -125,13 +125,13 @@ public abstract class AbstractWeekChartFragment extends AbstractChartFragment {
ArrayList<String> labels = new ArrayList<String>();
long balance = 0;
long daily_balance=0;
long daily_balance = 0;
TOTAL_DAYS_FOR_AVERAGE=0;
for (int counter = 0; counter < TOTAL_DAYS; counter++) {
ActivityAmounts amounts = getActivityAmountsForDay(db, day, device);
daily_balance=calculateBalance(amounts);
if (daily_balance>0){
if (daily_balance > 0) {
TOTAL_DAYS_FOR_AVERAGE++;
}

View File

@ -24,7 +24,7 @@ import nodomain.freeyourgadget.gadgetbridge.entities.DaoMaster;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
/**
* Provides lowlevel access to the database.
* Provides low-level access to the database.
*/
public interface DBHandler extends AutoCloseable {
/**

View File

@ -22,6 +22,9 @@ import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -36,17 +39,13 @@ import java.util.List;
import java.util.Locale;
import java.util.Objects;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import de.greenrobot.dao.Property;
import de.greenrobot.dao.query.Query;
import de.greenrobot.dao.query.QueryBuilder;
import de.greenrobot.dao.query.WhereCondition;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsActivity;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
import nodomain.freeyourgadget.gadgetbridge.entities.ActivityDescription;
import nodomain.freeyourgadget.gadgetbridge.entities.ActivityDescriptionDao;
import nodomain.freeyourgadget.gadgetbridge.entities.Alarm;
@ -71,7 +70,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
/**
* Provides utiliy access to some common entities, so you won't need to use
* Provides utility access to some common entities, so you won't need to use
* their DAO classes.
* <p/>
* Maybe this code should actually be in the DAO classes themselves, but then

View File

@ -20,9 +20,10 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip;
import android.content.Context;
import android.net.Uri;
import androidx.annotation.NonNull;
import java.io.IOException;
import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipFirmwareInfo;
@ -37,7 +38,7 @@ public class AmazfitBipFWHelper extends HuamiFWHelper {
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
firmwareInfo = new AmazfitBipFirmwareInfo(wholeFirmwareBytes);
if (!firmwareInfo.isHeaderValid()) {
throw new IllegalArgumentException("Not a an Amazifit Bip firmware");
throw new IllegalArgumentException("Not a an Amazfit Bip firmware");
}
}
}

View File

@ -38,7 +38,7 @@ public class AmazfitBipLiteFWHelper extends HuamiFWHelper {
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
firmwareInfo = new AmazfitBipLiteFirmwareInfo(wholeFirmwareBytes);
if (!firmwareInfo.isHeaderValid()) {
throw new IllegalArgumentException("Not a an Amazifit Bip Lite firmware");
throw new IllegalArgumentException("Not a an Amazfit Bip Lite firmware");
}
}
}

View File

@ -20,8 +20,6 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr;
import android.content.Context;
import android.net.Uri;
import androidx.annotation.NonNull;
import java.io.IOException;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
@ -37,7 +35,7 @@ public class AmazfitGTRFWHelper extends HuamiFWHelper {
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
firmwareInfo = new AmazfitGTRFirmwareInfo(wholeFirmwareBytes);
if (!firmwareInfo.isHeaderValid()) {
throw new IllegalArgumentException("Not a an Amazifit GTR firmware");
throw new IllegalArgumentException("Not a an Amazfit GTR firmware");
}
}
}

View File

@ -35,7 +35,7 @@ public class AmazfitGTRLiteFWHelper extends HuamiFWHelper {
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
firmwareInfo = new AmazfitGTRLiteFirmwareInfo(wholeFirmwareBytes);
if (!firmwareInfo.isHeaderValid()) {
throw new IllegalArgumentException("Not a an Amazifit GTR Lite Firmware");
throw new IllegalArgumentException("Not a an Amazfit GTR Lite Firmware");
}
}
}

View File

@ -35,7 +35,7 @@ public class AmazfitGTSFWHelper extends HuamiFWHelper {
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
firmwareInfo = new AmazfitGTSFirmwareInfo(wholeFirmwareBytes);
if (!firmwareInfo.isHeaderValid()) {
throw new IllegalArgumentException("Not a an Amazifit GTS firmware");
throw new IllegalArgumentException("Not a an Amazfit GTS firmware");
}
}
}

View File

@ -20,8 +20,6 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrex;
import android.content.Context;
import android.net.Uri;
import androidx.annotation.NonNull;
import java.io.IOException;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
@ -37,7 +35,7 @@ public class AmazfitTRexFWHelper extends HuamiFWHelper {
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
firmwareInfo = new AmazfitTRexFirmwareInfo(wholeFirmwareBytes);
if (!firmwareInfo.isHeaderValid()) {
throw new IllegalArgumentException("Not a an Amazifit T-Rex firmware");
throw new IllegalArgumentException("Not a an Amazfit T-Rex firmware");
}
}
}

View File

@ -19,13 +19,11 @@ package nodomain.freeyourgadget.gadgetbridge.devices.jyou;
import java.util.UUID;
import static nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport.BASE_UUID;
public final class BFH16Constants {
//Known Services
public static final UUID BFH16_GENERIC_ACCESS_SERVICE = UUID.fromString("00001800-0000-1000-8000-00805f9b34fb");
public static final UUID BFH16_GENERIC_ARTTRIBUTE_SERVICE = UUID.fromString("00001801-0000-1000-8000-00805f9b34fb");
public static final UUID BFH16_GENERIC_ATTRIBUTE_SERVICE = UUID.fromString("00001801-0000-1000-8000-00805f9b34fb");
public static final UUID BFH16_IDENTIFICATION_SERVICE1 = UUID.fromString("0000fef5-0000-1000-8000-00805f9b34fb");
public static final UUID BFH16_IDENTIFICATION_SERVICE2 = UUID.fromString("0000fee7-0000-1000-8000-00805f9b34fb");

View File

@ -139,7 +139,7 @@ public class CalendarReceiver extends BroadcastReceiver {
for (CalendarSyncState CalendarSyncState : CalendarSyncStateList) {
if (!eventState.containsKey(CalendarSyncState.getCalendarEntryId())) {
eventState.put(CalendarSyncState.getCalendarEntryId(), new EventSyncState(null, EventState.NEEDS_DELETE));
LOG.info("insert null event for orphanded calendar id=" + CalendarSyncState.getCalendarEntryId() + " for device=" + mGBDevice.getName());
LOG.info("insert null event for orphaned calendar id=" + CalendarSyncState.getCalendarEntryId() + " for device=" + mGBDevice.getName());
}
}

View File

@ -20,7 +20,7 @@ import java.io.Serializable;
public interface Alarm extends Serializable {
/**
* The {@link android.os.Bundle} name for transferring pacreled alarms.
* The {@link android.os.Bundle} name for transferring parceled alarms.
*/
String EXTRA_ALARM = "alarm";

View File

@ -43,7 +43,7 @@ public class CalendarEvents {
//further: primaryColor, secondaryColor, backgroundColor, headings, paragraphs, lastUpdated
// taken from: https://developer.getpebble.com/guides/timeline/pin-structure/
// needed for miband:
// needed for MiBand:
// time
private static final String[] EVENT_INSTANCE_PROJECTION = new String[]{

View File

@ -22,6 +22,8 @@ import android.bluetooth.BluetoothSocket;
import android.content.Context;
import android.os.ParcelUuid;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -31,7 +33,6 @@ import java.io.OutputStream;
import java.net.SocketTimeoutException;
import java.util.UUID;
import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.service.serial.AbstractSerialDeviceSupport;
@ -45,7 +46,6 @@ public abstract class BtClassicIoThread extends GBDeviceIoThread {
private final GBDeviceProtocol mProtocol;
private final AbstractSerialDeviceSupport mDeviceSupport;
private BluetoothAdapter mBtAdapter = null;
private BluetoothSocket mBtSocket = null;
private InputStream mInStream = null;

View File

@ -33,6 +33,8 @@ import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -44,13 +46,11 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
import androidx.annotation.Nullable;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.Logging;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice.State;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.receivers.AutoConnectIntervalReceiver;
/**
* One queue/thread per connectable device.

View File

@ -60,7 +60,7 @@ public class AmazfitBipLiteFirmwareInfo extends HuamiFirmwareInfo {
@Override
protected HuamiFirmwareType determineFirmwareType(byte[] bytes) {
if (ArrayUtils.startsWith(bytes, NEWRES_HEADER)) {
if ((bytes.length <= 100000) || (bytes.length > 700000)) { // dont know how to distinguish from Cor/Mi Band 3 .res
if ((bytes.length <= 100000) || (bytes.length > 700000)) { // don't know how to distinguish from Cor/Mi Band 3 .res
return HuamiFirmwareType.INVALID;
}
return HuamiFirmwareType.RES;

View File

@ -485,7 +485,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
}
}
// set only digytal time
// set only digital time
private void setTime(Calendar calendar) {
try {
TransactionBuilder builder = performInitialized("setTime");
@ -634,7 +634,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
case CallSpec.CALL_INCOMING:
isRinging = true;
remainingRepeats = repeatCount;
LOG.info(" Incomming call ");
LOG.info(" Incoming call ");
if (("Phone".equals(callSpec.name)) || (callSpec.name.contains("ropusn")) || (callSpec.name.contains("issed"))) {
// do nothing for notifications without caller name, e.g. system call event
} else {
@ -1168,14 +1168,14 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
buildCommand(WatchXPlusConstants.CMD_SET_UNITS,
WatchXPlusConstants.READ_VALUE));
builder.queue(getQueue());
} catch (IOException e) {
} catch (IOException e) {
LOG.warn(" Unable to get units ", e);
}
return this;
return this;
}
/** set watch units
*
/**
* Set watch units
*/
private void setUnitsSettings() {
int units = 0;
@ -1190,7 +1190,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
byte[] bArr = new byte[3];
bArr[0] = (byte) units; // metric - 0/imperial - 1
bArr[1] = (byte) 0x00; //time unit 12/24h (there are separate command for this)
bArr[1] = (byte) 0x00; // time unit 12/24h (there is a separate command for this)
bArr[2] = (byte) 0x00; // temperature unit (do nothing)
try {
TransactionBuilder builder = performInitialized("setUnits");

View File

@ -251,8 +251,10 @@ public class QHybridSupport extends QHybridBaseSupport {
globalCommandReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if(watchAdapter == null) return;
//noinspection SwitchStatementWithTooFewBranches
if (watchAdapter == null) {
return;
}
switch (intent.getAction()) {
case QHYBRID_ACTION_SET_ACTIVITY_HAND: {
try {

View File

@ -32,7 +32,7 @@ public class Alarm {
private final boolean repeat;
private String title, message;
public Alarm(byte minute, byte hour, String title, String message){
public Alarm(byte minute, byte hour, String title, String message) {
this.minute = minute;
this.hour = hour;
this.repeat = false;

View File

@ -22,7 +22,6 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.fossil.FossilWatchAdapter;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FileGetRequest;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FileLookupAndGetRequest;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
@ -61,6 +60,7 @@ public class AlarmsGetRequest extends FileLookupAndGetRequest {
for(int i = 0; i < alarms.length; i++){
alarms2[i] = Alarm.fromBytes(alarms[i].getData());
}
// TODO: This does nothing currently!
}
@Override

View File

@ -73,21 +73,21 @@ public class AlarmsSetRequest extends FilePutRequest {
String message = alarm.getMessage();
int alarmSize = 17 + label.length() + message.length();
buffer.put((byte) 0x00); // dunno why
buffer.putShort((short) (alarmSize - 3)); // alarm size, 0 above and this does not count
buffer.put((byte) 0x00); // prolly entry id time data
buffer.putShort((short) 3); // prolly entry length
buffer.put((byte) 0x00); // No information why
buffer.putShort((short) (alarmSize - 3)); // Alarm size, 0 above and this does not count
buffer.put((byte) 0x00); // Probably entry id time data
buffer.putShort((short) 3); // Probably entry length
buffer.put(alarm.getData());
buffer.put((byte) 0x01); // another entry id label
buffer.putShort((short) (label.length() + 1)); // entry length
buffer.put((byte) 0x01); // Another entry id label
buffer.putShort((short) (label.length() + 1)); // Entry length
buffer.put(label.getBytes());
buffer.put((byte) 0x00); // null terminator
buffer.put((byte) 0x00); // Null terminator
buffer.put((byte) 0x02); // entry id subtext
buffer.putShort((short) (message.length() + 1)); // entry length
buffer.put((byte) 0x02); // Entry ID subtext
buffer.putShort((short) (message.length() + 1)); // Entry length
buffer.put(message.getBytes());
buffer.put((byte) 0x00); // null terminator
buffer.put((byte) 0x00); // Null terminator
}
}

View File

@ -64,7 +64,6 @@ public class ConfigurationPutRequest extends FilePutRequest {
GB.log("error", GB.ERROR, e);
continue;
}
item.parseData(payload);
configItems.add(item);

View File

@ -17,6 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.util;
import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
@ -25,7 +27,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;

View File

@ -35,15 +35,16 @@ import android.provider.MediaStore;
import android.text.TextUtils;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.FileProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Locale;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.FileProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
@ -148,10 +149,11 @@ public class AndroidUtils {
}
/**
* As seen on stackoverflow https://stackoverflow.com/a/36714242/1207186
* As seen on StackOverflow https://stackoverflow.com/a/36714242/1207186
* Try to find the file path of a document uri
*
* @param context the application context
* @param uri the Uri for which the path should be resolved
* @param uri the Uri for which the path should be resolved
* @return the path corresponding to the Uri as a String
* @throws IllegalArgumentException on any problem decoding the uri to a path
*/
@ -170,7 +172,7 @@ public class AndroidUtils {
}
/**
* As seen on stackoverflow https://stackoverflow.com/a/36714242/1207186
* As seen on StackOverflow https://stackoverflow.com/a/36714242/1207186
* Try to find the file path of a document uri
* @param context the application context
* @param uri the Uri for which the path should be resolved

View File

@ -36,6 +36,8 @@ import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -46,7 +48,6 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.webview.GBChromeClient;
import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.webview.GBWebClient;
@ -55,7 +56,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.webview.JSInt
public class WebViewSingleton {
private static final Logger LOG = LoggerFactory.getLogger(WebViewSingleton.class);
private static WebViewSingleton instance = new WebViewSingleton();
private static final WebViewSingleton instance = new WebViewSingleton();
private WebView webView = null;
private MutableContextWrapper contextWrapper;
@ -71,6 +72,21 @@ public class WebViewSingleton {
private WebViewSingleton() {
}
//Internet helper outgoing connection
private final ServiceConnection internetHelperConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
LOG.info("internet helper service bound");
internetHelperBound = true;
internetHelper = new Messenger(service);
}
public void onServiceDisconnected(ComponentName className) {
LOG.info("internet helper service unbound");
internetHelper = null;
internetHelperBound = false;
}
};
public static synchronized void ensureCreated(Activity context) {
if (instance.webView == null) {
instance.contextWrapper = new MutableContextWrapper(context);
@ -91,21 +107,6 @@ public class WebViewSingleton {
}
}
//Internet helper outgoing connection
private ServiceConnection internetHelperConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
LOG.info("internet helper service bound");
internetHelperBound = true;
internetHelper = new Messenger(service);
}
public void onServiceDisconnected(ComponentName className) {
LOG.info("internet helper service unbound");
internetHelper = null;
internetHelperBound = false;
}
};
public static WebViewSingleton getInstance() {
return instance;
}