Agreement
This commit is contained in:
parent
c844a2ad9a
commit
690fd06c01
|
@ -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">
|
||||
|
|
|
@ -77,7 +77,9 @@
|
|||
<service
|
||||
android:name=".plugins.DanaR.Services.DanaRService"
|
||||
android:enabled="true"
|
||||
android:exported="false"></service>
|
||||
android:exported="false" />
|
||||
|
||||
<activity android:name=".AgreementActivity"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,44 @@
|
|||
package info.nightscout.androidaps;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
|
||||
public class AgreementActivity extends Activity {
|
||||
boolean IUnderstand;
|
||||
CheckBox agreeCheckBox;
|
||||
Button saveButton;
|
||||
SharedPreferences prefs;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_agreement);
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
IUnderstand = prefs.getBoolean("I_understand", false);
|
||||
setContentView(R.layout.activity_agreement);
|
||||
agreeCheckBox = (CheckBox)findViewById(R.id.agreementCheckBox);
|
||||
agreeCheckBox.setChecked(IUnderstand);
|
||||
saveButton = (Button)findViewById(R.id.agreementSaveButton);
|
||||
addListenerOnButton();
|
||||
}
|
||||
|
||||
public void addListenerOnButton() {
|
||||
saveButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
|
||||
prefs.edit().putBoolean("I_understand", agreeCheckBox.isChecked()).apply();
|
||||
|
||||
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
|
@ -65,6 +65,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
LocaleHelper.onCreate(this, "en");
|
||||
checkEula();
|
||||
setContentView(R.layout.activity_main);
|
||||
if (Config.logFunctionCalls)
|
||||
log.debug("onCreate");
|
||||
|
@ -198,6 +199,15 @@ public class MainActivity extends AppCompatActivity {
|
|||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
private void checkEula() {
|
||||
boolean IUnderstand = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean("I_understand", false);
|
||||
if (!IUnderstand) {
|
||||
Intent intent = new Intent(getApplicationContext(), AgreementActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<PluginBase> getPluginsList() {
|
||||
return pluginsList;
|
||||
}
|
||||
|
|
|
@ -670,17 +670,19 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
|||
}
|
||||
|
||||
private void storeSettings() {
|
||||
if (Config.logPrefsChange)
|
||||
log.debug("Storing settings");
|
||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
if (pluginList != null) {
|
||||
if (Config.logPrefsChange)
|
||||
log.debug("Storing settings");
|
||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
|
||||
for (PluginBase p : pluginList) {
|
||||
editor.putBoolean("ConfigBuilder" + p.getName() + "Enabled", p.isEnabled());
|
||||
editor.putBoolean("ConfigBuilder" + p.getName() + "Visible", p.isVisibleInTabs());
|
||||
for (PluginBase p : pluginList) {
|
||||
editor.putBoolean("ConfigBuilder" + p.getName() + "Enabled", p.isEnabled());
|
||||
editor.putBoolean("ConfigBuilder" + p.getName() + "Visible", p.isVisibleInTabs());
|
||||
}
|
||||
editor.commit();
|
||||
verifySelectionInCategories();
|
||||
}
|
||||
editor.commit();
|
||||
verifySelectionInCategories();
|
||||
}
|
||||
|
||||
private void loadSettings() {
|
||||
|
|
66
app/src/main/res/layout/activity_agreement.xml
Normal file
66
app/src/main/res/layout/activity_agreement.xml
Normal file
|
@ -0,0 +1,66 @@
|
|||
<RelativeLayout 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" android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context="info.nightscout.androidaps.AgreementActivity">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:id="@+id/scrollView2">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<TextView
|
||||
android:text="@string/end_user_license_agreement"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/app_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:textSize="11sp" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/end_user_license_agreement_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:textSize="11sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/end_user_license_agreement_i_understand"
|
||||
android:id="@+id/agreementCheckBox"
|
||||
android:checked="false" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/save"
|
||||
android:id="@+id/agreementSaveButton"
|
||||
android:layout_marginTop="20dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</RelativeLayout>
|
|
@ -220,5 +220,9 @@
|
|||
<string name="syncprofiletopump_title">Sync Nightscout profile to pump</string>
|
||||
<string name="danar_pump_settings">DanaR pump settings</string>
|
||||
<string name="nightscout">Nightscout</string>
|
||||
<string name="end_user_license_agreement">End User License Agreement</string>
|
||||
<string name="end_user_license_agreement_text">MUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</string>
|
||||
<string name="end_user_license_agreement_i_understand">I UNDERSTAND AND AGREE</string>
|
||||
<string name="save">Save</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue