diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index bbe042213a..3c22aead1b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -190,7 +190,7 @@
-
+
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.java b/app/src/main/java/info/nightscout/androidaps/MainActivity.java
index cdd1b4ec61..8ea71fe68e 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.java
@@ -49,14 +49,12 @@ import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.logging.LogSettingActivity;
import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSettingsStatus;
import info.nightscout.androidaps.setupwizard.SetupWizardActivity;
import info.nightscout.androidaps.tabs.TabPageAdapter;
import info.nightscout.utils.AndroidPermission;
import info.nightscout.utils.LocaleHelper;
-import info.nightscout.utils.LogDialog;
import info.nightscout.utils.OKDialog;
import info.nightscout.utils.PasswordProtection;
import info.nightscout.utils.SP;
@@ -376,12 +374,6 @@ public class MainActivity extends AppCompatActivity {
case R.id.nav_setupwizard:
startActivity(new Intent(this, SetupWizardActivity.class));
return true;
- case R.id.nav_show_logcat:
- LogDialog.showLogcat(this);
- return true;
- case R.id.nav_logsettings:
- startActivity(new Intent(this, LogSettingActivity.class));
- return true;
case R.id.nav_about:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(MainApp.gs(R.string.app_name) + " " + BuildConfig.VERSION);
diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java
index b16f3bc570..b4ba1340f1 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainApp.java
+++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java
@@ -79,7 +79,7 @@ import info.nightscout.androidaps.receivers.KeepAliveReceiver;
import info.nightscout.androidaps.receivers.NSAlarmReceiver;
import info.nightscout.androidaps.services.Intents;
import info.nightscout.utils.FabricPrivacy;
-import info.nightscout.utils.LoggerUtils;
+import info.nightscout.androidaps.plugins.Maintenance.LoggerUtils;
import io.fabric.sdk.android.Fabric;
diff --git a/app/src/main/java/info/nightscout/androidaps/logging/L.java b/app/src/main/java/info/nightscout/androidaps/logging/L.java
index 4b8b9d99f1..1024713946 100644
--- a/app/src/main/java/info/nightscout/androidaps/logging/L.java
+++ b/app/src/main/java/info/nightscout/androidaps/logging/L.java
@@ -8,9 +8,9 @@ import info.nightscout.utils.SP;
public class L {
public static class LogElement {
- String name;
+ public String name;
boolean defaultValue;
- boolean enabled;
+ public boolean enabled;
boolean requiresRestart = false;
LogElement(String name, boolean defaultValue) {
diff --git a/app/src/main/java/info/nightscout/utils/ImportExportPrefs.java b/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/ImportExportPrefs.java
similarity index 98%
rename from app/src/main/java/info/nightscout/utils/ImportExportPrefs.java
rename to app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/ImportExportPrefs.java
index 0cef5817a9..33580d8c2b 100644
--- a/app/src/main/java/info/nightscout/utils/ImportExportPrefs.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/ImportExportPrefs.java
@@ -1,4 +1,4 @@
-package info.nightscout.utils;
+package info.nightscout.androidaps.plugins.Maintenance;
import android.Manifest;
import android.app.Activity;
@@ -28,6 +28,8 @@ import java.util.Map;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventAppExit;
+import info.nightscout.utils.OKDialog;
+import info.nightscout.utils.ToastUtils;
/**
* Created by mike on 03.07.2016.
diff --git a/app/src/main/java/info/nightscout/utils/LoggerUtils.java b/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/LoggerUtils.java
similarity index 92%
rename from app/src/main/java/info/nightscout/utils/LoggerUtils.java
rename to app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/LoggerUtils.java
index 60d9251181..3be97056c5 100644
--- a/app/src/main/java/info/nightscout/utils/LoggerUtils.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/LoggerUtils.java
@@ -1,4 +1,4 @@
-package info.nightscout.utils;
+package info.nightscout.androidaps.plugins.Maintenance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/MaintenanceFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/MaintenanceFragment.java
index cda9e3d861..f9c00d56c7 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/MaintenanceFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/MaintenanceFragment.java
@@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.Maintenance;
+import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
@@ -10,8 +11,8 @@ import android.view.ViewGroup;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Food.FoodPlugin;
+import info.nightscout.androidaps.plugins.Maintenance.activities.LogSettingActivity;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
-import info.nightscout.utils.ImportExportPrefs;
/**
*
@@ -43,39 +44,38 @@ public class MaintenanceFragment extends Fragment {
view.findViewById(R.id.log_send).setOnClickListener(view1 -> MaintenancePlugin.getPlugin().sendLogs());
- view.findViewById(R.id.log_delete).setOnClickListener(view12 -> MaintenancePlugin.getPlugin().deleteLogs());
+ view.findViewById(R.id.log_delete).setOnClickListener(view1 -> MaintenancePlugin.getPlugin().deleteLogs());
- view.findViewById(R.id.nav_resetdb).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- new AlertDialog.Builder(f.getContext())
- .setTitle(R.string.nav_resetdb)
- .setMessage(R.string.reset_db_confirm)
- .setNegativeButton(android.R.string.cancel, null)
- .setPositiveButton(android.R.string.ok, (dialog, which) -> {
- MainApp.getDbHelper().resetDatabases();
- // should be handled by Plugin-Interface and
- // additional service interface and plugin registry
- FoodPlugin.getPlugin().getService().resetFood();
- TreatmentsPlugin.getPlugin().getService().resetTreatments();
- })
- .create()
- .show();
- }
- });
+ view.findViewById(R.id.nav_resetdb).setOnClickListener(view1 -> new AlertDialog.Builder(f.getContext())
+ .setTitle(R.string.nav_resetdb)
+ .setMessage(R.string.reset_db_confirm)
+ .setNegativeButton(android.R.string.cancel, null)
+ .setPositiveButton(android.R.string.ok, (dialog, which) -> {
+ MainApp.getDbHelper().resetDatabases();
+ // should be handled by Plugin-Interface and
+ // additional service interface and plugin registry
+ FoodPlugin.getPlugin().getService().resetFood();
+ TreatmentsPlugin.getPlugin().getService().resetTreatments();
+ })
+ .create()
+ .show());
- view.findViewById(R.id.nav_export).setOnClickListener(view13 -> {
+ view.findViewById(R.id.nav_export).setOnClickListener(view1 -> {
// start activity for checking permissions...
ImportExportPrefs.verifyStoragePermissions(f);
ImportExportPrefs.exportSharedPreferences(f);
});
- view.findViewById(R.id.nav_import).setOnClickListener(view14 -> {
+ view.findViewById(R.id.nav_import).setOnClickListener(view1 -> {
// start activity for checking permissions...
ImportExportPrefs.verifyStoragePermissions(f);
ImportExportPrefs.importSharedPreferences(f);
});
+ view.findViewById(R.id.nav_logsettings).setOnClickListener(view1 -> {
+ startActivity(new Intent(getActivity(), LogSettingActivity.class));
+ });
+
return view;
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/MaintenancePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/MaintenancePlugin.java
index 481a65b262..4a7592ce52 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/MaintenancePlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/MaintenancePlugin.java
@@ -13,10 +13,8 @@ import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Arrays;
-import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.zip.ZipEntry;
@@ -26,7 +24,6 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType;
-import info.nightscout.utils.LoggerUtils;
import info.nightscout.utils.SP;
public class MaintenancePlugin extends PluginBase {
@@ -60,7 +57,7 @@ public class MaintenancePlugin extends PluginBase {
super(new PluginDescription()
.mainType(PluginType.GENERAL)
.fragmentClass(MaintenanceFragment.class.getName())
- .alwayVisible(true)
+ .alwayVisible(false)
.alwaysEnabled(true)
.pluginName(R.string.maintenance)
.shortName(R.string.maintenance_shortname)
diff --git a/app/src/main/java/info/nightscout/androidaps/logging/LogSettingActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/activities/LogSettingActivity.java
similarity index 95%
rename from app/src/main/java/info/nightscout/androidaps/logging/LogSettingActivity.java
rename to app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/activities/LogSettingActivity.java
index d941e359a9..7d21d561b9 100644
--- a/app/src/main/java/info/nightscout/androidaps/logging/LogSettingActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/Maintenance/activities/LogSettingActivity.java
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.logging;
+package info.nightscout.androidaps.plugins.Maintenance.activities;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
@@ -14,6 +14,7 @@ import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.logging.L;
public class LogSettingActivity extends AppCompatActivity {
diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java
index 433c3927db..9dc9005457 100644
--- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java
+++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java
@@ -51,7 +51,7 @@ import info.nightscout.androidaps.setupwizard.elements.SWEditUrl;
import info.nightscout.androidaps.setupwizard.events.EventSWLabel;
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate;
import info.nightscout.utils.AndroidPermission;
-import info.nightscout.utils.ImportExportPrefs;
+import info.nightscout.androidaps.plugins.Maintenance.ImportExportPrefs;
import info.nightscout.utils.LocaleHelper;
import info.nightscout.utils.PasswordProtection;
import info.nightscout.utils.SP;
diff --git a/app/src/main/java/info/nightscout/utils/LogDialog.java b/app/src/main/java/info/nightscout/utils/LogDialog.java
deleted file mode 100644
index 7e2468774e..0000000000
--- a/app/src/main/java/info/nightscout/utils/LogDialog.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package info.nightscout.utils;
-
-import android.app.AlertDialog;
-import android.content.ClipData;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.ClipboardManager;
-import android.widget.TextView;
-
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-
-/**
- * Created by mike on 09.02.2017.
- */
-
-public class LogDialog {
-
- public static void showLogcat(Context context) {
- String logCat = "no logs";
- final String processId = Integer.toString(android.os.Process.myPid());
- try {
- Process process = Runtime.getRuntime().exec("logcat -d " + MainApp.gs(R.string.app_name) + ":D");
- BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
- StringBuilder log = new StringBuilder();
- String line;
-
- while ((line = bufferedReader.readLine()) != null) {
- if (line.contains(processId)) log.append(line + "\n");
- }
- logCat = log.toString();
-
- } catch (IOException e) {
- logCat = e.getLocalizedMessage();
- } finally {
- showAlertText(logCat, context);
- }
- }
-
- public static void showAlertText(final String msg, final Context context) {
- try {
- AlertDialog alertDialog = new AlertDialog.Builder(context)
- .setMessage(msg)
- .setPositiveButton(MainApp.gs(R.string.copy_to_clipboard), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
- clipboard.setPrimaryClip(ClipData.newPlainText(null, msg));
- ToastUtils.showToastInUiThread(context, MainApp.gs(R.string.copied_to_clipboard));
- }
- })
- .setNegativeButton(android.R.string.cancel, null)
- .show();
-
- if (msg.length() > 100) {
- TextView textView = (TextView) alertDialog.findViewById(android.R.id.message);
- textView.setTextSize(10);
- }
- } catch (Exception e) {
- // crashing on screen rotation
- }
- }
-}
diff --git a/app/src/main/res/layout/activity_logsetting.xml b/app/src/main/res/layout/activity_logsetting.xml
index 09d2e903a9..2ba89d267a 100644
--- a/app/src/main/res/layout/activity_logsetting.xml
+++ b/app/src/main/res/layout/activity_logsetting.xml
@@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- tools:context=".logging.LogSettingActivity">
+ tools:context=".plugins.Maintenance.activities.LogSettingActivity">