mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 21:06:50 +01:00
Minor fixes for crashes that Play Store build has encountered
This commit is contained in:
parent
c762bafb2e
commit
f996973a4d
@ -22,6 +22,7 @@ import android.annotation.TargetApi;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@ -292,7 +293,6 @@ public class ControlCenterv2 extends AppCompatActivity
|
|||||||
cl.getLogDialog().show();
|
cl.getLogDialog().show();
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
GB.toast(getBaseContext(), "Error showing Changelog", Toast.LENGTH_LONG, GB.ERROR);
|
GB.toast(getBaseContext(), "Error showing Changelog", Toast.LENGTH_LONG, GB.ERROR);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,13 +567,17 @@ public class ControlCenterv2 extends AppCompatActivity
|
|||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
// Use the Builder class for convenient dialog construction
|
// Use the Builder class for convenient dialog construction
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
Context context = getContext();
|
final Context context = getContext();
|
||||||
builder.setMessage(context.getString(R.string.permission_notification_policy_access,
|
builder.setMessage(context.getString(R.string.permission_notification_policy_access,
|
||||||
getContext().getString(R.string.app_name),
|
getContext().getString(R.string.app_name),
|
||||||
getContext().getString(R.string.ok)))
|
getContext().getString(R.string.ok)))
|
||||||
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
startActivity(new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS));
|
try {
|
||||||
|
startActivity(new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS));
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
GB.toast(context, "'Notification Policy' activity not found", Toast.LENGTH_LONG, GB.ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return builder.create();
|
return builder.create();
|
||||||
@ -586,14 +590,17 @@ public class ControlCenterv2 extends AppCompatActivity
|
|||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
// Use the Builder class for convenient dialog construction
|
// Use the Builder class for convenient dialog construction
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
Context context = getContext();
|
final Context context = getContext();
|
||||||
builder.setMessage(context.getString(R.string.permission_notification_listener,
|
builder.setMessage(context.getString(R.string.permission_notification_listener,
|
||||||
getContext().getString(R.string.app_name),
|
getContext().getString(R.string.app_name),
|
||||||
getContext().getString(R.string.ok)))
|
getContext().getString(R.string.ok)))
|
||||||
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
Intent enableIntent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
|
try {
|
||||||
startActivity(enableIntent);
|
startActivity(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"));
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
GB.toast(context, "'Notification Listener Settings' activity not found", Toast.LENGTH_LONG, GB.ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return builder.create();
|
return builder.create();
|
||||||
|
@ -98,6 +98,7 @@ import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
|
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.BatteryState;
|
import nodomain.freeyourgadget.gadgetbridge.model.BatteryState;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec;
|
import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.service.btle.BtLEQueue;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.calendar.CalendarEvent;
|
import nodomain.freeyourgadget.gadgetbridge.util.calendar.CalendarEvent;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.calendar.CalendarManager;
|
import nodomain.freeyourgadget.gadgetbridge.util.calendar.CalendarManager;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.CallSpec;
|
import nodomain.freeyourgadget.gadgetbridge.model.CallSpec;
|
||||||
@ -179,12 +180,17 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
switch (intent.getAction()) {
|
switch (intent.getAction()) {
|
||||||
case BANGLEJS_COMMAND_TX: {
|
case BANGLEJS_COMMAND_TX: {
|
||||||
String data = String.valueOf(intent.getExtras().get("DATA"));
|
String data = String.valueOf(intent.getExtras().get("DATA"));
|
||||||
try {
|
BtLEQueue queue = getQueue();
|
||||||
TransactionBuilder builder = performInitialized("TX");
|
if (queue==null) {
|
||||||
uartTx(builder, data);
|
LOG.warn("BANGLEJS_COMMAND_TX received, but getQueue()==null (state=" + gbDevice.getStateString() + ")");
|
||||||
builder.queue(getQueue());
|
} else {
|
||||||
} catch (IOException e) {
|
try {
|
||||||
GB.toast(getContext(), "Error in TX: " + e.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
|
TransactionBuilder builder = performInitialized("TX");
|
||||||
|
uartTx(builder, data);
|
||||||
|
builder.queue(queue);
|
||||||
|
} catch (IOException e) {
|
||||||
|
GB.toast(getContext(), "Error in TX: " + e.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user