diff --git a/SoulissApp/SoulissApp.iml b/SoulissApp/SoulissApp.iml
index 2e4bf17d..0adabc27 100644
--- a/SoulissApp/SoulissApp.iml
+++ b/SoulissApp/SoulissApp.iml
@@ -20,7 +20,7 @@
-
+
@@ -89,8 +89,6 @@
-
-
diff --git a/SoulissApp/build.gradle b/SoulissApp/build.gradle
index e37d3013..5d57b5e5 100644
--- a/SoulissApp/build.gradle
+++ b/SoulissApp/build.gradle
@@ -54,7 +54,7 @@ dependencies {
testImplementation 'junit:junit:4.12'
// Required for instrumented tests
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
- androidTestImplementation 'androidx.test:runner:1.2.0'
+ androidTestImplementation 'androidx.test:runner:1.1.0'
// androidTestImplementation 'androidx.work:work-testing:2.2.0'
implementation project(':ecoGallery')
diff --git a/SoulissApp/src/main/java/it/angelic/soulissclient/AbstractStatusedFragmentActivity.java b/SoulissApp/src/main/java/it/angelic/soulissclient/AbstractStatusedFragmentActivity.java
index 82c334af..873c0cb8 100644
--- a/SoulissApp/src/main/java/it/angelic/soulissclient/AbstractStatusedFragmentActivity.java
+++ b/SoulissApp/src/main/java/it/angelic/soulissclient/AbstractStatusedFragmentActivity.java
@@ -32,7 +32,6 @@
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
-import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.interpolator.view.animation.LinearOutSlowInInterpolator;
@@ -135,14 +134,27 @@ void initDrawer(final @NonNull Activity parentActivity, int activeSection) {
) {
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
+ try {
+ FloatingActionButton fab = findViewById(R.id.fab);
+ fab.show();
+ } catch (Exception ue) {
+ //no problem
+ }
super.onDrawerClosed(view);
- ActivityCompat.invalidateOptionsMenu(parentActivity);
+ parentActivity.invalidateOptionsMenu();
}
/** Called when a drawer has settled in a completely open state. */
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
- ActivityCompat.invalidateOptionsMenu(parentActivity);
+ try {
+ FloatingActionButton fab = findViewById(R.id.fab);
+ fab.hide();
+ } catch (Exception ue) {
+ //no problem
+ }
+
+ parentActivity.invalidateOptionsMenu();
info2.setText(getString(R.string.souliss_app_name) + " " + (opzioni.isSoulissReachable() ? getString(R.string.Online) : getString(R.string.offline))
+ " - " + getString(R.string.active_config) + ": " + SoulissApp.getCurrentConfig());
info1.setText("Souliss is controlling " + opzioni
@@ -176,7 +188,7 @@ public void onClick(View v) {
mDrawerList = findViewById(R.id.left_drawer);
// Set the drawer toggle as the DrawerListener
- mDrawerLayout.setDrawerListener(mDrawerToggle);
+ mDrawerLayout.addDrawerListener(mDrawerToggle);
mDrawermAdapter = new NavDrawerAdapter(parentActivity, R.layout.drawer_list_item, dmh.getStuff(), activeSection);
mDrawerList.setAdapter(mDrawermAdapter);
diff --git a/SoulissApp/src/main/java/it/angelic/soulissclient/MainActivity.java b/SoulissApp/src/main/java/it/angelic/soulissclient/MainActivity.java
index afd05f9e..deb1ccc0 100644
--- a/SoulissApp/src/main/java/it/angelic/soulissclient/MainActivity.java
+++ b/SoulissApp/src/main/java/it/angelic/soulissclient/MainActivity.java
@@ -142,7 +142,7 @@ private void configureVoiceFab() {
//VOICE SEARCH
FloatingActionButton fab = findViewById(R.id.fab);
if (opzioni.isVoiceCommandEnabled() && opzioni.isDbConfigured()) {
- fab.show();
+
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -157,9 +157,9 @@ public void onClick(View v) {
}
}
});
+ fab.show();
} else {
fab.hide();
- fab.hide();
}
}
@@ -547,20 +547,7 @@ protected void onStart() {
//refresh geofences
AsyncTask.execute(new GeofenceRunnable(MainActivity.this));
- locationCallback = new LocationCallback() {
- @Override
- public void onLocationResult(LocationResult locationResult) {
- Log.w(Constants.TAG, "RECEIVE POS updates " + locationResult);
- if (locationResult == null) {
- return;
- }
- for (Location location : locationResult.getLocations()) {
- if (launcherMainAdapter.getLocationLauncherElements() != null) {
- onLocationChanged(location);
- }
- }
- }
- };
+
startLocationUpdates();
} else if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_DENIED) {
@@ -575,6 +562,20 @@ public void onLocationResult(LocationResult locationResult) {
private void startLocationUpdates() {
Log.w(Constants.TAG, "Requesting POS updates ");
LocationRequest locReq = createLocationRequest();
+ locationCallback = new LocationCallback() {
+ @Override
+ public void onLocationResult(LocationResult locationResult) {
+ Log.w(Constants.TAG, "RECEIVE POS updates " + locationResult);
+ if (locationResult == null) {
+ return;
+ }
+ for (Location location : locationResult.getLocations()) {
+ if (launcherMainAdapter.getLocationLauncherElements() != null) {
+ onLocationChanged(location);
+ }
+ }
+ }
+ };
locationCli.requestLocationUpdates(locReq,
locationCallback,
Looper.getMainLooper());
diff --git a/SoulissApp/src/main/java/it/angelic/soulissclient/SettingsActivity.java b/SoulissApp/src/main/java/it/angelic/soulissclient/SettingsActivity.java
index 07a31fe9..43aa22d4 100644
--- a/SoulissApp/src/main/java/it/angelic/soulissclient/SettingsActivity.java
+++ b/SoulissApp/src/main/java/it/angelic/soulissclient/SettingsActivity.java
@@ -17,7 +17,7 @@
import it.angelic.soulissclient.preferences.BroadcastSettingsFragment;
import it.angelic.soulissclient.preferences.DbSettingsFragment;
import it.angelic.soulissclient.preferences.LauncherSettingsFragment;
-import it.angelic.soulissclient.preferences.NetSettingsFragmentNuova;
+import it.angelic.soulissclient.preferences.NetSettingsFragment;
import it.angelic.soulissclient.preferences.ServiceSettingsFragment;
import it.angelic.soulissclient.preferences.VisualSettingsFragment;
@@ -52,8 +52,8 @@ protected void onCreate(Bundle savedInstanceState) {
PreferenceFragmentCompat collected = null;
if (extras != null && extras.get(PreferenceActivity.EXTRA_SHOW_FRAGMENT) != null) {
String classNAme = (String) extras.get(PreferenceActivity.EXTRA_SHOW_FRAGMENT);
- if (NetSettingsFragmentNuova.class.getName().equals(classNAme))
- collected = new NetSettingsFragmentNuova();
+ if (NetSettingsFragment.class.getName().equals(classNAme))
+ collected = new NetSettingsFragment();
if (BroadcastSettingsFragment.class.getName().equals(classNAme))
collected = new BroadcastSettingsFragment();
if (ServiceSettingsFragment.class.getName().equals(classNAme))
diff --git a/SoulissApp/src/main/java/it/angelic/soulissclient/WelcomeActivity.java b/SoulissApp/src/main/java/it/angelic/soulissclient/WelcomeActivity.java
index b5d7fa5a..f8d8c246 100644
--- a/SoulissApp/src/main/java/it/angelic/soulissclient/WelcomeActivity.java
+++ b/SoulissApp/src/main/java/it/angelic/soulissclient/WelcomeActivity.java
@@ -314,8 +314,8 @@ public void onClick(View view) {
SoulissApp.setCurrentConfig(newConfig);
if (!(previousConfig.equalsIgnoreCase(newConfig))) {
//SAVE PREVIOUS if old one is not "create new" or "import"
- if (!previousConfig.equals("") && !(previousConfig.equals(getResources().getStringArray(R.array.configChooserArray)[1]))
- && !(previousConfig.equals(getResources().getStringArray(R.array.configChooserArray)[2]))) {
+ if (!previousConfig.equals("") && !(previousConfig.equals(getResources().getStringArray(R.array.configChooserArray)[0]))
+ && !(previousConfig.equals(getResources().getStringArray(R.array.configChooserArray)[1]))) {
//save Old DB and config
File filePrefs = new File(importDir, previousConfig + "_SoulissApp.prefs");
Log.w(Constants.TAG, "Saving old Preferences to: " + filePrefs.getPath());
@@ -359,9 +359,9 @@ public void onClick(View view) {
Log.e(Constants.TAG, "SERIO DB DEMO non generabile:" + newConfig);
}
}
- } else if (newConfig.equals(getResources().getStringArray(R.array.configChooserArray)[1])) {
+ } else if (newConfig.equals(getResources().getStringArray(R.array.configChooserArray)[0])) {
Log.i(Constants.TAG, "Nothing here");
- } else if (newConfig.equals(getResources().getStringArray(R.array.configChooserArray)[2])) {
+ } else if (newConfig.equals(getResources().getStringArray(R.array.configChooserArray)[1])) {
Log.i(Constants.TAG, "Nothing here");
} else { //caso dinamico
File filePrefs;
diff --git a/SoulissApp/src/main/java/it/angelic/soulissclient/drawer/DrawerItemClickListener.java b/SoulissApp/src/main/java/it/angelic/soulissclient/drawer/DrawerItemClickListener.java
index ed4dc19d..0ffad269 100644
--- a/SoulissApp/src/main/java/it/angelic/soulissclient/drawer/DrawerItemClickListener.java
+++ b/SoulissApp/src/main/java/it/angelic/soulissclient/drawer/DrawerItemClickListener.java
@@ -21,7 +21,7 @@
import it.angelic.soulissclient.model.db.SoulissDBHelper;
import it.angelic.soulissclient.preferences.DbSettingsFragment;
import it.angelic.soulissclient.preferences.LauncherSettingsFragment;
-import it.angelic.soulissclient.preferences.NetSettingsFragmentNuova;
+import it.angelic.soulissclient.preferences.NetSettingsFragment;
import it.angelic.soulissclient.preferences.ServiceSettingsFragment;
import it.angelic.soulissclient.preferences.VisualSettingsFragment;
@@ -115,7 +115,7 @@ private void selectItem(int position, int id) {
mDrawerLayout.closeDrawer(mDrawerLinear);
Intent myIntent4 = new Intent(mActivity, SettingsActivity.class);
myIntent4.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- myIntent4.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, NetSettingsFragmentNuova.class.getName());
+ myIntent4.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, NetSettingsFragment.class.getName());
myIntent4.setAction("network_setup");
mActivity.startActivity(myIntent4);
break;
diff --git a/SoulissApp/src/main/java/it/angelic/soulissclient/helpers/AlertDialogHelper.java b/SoulissApp/src/main/java/it/angelic/soulissclient/helpers/AlertDialogHelper.java
index 1495763d..125327d9 100644
--- a/SoulissApp/src/main/java/it/angelic/soulissclient/helpers/AlertDialogHelper.java
+++ b/SoulissApp/src/main/java/it/angelic/soulissclient/helpers/AlertDialogHelper.java
@@ -55,7 +55,7 @@
import it.angelic.soulissclient.model.db.SoulissDBTagHelper;
import it.angelic.soulissclient.net.UDPHelper;
import it.angelic.soulissclient.preferences.DbSettingsFragment;
-import it.angelic.soulissclient.preferences.NetSettingsFragmentNuova;
+import it.angelic.soulissclient.preferences.NetSettingsFragment;
import it.angelic.soulissclient.preferences.ServiceSettingsFragment;
import it.angelic.soulissclient.util.FontAwesomeEnum;
import it.angelic.soulissclient.util.FontAwesomeUtil;
@@ -89,7 +89,7 @@ public void onClick(DialogInterface dialog, int whichButton) {
final Intent preferencesActivity = new Intent(source.getBaseContext(),
SettingsActivity.class);
- preferencesActivity.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, NetSettingsFragmentNuova.class.getName());
+ preferencesActivity.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, NetSettingsFragment.class.getName());
// preferencesActivity.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS,com);
preferencesActivity.setAction("network_setup");
preferencesActivity.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
@@ -415,16 +415,13 @@ public void onClick(DialogInterface dialog, int whichButton) {
}
public static AlertDialog.Builder deleteConfigDialog(final Context cont, final Spinner toUpdate) {
+ ContextThemeWrapper wrapper = new ContextThemeWrapper(cont, SoulissApp.getOpzioni().isLightThemeSelected() ? R.style.LightThemeSelector : R.style.DarkThemeSelector);
- final AlertDialog.Builder alert = new AlertDialog.Builder(cont,SoulissApp.getOpzioni().isLightThemeSelected() ? R.style.MyAlertDialogThemeLight:R.style.MyAlertDialogTheme);
+ final AlertDialog.Builder alert = new AlertDialog.Builder(wrapper, SoulissApp.getOpzioni().isLightThemeSelected() ? R.style.MyAlertDialogThemeLight : R.style.MyAlertDialogTheme);
final String bckConfig = (String) toUpdate.getSelectedItem();
alert.setIcon(R.drawable.ic_cancel_24dp);
- alert.setTitle(cont.getString(R.string.delete) + " " + bckConfig);
+ alert.setTitle(cont.getString(R.string.delete) + " " + bckConfig + "?");
- // Set an EditText view to get user input
- //final EditText input = new EditText(cont);
- //alert.setView(input);
- //input.setText(bckConfig);
alert.setPositiveButton(cont.getResources().getString(android.R.string.ok),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
@@ -451,17 +448,19 @@ public void onClick(DialogInterface dialog, int whichButton) {
}
public static AlertDialog.Builder renameConfigDialog(final Context cont, final Spinner toUpdate) {
- final AlertDialog.Builder alert = new AlertDialog.Builder(cont,SoulissApp.getOpzioni().isLightThemeSelected() ? R.style.MyAlertDialogThemeLight:R.style.MyAlertDialogTheme);
- final SoulissPreferenceHelper opzioni = new SoulissPreferenceHelper(cont);
+ ContextThemeWrapper wrapper = new ContextThemeWrapper(cont, SoulissApp.getOpzioni().isLightThemeSelected() ? R.style.LightThemeSelector : R.style.DarkThemeSelector);
+
+ final AlertDialog.Builder alert = new AlertDialog.Builder(wrapper, SoulissApp.getOpzioni().isLightThemeSelected() ? R.style.MyAlertDialogThemeLight : R.style.MyAlertDialogTheme);
+ //final SoulissPreferenceHelper opzioni = new SoulissPreferenceHelper(cont);
final String bckConfig = (String) toUpdate.getSelectedItem();
alert.setIcon(R.drawable.ic_mode_edit_24dp);
alert.setTitle(cont.getString(R.string.rename) + " " + bckConfig);
// Set an EditText view to get user input
- final EditText input = new EditText(cont);
+ final EditText input = new EditText(wrapper);
alert.setView(input);
input.setText(bckConfig);
- alert.setPositiveButton(cont.getResources().getString(android.R.string.ok),
+ alert.setPositiveButton(wrapper.getResources().getString(android.R.string.ok),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
diff --git a/SoulissApp/src/main/java/it/angelic/soulissclient/preferences/BroadcastSettingsPreferenceListener.java b/SoulissApp/src/main/java/it/angelic/soulissclient/preferences/BroadcastSettingsPreferenceListener.java
deleted file mode 100644
index 84dfdeaa..00000000
--- a/SoulissApp/src/main/java/it/angelic/soulissclient/preferences/BroadcastSettingsPreferenceListener.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package it.angelic.soulissclient.preferences;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.preference.PreferenceActivity;
-
-import androidx.preference.Preference;
-import it.angelic.soulissclient.SoulissApp;
-import it.angelic.soulissclient.helpers.SoulissPreferenceHelper;
-import it.angelic.soulissclient.model.db.SoulissDBHelper;
-
-public class BroadcastSettingsPreferenceListener implements Preference.OnPreferenceClickListener {
-
- private static final String FTYPE = ".csv";
- private static final int DIALOG_LOAD_FILE = 1000;
- private String mChosenFile;
- // EXPORT
- private String[] mFileList;
- private Activity parent;
-
- public BroadcastSettingsPreferenceListener(Activity parent) {
- super();
- this.parent = parent;
- SoulissPreferenceHelper opzioni = SoulissApp.getOpzioni();
- SoulissDBHelper datasource = new SoulissDBHelper(parent);
- //File mPath = new File(Environment.getExternalStorageDirectory() + Constants.EXTERNAL_EXP_FOLDER);
- }
-
- private void fireBCastSubScreen() {
- Intent inten = parent.getIntent();
- inten.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
- parent.finish();
- parent.overridePendingTransition(0, 0);
- //if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
- inten.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, BroadcastSettingsFragment.class.getName());
- inten.setAction("bcast_setup");
- parent.startActivity(inten);
- return;
-
- }
-
- @Override
- public boolean onPreferenceClick(androidx.preference.Preference arg0) {
- //if ("dbexp".equals(arg0.getKey()))
- // return exportDb();
- fireBCastSubScreen();
- return true;
-
- }
-
-}
diff --git a/SoulissApp/src/main/java/it/angelic/soulissclient/preferences/NetSettingsFragmentNuova.java b/SoulissApp/src/main/java/it/angelic/soulissclient/preferences/NetSettingsFragment.java
similarity index 97%
rename from SoulissApp/src/main/java/it/angelic/soulissclient/preferences/NetSettingsFragmentNuova.java
rename to SoulissApp/src/main/java/it/angelic/soulissclient/preferences/NetSettingsFragment.java
index d03e52d7..ebb18238 100644
--- a/SoulissApp/src/main/java/it/angelic/soulissclient/preferences/NetSettingsFragmentNuova.java
+++ b/SoulissApp/src/main/java/it/angelic/soulissclient/preferences/NetSettingsFragment.java
@@ -12,7 +12,7 @@
import it.angelic.soulissclient.helpers.SoulissPreferenceHelper;
-public class NetSettingsFragmentNuova extends PreferenceFragmentCompat {
+public class NetSettingsFragment extends PreferenceFragmentCompat {
private SoulissPreferenceHelper opzioni;
private Preference userIndex;
@@ -49,7 +49,7 @@ public void onCreate(Bundle savedInstanceState) {
publicIP.setOnPreferenceChangeListener(ipChanger);
//BROADCAST Settings
- bCast.setOnPreferenceClickListener(new BroadcastSettingsPreferenceListener(getActivity()));
+ //bCast.setOnPreferenceClickListener(new BroadcastSettingsPreferenceListener(getActivity()));
/*
diff --git a/SoulissApp/src/main/res/xml/root_preferences.xml b/SoulissApp/src/main/res/xml/root_preferences.xml
index 24665f5c..9dd6fd86 100644
--- a/SoulissApp/src/main/res/xml/root_preferences.xml
+++ b/SoulissApp/src/main/res/xml/root_preferences.xml
@@ -22,7 +22,7 @@
diff --git a/SoulissApp/src/main/res/xml/settings_net.xml b/SoulissApp/src/main/res/xml/settings_net.xml
index f460b93b..0b8a7421 100644
--- a/SoulissApp/src/main/res/xml/settings_net.xml
+++ b/SoulissApp/src/main/res/xml/settings_net.xml
@@ -1,9 +1,10 @@
+ android:title="@string/opt_network">
-
+ android:title="Broadcast Setting to nodes" />
+