show invalid profiles in treatments tab
This commit is contained in:
parent
7f0918d147
commit
0266a79201
|
@ -1584,14 +1584,14 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
List<ProfileSwitch> profileSwitches;
|
||||
QueryBuilder<ProfileSwitch, Long> queryBuilder = daoProfileSwitch.queryBuilder();
|
||||
queryBuilder.orderBy("date", ascending);
|
||||
queryBuilder.limit(20L);
|
||||
queryBuilder.limit(100L);
|
||||
PreparedQuery<ProfileSwitch> preparedQuery = queryBuilder.prepare();
|
||||
profileSwitches = daoProfileSwitch.query(preparedQuery);
|
||||
return profileSwitches;
|
||||
} catch (SQLException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return new ArrayList<ProfileSwitch>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean createOrUpdate(ProfileSwitch profileSwitch) {
|
||||
|
|
|
@ -20,11 +20,12 @@ import android.widget.TextView;
|
|||
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.Services.Intents;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.ProfileIntervals;
|
||||
import info.nightscout.androidaps.db.ProfileSwitch;
|
||||
import info.nightscout.androidaps.db.Source;
|
||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
||||
|
@ -49,9 +50,9 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
|
|||
|
||||
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ProfileSwitchViewHolder> {
|
||||
|
||||
ProfileIntervals<ProfileSwitch> profileSwitchList;
|
||||
List<ProfileSwitch> profileSwitchList;
|
||||
|
||||
RecyclerViewAdapter(ProfileIntervals<ProfileSwitch> profileSwitchList) {
|
||||
RecyclerViewAdapter(List<ProfileSwitch> profileSwitchList) {
|
||||
this.profileSwitchList = profileSwitchList;
|
||||
}
|
||||
|
||||
|
@ -65,7 +66,7 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
|
|||
public void onBindViewHolder(ProfileSwitchViewHolder holder, int position) {
|
||||
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
if (profile == null) return;
|
||||
ProfileSwitch profileSwitch = profileSwitchList.getReversed(position);
|
||||
ProfileSwitch profileSwitch = profileSwitchList.get(position);
|
||||
holder.ph.setVisibility(profileSwitch.source == Source.PUMP ? View.VISIBLE : View.GONE);
|
||||
holder.ns.setVisibility(NSUpload.isIdValid(profileSwitch._id) ? View.VISIBLE : View.GONE);
|
||||
|
||||
|
@ -148,7 +149,7 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
|
|||
break;
|
||||
case R.id.profileswitch_date:
|
||||
case R.id.profileswitch_name:
|
||||
long time = ((ProfileSwitch)v.getTag()).date;
|
||||
long time = ((ProfileSwitch) v.getTag()).date;
|
||||
ProfileViewerDialog pvd = ProfileViewerDialog.newInstance(time);
|
||||
FragmentManager manager = getFragmentManager();
|
||||
pvd.show(manager, "ProfileViewDialog");
|
||||
|
@ -168,7 +169,7 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
|
|||
llm = new LinearLayoutManager(view.getContext());
|
||||
recyclerView.setLayoutManager(llm);
|
||||
|
||||
RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp.getConfigBuilder().getProfileSwitchesFromHistory());
|
||||
RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp.getDbHelper().getProfileSwitchData(false));
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
refreshFromNS = (Button) view.findViewById(R.id.profileswitch_refreshfromnightscout);
|
||||
|
@ -216,7 +217,7 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
recyclerView.swapAdapter(new RecyclerViewAdapter(MainApp.getConfigBuilder().getProfileSwitchesFromHistory()), false);
|
||||
recyclerView.swapAdapter(new RecyclerViewAdapter(MainApp.getDbHelper().getProfileSwitchData(false)), false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -64,10 +64,11 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/invalid_sign"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingEnd="10dp"
|
||||
android:text="@string/invalid"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textColor="@android:color/holo_red_light" />
|
||||
|
||||
<TextView
|
||||
|
|
Loading…
Reference in a new issue