plain temptarget plugin

This commit is contained in:
Milos Kozak 2017-01-13 21:14:04 +01:00
parent 6015930b41
commit 1b53cde2bf
6 changed files with 169 additions and 0 deletions

View file

@ -38,6 +38,7 @@ import info.nightscout.androidaps.plugins.SourceMM640g.SourceMM640gFragment;
import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientFragment;
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripFragment;
import info.nightscout.androidaps.plugins.TempBasals.TempBasalsFragment;
import info.nightscout.androidaps.plugins.TempTargetRange.TempTargetRangeFragment;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsFragment;
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpFragment;
import info.nightscout.androidaps.plugins.Wear.WearFragment;
@ -76,6 +77,7 @@ public class MainApp extends Application {
// Register all tabs in app here
pluginsList.add(OverviewFragment.getPlugin());
pluginsList.add(ActionsFragment.getPlugin());
pluginsList.add(TempTargetRangeFragment.getPlugin());
if (Config.DANAR) pluginsList.add(DanaRFragment.getPlugin());
if (Config.DANARKOREAN) pluginsList.add(DanaRKoreanFragment.getPlugin());
if (Config.CAREPORTALENABLED) pluginsList.add(CareportalFragment.getPlugin());

View file

@ -0,0 +1,63 @@
package info.nightscout.androidaps.plugins.TempTargetRange;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.squareup.otto.Subscribe;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.FragmentBase;
import info.nightscout.androidaps.plugins.TempTargetRange.events.EventNewTempTargetRange;
/**
* Created by mike on 13/01/17.
*/
public class TempTargetRangeFragment extends Fragment implements FragmentBase {
private static TempTargetRangePlugin tempTargetRangePlugin = new TempTargetRangePlugin();
public static TempTargetRangePlugin getPlugin() {
return tempTargetRangePlugin;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.temptargetrange_fragment, container, false);
return view;
}
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe
public void onStatusEvent(final EventNewTempTargetRange ev) {
updateGUI();
}
void updateGUI() {
Activity activity = getActivity();
if (activity != null)
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
}
});
}
}

View file

@ -0,0 +1,75 @@
package info.nightscout.androidaps.plugins.TempTargetRange;
import com.squareup.otto.Subscribe;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.plugins.TempTargetRange.events.EventNewTempTargetRange;
/**
* Created by mike on 13/01/17.
*/
public class TempTargetRangePlugin implements PluginBase {
static boolean fragmentEnabled = true;
static boolean fragmentVisible = true;
TempTargetRangePlugin() {
MainApp.bus().register(this);
}
@Override
public int getType() {
return PluginBase.GENERAL;
}
@Override
public String getFragmentClass() {
return TempTargetRangeFragment.class.getName();
}
@Override
public String getName() {
return MainApp.sResources.getString(R.string.temptargetrange);
}
@Override
public boolean isEnabled(int type) {
return type == GENERAL && fragmentEnabled;
}
@Override
public boolean isVisibleInTabs(int type) {
return type == GENERAL && fragmentVisible;
}
@Override
public boolean canBeHidden(int type) {
return true;
}
@Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
if (type == GENERAL) {
this.fragmentEnabled = fragmentEnabled;
}
}
@Override
public void setFragmentVisible(int type, boolean fragmentVisible) {
if (type == GENERAL) this.fragmentVisible = fragmentVisible;
}
public static boolean isEnabled() {
return fragmentEnabled;
}
@Subscribe
public void onStatusEvent(final EventNewTempTargetRange ev) {
}
}

View file

@ -0,0 +1,8 @@
package info.nightscout.androidaps.plugins.TempTargetRange.events;
/**
* Created by mike on 13.01.2017.
*/
public class EventNewTempTargetRange {
}

View file

@ -0,0 +1,20 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.TempBasals.TempBasalsFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/temptargetrange_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</FrameLayout>

View file

@ -398,4 +398,5 @@
<string name="minago">%dmin ago</string>
<string name="sms_minago">%dmin ago</string>
<string name="localprofile">Local Profile</string>
<string name="temptargetrange">Temp Target</string>
</resources>