aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/mygram
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/mygram')
-rw-r--r--app/src/main/java/mygram/droid/App.java32
-rw-r--r--app/src/main/java/mygram/droid/FolderActivity.java20
-rw-r--r--app/src/main/java/mygram/droid/MainActivity.java20
-rw-r--r--app/src/main/java/mygram/droid/Prefs.java60
-rw-r--r--app/src/main/java/mygram/droid/SettingsActivity.java20
-rw-r--r--app/src/main/java/mygram/droid/SetupActivity.java20
-rw-r--r--app/src/main/java/mygram/droid/ViewerActivity.java20
7 files changed, 192 insertions, 0 deletions
diff --git a/app/src/main/java/mygram/droid/App.java b/app/src/main/java/mygram/droid/App.java
new file mode 100644
index 0000000..ffbdd8d
--- /dev/null
+++ b/app/src/main/java/mygram/droid/App.java
@@ -0,0 +1,32 @@
+/*
+ * mygram-droid: Android TV client for Foldergram.
+ * Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+package mygram.droid;
+
+import android.app.Application;
+
+import java.net.CookieHandler;
+import java.net.CookieManager;
+import java.net.CookiePolicy;
+
+public final class App extends Application {
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ Prefs.init(this);
+ // One cookie jar for the Foldergram session: Api, Glide and ExoPlayer
+ // all use HttpURLConnection, which consults the default handler.
+ CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL));
+ }
+}
diff --git a/app/src/main/java/mygram/droid/FolderActivity.java b/app/src/main/java/mygram/droid/FolderActivity.java
new file mode 100644
index 0000000..d53588a
--- /dev/null
+++ b/app/src/main/java/mygram/droid/FolderActivity.java
@@ -0,0 +1,20 @@
+/*
+ * mygram-droid: Android TV client for Foldergram.
+ * Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+package mygram.droid;
+
+import android.app.Activity;
+
+public final class FolderActivity extends Activity {
+}
diff --git a/app/src/main/java/mygram/droid/MainActivity.java b/app/src/main/java/mygram/droid/MainActivity.java
new file mode 100644
index 0000000..767dbb1
--- /dev/null
+++ b/app/src/main/java/mygram/droid/MainActivity.java
@@ -0,0 +1,20 @@
+/*
+ * mygram-droid: Android TV client for Foldergram.
+ * Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+package mygram.droid;
+
+import android.app.Activity;
+
+public final class MainActivity extends Activity {
+}
diff --git a/app/src/main/java/mygram/droid/Prefs.java b/app/src/main/java/mygram/droid/Prefs.java
new file mode 100644
index 0000000..33ce878
--- /dev/null
+++ b/app/src/main/java/mygram/droid/Prefs.java
@@ -0,0 +1,60 @@
+/*
+ * mygram-droid: Android TV client for Foldergram.
+ * Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+package mygram.droid;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+/** Settings stored on the device. */
+final class Prefs {
+ private static SharedPreferences prefs;
+
+ private Prefs() {
+ }
+
+ static void init(Context c) {
+ prefs = c.getSharedPreferences("mygram", Context.MODE_PRIVATE);
+ }
+
+ /** Base URL like "http://192.0.2.10:4141", or null before setup. */
+ static String server() {
+ return prefs.getString("server", null);
+ }
+
+ /** Viewer password; empty for a public instance. */
+ static String password() {
+ return prefs.getString("password", "");
+ }
+
+ static int photoSeconds() {
+ return prefs.getInt("photo", 8);
+ }
+
+ static int backgroundSeconds() {
+ return prefs.getInt("background", 15);
+ }
+
+ static void setServer(String base, String password) {
+ prefs.edit().putString("server", base).putString("password", password).apply();
+ }
+
+ static void setPassword(String password) {
+ prefs.edit().putString("password", password).apply();
+ }
+
+ static void setTimes(int photo, int background) {
+ prefs.edit().putInt("photo", photo).putInt("background", background).apply();
+ }
+}
diff --git a/app/src/main/java/mygram/droid/SettingsActivity.java b/app/src/main/java/mygram/droid/SettingsActivity.java
new file mode 100644
index 0000000..776e48b
--- /dev/null
+++ b/app/src/main/java/mygram/droid/SettingsActivity.java
@@ -0,0 +1,20 @@
+/*
+ * mygram-droid: Android TV client for Foldergram.
+ * Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+package mygram.droid;
+
+import android.app.Activity;
+
+public final class SettingsActivity extends Activity {
+}
diff --git a/app/src/main/java/mygram/droid/SetupActivity.java b/app/src/main/java/mygram/droid/SetupActivity.java
new file mode 100644
index 0000000..ef1f68c
--- /dev/null
+++ b/app/src/main/java/mygram/droid/SetupActivity.java
@@ -0,0 +1,20 @@
+/*
+ * mygram-droid: Android TV client for Foldergram.
+ * Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+package mygram.droid;
+
+import android.app.Activity;
+
+public final class SetupActivity extends Activity {
+}
diff --git a/app/src/main/java/mygram/droid/ViewerActivity.java b/app/src/main/java/mygram/droid/ViewerActivity.java
new file mode 100644
index 0000000..9a3be55
--- /dev/null
+++ b/app/src/main/java/mygram/droid/ViewerActivity.java
@@ -0,0 +1,20 @@
+/*
+ * mygram-droid: Android TV client for Foldergram.
+ * Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+package mygram.droid;
+
+import android.app.Activity;
+
+public final class ViewerActivity extends Activity {
+}