From 6ded7dee9b8bf9a8309974c2c6bc973fed9fcbd2 Mon Sep 17 00:00:00 2001 From: Daniele Date: Tue, 12 Oct 2021 19:05:36 +0200 Subject: [PATCH] WIP saving settings --- .idea/misc.xml | 1 + app/src/main/ic_launcher-playstore.png | Bin 0 -> 19467 bytes .../java/it/danieleverducci/ojo/Settings.java | 74 ++++++++ .../ojo/ui/AddStreamFragment.java | 38 +++- .../danieleverducci/ojo/ui/MainActivity.java | 10 +- .../ojo/ui/SurveillanceFragment.java | 24 +-- .../drawable-v24/ic_launcher_foreground.xml | 30 ---- .../res/drawable/ic_launcher_background.xml | 170 ------------------ .../res/drawable/ic_launcher_foreground.xml | 15 ++ .../main/res/layout/fragment_add_stream.xml | 31 ++-- .../res/mipmap-anydpi-v26/ic_launcher.xml | 4 +- .../mipmap-anydpi-v26/ic_launcher_round.xml | 4 +- app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 3593 -> 0 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 5339 -> 0 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 2636 -> 0 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 3388 -> 0 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 4926 -> 0 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 7472 -> 0 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 7909 -> 0 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 11873 -> 0 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 10652 -> 0 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 16570 -> 0 bytes .../res/values/ic_launcher_background.xml | 4 + app/src/main/res/values/strings.xml | 7 +- 24 files changed, 168 insertions(+), 244 deletions(-) create mode 100644 app/src/main/ic_launcher-playstore.png create mode 100644 app/src/main/java/it/danieleverducci/ojo/Settings.java delete mode 100644 app/src/main/res/drawable-v24/ic_launcher_foreground.xml delete mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/drawable/ic_launcher_foreground.xml delete mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.png delete mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.png delete mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.png delete mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png delete mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/values/ic_launcher_background.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index b82c61c..6395638 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,7 @@ diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 0000000000000000000000000000000000000000..2e9b1d710aed102445068778f88fe9f9de328e47 GIT binary patch literal 19467 zcmeEu-PsT2ko-1woKra*^I8L_l%rh95}Bf-D`9 zOUKf&_u+p2gy-%3=D>bFJLk;I&dhaP-#C$aI;s@67;XUoK%uUtYybc^z<+N5H;KVN zIG@oo0MJCMD=WP4vDnHaK^gt6ttzkWO!VQ898P;1&F?^69?4mdrkr1p_Fo!{q1MAj z(l2+h4?cyhvZ$ zE~Pw>?pS&{;2N~te06DQblnA)Jxe4W{0m%AU3aBLLGbzm|Gy^JbMb#O22R5N--2P9Khk}n4#ShG^@47h+011-V~_r#aS zEN}MASn@f|zYM#@=>3Z2!c$pgmLZv&;m=ZS)ra(H{wE{bnq5CgV8X7}2DGv%iI{Ai z?utELlV{KPOA3)T{e96tGBXnn-GwXO1gVJg_jRQ_r=O_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WXgSU&`bvUTIz5bsf#p?DPTtw!7#@?goaL)6y z+m=l!zySoq4p2MlS;*aeqSM^wCtYUWeSm@CO2e*KBOPWO{i+T}FP~xBSyH^(F(yJD*;xGBjSh=^^KwPY3N27#Ok` zbMIYxv!y}uiqW>pGg~z3sxu8226!L%B9gg?B}A&iOX|{f-uU&UU#9HOjZ8dTuc6uh zM_UcJ-F#+a$kJ@y2f(Gf45ck@oVV&irG;EmfL#mF-t^e)?lyppXrtv&6v zW>p49(8ooZC(;bq+_lagy%4Z(-n*~gSMCqDeVE<3+${|_h&nm$KJUaW?B{@o3w&Sz zuHTqdcpSLM{gn4#;Z0dlw?br87FTYbn0deA?v*bhtATa<;YaTs>cxLq2OeIse{sp8 z8x84y_w<~Rn>7Vg4xZ;fROJ5fd-N}B_5xWRhKBZwX2)EU1;A%d{0i2*XRNl{7Ayk>sg7Ip=`!FBG0;5zybK{@TkaC) z7(+wd*zzqfeY&jc-WH#H#{ViFrKsXI}!`Y6mr)_ZqJ&0;M|tr zpIY{-{M!EAeHCW*r#Bv*zxH0Wefrk>jKJOMz>|I4EAFdYsXnjrr@pzsY3fX$>mENt zF6z9vute?D|2@Y~GG?xt69n9y^Z)qo|7ZUE_y2cbe{s;q^B3*?|Hu6OT-ux;vFYIJ w`|Z853;qBD5tyAu&kPzpGHJw~81>{o<96$&rgzI{?*L^6Pgg&ebxsLQ0F}QkkpKVy literal 0 HcmV?d00001 diff --git a/app/src/main/java/it/danieleverducci/ojo/Settings.java b/app/src/main/java/it/danieleverducci/ojo/Settings.java new file mode 100644 index 0000000..c0599a0 --- /dev/null +++ b/app/src/main/java/it/danieleverducci/ojo/Settings.java @@ -0,0 +1,74 @@ +package it.danieleverducci.ojo; + +import android.content.Context; +import android.util.Log; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import it.danieleverducci.ojo.entities.Camera; + +/** + * Manages the settings persistence + */ +public class Settings { + private static final String FILENAME = "settings.bin"; + private static final String TAG = "Settings"; + + private volatile String settingsFilePath; + private List cameras = new ArrayList<>(); + + public static Settings fromDisk(Context context) { + String filePath = context.getFilesDir() + File.separator + FILENAME; + Settings s = new Settings(); + try { + FileInputStream fin = new FileInputStream(filePath); + ObjectInputStream ois = new ObjectInputStream(fin); + s = (Settings) ois.readObject(); + } catch (FileNotFoundException e) { + Log.d(TAG, "No saved settings found, will create a new one"); + } catch (IOException e) { + Log.e(TAG, "Unable to load settings from disk: " + e.toString()); + } catch (ClassNotFoundException e) { + Log.e(TAG, e.toString()); + } + s.settingsFilePath = filePath; + return s; + } + + public List getCameras() { + return cameras; + } + + public void setCameras(List cameras) { + this.cameras = cameras; + } + + public void addCamera(Camera camera) { + this.cameras.add(camera); + } + + public boolean save() { + try { + FileOutputStream fout = new FileOutputStream(settingsFilePath); + ObjectOutputStream oos = new ObjectOutputStream(fout); + oos.writeObject(this); + fout.close(); + oos.close(); + return true; + } catch (FileNotFoundException e) { + Log.e(TAG, "Unable to create file " + settingsFilePath + ": " + e.toString()); + } catch (IOException e) { + Log.e(TAG, "Unable to save settings: " + e.toString()); + } + return false; + } +} diff --git a/app/src/main/java/it/danieleverducci/ojo/ui/AddStreamFragment.java b/app/src/main/java/it/danieleverducci/ojo/ui/AddStreamFragment.java index 2da7994..d8e63cd 100644 --- a/app/src/main/java/it/danieleverducci/ojo/ui/AddStreamFragment.java +++ b/app/src/main/java/it/danieleverducci/ojo/ui/AddStreamFragment.java @@ -9,7 +9,12 @@ import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.navigation.fragment.NavHostFragment; +import com.google.android.material.snackbar.Snackbar; + +import it.danieleverducci.ojo.R; +import it.danieleverducci.ojo.Settings; import it.danieleverducci.ojo.databinding.FragmentAddStreamBinding; +import it.danieleverducci.ojo.entities.Camera; public class AddStreamFragment extends Fragment { @@ -29,13 +34,32 @@ public class AddStreamFragment extends Fragment { public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); -// binding.buttonSecond.setOnClickListener(new View.OnClickListener() { -// @Override -// public void onClick(View view) { -// NavHostFragment.findNavController(AddStreamFragment.this) -// .navigate(R.id.action_SecondFragment_to_FirstFragment); -// } -// }); + binding.save.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + // Check the field is filled + String url = binding.streamUrl.getText().toString(); + if (!url.startsWith("rtsp://")) { + Snackbar.make(view, R.string.add_stream_invalid_url, Snackbar.LENGTH_LONG) + .setAction(R.string.add_stream_invalid_url_dismiss, null).show(); + return; + } + + // Load existing settings (if any) + Settings settings = Settings.fromDisk(getContext()); + // Add stream to list + settings.addCamera(new Camera("", url)); + // Save + if (!settings.save()) { + Snackbar.make(view, R.string.add_stream_error_saving, Snackbar.LENGTH_LONG).show(); + return; + } + + // Back to first fragment + NavHostFragment.findNavController(AddStreamFragment.this) + .navigate(R.id.action_SecondFragment_to_FirstFragment); + } + }); } @Override diff --git a/app/src/main/java/it/danieleverducci/ojo/ui/MainActivity.java b/app/src/main/java/it/danieleverducci/ojo/ui/MainActivity.java index 4b9e923..1542681 100644 --- a/app/src/main/java/it/danieleverducci/ojo/ui/MainActivity.java +++ b/app/src/main/java/it/danieleverducci/ojo/ui/MainActivity.java @@ -30,13 +30,19 @@ public class MainActivity extends AppCompatActivity { binding = ActivityMainBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); + // Show FAB only on first fragment NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main); + navController.addOnDestinationChangedListener((controller, destination, arguments) -> { + if (destination.getId() == R.id.FirstFragment) + binding.fab.show(); + else + binding.fab.hide(); + }); binding.fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) - .setAction("Action", null).show(); + navController.navigate(R.id.action_FirstFragment_to_SecondFragment); } }); } diff --git a/app/src/main/java/it/danieleverducci/ojo/ui/SurveillanceFragment.java b/app/src/main/java/it/danieleverducci/ojo/ui/SurveillanceFragment.java index 3c8f974..ac04e90 100644 --- a/app/src/main/java/it/danieleverducci/ojo/ui/SurveillanceFragment.java +++ b/app/src/main/java/it/danieleverducci/ojo/ui/SurveillanceFragment.java @@ -28,6 +28,7 @@ import java.util.Arrays; import java.util.List; import it.danieleverducci.ojo.R; +import it.danieleverducci.ojo.Settings; import it.danieleverducci.ojo.databinding.FragmentSurveillanceBinding; import it.danieleverducci.ojo.entities.Camera; @@ -70,18 +71,19 @@ public class SurveillanceFragment extends Fragment implements MediaPlayer.EventL // Start stream on surface view 1 + Settings settings = Settings.fromDisk(getContext()); + List cc = settings.getCameras(); - - List cc = new ArrayList<>(); - String rtspUrl = "rtsp://admin:Du4gdtPmXGCWT29@192.168.1.200:554/Streaming/Channels/101"; - Camera camera = new Camera("Camera 1", rtspUrl); - cc.add(camera); - rtspUrl = "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"; - camera = new Camera("Bunny", rtspUrl); - cc.add(camera); - rtspUrl = "rtsp://demo:demo@ipvmdemo.dyndns.org:5541/onvif-media/media.amp?profile=profile_1_h264&sessiontimeout=60&streamtype=unicast"; - camera = new Camera("Ipvm Demo", rtspUrl); - cc.add(camera); +// List cc = new ArrayList<>(); +// String rtspUrl = "rtsp://admin:Du4gdtPmXGCWT29@192.168.1.200:554/Streaming/Channels/101"; +// Camera camera = new Camera("Camera 1", rtspUrl); +// cc.add(camera); +// rtspUrl = "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"; +// camera = new Camera("Bunny", rtspUrl); +// cc.add(camera); +// rtspUrl = "rtsp://demo:demo@ipvmdemo.dyndns.org:5541/onvif-media/media.amp?profile=profile_1_h264&sessiontimeout=60&streamtype=unicast"; +// camera = new Camera("Ipvm Demo", rtspUrl); +// cc.add(camera); int elemsPerSide = calcGridSideElements(cc.size()); diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d1..0000000 --- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9..0000000 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..8c276c2 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/main/res/layout/fragment_add_stream.xml b/app/src/main/res/layout/fragment_add_stream.xml index a2587d0..68b5ce4 100644 --- a/app/src/main/res/layout/fragment_add_stream.xml +++ b/app/src/main/res/layout/fragment_add_stream.xml @@ -1,28 +1,23 @@ - - - + android:text="@string/add_stream_placeholder_url"/>