diff --git a/android/app/build.gradle b/android/app/build.gradle index b248a73..ac9a41b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -35,12 +35,12 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - //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 'androidx.recyclerview:recyclerview:1.0.0' implementation 'com.google.firebase:firebase-core:16.0.4' implementation 'com.google.firebase:firebase-messaging:17.3.4' diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java index 1fc4e25..b9c1bc5 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java @@ -37,6 +37,11 @@ public class SCNApp extends Application implements LifecycleObserver return instance; } + public static MainActivity getMainActivity() + { + return mainActivity.get(); + } + public static boolean isBackground() { return isBackground; diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java index 7b22612..0243684 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java @@ -19,7 +19,7 @@ import okhttp3.ResponseBody; public class ServerCommunication { - public static final String BASE_URL = SCNApp.LOCAL_DEBUG ? "localhost:1010/" : "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(); diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/MainActivity.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/MainActivity.java index cafebc4..4a18a04 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/MainActivity.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/MainActivity.java @@ -1,5 +1,6 @@ package com.blackforestbytes.simplecloudnotifier.view; +import android.net.Uri; import android.os.Bundle; import com.blackforestbytes.simplecloudnotifier.R; @@ -9,12 +10,15 @@ import com.blackforestbytes.simplecloudnotifier.model.SCNSettings; import com.blackforestbytes.simplecloudnotifier.service.NotificationService; 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; +import xyz.aprildown.ultimatemusicpicker.MusicPickerListener; -public class MainActivity extends AppCompatActivity +public class MainActivity extends AppCompatActivity implements MusicPickerListener { public TabAdapter adpTabs; @@ -50,4 +54,14 @@ public class MainActivity extends AppCompatActivity CMessageList.inst().fullSave(); } + + @Override + public void onMusicPick(@NotNull Uri uri, @NotNull String s) { + + } + + @Override + public void onPickCanceled() { + + } } diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/SettingsFragment.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/SettingsFragment.java index 17a1298..8cf6cd3 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/SettingsFragment.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/SettingsFragment.java @@ -1,6 +1,7 @@ package com.blackforestbytes.simplecloudnotifier.view; import android.media.AudioManager; +import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -13,6 +14,7 @@ import android.widget.Switch; import android.widget.TextView; import com.blackforestbytes.simplecloudnotifier.R; +import com.blackforestbytes.simplecloudnotifier.SCNApp; import com.blackforestbytes.simplecloudnotifier.model.SCNSettings; import androidx.annotation.NonNull; @@ -119,8 +121,10 @@ public class SettingsFragment extends Fragment { SCNSettings s = SCNSettings.inst(); - s.Enabled = prefAppEnabled.isChecked(); + s.Enabled = prefAppEnabled.isChecked(); + s.LocalCacheSize = prefLocalCacheSize.getSelectedItemPosition()>=0 ? SCNSettings.CHOOSABLE_CACHE_SIZES[prefLocalCacheSize.getSelectedItemPosition()] : 100; + s.save(); } private int getCacheSizeIndex(int value) @@ -142,6 +146,6 @@ public class SettingsFragment extends Fragment .notification() .alarm() .music() - .goWithActivity(this, 0, MainActivity.class); + .goWithDialog(SCNApp.getMainActivity().getSupportFragmentManager()); } } \ No newline at end of file diff --git a/android/app/src/main/res/layout/activity_main.xml b/android/app/src/main/res/layout/activity_main.xml index 5b56100..8936305 100644 --- a/android/app/src/main/res/layout/activity_main.xml +++ b/android/app/src/main/res/layout/activity_main.xml @@ -6,7 +6,7 @@ android:layout_height="match_parent" tools:showIn="@layout/activity_main"> - - - - @@ -216,7 +216,7 @@ app:layout_constraintStart_toStartOf="parent" tools:layout_editor_absoluteY="352dp" /> - + - - @@ -32,7 +32,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> - - + - - + - + - @@ -109,7 +109,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> - - + - - + - - + - - + - - + - - + - + - @@ -306,7 +306,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> - - + - - + - - + - - + - - + - - + - + - @@ -503,7 +503,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> - - + - - + - - + - - + - - + - - + - + diff --git a/android/app/src/main/res/layout/message_card.xml b/android/app/src/main/res/layout/message_card.xml index 849afd1..8de5fb2 100644 --- a/android/app/src/main/res/layout/message_card.xml +++ b/android/app/src/main/res/layout/message_card.xml @@ -4,7 +4,7 @@ android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto"> - - - + - + \ No newline at end of file