mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-03 13:37:32 +01:00
allow to setup a common suffix for canned replies (defaults to " (canned reply)")
This commit is contained in:
parent
0b53f60b0d
commit
de4ffe8fb0
@ -110,6 +110,7 @@ public class SettingsActivity extends AbstractSettingsActivity {
|
|||||||
"pebble_emu_addr",
|
"pebble_emu_addr",
|
||||||
"pebble_emu_port",
|
"pebble_emu_port",
|
||||||
"pebble_reconnect_attempts",
|
"pebble_reconnect_attempts",
|
||||||
|
"canned_reply_suffix",
|
||||||
"canned_reply_1",
|
"canned_reply_1",
|
||||||
"canned_reply_2",
|
"canned_reply_2",
|
||||||
"canned_reply_3",
|
"canned_reply_3",
|
||||||
|
@ -6,9 +6,11 @@ import android.app.PendingIntent;
|
|||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
import android.telephony.SmsManager;
|
import android.telephony.SmsManager;
|
||||||
|
|
||||||
@ -20,6 +22,7 @@ import java.io.IOException;
|
|||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
@ -243,6 +246,11 @@ public abstract class AbstractDeviceSupport implements DeviceSupport {
|
|||||||
Intent notificationListenerIntent = new Intent(action);
|
Intent notificationListenerIntent = new Intent(action);
|
||||||
notificationListenerIntent.putExtra("handle", deviceEvent.handle);
|
notificationListenerIntent.putExtra("handle", deviceEvent.handle);
|
||||||
if (deviceEvent.reply != null) {
|
if (deviceEvent.reply != null) {
|
||||||
|
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(GBApplication.getContext());
|
||||||
|
String suffix = sharedPrefs.getString("canned_reply_suffix", null);
|
||||||
|
if (suffix != null && !Objects.equals(suffix, "")) {
|
||||||
|
deviceEvent.reply += suffix;
|
||||||
|
}
|
||||||
notificationListenerIntent.putExtra("reply", deviceEvent.reply);
|
notificationListenerIntent.putExtra("reply", deviceEvent.reply);
|
||||||
}
|
}
|
||||||
LocalBroadcastManager.getInstance(context).sendBroadcast(notificationListenerIntent);
|
LocalBroadcastManager.getInstance(context).sendBroadcast(notificationListenerIntent);
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
<string name="pref_blacklist">Blacklist Apps</string>
|
<string name="pref_blacklist">Blacklist Apps</string>
|
||||||
|
|
||||||
<string name="pref_title_canned_replies">Canned Replies</string>
|
<string name="pref_title_canned_replies">Canned Replies</string>
|
||||||
|
<string name="pref_title_canned_reply_suffix">Common suffix</string>
|
||||||
|
|
||||||
<string name="pref_header_development">Developer Options</string>
|
<string name="pref_header_development">Developer Options</string>
|
||||||
<string name="pref_title_development_miaddr">Mi Band address</string>
|
<string name="pref_title_development_miaddr">Mi Band address</string>
|
||||||
|
@ -67,8 +67,12 @@
|
|||||||
android:title="@string/pref_blacklist" />
|
android:title="@string/pref_blacklist" />
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:key="pref_key_canned_replies"
|
android:key="pref_key_canned_replies"
|
||||||
android:title="@string/pref_title_canned_replies"
|
android:title="@string/pref_title_canned_replies">
|
||||||
android:dependency="pebble_force_untested" >
|
<EditTextPreference
|
||||||
|
android:defaultValue=" (canned reply)"
|
||||||
|
android:key="canned_reply_suffix"
|
||||||
|
android:maxLength="64"
|
||||||
|
android:title="@string/pref_title_canned_reply_suffix" />
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:key="canned_reply_1"
|
android:key="canned_reply_1"
|
||||||
android:maxLength="64" />
|
android:maxLength="64" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user