diff --git a/android/app/build.gradle b/android/app/build.gradle index bbf2245..b248a73 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -35,23 +35,21 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.support:support-v4:28.0.0' - implementation 'com.android.support:appcompat-v7:28.0.0' - implementation 'com.android.support:cardview-v7:28.0.0' - implementation 'com.android.support.constraint:constraint-layout:1.1.3' - implementation 'com.android.support:recyclerview-v7:28.0.0' - implementation 'com.android.support:design:28.0.0' - - implementation 'com.takisoft.fix:preference-v7:28.0.0.0' - implementation 'com.takisoft.fix:preference-v7-extras:28.0.0.0' + //implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.appcompat:appcompat:1.0.0' + implementation 'androidx.cardview:cardview:1.0.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'androidx.recyclerview:recyclerview:1.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-messaging:17.3.3' + implementation 'com.google.firebase:firebase-messaging:17.3.4' implementation "android.arch.lifecycle:extensions:1.1.1" implementation 'com.squareup.okhttp3:okhttp:3.10.0' implementation 'com.github.kenglxn.QRGen:android:2.5.0' + implementation "com.github.DeweyReed:UltimateMusicPicker:2.0.0" } apply plugin: 'com.google.gms.google-services' diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index aa93a3c..f8c2e81 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -2,6 +2,9 @@ + + + onUpdate()); + + prefLocalCacheSize.setAdapter(new ArrayAdapter<>(v.getContext(), android.R.layout.simple_spinner_item, SCNSettings.CHOOSABLE_CACHE_SIZES)); + prefLocalCacheSize.setSelection(getCacheSizeIndex(s.LocalCacheSize)); + prefLocalCacheSize.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() + { + @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { onUpdate(); } + @Override public void onNothingSelected(AdapterView parent) { onUpdate(); } + }); + + //TODO ... + + prevMsgLowRingtone.setOnClickListener((a) -> chooseRingtoneLow()); + } + return v; } + + private void onUpdate() + { + SCNSettings s = SCNSettings.inst(); + + s.Enabled = prefAppEnabled.isChecked(); + + } + + 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() + { + new UltimateMusicPicker() + .windowTitle("Choose notification sound") + .removeSilent() + .streamType(AudioManager.STREAM_ALARM) + .ringtone() + .notification() + .alarm() + .music() + .goWithActivity(this, 0, MainActivity.class); + } } \ No newline at end of file diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/TabAdapter.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/TabAdapter.java index f0d851f..2d07d4e 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/TabAdapter.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/TabAdapter.java @@ -1,8 +1,8 @@ package com.blackforestbytes.simplecloudnotifier.view; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentStatePagerAdapter; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; public class TabAdapter extends FragmentStatePagerAdapter { diff --git a/android/app/src/main/res/layout/fragment_settings.xml b/android/app/src/main/res/layout/fragment_settings.xml index 0a42063..bb2e908 100644 --- a/android/app/src/main/res/layout/fragment_settings.xml +++ b/android/app/src/main/res/layout/fragment_settings.xml @@ -32,7 +32,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> - -