SMSCommunicator plugin

This commit is contained in:
Milos Kozak 2016-07-13 13:54:40 +02:00
parent 76d42ef3fb
commit 272262b115
7 changed files with 99 additions and 1 deletions

View file

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View file

@ -9,6 +9,10 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECEIVE_MMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.SEND_MMS" />
<!-- To receive data from xdrip. -->
<uses-permission android:name="com.eveningoutpost.dexdrip.permissions.RECEIVE_BG_ESTIMATE" />

View file

@ -13,6 +13,7 @@ public class Config {
public static final boolean OBJECTIVESENABLED = APS && true;
public static final boolean CAREPORTALENABLED = true;
public static final boolean SMSCOMMUNICATORENABLED = true;
public static final boolean DANAR = true;

View file

@ -39,6 +39,7 @@ import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAFragment;
import info.nightscout.androidaps.plugins.Overview.OverviewFragment;
import info.nightscout.androidaps.plugins.SafetyFragment.SafetyFragment;
import info.nightscout.androidaps.plugins.SimpleProfile.SimpleProfileFragment;
import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorFragment;
import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientFragment;
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripFragment;
import info.nightscout.androidaps.plugins.TempBasals.TempBasalsFragment;
@ -100,6 +101,7 @@ public class MainActivity extends AppCompatActivity {
if (Config.OBJECTIVESENABLED) pluginsList.add(ObjectivesFragment.newInstance());
pluginsList.add(SourceXdripFragment.newInstance());
pluginsList.add(SourceNSClientFragment.newInstance());
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorFragment.newInstance());
pluginsList.add(configBuilderFragment = ConfigBuilderFragment.newInstance());
registerBus();

View file

@ -0,0 +1,83 @@
package info.nightscout.androidaps.plugins.SmsCommunicator;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.PluginBase;
/**
* A simple {@link Fragment} subclass.
*/
public class SmsCommunicatorFragment extends Fragment implements PluginBase {
boolean fragmentEnabled = false;
boolean fragmentVisible = true;
public SmsCommunicatorFragment() {
super();
registerBus();
}
public static SmsCommunicatorFragment newInstance() {
SmsCommunicatorFragment fragment = new SmsCommunicatorFragment();
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.smscommunicator_fragment, container, false);
}
private void registerBus() {
try {
MainApp.bus().unregister(this);
} catch (RuntimeException x) {
// Ignore
}
MainApp.bus().register(this);
}
@Override
public int getType() {
return PluginBase.GENERAL;
}
@Override
public String getName() {
return MainApp.sResources.getString(R.string.smscommunicator);
}
@Override
public boolean isEnabled(int type) {
return fragmentEnabled;
}
@Override
public boolean isVisibleInTabs(int type) {
return fragmentVisible;
}
@Override
public boolean canBeHidden(int type) {
return true;
}
@Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
this.fragmentEnabled = fragmentEnabled;
}
@Override
public void setFragmentVisible(int type, boolean fragmentVisible) {
this.fragmentVisible = fragmentVisible;
}
}

View file

@ -0,0 +1,7 @@
<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.SmsCommunicator.SmsCommunicatorFragment">
</FrameLayout>

View file

@ -242,5 +242,6 @@
<string name="percent">Percent</string>
<string name="absolute">Absolute</string>
<string name="canceltemp">Cancel temp basal</string>
<string name="smscommunicator">Sms Communicator</string>
</resources>