add @Nullable where possible

This commit is contained in:
Milos Kozak 2016-06-12 14:18:21 +02:00
parent f15fdf613f
commit 7e3d1e6ad4
4 changed files with 11 additions and 1 deletions

View file

@ -6,6 +6,7 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.support.annotation.Nullable;
import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.stmt.PreparedQuery;
@ -332,6 +333,7 @@ public class DataService extends IntentService {
editor.commit();
}
@Nullable
public static Treatment findById(String _id) {
try {
QueryBuilder<Treatment, String> qb = null;
@ -355,6 +357,7 @@ public class DataService extends IntentService {
return null;
}
@Nullable
public static Treatment findByTimeIndex(Long timeIndex) {
try {
QueryBuilder<Treatment, String> qb = null;

View file

@ -8,6 +8,7 @@ import java.util.List;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.support.annotation.Nullable;
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
import com.j256.ormlite.dao.Dao;
@ -109,6 +110,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
/*
* Return last BgReading from database or null if db is empty
*/
@Nullable
public BgReading lastBg() {
List<BgReading> bgList = null;
@ -133,6 +135,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
* Return bg reading if not old ( <9 min )
* or null if older
*/
@Nullable
public BgReading actualBg() {
BgReading lastBg = lastBg();
@ -182,6 +185,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
}
@Nullable
public GlucoseStatus getGlucoseStatusData() {
GlucoseStatus result = new GlucoseStatus();
try {

View file

@ -105,7 +105,8 @@ public class OverviewFragment extends Fragment implements PluginBase {
if (profile != null && lastBG != null && bgView != null) {
bgView.setText(lastBG.valueToUnitsToString(profile.getUnits()));
DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData();
deltaView.setText("Δ " + NSProfile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units);
if (glucoseStatus != null)
deltaView.setText("Δ " + NSProfile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units);
BgReading.units = profile.getUnits();
} else
return;

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.tabs;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.annotation.PluralsRes;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
@ -24,6 +25,7 @@ public class TabPageAdapter extends FragmentPagerAdapter {
}
@Override
@Nullable
public Fragment getItem(int position) {
if (position > registeredTabs)
return null;