mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-27 02:55:50 +01:00
Some initial fixes found by static analysis #92
This commit is contained in:
parent
929831e4f0
commit
567f27b0f4
@ -7,7 +7,6 @@ import android.os.Build;
|
|||||||
import android.os.Build.VERSION;
|
import android.os.Build.VERSION;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -27,7 +26,7 @@ public class GBApplication extends Application {
|
|||||||
private static final String TAG = "GBApplication";
|
private static final String TAG = "GBApplication";
|
||||||
private static GBApplication context;
|
private static GBApplication context;
|
||||||
private static ActivityDatabaseHandler mActivityDatabaseHandler;
|
private static ActivityDatabaseHandler mActivityDatabaseHandler;
|
||||||
private static Lock dbLock = new ReentrantLock();
|
private static final Lock dbLock = new ReentrantLock();
|
||||||
|
|
||||||
public GBApplication() {
|
public GBApplication() {
|
||||||
context = this;
|
context = this;
|
||||||
|
@ -50,14 +50,14 @@ public class ControlCenter extends Activity {
|
|||||||
public static final String ACTION_REFRESH_DEVICELIST
|
public static final String ACTION_REFRESH_DEVICELIST
|
||||||
= "nodomain.freeyourgadget.gadgetbridge.controlcenter.action.set_version";
|
= "nodomain.freeyourgadget.gadgetbridge.controlcenter.action.set_version";
|
||||||
|
|
||||||
TextView hintTextView;
|
private TextView hintTextView;
|
||||||
ListView deviceListView;
|
private ListView deviceListView;
|
||||||
GBDeviceAdapter mGBDeviceAdapter;
|
private GBDeviceAdapter mGBDeviceAdapter;
|
||||||
private GBDevice selectedDevice = null;
|
private GBDevice selectedDevice = null;
|
||||||
|
|
||||||
final List<GBDevice> deviceList = new ArrayList<>();
|
private final List<GBDevice> deviceList = new ArrayList<>();
|
||||||
|
|
||||||
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
|
@ -132,7 +132,7 @@ public class ChartsActivity extends FragmentActivity {
|
|||||||
* A {@link FragmentStatePagerAdapter} that returns a fragment corresponding to
|
* A {@link FragmentStatePagerAdapter} that returns a fragment corresponding to
|
||||||
* one of the sections/tabs/pages.
|
* one of the sections/tabs/pages.
|
||||||
*/
|
*/
|
||||||
public class SectionsPagerAdapter extends FragmentStatePagerAdapter {
|
public static class SectionsPagerAdapter extends FragmentStatePagerAdapter {
|
||||||
|
|
||||||
public SectionsPagerAdapter(FragmentManager fm) {
|
public SectionsPagerAdapter(FragmentManager fm) {
|
||||||
super(fm);
|
super(fm);
|
||||||
|
@ -169,8 +169,7 @@ 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 where = "(provider=" + provider.getID() + " and timestamp>=" + timestamp_from + " and timestamp<=" + timestamp_to + getWhereClauseFor(activityTypes, provider) + ")";
|
||||||
final String order = "timestamp";
|
final String order = "timestamp";
|
||||||
try (SQLiteDatabase db = this.getReadableDatabase()) {
|
try (SQLiteDatabase db = this.getReadableDatabase()) {
|
||||||
Cursor cursor = db.query(TABLE_GBACTIVITYSAMPLES, null, where, null, null, null, order);
|
try (Cursor cursor = db.query(TABLE_GBACTIVITYSAMPLES, null, where, null, null, null, order)) {
|
||||||
|
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
GBActivitySample sample = new GBActivitySample(
|
GBActivitySample sample = new GBActivitySample(
|
||||||
@ -183,6 +182,7 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper implements DBHandl
|
|||||||
} while (cursor.moveToNext());
|
} while (cursor.moveToNext());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return samples;
|
return samples;
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/alarm_time_picker"
|
android:id="@+id/alarm_time_picker"
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:timePickerMode="clock"
|
android:timePickerMode="clock"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user