From 447ad45fc6d0f0d08d6d82ec30f84494f4174119 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 13 Jan 2023 18:07:35 +0100 Subject: [PATCH] Release 3.14.3 --- app/build.gradle | 4 ++-- app/src/main/assets/release_notes/notes.json | 5 +++++ .../app/fedilab/android/helper/Helper.java | 4 ++++ .../android/ui/drawer/StatusAdapter.java | 19 ++++++++++++++++--- .../settings/FragmentSettingsCategories.java | 13 +++---------- app/src/main/res/values/strings.xml | 5 +++++ app/src/main/res/xml/pref_interface.xml | 8 ++++++++ app/src/main/res/xml/pref_timelines.xml | 6 ++++++ .../metadata/android/en/changelogs/465.txt | 8 ++++++++ 9 files changed, 57 insertions(+), 15 deletions(-) create mode 100644 src/fdroid/fastlane/metadata/android/en/changelogs/465.txt diff --git a/app/build.gradle b/app/build.gradle index 63041b02..456658a0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ android { defaultConfig { minSdk 21 targetSdk 33 - versionCode 464 - versionName "3.14.2" + versionCode 465 + versionName "3.14.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } flavorDimensions "default" diff --git a/app/src/main/assets/release_notes/notes.json b/app/src/main/assets/release_notes/notes.json index c4bd320a..1a73ed5e 100644 --- a/app/src/main/assets/release_notes/notes.json +++ b/app/src/main/assets/release_notes/notes.json @@ -1,4 +1,9 @@ [ + { + "version": "3.14.3", + "code": "465", + "note": "Added:\n- Display date of the message instead of the boost (default: disabled)\n- Allow to disable release notes popup in Settings\n\nFixed:\n- Fix timelines slow down and stuttering after some scrolls\n- Fix color issues with follow buttons\n- Fix import from settings (import from login was OK)" + }, { "version": "3.14.2", "code": "464", diff --git a/app/src/main/java/app/fedilab/android/helper/Helper.java b/app/src/main/java/app/fedilab/android/helper/Helper.java index e443b786..8ee91e3a 100644 --- a/app/src/main/java/app/fedilab/android/helper/Helper.java +++ b/app/src/main/java/app/fedilab/android/helper/Helper.java @@ -1781,6 +1781,10 @@ public class Helper { SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity); int lastReleaseNoteRead = sharedpreferences.getInt(activity.getString(R.string.SET_POPUP_RELEASE_NOTES), 0); int versionCode = BuildConfig.VERSION_CODE; + boolean disabled = sharedpreferences.getBoolean(activity.getString(R.string.SET_DISABLE_RELEASE_NOTES_ALERT), false); + if (disabled && !forced) { + return; + } if (lastReleaseNoteRead != versionCode || forced) { try { InputStream is = activity.getAssets().open("release_notes/notes.json"); diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java index 450473b3..c3537ab0 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java @@ -404,6 +404,7 @@ public class StatusAdapter extends RecyclerView.Adapter boolean displayQuote = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_QUOTES) + MainActivity.currentUserID + MainActivity.currentInstance, true); boolean displayReactions = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_REACTIONS) + MainActivity.currentUserID + MainActivity.currentInstance, true); boolean compactButtons = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_COMPACT_ACTION_BUTTON), false); + boolean originalDateForBoost = sharedpreferences.getBoolean(context.getString(R.string.SET_BOOST_ORIGINAL_DATE), true); if (compactButtons) { ConstraintSet set = new ConstraintSet(); @@ -1081,7 +1082,11 @@ public class StatusAdapter extends RecyclerView.Adapter } else { holder.binding.editTime.setVisibility(View.GONE); } - holder.binding.time.setText(Helper.longDateToString(status.created_at)); + if (originalDateForBoost || status.reblog == null) { + holder.binding.time.setText(Helper.longDateToString(statusToDeal.created_at)); + } else { + holder.binding.time.setText(Helper.longDateToString(status.created_at)); + } holder.binding.time.setVisibility(View.VISIBLE); holder.binding.dateShort.setVisibility(View.GONE); holder.binding.visibility.setImageResource(ressource); @@ -1108,7 +1113,11 @@ public class StatusAdapter extends RecyclerView.Adapter holder.binding.visibilitySmall.setVisibility(View.GONE); holder.binding.reblogsCount.setText(String.valueOf(statusToDeal.reblogs_count)); holder.binding.favoritesCount.setText(String.valueOf(statusToDeal.favourites_count)); - holder.binding.time.setText(Helper.dateDiff(context, statusToDeal.created_at)); + if (originalDateForBoost || status.reblog == null) { + holder.binding.time.setText(Helper.dateDiff(context, statusToDeal.created_at)); + } else { + holder.binding.time.setText(Helper.dateDiff(context, status.created_at)); + } if (statusToDeal.edited_at != null) { Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_baseline_mode_edit_message_24); img.setBounds(0, 0, (int) (Helper.convertDpToPixel(16, context) * scale + 0.5f), (int) (Helper.convertDpToPixel(16, context) * scale + 0.5f)); @@ -1130,7 +1139,11 @@ public class StatusAdapter extends RecyclerView.Adapter } else { holder.binding.dateShort.setCompoundDrawables(null, null, null, null); } - holder.binding.dateShort.setText(Helper.dateDiff(context, statusToDeal.created_at)); + if (originalDateForBoost || status.reblog == null) { + holder.binding.dateShort.setText(Helper.dateDiff(context, statusToDeal.created_at)); + } else { + holder.binding.dateShort.setText(Helper.dateDiff(context, status.created_at)); + } holder.binding.time.setVisibility(View.GONE); Helper.absoluteDateTimeReveal(context, holder.binding.dateShort, statusToDeal.created_at, statusToDeal.edited_at); } diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentSettingsCategories.java b/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentSettingsCategories.java index 258e32b5..a1f32db3 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentSettingsCategories.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentSettingsCategories.java @@ -20,7 +20,6 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; -import android.webkit.URLUtil; import android.widget.Toast; import androidx.activity.result.ActivityResultLauncher; @@ -164,9 +163,10 @@ public class FragmentSettingsCategories extends PreferenceFragmentCompat { pref_import_settings.setOnPreferenceClickListener(preference -> { Intent openFileIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT); openFileIntent.addCategory(Intent.CATEGORY_OPENABLE); - openFileIntent.setType("text/plain"); - String[] mimeTypes = new String[]{"text/plain"}; + openFileIntent.setType("application/zip"); + String[] mimeTypes = new String[]{"application/zip"}; openFileIntent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes); + //noinspection deprecation startActivityForResult( Intent.createChooser( openFileIntent, @@ -184,13 +184,6 @@ public class FragmentSettingsCategories extends PreferenceFragmentCompat { Toasty.error(requireActivity(), getString(R.string.toot_select_file_error), Toast.LENGTH_LONG).show(); return; } - String uriFullPath = data.getData().getPath(); - String[] uriFullPathStr = uriFullPath.split(":"); - String fullPath = uriFullPath; - if (uriFullPathStr.length > 1) { - fullPath = uriFullPathStr[1]; - } - final String fileName = URLUtil.guessFileName(fullPath, null, null); Helper.createFileFromUri(requireActivity(), data.getData(), file -> ZipHelper.importData(requireActivity(), file)); } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3567f944..8f69c1af 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -821,6 +821,7 @@ SET_PROXY_PORT SET_DEFAULT_LOCALE_NEW SET_SEND_CRASH_REPORTS + SET_DISABLE_RELEASE_NOTES_ALERT SET_DISABLE_GIF SET_JAVASCRIPT SET_CUSTOM_USER_AGENT @@ -1472,6 +1473,7 @@ SET_EXCLUDED_NOTIFICATIONS_TYPE SET_EXPAND_MEDIA SET_GROUP_REBLOGS + SET_BOOST_ORIGINAL_DATE SET_LIVE_TRANSLATE SET_TRUNCATE_TOOTS_SIZE @@ -2208,4 +2210,7 @@ Buttons at the bottom of messages will not take the whole width Followed by: Directory + Display original date for boosts + Disable release notes + When a new version is published, you will not be alerted inside the app. \ No newline at end of file diff --git a/app/src/main/res/xml/pref_interface.xml b/app/src/main/res/xml/pref_interface.xml index da7f64c3..9d82b3f0 100644 --- a/app/src/main/res/xml/pref_interface.xml +++ b/app/src/main/res/xml/pref_interface.xml @@ -86,6 +86,14 @@ app:summary="@string/set_enable_crash_report_indication" app:title="@string/set_enable_crash_report" /> + + +