diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java index 034410a0a..204933f52 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java @@ -7,7 +7,6 @@ import android.os.Build; import android.os.Build.VERSION; import android.preference.PreferenceManager; import android.util.Log; -import android.widget.Toast; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,7 +26,7 @@ public class GBApplication extends Application { private static final String TAG = "GBApplication"; private static GBApplication context; private static ActivityDatabaseHandler mActivityDatabaseHandler; - private static Lock dbLock = new ReentrantLock(); + private static final Lock dbLock = new ReentrantLock(); public GBApplication() { context = this; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java index 17ced04c9..56fa12159 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java @@ -50,14 +50,14 @@ public class ControlCenter extends Activity { public static final String ACTION_REFRESH_DEVICELIST = "nodomain.freeyourgadget.gadgetbridge.controlcenter.action.set_version"; - TextView hintTextView; - ListView deviceListView; - GBDeviceAdapter mGBDeviceAdapter; + private TextView hintTextView; + private ListView deviceListView; + private GBDeviceAdapter mGBDeviceAdapter; private GBDevice selectedDevice = null; - final List deviceList = new ArrayList<>(); + private final List deviceList = new ArrayList<>(); - private BroadcastReceiver mReceiver = new BroadcastReceiver() { + private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ChartsActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ChartsActivity.java index 301c1012e..dd63fb8ce 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ChartsActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ChartsActivity.java @@ -132,7 +132,7 @@ public class ChartsActivity extends FragmentActivity { * A {@link FragmentStatePagerAdapter} that returns a fragment corresponding to * one of the sections/tabs/pages. */ - public class SectionsPagerAdapter extends FragmentStatePagerAdapter { + public static class SectionsPagerAdapter extends FragmentStatePagerAdapter { public SectionsPagerAdapter(FragmentManager fm) { super(fm); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java index 3948acd49..f80fee199 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java @@ -169,18 +169,18 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper implements DBHandl final String where = "(provider=" + provider.getID() + " and timestamp>=" + timestamp_from + " and timestamp<=" + timestamp_to + getWhereClauseFor(activityTypes, provider) + ")"; final String order = "timestamp"; try (SQLiteDatabase db = this.getReadableDatabase()) { - Cursor cursor = db.query(TABLE_GBACTIVITYSAMPLES, null, where, null, null, null, order); - - if (cursor.moveToFirst()) { - do { - GBActivitySample sample = new GBActivitySample( - provider, - cursor.getInt(cursor.getColumnIndex(KEY_TIMESTAMP)), - cursor.getShort(cursor.getColumnIndex(KEY_INTENSITY)), - cursor.getShort(cursor.getColumnIndex(KEY_STEPS)), - (byte) cursor.getShort(cursor.getColumnIndex(KEY_TYPE))); - samples.add(sample); - } while (cursor.moveToNext()); + try (Cursor cursor = db.query(TABLE_GBACTIVITYSAMPLES, null, where, null, null, null, order)) { + if (cursor.moveToFirst()) { + do { + GBActivitySample sample = new GBActivitySample( + provider, + cursor.getInt(cursor.getColumnIndex(KEY_TIMESTAMP)), + cursor.getShort(cursor.getColumnIndex(KEY_INTENSITY)), + cursor.getShort(cursor.getColumnIndex(KEY_STEPS)), + (byte) cursor.getShort(cursor.getColumnIndex(KEY_TYPE))); + samples.add(sample); + } while (cursor.moveToNext()); + } } } diff --git a/app/src/main/res/layout/activity_alarm_details.xml b/app/src/main/res/layout/activity_alarm_details.xml index 3a4d36d05..b50f71936 100644 --- a/app/src/main/res/layout/activity_alarm_details.xml +++ b/app/src/main/res/layout/activity_alarm_details.xml @@ -17,8 +17,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/alarm_time_picker" - android:layout_alignParentTop="true" - android:layout_alignParentStart="true" android:timePickerMode="clock" android:layout_weight="1" />