All 3 flavors can be compiled.

This commit is contained in:
Jens 2021-02-17 22:27:53 +01:00
parent e90c4d3e38
commit 3a7a154761
17 changed files with 141 additions and 144 deletions

View File

@ -94,7 +94,7 @@
android:name=".ActivityMainScreen" android:name=".ActivityMainScreen"
android:label="@string/app_name"></activity> android:label="@string/app_name"></activity>
<activity <activity
android:name=".ActivityManageSpecificPoi" android:name=".ActivityManagePoi"
android:label="@string/title_activity_main"></activity> android:label="@string/title_activity_main"></activity>
<activity <activity
android:name=".ActivitySettings" android:name=".ActivitySettings"
@ -135,7 +135,7 @@
<receiver android:name=".receivers.ConnectivityReceiver" /> <receiver android:name=".receivers.ConnectivityReceiver" />
<receiver android:name=".receivers.TimeZoneListener" /> <receiver android:name=".receivers.TimeZoneListener" />
<activity android:name=".ActivityManageSpecificRule" /> <activity android:name=".ActivityManageRule" />
<activity android:name=".ActivityEditTriggerUrl" /> <activity android:name=".ActivityEditTriggerUrl" />
<activity android:name=".ActivityEditSendTextMessage" /> <activity android:name=".ActivityEditSendTextMessage" />
<activity android:name=".ActivityManageTimeFrame" /> <activity android:name=".ActivityManageTimeFrame" />
@ -182,7 +182,7 @@
<activity android:name=".ActivityEditSpeakText" /> <activity android:name=".ActivityEditSpeakText" />
<activity android:name=".ActivityManageBluetoothTrigger" /> <activity android:name=".ActivityManageBluetoothTrigger" />
<activity android:name=".ActivityMainProfiles" /> <activity android:name=".ActivityMainProfiles" />
<activity android:name=".ActivityManageSpecificProfile" /> <activity android:name=".ActivityManageProfile" />
<activity android:name=".ActivityVolumeTest" /> <activity android:name=".ActivityVolumeTest" />
<service <service

View File

@ -90,7 +90,7 @@
android:name=".ActivityMainScreen" android:name=".ActivityMainScreen"
android:label="@string/app_name"></activity> android:label="@string/app_name"></activity>
<activity <activity
android:name=".ActivityManageSpecificPoi" android:name=".ActivityManagePoi"
android:label="@string/title_activity_main"></activity> android:label="@string/title_activity_main"></activity>
<activity <activity
android:name=".ActivitySettings" android:name=".ActivitySettings"
@ -131,7 +131,7 @@
<receiver android:name=".receivers.ConnectivityReceiver" /> <receiver android:name=".receivers.ConnectivityReceiver" />
<receiver android:name=".receivers.TimeZoneListener" /> <receiver android:name=".receivers.TimeZoneListener" />
<activity android:name=".ActivityManageSpecificRule" /> <activity android:name=".ActivityManageRule" />
<activity android:name=".ActivityEditTriggerUrl" /> <activity android:name=".ActivityEditTriggerUrl" />
<activity android:name=".ActivityEditSendTextMessage" /> <activity android:name=".ActivityEditSendTextMessage" />
<activity android:name=".ActivityManageTimeFrame" /> <activity android:name=".ActivityManageTimeFrame" />
@ -177,7 +177,7 @@
<activity android:name=".ActivityEditSpeakText" /> <activity android:name=".ActivityEditSpeakText" />
<activity android:name=".ActivityManageBluetoothTrigger" /> <activity android:name=".ActivityManageBluetoothTrigger" />
<activity android:name=".ActivityMainProfiles" /> <activity android:name=".ActivityMainProfiles" />
<activity android:name=".ActivityManageSpecificProfile" /> <activity android:name=".ActivityManageProfile" />
<activity android:name=".ActivityVolumeTest" /> <activity android:name=".ActivityVolumeTest" />
<activity android:name=".ActivityPermissions"></activity> <activity android:name=".ActivityPermissions"></activity>

View File

@ -94,7 +94,7 @@
android:name=".ActivityMainScreen" android:name=".ActivityMainScreen"
android:label="@string/app_name"></activity> android:label="@string/app_name"></activity>
<activity <activity
android:name=".ActivityManageSpecificPoi" android:name=".ActivityManagePoi"
android:label="@string/title_activity_main"></activity> android:label="@string/title_activity_main"></activity>
<activity <activity
android:name=".ActivitySettings" android:name=".ActivitySettings"
@ -135,7 +135,7 @@
<receiver android:name=".receivers.ConnectivityReceiver" /> <receiver android:name=".receivers.ConnectivityReceiver" />
<receiver android:name=".receivers.TimeZoneListener" /> <receiver android:name=".receivers.TimeZoneListener" />
<activity android:name=".ActivityManageSpecificRule" /> <activity android:name=".ActivityManageRule" />
<activity android:name=".ActivityEditTriggerUrl" /> <activity android:name=".ActivityEditTriggerUrl" />
<activity android:name=".ActivityEditSendTextMessage" /> <activity android:name=".ActivityEditSendTextMessage" />
<activity android:name=".ActivityManageTimeFrame" /> <activity android:name=".ActivityManageTimeFrame" />
@ -182,7 +182,7 @@
<activity android:name=".ActivityEditSpeakText" /> <activity android:name=".ActivityEditSpeakText" />
<activity android:name=".ActivityManageBluetoothTrigger" /> <activity android:name=".ActivityManageBluetoothTrigger" />
<activity android:name=".ActivityMainProfiles" /> <activity android:name=".ActivityMainProfiles" />
<activity android:name=".ActivityManageSpecificProfile" /> <activity android:name=".ActivityManageProfile" />
<activity android:name=".ActivityVolumeTest" /> <activity android:name=".ActivityVolumeTest" />
<service <service

View File

@ -94,7 +94,7 @@
android:name=".ActivityMainScreen" android:name=".ActivityMainScreen"
android:label="@string/app_name"></activity> android:label="@string/app_name"></activity>
<activity <activity
android:name=".ActivityManageSpecificPoi" android:name=".ActivityManagePoi"
android:label="@string/title_activity_main"></activity> android:label="@string/title_activity_main"></activity>
<activity <activity
android:name=".ActivitySettings" android:name=".ActivitySettings"
@ -135,7 +135,7 @@
<receiver android:name=".receivers.ConnectivityReceiver" /> <receiver android:name=".receivers.ConnectivityReceiver" />
<receiver android:name=".receivers.TimeZoneListener" /> <receiver android:name=".receivers.TimeZoneListener" />
<activity android:name=".ActivityManageSpecificRule" /> <activity android:name=".ActivityManageRule" />
<activity android:name=".ActivityEditTriggerUrl" /> <activity android:name=".ActivityEditTriggerUrl" />
<activity android:name=".ActivityEditSendTextMessage" /> <activity android:name=".ActivityEditSendTextMessage" />
<activity android:name=".ActivityManageTimeFrame" /> <activity android:name=".ActivityManageTimeFrame" />
@ -182,7 +182,7 @@
<activity android:name=".ActivityEditSpeakText" /> <activity android:name=".ActivityEditSpeakText" />
<activity android:name=".ActivityManageBluetoothTrigger" /> <activity android:name=".ActivityManageBluetoothTrigger" />
<activity android:name=".ActivityMainProfiles" /> <activity android:name=".ActivityMainProfiles" />
<activity android:name=".ActivityManageSpecificProfile" /> <activity android:name=".ActivityManageProfile" />
<activity android:name=".ActivityVolumeTest" /> <activity android:name=".ActivityVolumeTest" />
<activity android:name=".ActivityPermissions"></activity> <activity android:name=".ActivityPermissions"></activity>

View File

@ -107,7 +107,7 @@ public class ActivityMainPoi extends ActivityGeneric
private void buttonAddPoi() private void buttonAddPoi()
{ {
poiToEdit = null; poiToEdit = null;
Intent manageSpecificPoiIntent = new Intent(ActivityMainPoi.this, ActivityManageSpecificPoi.class); Intent manageSpecificPoiIntent = new Intent(ActivityMainPoi.this, ActivityManagePoi.class);
manageSpecificPoiIntent.putExtra("action", "create"); manageSpecificPoiIntent.putExtra("action", "create");
startActivityForResult(manageSpecificPoiIntent, 1000); startActivityForResult(manageSpecificPoiIntent, 1000);
} }
@ -182,7 +182,7 @@ public class ActivityMainPoi extends ActivityGeneric
break;*/ break;*/
case 0: case 0:
poiToEdit = pointOfInterest; poiToEdit = pointOfInterest;
Intent manageSpecificPoiIntent = new Intent (ActivityMainPoi.this, ActivityManageSpecificPoi.class); Intent manageSpecificPoiIntent = new Intent (ActivityMainPoi.this, ActivityManagePoi.class);
manageSpecificPoiIntent.putExtra("action", "change"); manageSpecificPoiIntent.putExtra("action", "change");
startActivityForResult(manageSpecificPoiIntent, 2000); startActivityForResult(manageSpecificPoiIntent, 2000);
break; break;

View File

@ -57,7 +57,7 @@ public class ActivityMainProfiles extends ActivityGeneric
} }
profileToEdit = null; profileToEdit = null;
Intent manageSpecificProfileIntent = new Intent (ActivityMainProfiles.this, ActivityManageSpecificProfile.class); Intent manageSpecificProfileIntent = new Intent (ActivityMainProfiles.this, ActivityManageProfile.class);
manageSpecificProfileIntent.putExtra("action", "create"); manageSpecificProfileIntent.putExtra("action", "create");
startActivityForResult(manageSpecificProfileIntent, 1000); startActivityForResult(manageSpecificProfileIntent, 1000);
} }
@ -179,7 +179,7 @@ public class ActivityMainProfiles extends ActivityGeneric
break; break;
case 1: case 1:
profileToEdit = profile; profileToEdit = profile;
Intent manageSpecificProfileIntent = new Intent (ActivityMainProfiles.this, ActivityManageSpecificProfile.class); Intent manageSpecificProfileIntent = new Intent (ActivityMainProfiles.this, ActivityManageProfile.class);
manageSpecificProfileIntent.putExtra("action", "change"); manageSpecificProfileIntent.putExtra("action", "change");
startActivityForResult(manageSpecificProfileIntent, 2000); startActivityForResult(manageSpecificProfileIntent, 2000);
break; break;

View File

@ -59,7 +59,7 @@ public class ActivityMainRules extends ActivityGeneric
} }
ruleToEdit = null; ruleToEdit = null;
Intent startAddRuleIntent = new Intent(ActivityMainRules.this, ActivityManageSpecificRule.class); Intent startAddRuleIntent = new Intent(ActivityMainRules.this, ActivityManageRule.class);
startActivityForResult(startAddRuleIntent, 3000); startActivityForResult(startAddRuleIntent, 3000);
} }
}); });
@ -211,7 +211,7 @@ public class ActivityMainRules extends ActivityGeneric
break; break;
case 1: case 1:
ruleToEdit = ruleThisIsAbout; ruleToEdit = ruleThisIsAbout;
Intent manageSpecificRuleIntent = new Intent (ActivityMainRules.this, ActivityManageSpecificRule.class); Intent manageSpecificRuleIntent = new Intent (ActivityMainRules.this, ActivityManageRule.class);
startActivityForResult(manageSpecificRuleIntent, 4000); startActivityForResult(manageSpecificRuleIntent, 4000);
break; break;
case 2: case 2:

View File

@ -35,7 +35,7 @@ public class ActivityMainScreen extends ActivityGeneric
private static ActivityMainScreen activityMainScreenInstance = null; private static ActivityMainScreen activityMainScreenInstance = null;
private ToggleButton toggleService, tbLockSound; private ToggleButton toggleService, tbLockSound;
private Button bShowHelp, bPrivacy, bSettingsErase, bSettingsSetToDefault, bVolumeTest, bAddSoundLockTIme; private Button bShowHelp, bPrivacy, bSettingsErase, bSettingsSetToDefault, bVolumeTest, bAddSoundLockTIme;
private TextView tvActivePoi, tvClosestPoi, tvLastRule, tvMainScreenNote, tvlockSoundDuration; private TextView tvActivePoi, tvClosestPoi, tvLastRule, tvMainScreenNote, tvMainScreenNote2, tvlockSoundDuration;
private ListView lvRuleHistory; private ListView lvRuleHistory;
private ArrayAdapter<Rule> ruleHistoryListViewAdapter; private ArrayAdapter<Rule> ruleHistoryListViewAdapter;
@ -65,6 +65,7 @@ public class ActivityMainScreen extends ActivityGeneric
lvRuleHistory = (ListView) findViewById(R.id.lvRuleHistory); lvRuleHistory = (ListView) findViewById(R.id.lvRuleHistory);
tvLastRule = (TextView) findViewById(R.id.tvTimeFrameHelpText); tvLastRule = (TextView) findViewById(R.id.tvTimeFrameHelpText);
tvMainScreenNote = (TextView) findViewById(R.id.tvMainScreenNote); tvMainScreenNote = (TextView) findViewById(R.id.tvMainScreenNote);
tvMainScreenNote2 = (TextView) findViewById(R.id.tvMainScreenNote2);
tvlockSoundDuration = (TextView)findViewById(R.id.tvlockSoundDuration); tvlockSoundDuration = (TextView)findViewById(R.id.tvlockSoundDuration);
tbLockSound = (ToggleButton) findViewById(R.id.tbLockSound); tbLockSound = (ToggleButton) findViewById(R.id.tbLockSound);
toggleService = (ToggleButton) findViewById(R.id.tbArmMastListener); toggleService = (ToggleButton) findViewById(R.id.tbArmMastListener);
@ -292,6 +293,17 @@ public class ActivityMainScreen extends ActivityGeneric
activityMainScreenInstance.tvMainScreenNote.setVisibility(View.GONE); activityMainScreenInstance.tvMainScreenNote.setVisibility(View.GONE);
} }
if(Miscellaneous.restrictedFeaturesConfigured())
{
activityMainScreenInstance.tvMainScreenNote2.setText(R.string.settingsReferringToRestrictedFeatures);
activityMainScreenInstance.tvMainScreenNote2.setVisibility(View.VISIBLE);
}
else
{
activityMainScreenInstance.tvMainScreenNote2.setText("");
activityMainScreenInstance.tvMainScreenNote2.setVisibility(View.GONE);
}
if (AutomationService.isMyServiceRunning(activityMainScreenInstance)) if (AutomationService.isMyServiceRunning(activityMainScreenInstance))
{ {
Miscellaneous.logEvent("i", "MainScreen", "Service is running. Updating mainscreen with this info.", 5); Miscellaneous.logEvent("i", "MainScreen", "Service is running. Updating mainscreen with this info.", 5);

View File

@ -21,7 +21,7 @@ import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.Toast; import android.widget.Toast;
public class ActivityManageSpecificPoi extends Activity public class ActivityManagePoi extends Activity
{ {
public LocationManager myLocationManager; public LocationManager myLocationManager;
MyLocationListenerGps myLocationListenerGps = new MyLocationListenerGps(); MyLocationListenerGps myLocationListenerGps = new MyLocationListenerGps();
@ -211,7 +211,7 @@ public class ActivityManageSpecificPoi extends Activity
// break; // break;
// } // }
progressDialog = ProgressDialog.show(ActivityManageSpecificPoi.this, "", getResources().getString(R.string.gettingPosition), true, true); progressDialog = ProgressDialog.show(ActivityManagePoi.this, "", getResources().getString(R.string.gettingPosition), true, true);
getLocation(); getLocation();
} }
}; };

View File

@ -29,7 +29,7 @@ import androidx.annotation.RequiresApi;
import java.io.File; import java.io.File;
public class ActivityManageSpecificProfile extends Activity public class ActivityManageProfile extends Activity
{ {
private static ProgressDialog progressDialog; private static ProgressDialog progressDialog;
final static int intentCodeRingtonePickerCallsFile = 9010; final static int intentCodeRingtonePickerCallsFile = 9010;
@ -195,7 +195,7 @@ public class ActivityManageSpecificProfile extends Activity
checkBoxScreenLockUnlockSound.setEnabled(isChecked); checkBoxScreenLockUnlockSound.setEnabled(isChecked);
if(isChecked && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) if(isChecked && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
Miscellaneous.messageBox("Info", getResources().getString(R.string.screenLockSoundNotice), ActivityManageSpecificProfile.this).show(); Miscellaneous.messageBox("Info", getResources().getString(R.string.screenLockSoundNotice), ActivityManageProfile.this).show();
} }
}); });
checkBoxChangeHapticFeedback.setOnCheckedChangeListener(new OnCheckedChangeListener() checkBoxChangeHapticFeedback.setOnCheckedChangeListener(new OnCheckedChangeListener()
@ -223,13 +223,13 @@ public class ActivityManageSpecificProfile extends Activity
try try
{ {
if(ActivityMainProfiles.profileToEdit == null) if(ActivityMainProfiles.profileToEdit == null)
createProfile(ActivityManageSpecificProfile.this); createProfile(ActivityManageProfile.this);
else else
changeProfile(); changeProfile();
} }
catch(Exception ex) catch(Exception ex)
{ {
Toast.makeText(ActivityManageSpecificProfile.this, getResources().getString(R.string.errorWritingFile) + " " + ex.getMessage(), Toast.LENGTH_LONG).show(); Toast.makeText(ActivityManageProfile.this, getResources().getString(R.string.errorWritingFile) + " " + ex.getMessage(), Toast.LENGTH_LONG).show();
} }
} }
}); });
@ -440,14 +440,14 @@ public class ActivityManageSpecificProfile extends Activity
Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
if (uri != null) if (uri != null)
{ {
String ringTonePath = CompensateCrappyAndroidPaths.getPath(ActivityManageSpecificProfile.this, uri); String ringTonePath = CompensateCrappyAndroidPaths.getPath(ActivityManageProfile.this, uri);
setIncomingCallsRingtone(new File(ringTonePath)); setIncomingCallsRingtone(new File(ringTonePath));
} }
break; break;
} }
case intentCodeRingtonePickerCallsFile: case intentCodeRingtonePickerCallsFile:
{ {
String ringTonePath = CompensateCrappyAndroidPaths.getPath(ActivityManageSpecificProfile.this, data.getData()); String ringTonePath = CompensateCrappyAndroidPaths.getPath(ActivityManageProfile.this, data.getData());
setIncomingCallsRingtone(new File(ringTonePath)); setIncomingCallsRingtone(new File(ringTonePath));
break; break;
} }
@ -456,14 +456,14 @@ public class ActivityManageSpecificProfile extends Activity
Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
if (uri != null) if (uri != null)
{ {
String ringTonePath = CompensateCrappyAndroidPaths.getPath(ActivityManageSpecificProfile.this, data.getData()); String ringTonePath = CompensateCrappyAndroidPaths.getPath(ActivityManageProfile.this, data.getData());
setNotificationsRingtone(new File(ringTonePath)); setNotificationsRingtone(new File(ringTonePath));
} }
break; break;
} }
case intentCodeRingtonePickerNotificationsFile: case intentCodeRingtonePickerNotificationsFile:
{ {
String ringTonePath = CompensateCrappyAndroidPaths.getPath(ActivityManageSpecificProfile.this, data.getData()); String ringTonePath = CompensateCrappyAndroidPaths.getPath(ActivityManageProfile.this, data.getData());
setNotificationsRingtone(new File(ringTonePath)); setNotificationsRingtone(new File(ringTonePath));
break; break;
} }

View File

@ -45,7 +45,7 @@ import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
public class ActivityManageSpecificRule extends Activity public class ActivityManageRule extends Activity
{ {
final static String activityDetectionClassPath = "com.jens.automation2.receivers.ActivityDetectionReceiver"; final static String activityDetectionClassPath = "com.jens.automation2.receivers.ActivityDetectionReceiver";
@ -54,7 +54,7 @@ public class ActivityManageSpecificRule extends Activity
private ListView triggerListView, actionListView; private ListView triggerListView, actionListView;
private EditText etRuleName; private EditText etRuleName;
private CheckBox chkRuleActive, chkRuleToggle; private CheckBox chkRuleActive, chkRuleToggle;
private static ActivityManageSpecificRule instance = null; private static ActivityManageRule instance = null;
ImageView imageHelpButton; ImageView imageHelpButton;
private static ProgressDialog progressDialog = null; private static ProgressDialog progressDialog = null;
@ -96,10 +96,10 @@ public class ActivityManageSpecificRule extends Activity
final static int requestCodeActionScreenBrightnessEdit = 402; final static int requestCodeActionScreenBrightnessEdit = 402;
final static int requestCodeActionSendTextMessage = 7001; final static int requestCodeActionSendTextMessage = 7001;
public static ActivityManageSpecificRule getInstance() public static ActivityManageRule getInstance()
{ {
if(instance == null) if(instance == null)
instance = new ActivityManageSpecificRule(); instance = new ActivityManageRule();
return instance; return instance;
} }
@ -182,7 +182,7 @@ public class ActivityManageSpecificRule extends Activity
finish(); finish();
} }
else else
Toast.makeText(ActivityManageSpecificRule.this, getResources().getString(R.string.errorWritingConfig), Toast.LENGTH_LONG).show(); Toast.makeText(ActivityManageRule.this, getResources().getString(R.string.errorWritingConfig), Toast.LENGTH_LONG).show();
} }
else else
{ {
@ -194,7 +194,7 @@ public class ActivityManageSpecificRule extends Activity
finish(); finish();
} }
else else
Toast.makeText(ActivityManageSpecificRule.this, getResources().getString(R.string.errorWritingConfig), Toast.LENGTH_LONG).show(); Toast.makeText(ActivityManageRule.this, getResources().getString(R.string.errorWritingConfig), Toast.LENGTH_LONG).show();
} }
} }
}); });
@ -234,7 +234,7 @@ public class ActivityManageSpecificRule extends Activity
// break; // break;
case timeFrame: case timeFrame:
ActivityManageTimeFrame.editedTimeFrameTrigger = selectedTrigger; ActivityManageTimeFrame.editedTimeFrameTrigger = selectedTrigger;
Intent timeFrameEditor = new Intent(ActivityManageSpecificRule.this, ActivityManageTimeFrame.class); Intent timeFrameEditor = new Intent(ActivityManageRule.this, ActivityManageTimeFrame.class);
startActivityForResult(timeFrameEditor, requestCodeTriggerTimeframeEdit); startActivityForResult(timeFrameEditor, requestCodeTriggerTimeframeEdit);
break; break;
// case usb_host_connection: // case usb_host_connection:
@ -243,7 +243,7 @@ public class ActivityManageSpecificRule extends Activity
// break; // break;
case bluetoothConnection: case bluetoothConnection:
ActivityManageBluetoothTrigger.editedBluetoothTrigger = selectedTrigger; ActivityManageBluetoothTrigger.editedBluetoothTrigger = selectedTrigger;
Intent bluetoothEditor = new Intent(ActivityManageSpecificRule.this, ActivityManageBluetoothTrigger.class); Intent bluetoothEditor = new Intent(ActivityManageRule.this, ActivityManageBluetoothTrigger.class);
startActivityForResult(bluetoothEditor, requestCodeTriggerBluetoothEdit); startActivityForResult(bluetoothEditor, requestCodeTriggerBluetoothEdit);
break; break;
default: default:
@ -288,13 +288,13 @@ public class ActivityManageSpecificRule extends Activity
// case setAirplaneMode: // case setAirplaneMode:
// break; // break;
case startOtherActivity: case startOtherActivity:
Intent intent = new Intent(ActivityManageSpecificRule.this, ActivityManageStartActivity.class); Intent intent = new Intent(ActivityManageRule.this, ActivityManageStartActivity.class);
ActivityManageStartActivity.resultingAction = a; ActivityManageStartActivity.resultingAction = a;
intent.putExtra("edit", true); intent.putExtra("edit", true);
startActivityForResult(intent, requestCodeActionStartActivityEdit); startActivityForResult(intent, requestCodeActionStartActivityEdit);
break; break;
case triggerUrl: case triggerUrl:
Intent activityEditTriggerUrlIntent = new Intent(ActivityManageSpecificRule.this, ActivityEditTriggerUrl.class); Intent activityEditTriggerUrlIntent = new Intent(ActivityManageRule.this, ActivityEditTriggerUrl.class);
// activityEditTriggerUrlIntent.putExtra("urlToTrigger", a.getParameter2()); // activityEditTriggerUrlIntent.putExtra("urlToTrigger", a.getParameter2());
ActivityEditTriggerUrl.resultingAction = a; ActivityEditTriggerUrl.resultingAction = a;
activityEditTriggerUrlIntent.putExtra("edit", true); activityEditTriggerUrlIntent.putExtra("edit", true);
@ -321,19 +321,19 @@ public class ActivityManageSpecificRule extends Activity
// case wakeupDevice: // case wakeupDevice:
// break; // break;
case speakText: case speakText:
Intent activitySpeakTextIntent = new Intent(ActivityManageSpecificRule.this, ActivityEditSpeakText.class); Intent activitySpeakTextIntent = new Intent(ActivityManageRule.this, ActivityEditSpeakText.class);
ActivityEditSpeakText.resultingAction = a; ActivityEditSpeakText.resultingAction = a;
activitySpeakTextIntent.putExtra("edit", true); activitySpeakTextIntent.putExtra("edit", true);
startActivityForResult(activitySpeakTextIntent, requestCodeActionSpeakTextEdit); startActivityForResult(activitySpeakTextIntent, requestCodeActionSpeakTextEdit);
break; break;
case sendTextMessage: case sendTextMessage:
Intent activitySendTextMessageIntent = new Intent(ActivityManageSpecificRule.this, ActivityEditSendTextMessage.class); Intent activitySendTextMessageIntent = new Intent(ActivityManageRule.this, ActivityEditSendTextMessage.class);
ActivityEditSendTextMessage.resultingAction = a; ActivityEditSendTextMessage.resultingAction = a;
activitySendTextMessageIntent.putExtra("edit", true); activitySendTextMessageIntent.putExtra("edit", true);
startActivityForResult(activitySendTextMessageIntent, requestCodeActionSendTextMessage); startActivityForResult(activitySendTextMessageIntent, requestCodeActionSendTextMessage);
break; break;
case setScreenBrightness: case setScreenBrightness:
Intent activityEditScreenBrightnessIntent = new Intent(ActivityManageSpecificRule.this, ActivityManageBrightnessSetting.class); Intent activityEditScreenBrightnessIntent = new Intent(ActivityManageRule.this, ActivityManageBrightnessSetting.class);
// ActivityEditTriggerUrl.resultingAction = a; // ActivityEditTriggerUrl.resultingAction = a;
activityEditScreenBrightnessIntent.putExtra("autoBrightness", a.getParameter1()); activityEditScreenBrightnessIntent.putExtra("autoBrightness", a.getParameter1());
activityEditScreenBrightnessIntent.putExtra("brightnessValue", Integer.parseInt(a.getParameter2())); activityEditScreenBrightnessIntent.putExtra("brightnessValue", Integer.parseInt(a.getParameter2()));
@ -368,7 +368,7 @@ public class ActivityManageSpecificRule extends Activity
guiEditing = true; guiEditing = true;
chkRuleToggle.setChecked(false); chkRuleToggle.setChecked(false);
guiEditing = false; guiEditing = false;
Toast.makeText(ActivityManageSpecificRule.this, getResources().getString(R.string.toggleNotAllowed), Toast.LENGTH_LONG).show(); Toast.makeText(ActivityManageRule.this, getResources().getString(R.string.toggleNotAllowed), Toast.LENGTH_LONG).show();
} }
} }
}); });
@ -379,7 +379,7 @@ public class ActivityManageSpecificRule extends Activity
public void onClick(View v) public void onClick(View v)
{ {
// Open help popup // Open help popup
Miscellaneous.messageBox(getResources().getString(R.string.whatsThis), getResources().getString(R.string.helpTextToggable), ActivityManageSpecificRule.this).show(); Miscellaneous.messageBox(getResources().getString(R.string.whatsThis), getResources().getString(R.string.helpTextToggable), ActivityManageRule.this).show();
} }
}); });
} }
@ -455,7 +455,7 @@ public class ActivityManageSpecificRule extends Activity
else if(types[i].toString().equals(Trigger_Enum.phoneCall.toString())) else if(types[i].toString().equals(Trigger_Enum.phoneCall.toString()))
{ {
// if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS") && !Miscellaneous.isGooglePlayInstalled(ActivityManageSpecificRule.this)) // if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS") && !Miscellaneous.isGooglePlayInstalled(ActivityManageSpecificRule.this))
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS")) if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, "android.permission.SEND_SMS"))
items.add(new Item(typesLong[i].toString(), R.drawable.phone)); items.add(new Item(typesLong[i].toString(), R.drawable.phone));
} }
else if(types[i].toString().equals(Trigger_Enum.nfcTag.toString())) else if(types[i].toString().equals(Trigger_Enum.nfcTag.toString()))
@ -551,7 +551,7 @@ public class ActivityManageSpecificRule extends Activity
Toast.makeText(myContext, getResources().getString(R.string.triggerOnlyAvailableIfPlayServicesInstalled), Toast.LENGTH_LONG).show(); Toast.makeText(myContext, getResources().getString(R.string.triggerOnlyAvailableIfPlayServicesInstalled), Toast.LENGTH_LONG).show();
} }
else else
Miscellaneous.messageBox(getResources().getString(R.string.error), getResources().getString(R.string.featureNotInFdroidVersion), ActivityManageSpecificRule.this).show(); Miscellaneous.messageBox(getResources().getString(R.string.error), getResources().getString(R.string.featureNotInFdroidVersion), ActivityManageRule.this).show();
} }
catch (IllegalAccessException | InvocationTargetException e) catch (IllegalAccessException | InvocationTargetException e)
{ {
@ -561,7 +561,7 @@ public class ActivityManageSpecificRule extends Activity
} }
else if(triggerType == Trigger_Enum.nfcTag) else if(triggerType == Trigger_Enum.nfcTag)
{ {
if(NfcReceiver.checkNfcRequirements(ActivityManageSpecificRule.this, true)) if(NfcReceiver.checkNfcRequirements(ActivityManageRule.this, true))
{ {
newTrigger.setTriggerType(Trigger_Enum.nfcTag); newTrigger.setTriggerType(Trigger_Enum.nfcTag);
Intent nfcEditor = new Intent(myContext, ActivityManageNfc.class); Intent nfcEditor = new Intent(myContext, ActivityManageNfc.class);
@ -572,7 +572,7 @@ public class ActivityManageSpecificRule extends Activity
else if(triggerType == Trigger_Enum.bluetoothConnection) else if(triggerType == Trigger_Enum.bluetoothConnection)
{ {
if(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) if(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH))
Miscellaneous.messageBox("Bluetooth", getResources().getString(R.string.deviceDoesNotHaveBluetooth), ActivityManageSpecificRule.this).show();; Miscellaneous.messageBox("Bluetooth", getResources().getString(R.string.deviceDoesNotHaveBluetooth), ActivityManageRule.this).show();;
newTrigger.setTriggerType(Trigger_Enum.bluetoothConnection); newTrigger.setTriggerType(Trigger_Enum.bluetoothConnection);
ActivityManageBluetoothTrigger.editedBluetoothTrigger = newTrigger; ActivityManageBluetoothTrigger.editedBluetoothTrigger = newTrigger;
@ -585,7 +585,7 @@ public class ActivityManageSpecificRule extends Activity
if(triggerType == Trigger_Enum.nfcTag) if(triggerType == Trigger_Enum.nfcTag)
{ {
if (NfcReceiver.checkNfcRequirements(ActivityManageSpecificRule.this, true)) if (NfcReceiver.checkNfcRequirements(ActivityManageRule.this, true))
getTriggerParamterDialog(context, booleanChoices).show(); getTriggerParamterDialog(context, booleanChoices).show();
} }
else else
@ -658,7 +658,7 @@ public class ActivityManageSpecificRule extends Activity
{ {
progressDialog = ProgressDialog.show(myContext, null, getResources().getString(R.string.gettingListOfInstalledApplications), true, false); progressDialog = ProgressDialog.show(myContext, null, getResources().getString(R.string.gettingListOfInstalledApplications), true, false);
newTrigger.setTriggerType(Trigger_Enum.process_started_stopped); newTrigger.setTriggerType(Trigger_Enum.process_started_stopped);
new GenerateApplicationSelectionsDialogTask().execute(ActivityManageSpecificRule.this); new GenerateApplicationSelectionsDialogTask().execute(ActivityManageRule.this);
// getTriggerRunningProcessDialog1(myContext).show(); // getTriggerRunningProcessDialog1(myContext).show();
} }
else if(triggerType.equals(Trigger_Enum.phoneCall)) else if(triggerType.equals(Trigger_Enum.phoneCall))
@ -820,7 +820,7 @@ public class ActivityManageSpecificRule extends Activity
public void onClick(DialogInterface dialog, int which) public void onClick(DialogInterface dialog, int which)
{ {
newTrigger.setPhoneDirection(which); newTrigger.setPhoneDirection(which);
getTriggerPhoneNumberDialog(ActivityManageSpecificRule.this).show(); getTriggerPhoneNumberDialog(ActivityManageRule.this).show();
} }
}); });
@ -965,10 +965,10 @@ public class ActivityManageSpecificRule extends Activity
return alertDialog.create(); return alertDialog.create();
} }
private static class GenerateApplicationSelectionsDialogTask extends AsyncTask<ActivityManageSpecificRule, Void, String[]> private static class GenerateApplicationSelectionsDialogTask extends AsyncTask<ActivityManageRule, Void, String[]>
{ {
@Override @Override
protected String[] doInBackground(ActivityManageSpecificRule... params) protected String[] doInBackground(ActivityManageRule... params)
{ {
// Looper.prepare(); // Looper.prepare();
final String[] applicationArray = ActivityManageStartActivity.getApplicationNameListString(params[0]); final String[] applicationArray = ActivityManageStartActivity.getApplicationNameListString(params[0]);
@ -984,13 +984,13 @@ public class ActivityManageSpecificRule extends Activity
progressDialog = null; progressDialog = null;
} }
ActivityManageSpecificRule.getInstance().showProcessDialog(result); ActivityManageRule.getInstance().showProcessDialog(result);
} }
} }
void showProcessDialog(String[] programStrings) void showProcessDialog(String[] programStrings)
{ {
getTriggerRunningProcessDialog1(ActivityManageSpecificRule.this, programStrings).show(); getTriggerRunningProcessDialog1(ActivityManageRule.this, programStrings).show();
} }
private AlertDialog getTriggerRunningProcessDialog1(final Context myContext, final String[] applicationArray) private AlertDialog getTriggerRunningProcessDialog1(final Context myContext, final String[] applicationArray)
@ -1026,7 +1026,7 @@ public class ActivityManageSpecificRule extends Activity
{ {
String packageName = packageArray[which]; String packageName = packageArray[which];
getTriggerRunningProcessDialog3(myContext, packageName).show(); getTriggerRunningProcessDialog3(myContext, packageName).show();
Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.chooseActivityHint), ActivityManageSpecificRule.this).show(); Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.chooseActivityHint), ActivityManageRule.this).show();
} }
}); });
AlertDialog alertDialog = alertDialogBuilder.create(); AlertDialog alertDialog = alertDialogBuilder.create();
@ -1248,7 +1248,7 @@ public class ActivityManageSpecificRule extends Activity
else if(types[i].toString().equals(Action_Enum.sendTextMessage.toString())) else if(types[i].toString().equals(Action_Enum.sendTextMessage.toString()))
{ {
// if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS") && !Miscellaneous.isGooglePlayInstalled(ActivityManageSpecificRule.this)) // if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS") && !Miscellaneous.isGooglePlayInstalled(ActivityManageSpecificRule.this))
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS")) if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, "android.permission.SEND_SMS"))
items.add(new Item(typesLong[i].toString(), R.drawable.message)); items.add(new Item(typesLong[i].toString(), R.drawable.message));
} }
else else
@ -1303,31 +1303,31 @@ public class ActivityManageSpecificRule extends Activity
newAction.setAction(Action_Enum.setWifi); newAction.setAction(Action_Enum.setWifi);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
Toast.makeText(context, context.getResources().getString(R.string.android10WifiToggleNotice), Toast.LENGTH_LONG).show(); Toast.makeText(context, context.getResources().getString(R.string.android10WifiToggleNotice), Toast.LENGTH_LONG).show();
getActionParameter1Dialog(ActivityManageSpecificRule.this).show(); getActionParameter1Dialog(ActivityManageRule.this).show();
} }
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setBluetooth.toString())) else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setBluetooth.toString()))
{ {
if(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) if(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH))
Miscellaneous.messageBox("Bluetooth", getResources().getString(R.string.deviceDoesNotHaveBluetooth), ActivityManageSpecificRule.this).show();; Miscellaneous.messageBox("Bluetooth", getResources().getString(R.string.deviceDoesNotHaveBluetooth), ActivityManageRule.this).show();;
newAction.setAction(Action_Enum.setBluetooth); newAction.setAction(Action_Enum.setBluetooth);
getActionParameter1Dialog(ActivityManageSpecificRule.this).show(); getActionParameter1Dialog(ActivityManageRule.this).show();
} }
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setUsbTethering.toString())) else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setUsbTethering.toString()))
{ {
newAction.setAction(Action_Enum.setUsbTethering); newAction.setAction(Action_Enum.setUsbTethering);
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) if(Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1)
Toast.makeText(context, context.getResources().getString(R.string.usbTetheringFailForAboveGingerbread), Toast.LENGTH_LONG).show(); Toast.makeText(context, context.getResources().getString(R.string.usbTetheringFailForAboveGingerbread), Toast.LENGTH_LONG).show();
getActionParameter1Dialog(ActivityManageSpecificRule.this).show(); getActionParameter1Dialog(ActivityManageRule.this).show();
} }
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setWifiTethering.toString())) else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setWifiTethering.toString()))
{ {
newAction.setAction(Action_Enum.setWifiTethering); newAction.setAction(Action_Enum.setWifiTethering);
getActionParameter1Dialog(ActivityManageSpecificRule.this).show(); getActionParameter1Dialog(ActivityManageRule.this).show();
} }
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setDisplayRotation.toString())) else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setDisplayRotation.toString()))
{ {
newAction.setAction(Action_Enum.setDisplayRotation); newAction.setAction(Action_Enum.setDisplayRotation);
getActionParameter1Dialog(ActivityManageSpecificRule.this).show(); getActionParameter1Dialog(ActivityManageRule.this).show();
} }
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.changeSoundProfile.toString())) else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.changeSoundProfile.toString()))
{ {
@ -1342,34 +1342,34 @@ public class ActivityManageSpecificRule extends Activity
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.startOtherActivity.toString())) else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.startOtherActivity.toString()))
{ {
newAction.setAction(Action_Enum.startOtherActivity); newAction.setAction(Action_Enum.startOtherActivity);
Intent intent = new Intent(ActivityManageSpecificRule.this, ActivityManageStartActivity.class); Intent intent = new Intent(ActivityManageRule.this, ActivityManageStartActivity.class);
startActivityForResult(intent, 3000); startActivityForResult(intent, 3000);
} }
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.waitBeforeNextAction.toString())) else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.waitBeforeNextAction.toString()))
{ {
newAction.setAction(Action_Enum.waitBeforeNextAction); newAction.setAction(Action_Enum.waitBeforeNextAction);
getActionWaitBeforeNextActionDialog(ActivityManageSpecificRule.this).show(); getActionWaitBeforeNextActionDialog(ActivityManageRule.this).show();
} }
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.wakeupDevice.toString())) else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.wakeupDevice.toString()))
{ {
newAction.setAction(Action_Enum.wakeupDevice); newAction.setAction(Action_Enum.wakeupDevice);
getActionWakeupDeviceDialog(ActivityManageSpecificRule.this).show(); getActionWakeupDeviceDialog(ActivityManageRule.this).show();
} }
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setAirplaneMode.toString())) else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setAirplaneMode.toString()))
{ {
if(Build.VERSION.SDK_INT >= 17) if(Build.VERSION.SDK_INT >= 17)
{ {
Toast.makeText(context, getResources().getString(R.string.airplaneModeSdk17Warning), Toast.LENGTH_LONG).show(); Toast.makeText(context, getResources().getString(R.string.airplaneModeSdk17Warning), Toast.LENGTH_LONG).show();
Miscellaneous.messageBox(getResources().getString(R.string.airplaneMode), getResources().getString(R.string.rootExplanation), ActivityManageSpecificRule.this).show(); Miscellaneous.messageBox(getResources().getString(R.string.airplaneMode), getResources().getString(R.string.rootExplanation), ActivityManageRule.this).show();
} }
newAction.setAction(Action_Enum.setAirplaneMode); newAction.setAction(Action_Enum.setAirplaneMode);
getActionParameter1Dialog(ActivityManageSpecificRule.this).show(); getActionParameter1Dialog(ActivityManageRule.this).show();
} }
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setDataConnection.toString())) else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setDataConnection.toString()))
{ {
newAction.setAction(Action_Enum.setDataConnection); newAction.setAction(Action_Enum.setDataConnection);
getActionParameter1Dialog(ActivityManageSpecificRule.this).show(); getActionParameter1Dialog(ActivityManageRule.this).show();
Miscellaneous.messageBox(getResources().getString(R.string.actionDataConnection), getResources().getString(R.string.rootExplanation), ActivityManageSpecificRule.this).show(); Miscellaneous.messageBox(getResources().getString(R.string.actionDataConnection), getResources().getString(R.string.rootExplanation), ActivityManageRule.this).show();
} }
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.speakText.toString())) else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.speakText.toString()))
{ {
@ -1382,7 +1382,7 @@ public class ActivityManageSpecificRule extends Activity
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.sendTextMessage.toString())) else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.sendTextMessage.toString()))
{ {
// if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS") && !Miscellaneous.isGooglePlayInstalled(ActivityManageSpecificRule.this)) // if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS") && !Miscellaneous.isGooglePlayInstalled(ActivityManageSpecificRule.this))
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS")) if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, "android.permission.SEND_SMS"))
{ {
//launch other activity to enter parameters; //launch other activity to enter parameters;
newAction.setAction(Action_Enum.sendTextMessage); newAction.setAction(Action_Enum.sendTextMessage);
@ -1482,7 +1482,7 @@ public class ActivityManageSpecificRule extends Activity
else else
{ {
// Is already at the top // Is already at the top
Toast.makeText(ActivityManageSpecificRule.this, getResources().getString(R.string.cantMoveUp), Toast.LENGTH_LONG).show(); Toast.makeText(ActivityManageRule.this, getResources().getString(R.string.cantMoveUp), Toast.LENGTH_LONG).show();
} }
break; break;
case 2: case 2:
@ -1497,7 +1497,7 @@ public class ActivityManageSpecificRule extends Activity
else else
{ {
// Is already at the bottom // Is already at the bottom
Toast.makeText(ActivityManageSpecificRule.this, getResources().getString(R.string.cantMoveDown), Toast.LENGTH_LONG).show(); Toast.makeText(ActivityManageRule.this, getResources().getString(R.string.cantMoveDown), Toast.LENGTH_LONG).show();
} }
break; break;
} }
@ -1583,8 +1583,8 @@ public class ActivityManageSpecificRule extends Activity
{ {
if(input.getText().toString().length() == 0| input.getText().toString().equals("0") | input.getText().toString().contains(",") | input.getText().toString().contains(".")) if(input.getText().toString().length() == 0| input.getText().toString().equals("0") | input.getText().toString().contains(",") | input.getText().toString().contains("."))
{ {
Toast.makeText(myContext, ActivityManageSpecificRule.this.getResources().getString(R.string.enterAPositiveValidNonDecimalNumber), Toast.LENGTH_LONG).show(); Toast.makeText(myContext, ActivityManageRule.this.getResources().getString(R.string.enterAPositiveValidNonDecimalNumber), Toast.LENGTH_LONG).show();
getActionWaitBeforeNextActionDialog(ActivityManageSpecificRule.this).show(); getActionWaitBeforeNextActionDialog(ActivityManageRule.this).show();
} }
else else
{ {
@ -1625,8 +1625,8 @@ public class ActivityManageSpecificRule extends Activity
{ {
if(input.getText().toString().length() == 0| input.getText().toString().contains(",") | input.getText().toString().contains(".")) if(input.getText().toString().length() == 0| input.getText().toString().contains(",") | input.getText().toString().contains("."))
{ {
Toast.makeText(myContext, ActivityManageSpecificRule.this.getResources().getString(R.string.enterAPositiveValidNonDecimalNumber), Toast.LENGTH_LONG).show(); Toast.makeText(myContext, ActivityManageRule.this.getResources().getString(R.string.enterAPositiveValidNonDecimalNumber), Toast.LENGTH_LONG).show();
getActionWakeupDeviceDialog(ActivityManageSpecificRule.this).show(); getActionWakeupDeviceDialog(ActivityManageRule.this).show();
} }
else else
{ {

View File

@ -83,14 +83,15 @@ public class ActivityPermissions extends Activity
} }
}); });
bRequestPermissions.setOnClickListener(new View.OnClickListener() // bRequestPermissions.setOnClickListener(new View.OnClickListener()
{ // {
@Override // @Override
public void onClick(View v) // public void onClick(View v)
{ // {
finish(); // finish();
} // }
}); // });
bRequestPermissions.setOnClickListener(new View.OnClickListener() bRequestPermissions.setOnClickListener(new View.OnClickListener()
{ {
@Override @Override

View File

@ -36,6 +36,7 @@ public class AutomationService extends Service implements OnInitListener
{ {
protected TextToSpeech ttsEngine = null; protected TextToSpeech ttsEngine = null;
protected final static int notificationId = 1000; protected final static int notificationId = 1000;
protected final static int notificationIdRestrictions = 1005;
final static String NOTIFICATION_CHANNEL_ID = "com.jens.automation2"; final static String NOTIFICATION_CHANNEL_ID = "com.jens.automation2";
final static String channelName = "Automation notifications"; final static String channelName = "Automation notifications";
@ -373,18 +374,18 @@ public class AutomationService extends Service implements OnInitListener
protected void checkForRestrictedFeatures() protected void checkForRestrictedFeatures()
{ {
try if(Rule.isAnyRuleUsing(Trigger_Enum.activityDetection))
{ {
Class testClass = Class.forName(ActivityManageSpecificRule.activityDetectionClassPath); try
}
catch (ClassNotFoundException e)
{
if(Rule.isAnyRuleUsing(Trigger_Enum.activityDetection))
{ {
Intent intent = new Intent(AutomationService.this, ActivityMainScreen.class); Class testClass = Class.forName(ActivityManageRule.activityDetectionClassPath);
}
catch (ClassNotFoundException e)
{
Intent intent = new Intent(AutomationService.this, ActivityMainTabLayout.class);
PendingIntent pi = PendingIntent.getActivity(AutomationService.this, 0, intent, 0); PendingIntent pi = PendingIntent.getActivity(AutomationService.this, 0, intent, 0);
// Miscellaneous.createDismissableNotification(getResources().getString(R.string.settingsReferringToRestrictedFeatures), ActivityPermissions.notificationIdPermissions, pi); // Miscellaneous.createDismissableNotification(getResources().getString(R.string.settingsReferringToRestrictedFeatures), ActivityPermissions.notificationIdPermissions, pi);
Miscellaneous.createDismissableNotification(getResources().getString(R.string.settingsReferringToRestrictedFeatures), 1, pi); Miscellaneous.createDismissableNotification(getResources().getString(R.string.settingsReferringToRestrictedFeatures), notificationIdRestrictions, pi);
} }
} }
} }

View File

@ -739,52 +739,8 @@ public class Miscellaneous extends Service
Notification dismissableNotification = dismissableNotificationBuilder.build(); Notification dismissableNotification = dismissableNotificationBuilder.build();
mNotificationManager.notify(notificationId, dismissableNotification); mNotificationManager.notify(notificationId, dismissableNotification);
/*NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher) // notification icon
.setContentTitle("Notification!") // title for notification
.setContentText("Hello word") // message for notification
.setAutoCancel(true); // clear notification after click
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pi = PendingIntent.getActivity(this,0,intent,Intent.FLAG_ACTIVITY_NEW_TASK);
mBuilder.setContentIntent(pi);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(0, dismissableNotification);*/
} }
/*protected static Notification.Builder createDismissableNotificationBuilder()
{
Notification.Builder builder = new Notification.Builder(AutomationService.getInstance());
builder.setContentTitle("Automation");
builder.setSmallIcon(R.drawable.ic_launcher);
builder.setCategory(Notification.CATEGORY_EVENT);
builder.setWhen(System.currentTimeMillis());
//static PendingIntent myPendingIntent = PendingIntent.getActivity(this, 0, myIntent, 0);
//builder.setContentIntent(myPendingIntent);
// Notification defaultNotification = new Notification();
*//* Notification defaultNotification = builder.build();
defaultNotification.icon = R.drawable.ic_launcher;
defaultNotification.when = System.currentTimeMillis();
// defaultNotification.defaults |= Notification.DEFAULT_VIBRATE;
// defaultNotification.defaults |= Notification.DEFAULT_LIGHTS;
defaultNotification.flags |= Notification.FLAG_AUTO_CANCEL;
// defaultNotification.flags |= Notification.FLAG_SHOW_LIGHTS;
defaultNotification.flags |= Notification.FLAG_ONLY_ALERT_ONCE;
// defaultNotification.ledARGB = Color.YELLOW;
// defaultNotification.ledOnMS = 1500;
// defaultNotification.ledOffMS = 1500;
*//*
return builder;
}*/
protected static NotificationCompat.Builder createDismissableNotificationBuilder(PendingIntent myPendingIntent) protected static NotificationCompat.Builder createDismissableNotificationBuilder(PendingIntent myPendingIntent)
{ {
NotificationManager mNotificationManager = (NotificationManager) AutomationService.getInstance().getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager mNotificationManager = (NotificationManager) AutomationService.getInstance().getSystemService(Context.NOTIFICATION_SERVICE);
@ -928,4 +884,21 @@ public class Miscellaneous extends Service
return result; return result;
} }
public static boolean restrictedFeaturesConfigured()
{
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.activityDetection))
{
try
{
Class testClass = Class.forName(ActivityManageRule.activityDetectionClassPath);
}
catch (ClassNotFoundException e)
{
return true;
}
}
return false;
}
} }

View File

@ -18,7 +18,7 @@ import com.jens.automation2.receivers.TimeZoneListener;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import static com.jens.automation2.ActivityManageSpecificRule.activityDetectionClassPath; import static com.jens.automation2.ActivityManageRule.activityDetectionClassPath;
/** /**
* Created by jens on 08.03.2017. * Created by jens on 08.03.2017.
@ -165,7 +165,7 @@ public class ReceiverCoordinator
try try
{ {
Class testClass = Class.forName(ActivityManageSpecificRule.activityDetectionClassPath); Class testClass = Class.forName(ActivityManageRule.activityDetectionClassPath);
//startActivityDetectionReceiver //startActivityDetectionReceiver
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.activityDetection)) if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.activityDetection))
{ {
@ -202,7 +202,7 @@ public class ReceiverCoordinator
try try
{ {
Class testClass = Class.forName(ActivityManageSpecificRule.activityDetectionClassPath); Class testClass = Class.forName(ActivityManageRule.activityDetectionClassPath);
Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "stopActivityDetectionReceiver", null); Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "stopActivityDetectionReceiver", null);
// ActivityDetectionReceiver.stopActivityDetectionReceiver(); // ActivityDetectionReceiver.stopActivityDetectionReceiver();
} }

View File

@ -8,8 +8,6 @@ import androidx.annotation.RequiresApi;
import com.jens.automation2.receivers.BluetoothReceiver; import com.jens.automation2.receivers.BluetoothReceiver;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
@ -355,13 +353,13 @@ public class Trigger
case activityDetection: case activityDetection:
try try
{ {
Class testClass = Class.forName(ActivityManageSpecificRule.activityDetectionClassPath); Class testClass = Class.forName(ActivityManageRule.activityDetectionClassPath);
if (ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), "com.google.android.gms.permission.ACTIVITY_RECOGNITION")) if (ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), "com.google.android.gms.permission.ACTIVITY_RECOGNITION"))
{ {
// This type doesn't have an activate/deactivate equivalent, at least not yet. // This type doesn't have an activate/deactivate equivalent, at least not yet.
// try // try
// { // {
returnString.append(Miscellaneous.runMethodReflective(ActivityManageSpecificRule.activityDetectionClassPath, "getDescription", new Object[]{getActivityDetectionType()})); returnString.append(Miscellaneous.runMethodReflective(ActivityManageRule.activityDetectionClassPath, "getDescription", new Object[]{getActivityDetectionType()}));
// for(Method method : activityDetection.getMethods()) // for(Method method : activityDetection.getMethods())
// { // {
// if(method.getName().equalsIgnoreCase("getDescription")) // if(method.getName().equalsIgnoreCase("getDescription"))

View File

@ -37,6 +37,18 @@
android:textColor="@color/importantMessage" android:textColor="@color/importantMessage"
android:singleLine="false" android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/tvMainScreenNote2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:scrollHorizontally="false"
android:textColor="@color/importantMessage"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TableLayout <TableLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"