Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
ac681065fa
|
|||
90d8b46179
|
|||
![]() |
280b5ca4aa | ||
54a171bd5e
|
|||
c043367810
|
|||
5494df1c56
|
|||
f9d04e38a0
|
|||
6dfd7e016b
|
|||
96a3cbc40a
|
|||
7261795c99
|
|||
d6becd15c1
|
|||
0b22a18088
|
|||
39fcddfaf0
|
|||
![]() |
38eaa0c132 |
@@ -35,23 +35,22 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
implementation 'com.android.support:support-v4:28.0.0'
|
implementation 'androidx.appcompat:appcompat:1.0.0'
|
||||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
implementation 'com.android.support:cardview-v7:28.0.0'
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
||||||
implementation 'com.android.support:recyclerview-v7:28.0.0'
|
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
||||||
implementation 'com.android.support:design:28.0.0'
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
|
||||||
|
|
||||||
implementation 'com.takisoft.fix:preference-v7:28.0.0.0'
|
|
||||||
implementation 'com.takisoft.fix:preference-v7-extras:28.0.0.0'
|
|
||||||
|
|
||||||
|
implementation 'com.google.android.material:material:1.0.0'
|
||||||
implementation 'com.google.firebase:firebase-core:16.0.4'
|
implementation 'com.google.firebase:firebase-core:16.0.4'
|
||||||
implementation 'com.google.firebase:firebase-messaging:17.3.3'
|
implementation 'com.google.firebase:firebase-messaging:17.3.4'
|
||||||
|
implementation 'com.google.android.gms:play-services-ads:17.0.0'
|
||||||
implementation "android.arch.lifecycle:extensions:1.1.1"
|
|
||||||
|
|
||||||
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
|
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
|
||||||
implementation 'com.github.kenglxn.QRGen:android:2.5.0'
|
implementation 'com.github.kenglxn.QRGen:android:2.5.0'
|
||||||
|
implementation "com.github.DeweyReed:UltimateMusicPicker:2.0.0"
|
||||||
|
implementation 'com.github.duanhong169:colorpicker:1.1.5'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.google.gms.google-services'
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
@@ -1,15 +1,22 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="com.blackforestbytes.simplecloudnotifier">
|
package="com.blackforestbytes.simplecloudnotifier">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="com.android.vending.BILLING" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
android:name="SCNApp"
|
android:name="SCNApp"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@drawable/icon"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme"
|
||||||
|
tools:ignore="GoogleAppIndexingWarning">
|
||||||
|
|
||||||
<activity android:name=".view.MainActivity">
|
<activity android:name=".view.MainActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
@@ -19,8 +26,10 @@
|
|||||||
|
|
||||||
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/icon" />
|
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/icon" />
|
||||||
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/colorAccent" />
|
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/colorAccent" />
|
||||||
|
<meta-data android:name="com.google.android.gms.ads.AD_MANAGER_APP" android:value="true"/>
|
||||||
|
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3320562328966175~7579972005"/>
|
||||||
|
|
||||||
<service android:name=".service.FBMService">
|
<service android:name=".service.FBMService" android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@@ -1,28 +1,28 @@
|
|||||||
package com.blackforestbytes.simplecloudnotifier;
|
package com.blackforestbytes.simplecloudnotifier;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.arch.lifecycle.Lifecycle;
|
|
||||||
import android.arch.lifecycle.LifecycleObserver;
|
|
||||||
import android.arch.lifecycle.OnLifecycleEvent;
|
|
||||||
import android.arch.lifecycle.ProcessLifecycleOwner;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.blackforestbytes.simplecloudnotifier.model.CMessageList;
|
|
||||||
import com.blackforestbytes.simplecloudnotifier.service.NotificationService;
|
|
||||||
import com.blackforestbytes.simplecloudnotifier.view.AccountFragment;
|
import com.blackforestbytes.simplecloudnotifier.view.AccountFragment;
|
||||||
import com.blackforestbytes.simplecloudnotifier.view.MainActivity;
|
import com.blackforestbytes.simplecloudnotifier.view.MainActivity;
|
||||||
import com.blackforestbytes.simplecloudnotifier.view.TabAdapter;
|
import com.blackforestbytes.simplecloudnotifier.view.TabAdapter;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
|
import androidx.lifecycle.Lifecycle;
|
||||||
|
import androidx.lifecycle.LifecycleObserver;
|
||||||
|
import androidx.lifecycle.OnLifecycleEvent;
|
||||||
|
import androidx.lifecycle.ProcessLifecycleOwner;
|
||||||
|
|
||||||
public class SCNApp extends Application implements LifecycleObserver
|
public class SCNApp extends Application implements LifecycleObserver
|
||||||
{
|
{
|
||||||
private static SCNApp instance;
|
private static SCNApp instance;
|
||||||
private static WeakReference<MainActivity> mainActivity;
|
private static WeakReference<MainActivity> mainActivity;
|
||||||
|
|
||||||
public static final boolean DEBUG = BuildConfig.DEBUG || !BuildConfig.VERSION_NAME.endsWith(".0");
|
public static final boolean LOCAL_DEBUG = BuildConfig.DEBUG;
|
||||||
public static final boolean RELEASE = !DEBUG;
|
public static final boolean DEBUG = BuildConfig.DEBUG || !BuildConfig.VERSION_NAME.endsWith(".0");
|
||||||
|
public static final boolean RELEASE = !DEBUG;
|
||||||
|
|
||||||
private static boolean isBackground = true;
|
private static boolean isBackground = true;
|
||||||
|
|
||||||
@@ -37,6 +37,11 @@ public class SCNApp extends Application implements LifecycleObserver
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MainActivity getMainActivity()
|
||||||
|
{
|
||||||
|
return mainActivity.get();
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isBackground()
|
public static boolean isBackground()
|
||||||
{
|
{
|
||||||
return isBackground;
|
return isBackground;
|
||||||
@@ -92,3 +97,33 @@ public class SCNApp extends Application implements LifecycleObserver
|
|||||||
isBackground = false;
|
isBackground = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==TODO==
|
||||||
|
|
||||||
|
- Pro mode
|
||||||
|
- no ads
|
||||||
|
- more quota
|
||||||
|
- restore pro mode
|
||||||
|
- send pro state to server
|
||||||
|
|
||||||
|
- prevent duplicate-send
|
||||||
|
- send custom msg-id in API
|
||||||
|
- prevent second ack on same msg-id
|
||||||
|
|
||||||
|
- more in-depth API doc on website (?)
|
||||||
|
|
||||||
|
- perhaps response codes in api (?)
|
||||||
|
|
||||||
|
- test notification channels
|
||||||
|
|
||||||
|
- publish (+ HN post ?)
|
||||||
|
|
||||||
|
- Use for mscom server errrors
|
||||||
|
- Use for bfb server errors
|
||||||
|
- Use for transmission state
|
||||||
|
- Message on connnection lost (seperate process - resend until succ)
|
||||||
|
- Message on connnection regained
|
||||||
|
- Message on seed-count changed
|
||||||
|
|
||||||
|
*/
|
@@ -55,6 +55,9 @@ public class CMessageList
|
|||||||
SharedPreferences.Editor e = sharedPref.edit();
|
SharedPreferences.Editor e = sharedPref.edit();
|
||||||
|
|
||||||
Messages.add(msg);
|
Messages.add(msg);
|
||||||
|
|
||||||
|
while (Messages.size()>SCNSettings.inst().LocalCacheSize) Messages.remove(0);
|
||||||
|
|
||||||
e.putInt("message_count", count+1);
|
e.putInt("message_count", count+1);
|
||||||
e.putLong("message["+count+"].timestamp", time);
|
e.putLong("message["+count+"].timestamp", time);
|
||||||
e.putString("message["+count+"].title", title);
|
e.putString("message["+count+"].title", title);
|
||||||
|
@@ -0,0 +1,17 @@
|
|||||||
|
package com.blackforestbytes.simplecloudnotifier.model;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
public class NotificationSettings
|
||||||
|
{
|
||||||
|
public boolean EnableSound = false;
|
||||||
|
public String SoundName = "";
|
||||||
|
public String SoundSource = Uri.EMPTY.toString();
|
||||||
|
public boolean RepeatSound = false;
|
||||||
|
|
||||||
|
public boolean EnableLED = false;
|
||||||
|
public int LEDColor = Color.BLUE;
|
||||||
|
|
||||||
|
public boolean EnableVibration = false;
|
||||||
|
}
|
@@ -22,6 +22,12 @@ public class SCNSettings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
|
public final static Integer[] CHOOSABLE_CACHE_SIZES = new Integer[]{20, 50, 100, 200, 500, 1000, 2000, 5000};
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
public int quota_curr;
|
public int quota_curr;
|
||||||
public int quota_max;
|
public int quota_max;
|
||||||
public int user_id;
|
public int user_id;
|
||||||
@@ -30,16 +36,54 @@ public class SCNSettings
|
|||||||
public String fcm_token_local;
|
public String fcm_token_local;
|
||||||
public String fcm_token_server;
|
public String fcm_token_server;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
|
public boolean Enabled = true;
|
||||||
|
public int LocalCacheSize = 500;
|
||||||
|
|
||||||
|
public final NotificationSettings PriorityLow = new NotificationSettings();
|
||||||
|
public final NotificationSettings PriorityNorm = new NotificationSettings();
|
||||||
|
public final NotificationSettings PriorityHigh = new NotificationSettings();
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
public SCNSettings()
|
public SCNSettings()
|
||||||
{
|
{
|
||||||
SharedPreferences sharedPref = SCNApp.getContext().getSharedPreferences("Config", Context.MODE_PRIVATE);
|
SharedPreferences sharedPref = SCNApp.getContext().getSharedPreferences("Config", Context.MODE_PRIVATE);
|
||||||
|
|
||||||
quota_curr = sharedPref.getInt("quota_curr", 0);
|
quota_curr = sharedPref.getInt( "quota_curr", 0);
|
||||||
quota_max = sharedPref.getInt("quota_max", 0);
|
quota_max = sharedPref.getInt( "quota_max", 0);
|
||||||
user_id = sharedPref.getInt("user_id", -1);
|
user_id = sharedPref.getInt( "user_id", -1);
|
||||||
user_key = sharedPref.getString("user_key", "");
|
user_key = sharedPref.getString("user_key", "");
|
||||||
fcm_token_local = sharedPref.getString("fcm_token_local", "");
|
fcm_token_local = sharedPref.getString("fcm_token_local", "");
|
||||||
fcm_token_server = sharedPref.getString("fcm_token_server", "");
|
fcm_token_server = sharedPref.getString("fcm_token_server", "");
|
||||||
|
|
||||||
|
Enabled = sharedPref.getBoolean("app_enabled", Enabled);
|
||||||
|
LocalCacheSize = sharedPref.getInt("local_cache_size", LocalCacheSize);
|
||||||
|
|
||||||
|
PriorityLow.EnableLED = sharedPref.getBoolean("priority_low:enabled_led", PriorityLow.EnableLED);
|
||||||
|
PriorityLow.EnableSound = sharedPref.getBoolean("priority_low:enabled_sound", PriorityLow.EnableSound);
|
||||||
|
PriorityLow.EnableVibration = sharedPref.getBoolean("priority_low:enabled_vibration", PriorityLow.EnableVibration);
|
||||||
|
PriorityLow.RepeatSound = sharedPref.getBoolean("priority_low:repeat_sound", PriorityLow.RepeatSound);
|
||||||
|
PriorityLow.SoundName = sharedPref.getString( "priority_low:sound_name", PriorityLow.SoundName);
|
||||||
|
PriorityLow.SoundSource = sharedPref.getString( "priority_low:sound_source", PriorityLow.SoundSource);
|
||||||
|
PriorityLow.LEDColor = sharedPref.getInt( "priority_low:led_color", PriorityLow.LEDColor);
|
||||||
|
|
||||||
|
PriorityNorm.EnableLED = sharedPref.getBoolean("priority_norm:enabled_led", PriorityNorm.EnableLED);
|
||||||
|
PriorityNorm.EnableSound = sharedPref.getBoolean("priority_norm:enabled_sound", PriorityNorm.EnableSound);
|
||||||
|
PriorityNorm.EnableVibration = sharedPref.getBoolean("priority_norm:enabled_vibration", PriorityNorm.EnableVibration);
|
||||||
|
PriorityNorm.RepeatSound = sharedPref.getBoolean("priority_norm:repeat_sound", PriorityNorm.RepeatSound);
|
||||||
|
PriorityNorm.SoundName = sharedPref.getString( "priority_norm:sound_name", PriorityNorm.SoundName);
|
||||||
|
PriorityNorm.SoundSource = sharedPref.getString( "priority_norm:sound_source", PriorityNorm.SoundSource);
|
||||||
|
PriorityNorm.LEDColor = sharedPref.getInt( "priority_norm:led_color", PriorityNorm.LEDColor);
|
||||||
|
|
||||||
|
PriorityHigh.EnableLED = sharedPref.getBoolean("priority_high:enabled_led", PriorityHigh.EnableLED);
|
||||||
|
PriorityHigh.EnableSound = sharedPref.getBoolean("priority_high:enabled_sound", PriorityHigh.EnableSound);
|
||||||
|
PriorityHigh.EnableVibration = sharedPref.getBoolean("priority_high:enabled_vibration", PriorityHigh.EnableVibration);
|
||||||
|
PriorityHigh.RepeatSound = sharedPref.getBoolean("priority_high:repeat_sound", PriorityHigh.RepeatSound);
|
||||||
|
PriorityHigh.SoundName = sharedPref.getString( "priority_high:sound_name", PriorityHigh.SoundName);
|
||||||
|
PriorityHigh.SoundSource = sharedPref.getString( "priority_high:sound_source", PriorityHigh.SoundSource);
|
||||||
|
PriorityHigh.LEDColor = sharedPref.getInt( "priority_high:led_color", PriorityHigh.LEDColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save()
|
public void save()
|
||||||
@@ -47,12 +91,39 @@ public class SCNSettings
|
|||||||
SharedPreferences sharedPref = SCNApp.getContext().getSharedPreferences("Config", Context.MODE_PRIVATE);
|
SharedPreferences sharedPref = SCNApp.getContext().getSharedPreferences("Config", Context.MODE_PRIVATE);
|
||||||
SharedPreferences.Editor e = sharedPref.edit();
|
SharedPreferences.Editor e = sharedPref.edit();
|
||||||
|
|
||||||
e.putInt("quota_curr", quota_curr);
|
e.putInt( "quota_curr", quota_curr);
|
||||||
e.putInt("quota_max", quota_max);
|
e.putInt( "quota_max", quota_max);
|
||||||
e.putInt("user_id", user_id);
|
e.putInt( "user_id", user_id);
|
||||||
e.putString("user_key", user_key);
|
e.putString( "user_key", user_key);
|
||||||
e.putString("fcm_token_local", fcm_token_local);
|
e.putString( "fcm_token_local", fcm_token_local);
|
||||||
e.putString("fcm_token_server", fcm_token_server);
|
e.putString( "fcm_token_server", fcm_token_server);
|
||||||
|
|
||||||
|
e.putBoolean("app_enabled", Enabled);
|
||||||
|
e.putInt( "local_cache_size", LocalCacheSize);
|
||||||
|
|
||||||
|
e.putBoolean("priority_low:enabled_led", PriorityLow.EnableLED);
|
||||||
|
e.putBoolean("priority_low:enabled_sound", PriorityLow.EnableSound);
|
||||||
|
e.putBoolean("priority_low:enabled_vibration", PriorityLow.EnableVibration);
|
||||||
|
e.putBoolean("priority_low:repeat_sound", PriorityLow.RepeatSound);
|
||||||
|
e.putString( "priority_low:sound_name", PriorityLow.SoundName);
|
||||||
|
e.putString( "priority_low:sound_source", PriorityLow.SoundSource);
|
||||||
|
e.putInt( "priority_low:led_color", PriorityLow.LEDColor);
|
||||||
|
|
||||||
|
e.putBoolean("priority_norm:enabled_led", PriorityNorm.EnableLED);
|
||||||
|
e.putBoolean("priority_norm:enabled_sound", PriorityNorm.EnableSound);
|
||||||
|
e.putBoolean("priority_norm:enabled_vibration", PriorityNorm.EnableVibration);
|
||||||
|
e.putBoolean("priority_norm:repeat_sound", PriorityNorm.RepeatSound);
|
||||||
|
e.putString( "priority_norm:sound_name", PriorityNorm.SoundName);
|
||||||
|
e.putString( "priority_norm:sound_source", PriorityNorm.SoundSource);
|
||||||
|
e.putInt( "priority_norm:led_color", PriorityNorm.LEDColor);
|
||||||
|
|
||||||
|
e.putBoolean("priority_high:enabled_led", PriorityHigh.EnableLED);
|
||||||
|
e.putBoolean("priority_high:enabled_sound", PriorityHigh.EnableSound);
|
||||||
|
e.putBoolean("priority_high:enabled_vibration", PriorityHigh.EnableVibration);
|
||||||
|
e.putBoolean("priority_high:repeat_sound", PriorityHigh.RepeatSound);
|
||||||
|
e.putString( "priority_high:sound_name", PriorityHigh.SoundName);
|
||||||
|
e.putString( "priority_high:sound_source", PriorityHigh.SoundSource);
|
||||||
|
e.putInt( "priority_high:led_color", PriorityHigh.LEDColor);
|
||||||
|
|
||||||
e.apply();
|
e.apply();
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ import okhttp3.ResponseBody;
|
|||||||
|
|
||||||
public class ServerCommunication
|
public class ServerCommunication
|
||||||
{
|
{
|
||||||
public static final String BASE_URL = "https://scn.blackforestbytes.com/";
|
public static final String BASE_URL = /*SCNApp.LOCAL_DEBUG ? "http://localhost:1010/" : */"https://scn.blackforestbytes.com/";
|
||||||
|
|
||||||
private static final OkHttpClient client = new OkHttpClient();
|
private static final OkHttpClient client = new OkHttpClient();
|
||||||
|
|
||||||
|
@@ -1,20 +1,13 @@
|
|||||||
package com.blackforestbytes.simplecloudnotifier.service;
|
package com.blackforestbytes.simplecloudnotifier.service;
|
||||||
|
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.support.v4.app.NotificationCompat;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.blackforestbytes.simplecloudnotifier.R;
|
|
||||||
import com.blackforestbytes.simplecloudnotifier.SCNApp;
|
import com.blackforestbytes.simplecloudnotifier.SCNApp;
|
||||||
import com.blackforestbytes.simplecloudnotifier.model.CMessage;
|
import com.blackforestbytes.simplecloudnotifier.model.CMessage;
|
||||||
import com.blackforestbytes.simplecloudnotifier.model.CMessageList;
|
import com.blackforestbytes.simplecloudnotifier.model.CMessageList;
|
||||||
import com.blackforestbytes.simplecloudnotifier.model.PriorityEnum;
|
import com.blackforestbytes.simplecloudnotifier.model.PriorityEnum;
|
||||||
import com.blackforestbytes.simplecloudnotifier.model.SCNSettings;
|
import com.blackforestbytes.simplecloudnotifier.model.SCNSettings;
|
||||||
import com.blackforestbytes.simplecloudnotifier.view.MainActivity;
|
|
||||||
import com.google.firebase.messaging.FirebaseMessagingService;
|
import com.google.firebase.messaging.FirebaseMessagingService;
|
||||||
import com.google.firebase.messaging.RemoteMessage;
|
import com.google.firebase.messaging.RemoteMessage;
|
||||||
|
|
||||||
@@ -32,6 +25,8 @@ public class FBMService extends FirebaseMessagingService
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (!SCNSettings.inst().Enabled) return;
|
||||||
|
|
||||||
Log.i("FB::MessageReceived", "From: " + remoteMessage.getFrom());
|
Log.i("FB::MessageReceived", "From: " + remoteMessage.getFrom());
|
||||||
Log.i("FB::MessageReceived", "Payload: " + remoteMessage.getData());
|
Log.i("FB::MessageReceived", "Payload: " + remoteMessage.getData());
|
||||||
if (remoteMessage.getNotification() != null) Log.i("FB::MessageReceived", "Notify_Title: " + remoteMessage.getNotification().getTitle());
|
if (remoteMessage.getNotification() != null) Log.i("FB::MessageReceived", "Notify_Title: " + remoteMessage.getNotification().getTitle());
|
||||||
@@ -47,11 +42,11 @@ public class FBMService extends FirebaseMessagingService
|
|||||||
|
|
||||||
if (SCNApp.isBackground())
|
if (SCNApp.isBackground())
|
||||||
{
|
{
|
||||||
NotificationService.inst().show(msg);
|
NotificationService.inst().showBackground(msg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SCNApp.showToast("Message recieved: " + title, Toast.LENGTH_LONG);
|
NotificationService.inst().showForeground(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@@ -1,22 +1,33 @@
|
|||||||
package com.blackforestbytes.simplecloudnotifier.service;
|
package com.blackforestbytes.simplecloudnotifier.service;
|
||||||
|
|
||||||
|
import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.media.AudioAttributes;
|
||||||
|
import android.media.AudioManager;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.blackforestbytes.simplecloudnotifier.R;
|
import com.blackforestbytes.simplecloudnotifier.R;
|
||||||
import com.blackforestbytes.simplecloudnotifier.SCNApp;
|
import com.blackforestbytes.simplecloudnotifier.SCNApp;
|
||||||
import com.blackforestbytes.simplecloudnotifier.model.CMessage;
|
import com.blackforestbytes.simplecloudnotifier.model.CMessage;
|
||||||
|
import com.blackforestbytes.simplecloudnotifier.model.NotificationSettings;
|
||||||
|
import com.blackforestbytes.simplecloudnotifier.model.PriorityEnum;
|
||||||
|
import com.blackforestbytes.simplecloudnotifier.model.SCNSettings;
|
||||||
import com.blackforestbytes.simplecloudnotifier.view.MainActivity;
|
import com.blackforestbytes.simplecloudnotifier.view.MainActivity;
|
||||||
|
|
||||||
|
import androidx.core.app.NotificationCompat;
|
||||||
|
|
||||||
public class NotificationService
|
public class NotificationService
|
||||||
{
|
{
|
||||||
private final static String CHANNEL_ID = "CHAN_BFB_SCN_MESSAGES";
|
private final static String CHANNEL_ID_LOW = "CHAN_BFB_SCN_MESSAGES_LOW";
|
||||||
|
private final static String CHANNEL_ID_NORM = "CHAN_BFB_SCN_MESSAGES_NORM";
|
||||||
|
private final static String CHANNEL_ID_HIGH = "CHAN_BFB_SCN_MESSAGES_HIGH";
|
||||||
|
|
||||||
private final static Object _lock = new Object();
|
private final static Object _lock = new Object();
|
||||||
private static NotificationService _inst = null;
|
private static NotificationService _inst = null;
|
||||||
@@ -31,39 +42,92 @@ public class NotificationService
|
|||||||
|
|
||||||
private NotificationService()
|
private NotificationService()
|
||||||
{
|
{
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
updateChannels();
|
||||||
{
|
|
||||||
Context ctxt = SCNApp.getContext();
|
|
||||||
|
|
||||||
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, "Push notifications", NotificationManager.IMPORTANCE_HIGH);
|
|
||||||
channel.setDescription("Messages from the API");
|
|
||||||
channel.setLightColor(Color.rgb(255, 0, 0));
|
|
||||||
channel.setVibrationPattern(new long[]{200});
|
|
||||||
channel.enableLights(true);
|
|
||||||
channel.enableVibration(true);
|
|
||||||
|
|
||||||
NotificationManager notificationManager = ctxt.getSystemService(NotificationManager.class);
|
|
||||||
if (notificationManager != null) notificationManager.createNotificationChannel(channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show(CMessage msg)
|
public void updateChannels()
|
||||||
|
{
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return;
|
||||||
|
|
||||||
|
Context ctxt = SCNApp.getContext();
|
||||||
|
NotificationManager notifman = ctxt.getSystemService(NotificationManager.class);
|
||||||
|
if (notifman == null) return;
|
||||||
|
|
||||||
|
NotificationChannel channelLow = notifman.getNotificationChannel(CHANNEL_ID_LOW);
|
||||||
|
if (channelLow == null) notifman.createNotificationChannel(channelLow = new NotificationChannel(CHANNEL_ID_LOW, "Push notifications (low priority)", NotificationManager.IMPORTANCE_LOW));
|
||||||
|
NotificationChannel channelNorm = notifman.getNotificationChannel(CHANNEL_ID_NORM);
|
||||||
|
if (channelNorm == null) notifman.createNotificationChannel(channelNorm = new NotificationChannel(CHANNEL_ID_NORM, "Push notifications (normal priority)", NotificationManager.IMPORTANCE_DEFAULT));
|
||||||
|
NotificationChannel channelHigh = notifman.getNotificationChannel(CHANNEL_ID_HIGH);
|
||||||
|
if (channelHigh == null) notifman.createNotificationChannel(channelHigh = new NotificationChannel(CHANNEL_ID_HIGH, "Push notifications (high priority)", NotificationManager.IMPORTANCE_HIGH));
|
||||||
|
|
||||||
|
channelLow.setDescription("Messages from the API with priority set to low");
|
||||||
|
channelLow.enableLights(SCNSettings.inst().PriorityLow.EnableLED);
|
||||||
|
channelLow.setLightColor(SCNSettings.inst().PriorityLow.LEDColor);
|
||||||
|
channelLow.enableVibration(SCNSettings.inst().PriorityLow.EnableVibration);
|
||||||
|
channelLow.setVibrationPattern(new long[]{200});
|
||||||
|
|
||||||
|
channelNorm.setDescription("Messages from the API with priority set to normal");
|
||||||
|
channelNorm.enableLights(SCNSettings.inst().PriorityNorm.EnableLED);
|
||||||
|
channelNorm.setLightColor(SCNSettings.inst().PriorityNorm.LEDColor);
|
||||||
|
channelNorm.enableVibration(SCNSettings.inst().PriorityNorm.EnableVibration);
|
||||||
|
channelNorm.setVibrationPattern(new long[]{200});
|
||||||
|
|
||||||
|
channelHigh.setDescription("Messages from the API with priority set to high");
|
||||||
|
channelHigh.enableLights(SCNSettings.inst().PriorityHigh.EnableLED);
|
||||||
|
channelHigh.setLightColor(SCNSettings.inst().PriorityHigh.LEDColor);
|
||||||
|
channelHigh.enableVibration(SCNSettings.inst().PriorityHigh.EnableVibration);
|
||||||
|
channelHigh.setVibrationPattern(new long[]{200});
|
||||||
|
channelLow.setBypassDnd(true);
|
||||||
|
channelLow.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showForeground(CMessage msg)
|
||||||
|
{
|
||||||
|
SCNApp.showToast("Message recieved: " + msg.Title, Toast.LENGTH_LONG);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showBackground(CMessage msg)
|
||||||
{
|
{
|
||||||
Context ctxt = SCNApp.getContext();
|
Context ctxt = SCNApp.getContext();
|
||||||
|
|
||||||
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(ctxt, CHANNEL_ID)
|
String channel = CHANNEL_ID_NORM;
|
||||||
.setSmallIcon(R.drawable.ic_bfb)
|
NotificationSettings ns = SCNSettings.inst().PriorityNorm;
|
||||||
.setContentTitle(msg.Title)
|
switch (msg.Priority)
|
||||||
.setContentText(msg.Content)
|
{
|
||||||
.setShowWhen(true)
|
case LOW: ns = SCNSettings.inst().PriorityLow; channel = CHANNEL_ID_LOW; break;
|
||||||
.setWhen(msg.Timestamp)
|
case NORMAL: ns = SCNSettings.inst().PriorityNorm; channel = CHANNEL_ID_NORM; break;
|
||||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
case HIGH: ns = SCNSettings.inst().PriorityHigh; channel = CHANNEL_ID_HIGH; break;
|
||||||
.setAutoCancel(true);
|
}
|
||||||
|
|
||||||
|
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(ctxt, channel);
|
||||||
|
mBuilder.setSmallIcon(R.drawable.ic_bfb);
|
||||||
|
mBuilder.setContentTitle(msg.Title);
|
||||||
|
mBuilder.setContentText(msg.Content);
|
||||||
|
mBuilder.setShowWhen(true);
|
||||||
|
mBuilder.setWhen(msg.Timestamp);
|
||||||
|
mBuilder.setAutoCancel(true);
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
|
||||||
|
{
|
||||||
|
if (msg.Priority == PriorityEnum.LOW) mBuilder.setPriority(NotificationCompat.PRIORITY_LOW);
|
||||||
|
if (msg.Priority == PriorityEnum.NORMAL) mBuilder.setPriority(NotificationCompat.PRIORITY_DEFAULT);
|
||||||
|
if (msg.Priority == PriorityEnum.HIGH) mBuilder.setPriority(NotificationCompat.PRIORITY_HIGH);
|
||||||
|
if (ns.EnableVibration) mBuilder.setVibrate(new long[]{200});
|
||||||
|
if (ns.EnableLED) mBuilder.setLights(ns.LEDColor, 500, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ns.EnableSound && !ns.SoundSource.isEmpty())
|
||||||
|
{
|
||||||
|
mBuilder.setSound(Uri.parse(ns.SoundSource), AudioManager.STREAM_ALARM);
|
||||||
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(ctxt, MainActivity.class);
|
Intent intent = new Intent(ctxt, MainActivity.class);
|
||||||
PendingIntent pi = PendingIntent.getActivity(ctxt, 0, intent, 0);
|
PendingIntent pi = PendingIntent.getActivity(ctxt, 0, intent, 0);
|
||||||
mBuilder.setContentIntent(pi);
|
mBuilder.setContentIntent(pi);
|
||||||
NotificationManager mNotificationManager = (NotificationManager) ctxt.getSystemService(Context.NOTIFICATION_SERVICE);
|
NotificationManager mNotificationManager = (NotificationManager) ctxt.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
if (mNotificationManager != null) mNotificationManager.notify(0, mBuilder.build());
|
|
||||||
|
Notification n = mBuilder.build();
|
||||||
|
if (ns.EnableSound && !ns.SoundSource.isEmpty() && ns.RepeatSound) n.flags |= Notification.FLAG_INSISTENT;
|
||||||
|
|
||||||
|
if (mNotificationManager != null) mNotificationManager.notify(0, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,8 +6,6 @@ import android.content.ClipboardManager;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -22,6 +20,9 @@ import com.blackforestbytes.simplecloudnotifier.model.SCNSettings;
|
|||||||
import net.glxn.qrgen.android.QRCode;
|
import net.glxn.qrgen.android.QRCode;
|
||||||
import net.glxn.qrgen.core.image.ImageType;
|
import net.glxn.qrgen.core.image.ImageType;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import static android.content.Context.CLIPBOARD_SERVICE;
|
import static android.content.Context.CLIPBOARD_SERVICE;
|
||||||
|
|
||||||
public class AccountFragment extends Fragment
|
public class AccountFragment extends Fragment
|
||||||
|
@@ -1,24 +1,21 @@
|
|||||||
package com.blackforestbytes.simplecloudnotifier.view;
|
package com.blackforestbytes.simplecloudnotifier.view;
|
||||||
|
|
||||||
import android.support.design.widget.TabLayout;
|
import android.net.Uri;
|
||||||
import android.support.v4.view.PagerAdapter;
|
|
||||||
import android.support.v4.view.ViewPager;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
|
|
||||||
import com.blackforestbytes.simplecloudnotifier.R;
|
import com.blackforestbytes.simplecloudnotifier.R;
|
||||||
import com.blackforestbytes.simplecloudnotifier.SCNApp;
|
import com.blackforestbytes.simplecloudnotifier.SCNApp;
|
||||||
import com.blackforestbytes.simplecloudnotifier.model.CMessageList;
|
import com.blackforestbytes.simplecloudnotifier.model.CMessageList;
|
||||||
import com.blackforestbytes.simplecloudnotifier.model.SCNSettings;
|
import com.blackforestbytes.simplecloudnotifier.model.SCNSettings;
|
||||||
import com.blackforestbytes.simplecloudnotifier.model.ServerCommunication;
|
|
||||||
import com.blackforestbytes.simplecloudnotifier.service.NotificationService;
|
import com.blackforestbytes.simplecloudnotifier.service.NotificationService;
|
||||||
import com.google.firebase.iid.FirebaseInstanceId;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.viewpager.widget.PagerAdapter;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity
|
public class MainActivity extends AppCompatActivity
|
||||||
{
|
{
|
||||||
|
@@ -1,19 +1,18 @@
|
|||||||
package com.blackforestbytes.simplecloudnotifier.view;
|
package com.blackforestbytes.simplecloudnotifier.view;
|
||||||
|
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.blackforestbytes.simplecloudnotifier.R;
|
import com.blackforestbytes.simplecloudnotifier.R;
|
||||||
import com.blackforestbytes.simplecloudnotifier.SCNApp;
|
|
||||||
import com.blackforestbytes.simplecloudnotifier.model.CMessage;
|
import com.blackforestbytes.simplecloudnotifier.model.CMessage;
|
||||||
import com.blackforestbytes.simplecloudnotifier.model.CMessageList;
|
import com.blackforestbytes.simplecloudnotifier.model.CMessageList;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
public class MessageAdapter extends RecyclerView.Adapter
|
public class MessageAdapter extends RecyclerView.Adapter
|
||||||
{
|
{
|
||||||
private final View vNoElements;
|
private final View vNoElements;
|
||||||
|
@@ -1,17 +1,18 @@
|
|||||||
package com.blackforestbytes.simplecloudnotifier.view;
|
package com.blackforestbytes.simplecloudnotifier.view;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.blackforestbytes.simplecloudnotifier.R;
|
import com.blackforestbytes.simplecloudnotifier.R;
|
||||||
|
import com.google.android.gms.ads.doubleclick.PublisherAdRequest;
|
||||||
|
import com.google.android.gms.ads.doubleclick.PublisherAdView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
public class NotificationsFragment extends Fragment
|
public class NotificationsFragment extends Fragment
|
||||||
{
|
{
|
||||||
@@ -29,6 +30,11 @@ public class NotificationsFragment extends Fragment
|
|||||||
rvMessages.setLayoutManager(new LinearLayoutManager(this.getContext(), RecyclerView.VERTICAL, true));
|
rvMessages.setLayoutManager(new LinearLayoutManager(this.getContext(), RecyclerView.VERTICAL, true));
|
||||||
rvMessages.setAdapter(new MessageAdapter(v.findViewById(R.id.tvNoElements)));
|
rvMessages.setAdapter(new MessageAdapter(v.findViewById(R.id.tvNoElements)));
|
||||||
|
|
||||||
|
PublisherAdView mPublisherAdView = v.findViewById(R.id.adBanner);
|
||||||
|
PublisherAdRequest adRequest = new PublisherAdRequest.Builder().build();
|
||||||
|
mPublisherAdView.loadAd(adRequest);
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,15 +1,341 @@
|
|||||||
package com.blackforestbytes.simplecloudnotifier.view;
|
package com.blackforestbytes.simplecloudnotifier.view;
|
||||||
|
|
||||||
|
import android.app.NotificationManager;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.media.AudioManager;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.preference.PreferenceFragmentCompat;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.Switch;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.blackforestbytes.simplecloudnotifier.R;
|
import com.blackforestbytes.simplecloudnotifier.R;
|
||||||
|
import com.blackforestbytes.simplecloudnotifier.model.SCNSettings;
|
||||||
|
import com.blackforestbytes.simplecloudnotifier.service.NotificationService;
|
||||||
|
|
||||||
public class SettingsFragment extends PreferenceFragmentCompat
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import top.defaults.colorpicker.ColorPickerPopup;
|
||||||
|
import xyz.aprildown.ultimatemusicpicker.MusicPickerListener;
|
||||||
|
import xyz.aprildown.ultimatemusicpicker.UltimateMusicPicker;
|
||||||
|
|
||||||
|
public class SettingsFragment extends Fragment implements MusicPickerListener
|
||||||
{
|
{
|
||||||
@Override
|
private Switch prefAppEnabled;
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey)
|
private Spinner prefLocalCacheSize;
|
||||||
|
private Button prefUpgradeAccount;
|
||||||
|
|
||||||
|
private Switch prefMsgLowEnableSound;
|
||||||
|
private TextView prefMsgLowRingtone_value;
|
||||||
|
private View prefMsgLowRingtone_container;
|
||||||
|
private Switch prefMsgLowRepeatSound;
|
||||||
|
private Switch prefMsgLowEnableLED;
|
||||||
|
private View prefMsgLowLedColor_container;
|
||||||
|
private ImageView prefMsgLowLedColor_value;
|
||||||
|
private Switch prefMsgLowEnableVibrations;
|
||||||
|
|
||||||
|
private Switch prefMsgNormEnableSound;
|
||||||
|
private TextView prefMsgNormRingtone_value;
|
||||||
|
private View prefMsgNormRingtone_container;
|
||||||
|
private Switch prefMsgNormRepeatSound;
|
||||||
|
private Switch prefMsgNormEnableLED;
|
||||||
|
private View prefMsgNormLedColor_container;
|
||||||
|
private ImageView prefMsgNormLedColor_value;
|
||||||
|
private Switch prefMsgNormEnableVibrations;
|
||||||
|
|
||||||
|
private Switch prefMsgHighEnableSound;
|
||||||
|
private TextView prefMsgHighRingtone_value;
|
||||||
|
private View prefMsgHighRingtone_container;
|
||||||
|
private Switch prefMsgHighRepeatSound;
|
||||||
|
private Switch prefMsgHighEnableLED;
|
||||||
|
private View prefMsgHighLedColor_container;
|
||||||
|
private ImageView prefMsgHighLedColor_value;
|
||||||
|
private Switch prefMsgHighEnableVibrations;
|
||||||
|
|
||||||
|
private int musicPickerSwitch = -1;
|
||||||
|
|
||||||
|
public SettingsFragment()
|
||||||
{
|
{
|
||||||
setPreferencesFromResource(R.xml.preferences, rootKey);
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
View v = inflater.inflate(R.layout.fragment_settings, container, false);
|
||||||
|
|
||||||
|
initFields(v);
|
||||||
|
updateUI();
|
||||||
|
initListener();
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initFields(View v)
|
||||||
|
{
|
||||||
|
prefAppEnabled = v.findViewById(R.id.prefAppEnabled);
|
||||||
|
prefLocalCacheSize = v.findViewById(R.id.prefLocalCacheSize);
|
||||||
|
prefUpgradeAccount = v.findViewById(R.id.prefUpgradeAccount);
|
||||||
|
|
||||||
|
prefMsgLowEnableSound = v.findViewById(R.id.prefMsgLowEnableSound);
|
||||||
|
prefMsgLowRingtone_value = v.findViewById(R.id.prefMsgLowRingtone_value);
|
||||||
|
prefMsgLowRingtone_container = v.findViewById(R.id.prefMsgLowRingtone_container);
|
||||||
|
prefMsgLowRepeatSound = v.findViewById(R.id.prefMsgLowRepeatSound);
|
||||||
|
prefMsgLowEnableLED = v.findViewById(R.id.prefMsgLowEnableLED);
|
||||||
|
prefMsgLowLedColor_value = v.findViewById(R.id.prefMsgLowLedColor_value);
|
||||||
|
prefMsgLowLedColor_container = v.findViewById(R.id.prefMsgLowLedColor_container);
|
||||||
|
prefMsgLowEnableVibrations = v.findViewById(R.id.prefMsgLowEnableVibrations);
|
||||||
|
|
||||||
|
prefMsgNormEnableSound = v.findViewById(R.id.prefMsgNormEnableSound);
|
||||||
|
prefMsgNormRingtone_value = v.findViewById(R.id.prefMsgNormRingtone_value);
|
||||||
|
prefMsgNormRingtone_container = v.findViewById(R.id.prefMsgNormRingtone_container);
|
||||||
|
prefMsgNormRepeatSound = v.findViewById(R.id.prefMsgNormRepeatSound);
|
||||||
|
prefMsgNormEnableLED = v.findViewById(R.id.prefMsgNormEnableLED);
|
||||||
|
prefMsgNormLedColor_value = v.findViewById(R.id.prefMsgNormLedColor_value);
|
||||||
|
prefMsgNormLedColor_container = v.findViewById(R.id.prefMsgNormLedColor_container);
|
||||||
|
prefMsgNormEnableVibrations = v.findViewById(R.id.prefMsgNormEnableVibrations);
|
||||||
|
|
||||||
|
prefMsgHighEnableSound = v.findViewById(R.id.prefMsgHighEnableSound);
|
||||||
|
prefMsgHighRingtone_value = v.findViewById(R.id.prefMsgHighRingtone_value);
|
||||||
|
prefMsgHighRingtone_container = v.findViewById(R.id.prefMsgHighRingtone_container);
|
||||||
|
prefMsgHighRepeatSound = v.findViewById(R.id.prefMsgHighRepeatSound);
|
||||||
|
prefMsgHighEnableLED = v.findViewById(R.id.prefMsgHighEnableLED);
|
||||||
|
prefMsgHighLedColor_value = v.findViewById(R.id.prefMsgHighLedColor_value);
|
||||||
|
prefMsgHighLedColor_container = v.findViewById(R.id.prefMsgHighLedColor_container);
|
||||||
|
prefMsgHighEnableVibrations = v.findViewById(R.id.prefMsgHighEnableVibrations);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateUI()
|
||||||
|
{
|
||||||
|
SCNSettings s = SCNSettings.inst();
|
||||||
|
Context c = getContext();
|
||||||
|
if (c == null) return;
|
||||||
|
|
||||||
|
if (prefAppEnabled.isChecked() != s.Enabled) prefAppEnabled.setChecked(s.Enabled);
|
||||||
|
|
||||||
|
ArrayAdapter<Integer> plcsa = new ArrayAdapter<>(c, android.R.layout.simple_spinner_item, SCNSettings.CHOOSABLE_CACHE_SIZES);
|
||||||
|
plcsa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
prefLocalCacheSize.setAdapter(plcsa);
|
||||||
|
prefLocalCacheSize.setSelection(getCacheSizeIndex(s.LocalCacheSize));
|
||||||
|
|
||||||
|
if (prefMsgLowEnableSound.isChecked() != s.PriorityLow.EnableSound) prefMsgLowEnableSound.setChecked(s.PriorityLow.EnableSound);
|
||||||
|
if (!prefMsgLowRingtone_value.getText().equals(s.PriorityLow.SoundName)) prefMsgLowRingtone_value.setText(s.PriorityLow.SoundName);
|
||||||
|
if (prefMsgLowRepeatSound.isChecked() != s.PriorityLow.RepeatSound) prefMsgLowRepeatSound.setChecked(s.PriorityLow.RepeatSound);
|
||||||
|
if (prefMsgLowEnableLED.isChecked() != s.PriorityLow.EnableLED) prefMsgLowEnableLED.setChecked(s.PriorityLow.EnableLED);
|
||||||
|
prefMsgLowLedColor_value.setColorFilter(s.PriorityLow.LEDColor);
|
||||||
|
if (prefMsgLowEnableVibrations.isChecked() != s.PriorityLow.EnableVibration) prefMsgLowEnableVibrations.setChecked(s.PriorityLow.EnableVibration);
|
||||||
|
|
||||||
|
if (prefMsgNormEnableSound.isChecked() != s.PriorityNorm.EnableSound) prefMsgNormEnableSound.setChecked(s.PriorityNorm.EnableSound);
|
||||||
|
if (!prefMsgNormRingtone_value.getText().equals(s.PriorityNorm.SoundName)) prefMsgNormRingtone_value.setText(s.PriorityNorm.SoundName);
|
||||||
|
if (prefMsgNormRepeatSound.isChecked() != s.PriorityNorm.RepeatSound) prefMsgNormRepeatSound.setChecked(s.PriorityNorm.RepeatSound);
|
||||||
|
if (prefMsgNormEnableLED.isChecked() != s.PriorityNorm.EnableLED) prefMsgNormEnableLED.setChecked(s.PriorityNorm.EnableLED);
|
||||||
|
prefMsgNormLedColor_value.setColorFilter(s.PriorityNorm.LEDColor);
|
||||||
|
if (prefMsgNormEnableVibrations.isChecked() != s.PriorityNorm.EnableVibration) prefMsgNormEnableVibrations.setChecked(s.PriorityNorm.EnableVibration);
|
||||||
|
|
||||||
|
if (prefMsgHighEnableSound.isChecked() != s.PriorityHigh.EnableSound) prefMsgHighEnableSound.setChecked(s.PriorityHigh.EnableSound);
|
||||||
|
if (!prefMsgHighRingtone_value.getText().equals(s.PriorityHigh.SoundName)) prefMsgHighRingtone_value.setText(s.PriorityHigh.SoundName);
|
||||||
|
if (prefMsgHighRepeatSound.isChecked() != s.PriorityHigh.RepeatSound) prefMsgHighRepeatSound.setChecked(s.PriorityHigh.RepeatSound);
|
||||||
|
if (prefMsgHighEnableLED.isChecked() != s.PriorityHigh.EnableLED) prefMsgHighEnableLED.setChecked(s.PriorityHigh.EnableLED);
|
||||||
|
prefMsgHighLedColor_value.setColorFilter(s.PriorityHigh.LEDColor);
|
||||||
|
if (prefMsgHighEnableVibrations.isChecked() != s.PriorityHigh.EnableVibration) prefMsgHighEnableVibrations.setChecked(s.PriorityHigh.EnableVibration);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initListener()
|
||||||
|
{
|
||||||
|
SCNSettings s = SCNSettings.inst();
|
||||||
|
|
||||||
|
prefAppEnabled.setOnCheckedChangeListener((a,b) -> { s.Enabled=b; saveAndUpdate(); });
|
||||||
|
|
||||||
|
prefLocalCacheSize.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
|
||||||
|
{
|
||||||
|
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
s.LocalCacheSize = prefLocalCacheSize.getSelectedItemPosition()>=0 ? SCNSettings.CHOOSABLE_CACHE_SIZES[prefLocalCacheSize.getSelectedItemPosition()] : 100;
|
||||||
|
saveAndUpdate();
|
||||||
|
}
|
||||||
|
@Override public void onNothingSelected(AdapterView<?> parent) { /* */ }
|
||||||
|
});
|
||||||
|
|
||||||
|
prefUpgradeAccount.setOnClickListener(a -> onUpgradeAccount());
|
||||||
|
|
||||||
|
prefMsgLowEnableSound.setOnCheckedChangeListener((a,b) -> { s.PriorityLow.EnableSound=b; saveAndUpdate(); });
|
||||||
|
prefMsgLowRingtone_container.setOnClickListener(a -> chooseRingtoneLow());
|
||||||
|
prefMsgLowRepeatSound.setOnCheckedChangeListener((a,b) -> { s.PriorityLow.RepeatSound=b; saveAndUpdate(); });
|
||||||
|
prefMsgLowEnableLED.setOnCheckedChangeListener((a,b) -> { s.PriorityLow.EnableLED=b; saveAndUpdate(); });
|
||||||
|
prefMsgLowLedColor_container.setOnClickListener(a -> chooseLEDColorLow());
|
||||||
|
prefMsgLowEnableVibrations.setOnCheckedChangeListener((a,b) -> { s.PriorityLow.EnableVibration=b; saveAndUpdate(); });
|
||||||
|
|
||||||
|
prefMsgNormEnableSound.setOnCheckedChangeListener((a,b) -> { s.PriorityNorm.EnableSound=b; saveAndUpdate(); });
|
||||||
|
prefMsgNormRingtone_container.setOnClickListener(a -> chooseRingtoneNorm());
|
||||||
|
prefMsgNormRepeatSound.setOnCheckedChangeListener((a,b) -> { s.PriorityNorm.RepeatSound=b; saveAndUpdate(); });
|
||||||
|
prefMsgNormEnableLED.setOnCheckedChangeListener((a,b) -> { s.PriorityNorm.EnableLED=b; saveAndUpdate(); });
|
||||||
|
prefMsgNormLedColor_container.setOnClickListener(a -> chooseLEDColorNorm());
|
||||||
|
prefMsgNormEnableVibrations.setOnCheckedChangeListener((a,b) -> { s.PriorityNorm.EnableVibration=b; saveAndUpdate(); });
|
||||||
|
|
||||||
|
prefMsgHighEnableSound.setOnCheckedChangeListener((a,b) -> { s.PriorityHigh.EnableSound=b; saveAndUpdate(); });
|
||||||
|
prefMsgHighRingtone_container.setOnClickListener(a -> chooseRingtoneHigh());
|
||||||
|
prefMsgHighRepeatSound.setOnCheckedChangeListener((a,b) -> { s.PriorityHigh.RepeatSound=b; saveAndUpdate(); });
|
||||||
|
prefMsgHighEnableLED.setOnCheckedChangeListener((a,b) -> { s.PriorityHigh.EnableLED=b; saveAndUpdate(); });
|
||||||
|
prefMsgHighLedColor_container.setOnClickListener(a -> chooseLEDColorHigh());
|
||||||
|
prefMsgHighEnableVibrations.setOnCheckedChangeListener((a,b) -> { s.PriorityHigh.EnableVibration=b; saveAndUpdate(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveAndUpdate()
|
||||||
|
{
|
||||||
|
SCNSettings.inst().save();
|
||||||
|
updateUI();
|
||||||
|
NotificationService.inst().updateChannels();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onUpgradeAccount()
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getCacheSizeIndex(int value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < SCNSettings.CHOOSABLE_CACHE_SIZES.length; i++)
|
||||||
|
{
|
||||||
|
if (SCNSettings.CHOOSABLE_CACHE_SIZES[i] == value) return i;
|
||||||
|
}
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void chooseRingtoneLow()
|
||||||
|
{
|
||||||
|
musicPickerSwitch = 1;
|
||||||
|
UltimateMusicPicker ump = new UltimateMusicPicker();
|
||||||
|
ump.windowTitle("Choose notification sound");
|
||||||
|
ump.removeSilent();
|
||||||
|
ump.streamType(AudioManager.STREAM_ALARM);
|
||||||
|
ump.ringtone();
|
||||||
|
ump.notification();
|
||||||
|
ump.alarm();
|
||||||
|
ump.music();
|
||||||
|
if (!SCNSettings.inst().PriorityLow.SoundSource.isEmpty())ump.selectUri(Uri.parse(SCNSettings.inst().PriorityLow.SoundSource));
|
||||||
|
ump.goWithDialog(getChildFragmentManager());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void chooseRingtoneNorm()
|
||||||
|
{
|
||||||
|
musicPickerSwitch = 2;
|
||||||
|
UltimateMusicPicker ump = new UltimateMusicPicker();
|
||||||
|
ump.windowTitle("Choose notification sound");
|
||||||
|
ump.removeSilent();
|
||||||
|
ump.streamType(AudioManager.STREAM_ALARM);
|
||||||
|
ump.ringtone();
|
||||||
|
ump.notification();
|
||||||
|
ump.alarm();
|
||||||
|
ump.music();
|
||||||
|
if (!SCNSettings.inst().PriorityNorm.SoundSource.isEmpty())ump.defaultUri(Uri.parse(SCNSettings.inst().PriorityNorm.SoundSource));
|
||||||
|
ump.goWithDialog(getChildFragmentManager());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void chooseRingtoneHigh()
|
||||||
|
{
|
||||||
|
musicPickerSwitch = 3;
|
||||||
|
UltimateMusicPicker ump = new UltimateMusicPicker();
|
||||||
|
ump.windowTitle("Choose notification sound");
|
||||||
|
ump.removeSilent();
|
||||||
|
ump.streamType(AudioManager.STREAM_ALARM);
|
||||||
|
ump.ringtone();
|
||||||
|
ump.notification();
|
||||||
|
ump.alarm();
|
||||||
|
ump.music();
|
||||||
|
if (!SCNSettings.inst().PriorityHigh.SoundSource.isEmpty())ump.defaultUri(Uri.parse(SCNSettings.inst().PriorityHigh.SoundSource));
|
||||||
|
ump.goWithDialog(getChildFragmentManager());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void chooseLEDColorLow()
|
||||||
|
{
|
||||||
|
new ColorPickerPopup.Builder(getContext())
|
||||||
|
.initialColor(SCNSettings.inst().PriorityLow.LEDColor) // Set initial color
|
||||||
|
.enableBrightness(true) // Enable brightness slider or not
|
||||||
|
.okTitle("Choose")
|
||||||
|
.cancelTitle("Cancel")
|
||||||
|
.showIndicator(true)
|
||||||
|
.showValue(false)
|
||||||
|
.build()
|
||||||
|
.show(getView(), new ColorPickerPopup.ColorPickerObserver()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onColorPicked(int color) {
|
||||||
|
SCNSettings.inst().PriorityLow.LEDColor = color;
|
||||||
|
saveAndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onColor(int color, boolean fromUser) { }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void chooseLEDColorNorm()
|
||||||
|
{
|
||||||
|
new ColorPickerPopup.Builder(getContext())
|
||||||
|
.initialColor(SCNSettings.inst().PriorityNorm.LEDColor) // Set initial color
|
||||||
|
.enableBrightness(true) // Enable brightness slider or not
|
||||||
|
.okTitle("Choose")
|
||||||
|
.cancelTitle("Cancel")
|
||||||
|
.showIndicator(true)
|
||||||
|
.showValue(false)
|
||||||
|
.build()
|
||||||
|
.show(getView(), new ColorPickerPopup.ColorPickerObserver()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onColorPicked(int color) {
|
||||||
|
SCNSettings.inst().PriorityNorm.LEDColor = color;
|
||||||
|
saveAndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onColor(int color, boolean fromUser) { }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void chooseLEDColorHigh()
|
||||||
|
{
|
||||||
|
new ColorPickerPopup.Builder(getContext())
|
||||||
|
.initialColor(SCNSettings.inst().PriorityHigh.LEDColor) // Set initial color
|
||||||
|
.enableBrightness(true) // Enable brightness slider or not
|
||||||
|
.okTitle("Choose")
|
||||||
|
.cancelTitle("Cancel")
|
||||||
|
.showIndicator(true)
|
||||||
|
.showValue(false)
|
||||||
|
.build()
|
||||||
|
.show(getView(), new ColorPickerPopup.ColorPickerObserver()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onColorPicked(int color) {
|
||||||
|
SCNSettings.inst().PriorityHigh.LEDColor = color;
|
||||||
|
saveAndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onColor(int color, boolean fromUser) { }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMusicPick(@NotNull Uri uri, @NotNull String s)
|
||||||
|
{
|
||||||
|
if (musicPickerSwitch == 1) { SCNSettings.inst().PriorityLow.SoundSource =uri.toString(); SCNSettings.inst().PriorityLow.SoundName =s; saveAndUpdate(); }
|
||||||
|
if (musicPickerSwitch == 2) { SCNSettings.inst().PriorityNorm.SoundSource=uri.toString(); SCNSettings.inst().PriorityNorm.SoundName=s; saveAndUpdate(); }
|
||||||
|
if (musicPickerSwitch == 3) { SCNSettings.inst().PriorityHigh.SoundSource=uri.toString(); SCNSettings.inst().PriorityHigh.SoundName=s; saveAndUpdate(); }
|
||||||
|
|
||||||
|
musicPickerSwitch = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPickCanceled()
|
||||||
|
{
|
||||||
|
musicPickerSwitch = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,8 +1,8 @@
|
|||||||
package com.blackforestbytes.simplecloudnotifier.view;
|
package com.blackforestbytes.simplecloudnotifier.view;
|
||||||
|
|
||||||
import android.support.v4.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
|
|
||||||
public class TabAdapter extends FragmentStatePagerAdapter {
|
public class TabAdapter extends FragmentStatePagerAdapter {
|
||||||
|
|
||||||
|
6
android/app/src/main/res/drawable/circle.xml
Normal file
6
android/app/src/main/res/drawable/circle.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<vector android:height="24dp" android:viewportHeight="1000"
|
||||||
|
android:viewportWidth="1000" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000"
|
||||||
|
android:pathData="M500,500m-500,0a500,500 0,1 1,1000 0a500,500 0,1 1,-1000 0"
|
||||||
|
android:strokeColor="#000000" android:strokeWidth="1"/>
|
||||||
|
</vector>
|
Binary file not shown.
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 114 KiB |
@@ -6,7 +6,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:showIn="@layout/activity_main">
|
tools:showIn="@layout/activity_main">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
android:minHeight="?attr/actionBarSize"
|
android:minHeight="?attr/actionBarSize"
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
|
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||||
|
|
||||||
<android.support.design.widget.TabLayout
|
<com.google.android.material.tabs.TabLayout
|
||||||
android:id="@+id/tab_layout"
|
android:id="@+id/tab_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
android:minHeight="?attr/actionBarSize"
|
android:minHeight="?attr/actionBarSize"
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
||||||
|
|
||||||
<android.support.v4.view.ViewPager
|
<androidx.viewpager.widget.ViewPager
|
||||||
android:id="@+id/pager"
|
android:id="@+id/pager"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".view.AccountFragment">
|
tools:context=".view.AccountFragment">
|
||||||
|
|
||||||
<android.support.constraint.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
@@ -216,7 +216,7 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
tools:layout_editor_absoluteY="352dp" />
|
tools:layout_editor_absoluteY="352dp" />
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/loadingPanel"
|
android:id="@+id/loadingPanel"
|
||||||
|
@@ -3,20 +3,49 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:ads="http://schemas.android.com/apk/res-auto"
|
||||||
tools:context=".view.NotificationsFragment">
|
tools:context=".view.NotificationsFragment">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/rvMessages"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent">
|
||||||
android:clipToPadding="false"
|
|
||||||
android:scrollbars="vertical" />
|
<RelativeLayout
|
||||||
|
android:id="@+id/pnlMessages"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/adBanner"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rvMessages"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:scrollbars="vertical" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvNoElements"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/no_notifications"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.gms.ads.doubleclick.PublisherAdView
|
||||||
|
android:id="@+id/adBanner"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/pnlMessages"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
ads:adSize="SMART_BANNER"
|
||||||
|
ads:adUnitId="ca-app-pub-3320562328966175/5524654300" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvNoElements"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/no_notifications"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
717
android/app/src/main/res/layout/fragment_settings.xml
Normal file
717
android/app/src/main/res/layout/fragment_settings.xml
Normal file
@@ -0,0 +1,717 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:ignore="TooManyViews"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".view.SettingsFragment">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="12dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:background="@color/colorHeader"
|
||||||
|
android:textColor="@color/colorHeaderForeground"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:padding="4dp"
|
||||||
|
android:text="@string/str_common_settings"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/prefAppEnabled"
|
||||||
|
android:text="@string/str_enabled"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvLocalCacheSize"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/str_localcachesize"
|
||||||
|
android:textColor="#000"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/prefLocalCacheSize"
|
||||||
|
app:layout_constraintHorizontal_bias="0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:minWidth="64dp"
|
||||||
|
android:id="@+id/prefLocalCacheSize"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:spinnerMode="dialog"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/prefUpgradeAccount"
|
||||||
|
android:text="@string/str_upgrade_account"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="12dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:background="@color/colorHeader"
|
||||||
|
android:textColor="@color/colorHeaderForeground"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:padding="4dp"
|
||||||
|
android:text="@string/str_header_prio0"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/prefMsgLowEnableSound"
|
||||||
|
android:text="@string/str_msg_enablesound"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/prefMsgLowRingtone_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvMsgLowRingtone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/str_notificationsound"
|
||||||
|
android:textColor="#000" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/prefMsgLowRingtone_value"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minWidth="64dp"
|
||||||
|
android:spinnerMode="dialog"
|
||||||
|
android:text="Whatever"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/prefMsgLowRepeatSound"
|
||||||
|
android:text="@string/str_repeatnotificationsound"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/prefMsgLowEnableLED"
|
||||||
|
android:text="@string/str_enable_led"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/prefMsgLowLedColor_container"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/str_ledcolor"
|
||||||
|
android:textColor="#000"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/prefMsgLowLedColor_value"
|
||||||
|
app:layout_constraintHorizontal_bias="0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:src="@drawable/circle"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:id="@+id/prefMsgLowLedColor_value"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:spinnerMode="dialog"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/prefMsgLowEnableVibrations"
|
||||||
|
android:text="@string/str_enable_vibration"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="12dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:background="@color/colorHeader"
|
||||||
|
android:textColor="@color/colorHeaderForeground"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:padding="4dp"
|
||||||
|
android:text="@string/str_header_prio1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/prefMsgNormEnableSound"
|
||||||
|
android:text="@string/str_msg_enablesound"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/prefMsgNormRingtone_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvMsgNormRingtone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/str_notificationsound"
|
||||||
|
android:textColor="#000" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/prefMsgNormRingtone_value"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minWidth="64dp"
|
||||||
|
android:spinnerMode="dialog"
|
||||||
|
android:text="Whatever"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/prefMsgNormRepeatSound"
|
||||||
|
android:text="@string/str_repeatnotificationsound"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/prefMsgNormEnableLED"
|
||||||
|
android:text="@string/str_enable_led"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/prefMsgNormLedColor_container"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/str_ledcolor"
|
||||||
|
android:textColor="#000"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/prefMsgNormLedColor_value"
|
||||||
|
app:layout_constraintHorizontal_bias="0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:src="@drawable/circle"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:id="@+id/prefMsgNormLedColor_value"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:spinnerMode="dialog"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/prefMsgNormEnableVibrations"
|
||||||
|
android:text="@string/str_enable_vibration"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="12dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:background="@color/colorHeader"
|
||||||
|
android:textColor="@color/colorHeaderForeground"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:padding="4dp"
|
||||||
|
android:text="@string/str_header_prio2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/prefMsgHighEnableSound"
|
||||||
|
android:text="@string/str_msg_enablesound"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/prefMsgHighRingtone_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvMsgHighRingtone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/str_notificationsound"
|
||||||
|
android:textColor="#000" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/prefMsgHighRingtone_value"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minWidth="64dp"
|
||||||
|
android:spinnerMode="dialog"
|
||||||
|
android:text="Whatever"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/prefMsgHighRepeatSound"
|
||||||
|
android:text="@string/str_repeatnotificationsound"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/prefMsgHighEnableLED"
|
||||||
|
android:text="@string/str_enable_led"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/prefMsgHighLedColor_container"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/str_ledcolor"
|
||||||
|
android:textColor="#000"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/prefMsgHighLedColor_value"
|
||||||
|
app:layout_constraintHorizontal_bias="0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:src="@drawable/circle"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:id="@+id/prefMsgHighLedColor_value"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:spinnerMode="dialog"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background="#c0c0c0"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="48dp">
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/prefMsgHighEnableVibrations"
|
||||||
|
android:text="@string/str_enable_vibration"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
@@ -4,7 +4,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<android.support.v7.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/card_view"
|
android:id="@+id/card_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
card_view:cardCornerRadius="@dimen/card_album_radius">
|
card_view:cardCornerRadius="@dimen/card_album_radius">
|
||||||
|
|
||||||
|
|
||||||
<android.support.constraint.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:background="#FFFFFFFF"
|
android:background="#FFFFFFFF"
|
||||||
android:layout_margin="3dp"
|
android:layout_margin="3dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -63,6 +63,7 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/ivPriority"
|
android:id="@+id/ivPriority"
|
||||||
|
android:tint="#BBB"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
@@ -73,8 +74,8 @@
|
|||||||
android:paddingTop="3dp"
|
android:paddingTop="3dp"
|
||||||
android:contentDescription="@string/desc_priority_icon" />
|
android:contentDescription="@string/desc_priority_icon" />
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</android.support.v7.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@@ -3,6 +3,8 @@
|
|||||||
<color name="colorPrimary">#3F51B5</color>
|
<color name="colorPrimary">#3F51B5</color>
|
||||||
<color name="colorPrimaryDark">#303F9F</color>
|
<color name="colorPrimaryDark">#303F9F</color>
|
||||||
<color name="colorAccent">#FF4081</color>
|
<color name="colorAccent">#FF4081</color>
|
||||||
|
<color name="colorHeader">#3F51B5</color>
|
||||||
|
<color name="colorHeaderForeground">#FFFFFF</color>
|
||||||
|
|
||||||
<color name="colorBlack">#000</color>
|
<color name="colorBlack">#000</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -15,4 +15,17 @@
|
|||||||
<string name="str_not_connected">not connected</string>
|
<string name="str_not_connected">not connected</string>
|
||||||
<string name="str_reload">reload</string>
|
<string name="str_reload">reload</string>
|
||||||
<string name="desc_priority_icon">Priority icon</string>
|
<string name="desc_priority_icon">Priority icon</string>
|
||||||
|
<string name="str_common_settings">Common Settings</string>
|
||||||
|
<string name="str_enabled">Enabled</string>
|
||||||
|
<string name="str_localcachesize">Remember the last x notifications locally</string>
|
||||||
|
<string name="str_header_prio0">Notifications (low priority)</string>
|
||||||
|
<string name="str_header_prio1">Notifications (normal priority)</string>
|
||||||
|
<string name="str_header_prio2">Notifications (high priority)</string>
|
||||||
|
<string name="str_msg_enablesound">Enable notification sound</string>
|
||||||
|
<string name="str_notificationsound">Notification sound</string>
|
||||||
|
<string name="str_repeatnotificationsound">Repeat notification sound</string>
|
||||||
|
<string name="str_enable_led">Enable notification light</string>
|
||||||
|
<string name="str_ledcolor">Notification light color</string>
|
||||||
|
<string name="str_enable_vibration">Enable notification vibration</string>
|
||||||
|
<string name="str_upgrade_account">Upgrade account</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="@style/PreferenceFixTheme.Light.NoActionBar">
|
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
<!-- your app branding color for the app bar -->
|
<!-- your app branding color for the app bar -->
|
||||||
<item name="colorPrimary">#3F51B5</item>
|
<item name="colorPrimary">#3F51B5</item>
|
||||||
<!-- darker variant for the status bar and contextual app bars -->
|
<!-- darker variant for the status bar and contextual app bars -->
|
||||||
|
@@ -1,33 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<EditTextPreference
|
|
||||||
android:key="message_count"
|
|
||||||
android:title="Keep x notifications"
|
|
||||||
android:summary="Remember tha last x notifications locally"
|
|
||||||
android:defaultValue="200" />
|
|
||||||
|
|
||||||
<PreferenceCategory
|
|
||||||
android:title="Notifications"
|
|
||||||
android:key="pref_key_notifications">
|
|
||||||
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:key="notification_enable_sound"
|
|
||||||
android:title="Notification sound"
|
|
||||||
android:summary="Play a sound when a notification is recieved"
|
|
||||||
android:defaultValue="false" />
|
|
||||||
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:key="notification_enable_light"
|
|
||||||
android:title="Notification light"
|
|
||||||
android:summary="Turn the notification LED on when a notification is recieved"
|
|
||||||
android:defaultValue="true" />
|
|
||||||
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:key="notification_enable_vibrate"
|
|
||||||
android:title="Notification vibration"
|
|
||||||
android:summary="Vibrate when a notification is recieved"
|
|
||||||
android:defaultValue="false" />
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
@@ -1,3 +1,3 @@
|
|||||||
#Sat Oct 20 02:47:36 CEST 2018
|
#Mon Oct 22 15:29:01 CEST 2018
|
||||||
VERSION_NAME=0.0.2
|
VERSION_NAME=0.0.4
|
||||||
VERSION_CODE=2
|
VERSION_CODE=4
|
||||||
|
@@ -9,8 +9,6 @@ buildscript {
|
|||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||||
classpath 'com.google.gms:google-services:4.0.1'
|
classpath 'com.google.gms:google-services:4.0.1'
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
|
||||||
// in the individual module build.gradle files
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,6 +18,9 @@ allprojects {
|
|||||||
jcenter()
|
jcenter()
|
||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
maven { url "https://dl.bintray.com/gericop/maven" }
|
maven { url "https://dl.bintray.com/gericop/maven" }
|
||||||
|
maven { url "https://maven.google.com" }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,3 +11,6 @@ org.gradle.jvmargs=-Xmx1536m
|
|||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
|
|
||||||
|
android.useAndroidX=true
|
||||||
|
android.enableJetifier=true
|
||||||
|
BIN
data/graphic.png
BIN
data/graphic.png
Binary file not shown.
Before Width: | Height: | Size: 107 KiB |
BIN
data/icon.pdn
BIN
data/icon.pdn
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 114 KiB |
Reference in New Issue
Block a user