diff --git a/app/src/main/java/com/github/gotify/messages/ListMessageAdapter.java b/app/src/main/java/com/github/gotify/messages/ListMessageAdapter.java index f8eaf17..c19ac37 100644 --- a/app/src/main/java/com/github/gotify/messages/ListMessageAdapter.java +++ b/app/src/main/java/com/github/gotify/messages/ListMessageAdapter.java @@ -34,11 +34,13 @@ import org.threeten.bp.OffsetDateTime; public class ListMessageAdapter extends RecyclerView.Adapter { private Context context; + private SharedPreferences prefs; private Picasso picasso; private List items; private Delete delete; private Settings settings; private Markwon markwon; + private int messageLayout; private final String TIME_FORMAT_RELATIVE; private final String TIME_FORMAT_PREFS_KEY; @@ -56,11 +58,25 @@ public class ListMessageAdapter extends RecyclerView.Adapter getItems() { @@ -74,7 +90,7 @@ public class ListMessageAdapter extends RecyclerView.Adapter { + new AlertDialog.Builder(getContext()) + .setTitle(R.string.setting_message_layout_dialog_title) + .setMessage(R.string.setting_message_layout_dialog_message) + .setPositiveButton( + getString(R.string.setting_message_layout_dialog_button1), + (ignored3, ignored4) -> { + restartApp(); + }) + .setNegativeButton( + getString(R.string.setting_message_layout_dialog_button2), + (ignore3, ignored4) -> {}) + .show(); + return true; + }); + } + + private void restartApp() { + PackageManager packageManager = getContext().getPackageManager(); + String packageName = getContext().getPackageName(); + Intent intent = packageManager.getLaunchIntentForPackage(packageName); + ComponentName componentName = intent.getComponent(); + Intent mainIntent = Intent.makeRestartActivityTask(componentName); + startActivity(mainIntent); + Runtime.getRuntime().exit(0); + } } } diff --git a/app/src/main/res/layout/message_item.xml b/app/src/main/res/layout/message_item.xml index eb97462..ca51d26 100644 --- a/app/src/main/res/layout/message_item.xml +++ b/app/src/main/res/layout/message_item.xml @@ -1,6 +1,7 @@ @@ -22,7 +23,7 @@ android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginEnd="8dp" - android:text="" + tools:text="A Notification Title" android:textSize="16sp" android:textStyle="bold" app:layout_constraintEnd_toStartOf="@+id/message_date" @@ -35,11 +36,11 @@ android:layout_height="50dp" android:layout_marginStart="8dp" android:layout_marginTop="8dp" + tools:srcCompat="@drawable/gotify" android:contentDescription="@string/message_image_desc" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/message_title" /> - diff --git a/app/src/main/res/layout/message_item_compact.xml b/app/src/main/res/layout/message_item_compact.xml new file mode 100644 index 0000000..7cd344d --- /dev/null +++ b/app/src/main/res/layout/message_item_compact.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 3a9d936..a4ef6f8 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -8,6 +8,19 @@ Light Dark System Default + + + @string/message_layout_entry_normal + @string/message_layout_entry_compact + + Normal + Compact + + @string/message_layout_value_normal + @string/message_layout_value_compact + + message_layout_normal + message_layout_compact @string/time_format_entry_absolute diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9f1ed7e..4c2ae7c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -70,6 +70,12 @@ Appearance Theme theme + Message layout + message_layout + Restart App? + The change will be effective on next app start.\n\nDo you want to restart now? + Restart + Later Time format time_format Push message diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml index ec2273d..0971135 100644 --- a/app/src/main/res/xml/root_preferences.xml +++ b/app/src/main/res/xml/root_preferences.xml @@ -9,12 +9,19 @@ android:key="@string/setting_key_theme" android:title="@string/setting_theme" /> + + + android:title="@string/setting_time_format" /> diff --git a/client/src/main/java/com/github/gotify/client/StringUtil.java b/client/src/main/java/com/github/gotify/client/StringUtil.java index b4f7158..fcb0212 100644 --- a/client/src/main/java/com/github/gotify/client/StringUtil.java +++ b/client/src/main/java/com/github/gotify/client/StringUtil.java @@ -13,7 +13,6 @@ package com.github.gotify.client; -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-06-24T18:39:01.386+02:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/client/src/main/java/com/github/gotify/client/model/Application.java b/client/src/main/java/com/github/gotify/client/model/Application.java index 4087283..37cabe8 100644 --- a/client/src/main/java/com/github/gotify/client/model/Application.java +++ b/client/src/main/java/com/github/gotify/client/model/Application.java @@ -27,7 +27,6 @@ import java.io.IOException; * The Application holds information about an app which can send notifications. */ @ApiModel(description = "The Application holds information about an app which can send notifications.") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-06-24T18:39:01.386+02:00") public class Application { @SerializedName("description") private String description = null; diff --git a/client/src/main/java/com/github/gotify/client/model/Client.java b/client/src/main/java/com/github/gotify/client/model/Client.java index a01090a..66409ba 100644 --- a/client/src/main/java/com/github/gotify/client/model/Client.java +++ b/client/src/main/java/com/github/gotify/client/model/Client.java @@ -27,7 +27,6 @@ import java.io.IOException; * The Client holds information about a device which can receive notifications (and other stuff). */ @ApiModel(description = "The Client holds information about a device which can receive notifications (and other stuff).") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-06-24T18:39:01.386+02:00") public class Client { @SerializedName("id") private Long id = null; diff --git a/client/src/main/java/com/github/gotify/client/model/Error.java b/client/src/main/java/com/github/gotify/client/model/Error.java index a4ab45a..8c0d220 100644 --- a/client/src/main/java/com/github/gotify/client/model/Error.java +++ b/client/src/main/java/com/github/gotify/client/model/Error.java @@ -27,7 +27,6 @@ import java.io.IOException; * The Error contains error relevant information. */ @ApiModel(description = "The Error contains error relevant information.") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-06-24T18:39:01.386+02:00") public class Error { @SerializedName("error") private String error = null; diff --git a/client/src/main/java/com/github/gotify/client/model/Health.java b/client/src/main/java/com/github/gotify/client/model/Health.java index 9e9834b..6da1b3f 100644 --- a/client/src/main/java/com/github/gotify/client/model/Health.java +++ b/client/src/main/java/com/github/gotify/client/model/Health.java @@ -27,7 +27,6 @@ import java.io.IOException; * Health represents how healthy the application is. */ @ApiModel(description = "Health represents how healthy the application is.") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-06-24T18:39:01.386+02:00") public class Health { @SerializedName("database") private String database = null; diff --git a/client/src/main/java/com/github/gotify/client/model/Message.java b/client/src/main/java/com/github/gotify/client/model/Message.java index a7b4e08..2c50109 100644 --- a/client/src/main/java/com/github/gotify/client/model/Message.java +++ b/client/src/main/java/com/github/gotify/client/model/Message.java @@ -31,7 +31,6 @@ import org.threeten.bp.OffsetDateTime; * The MessageExternal holds information about a message which was sent by an Application. */ @ApiModel(description = "The MessageExternal holds information about a message which was sent by an Application.") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-06-24T18:39:01.386+02:00") public class Message { @SerializedName("appid") private Long appid = null; diff --git a/client/src/main/java/com/github/gotify/client/model/PagedMessages.java b/client/src/main/java/com/github/gotify/client/model/PagedMessages.java index ff4a25b..bd8cfcb 100644 --- a/client/src/main/java/com/github/gotify/client/model/PagedMessages.java +++ b/client/src/main/java/com/github/gotify/client/model/PagedMessages.java @@ -31,7 +31,6 @@ import java.util.List; * Wrapper for the paging and the messages */ @ApiModel(description = "Wrapper for the paging and the messages") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-06-24T18:39:01.386+02:00") public class PagedMessages { @SerializedName("messages") private List messages = new ArrayList(); diff --git a/client/src/main/java/com/github/gotify/client/model/Paging.java b/client/src/main/java/com/github/gotify/client/model/Paging.java index 60b9051..cdf5985 100644 --- a/client/src/main/java/com/github/gotify/client/model/Paging.java +++ b/client/src/main/java/com/github/gotify/client/model/Paging.java @@ -27,7 +27,6 @@ import java.io.IOException; * The Paging holds information about the limit and making requests to the next page. */ @ApiModel(description = "The Paging holds information about the limit and making requests to the next page.") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-06-24T18:39:01.386+02:00") public class Paging { @SerializedName("limit") private Long limit = null; diff --git a/client/src/main/java/com/github/gotify/client/model/PluginConf.java b/client/src/main/java/com/github/gotify/client/model/PluginConf.java index fc51445..ddd4f06 100644 --- a/client/src/main/java/com/github/gotify/client/model/PluginConf.java +++ b/client/src/main/java/com/github/gotify/client/model/PluginConf.java @@ -29,7 +29,6 @@ import java.util.List; * Holds information about a plugin instance for one user. */ @ApiModel(description = "Holds information about a plugin instance for one user.") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-06-24T18:39:01.386+02:00") public class PluginConf { @SerializedName("author") private String author = null; diff --git a/client/src/main/java/com/github/gotify/client/model/User.java b/client/src/main/java/com/github/gotify/client/model/User.java index b636127..e050cfb 100644 --- a/client/src/main/java/com/github/gotify/client/model/User.java +++ b/client/src/main/java/com/github/gotify/client/model/User.java @@ -27,7 +27,6 @@ import java.io.IOException; * The User holds information about permission and other stuff. */ @ApiModel(description = "The User holds information about permission and other stuff.") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-06-24T18:39:01.386+02:00") public class User { @SerializedName("admin") private Boolean admin = null; diff --git a/client/src/main/java/com/github/gotify/client/model/UserPass.java b/client/src/main/java/com/github/gotify/client/model/UserPass.java index fb5b020..a5c0a4c 100644 --- a/client/src/main/java/com/github/gotify/client/model/UserPass.java +++ b/client/src/main/java/com/github/gotify/client/model/UserPass.java @@ -27,7 +27,6 @@ import java.io.IOException; * The Password for updating the user. */ @ApiModel(description = "The Password for updating the user.") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-06-24T18:39:01.386+02:00") public class UserPass { @SerializedName("pass") private String pass = null; diff --git a/client/src/main/java/com/github/gotify/client/model/UserWithPass.java b/client/src/main/java/com/github/gotify/client/model/UserWithPass.java index 25583a1..4f9ba0c 100644 --- a/client/src/main/java/com/github/gotify/client/model/UserWithPass.java +++ b/client/src/main/java/com/github/gotify/client/model/UserWithPass.java @@ -27,7 +27,6 @@ import java.io.IOException; * The UserWithPass holds information about the credentials and other stuff. */ @ApiModel(description = "The UserWithPass holds information about the credentials and other stuff.") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-06-24T18:39:01.386+02:00") public class UserWithPass { @SerializedName("admin") private Boolean admin = null; diff --git a/client/src/main/java/com/github/gotify/client/model/VersionInfo.java b/client/src/main/java/com/github/gotify/client/model/VersionInfo.java index 58b36ff..5aff361 100644 --- a/client/src/main/java/com/github/gotify/client/model/VersionInfo.java +++ b/client/src/main/java/com/github/gotify/client/model/VersionInfo.java @@ -27,7 +27,6 @@ import java.io.IOException; * VersionInfo Model */ @ApiModel(description = "VersionInfo Model") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-06-24T18:39:01.386+02:00") public class VersionInfo { @SerializedName("buildDate") private String buildDate = null;