diff --git a/app/build.gradle b/app/build.gradle index 32e98a8a..80849b93 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId 'org.nuclearfog.twidda' minSdkVersion 21 targetSdkVersion 34 - versionCode 103 - versionName '3.5' + versionCode 104 + versionName '3.5.1' resConfigs 'en', 'es', 'de', 'zh-rCN' } diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/AnnouncementAdapter.java b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/AnnouncementAdapter.java index e378617b..487d5f09 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/AnnouncementAdapter.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/AnnouncementAdapter.java @@ -49,7 +49,11 @@ public class AnnouncementAdapter extends Adapter implements @Override public void onItemClick(int position, int type, int... extras) { - listener.onAnnouncementClick(items.get(position)); + if (type == ANNOUNCEMENT_DISMISS) { + listener.onAnnouncementDismiss(items.get(position)); + } else if (type == ANNOUNCEMENT_CLICK) { + listener.onAnnouncementClick(items.get(position)); + } } @@ -95,8 +99,17 @@ public class AnnouncementAdapter extends Adapter implements public interface OnAnnouncementClickListener { /** + * called when announcement was selected + * * @param announcement clicked item */ void onAnnouncementClick(Announcement announcement); + + /** + * called to dismiss announcement + * + * @param announcement clicked item + */ + void onAnnouncementDismiss(Announcement announcement); } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/NotificationAdapter.java b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/NotificationAdapter.java index 6f92c72d..75ad71e2 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/NotificationAdapter.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/NotificationAdapter.java @@ -157,6 +157,10 @@ public class NotificationAdapter extends Adapter implements OnHolder public void onItemClick(int position, int type, int... extras) { Notification item = notifications.get(position); switch (type) { + case OnHolderClickListener.NOTIFICATION_USER_CLICK: + listener.onNotificationClick(item, OnNotificationClickListener.NOTIFICATION_VIEW_USER); + break; + case OnHolderClickListener.USER_CLICK: case OnHolderClickListener.STATUS_LABEL: if (item != null && item.getUser() != null) { @@ -166,7 +170,7 @@ public class NotificationAdapter extends Adapter implements OnHolder case OnHolderClickListener.STATUS_CLICK: if (item != null) { - listener.onNotificationClick(item, OnNotificationClickListener.NOTIFICATION_VIEW); + listener.onNotificationClick(item, OnNotificationClickListener.NOTIFICATION_VIEW_STATUS); } break; @@ -293,25 +297,30 @@ public class NotificationAdapter extends Adapter implements OnHolder public interface OnNotificationClickListener { /** - * used when a notification was clicked + * used when a status notification was clicked */ - int NOTIFICATION_VIEW = 1; + int NOTIFICATION_VIEW_STATUS = 1; + + /** + * used when an user notification was clicked + */ + int NOTIFICATION_VIEW_USER = 2; /** * used when the notification dismiss button was clicked */ - int NOTIFICATION_DISMISS = 2; + int NOTIFICATION_DISMISS = 3; /** * used when the user of a notification was clicked */ - int NOTIFICATION_USER = 3; + int NOTIFICATION_USER = 4; /** * called on notification click * * @param notification clicked notification - * @param action action {@link #NOTIFICATION_VIEW ,#DISMISS} + * @param action action {@link #NOTIFICATION_VIEW_STATUS ,#DISMISS} */ void onNotificationClick(Notification notification, int action); diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/AnnouncementHolder.java b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/AnnouncementHolder.java index eb15cd91..003ebdb4 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/AnnouncementHolder.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/AnnouncementHolder.java @@ -50,6 +50,7 @@ public class AnnouncementHolder extends ViewHolder implements OnClickListener { emojiLoader = new TextEmojiLoader(parent.getContext()); CardView card = (CardView) itemView; ViewGroup container = itemView.findViewById(R.id.item_announcement_container); + View dismiss = itemView.findViewById(R.id.item_announcement_dismiss); time = itemView.findViewById(R.id.item_announcement_timestamp); content = itemView.findViewById(R.id.item_announcement_content); iconSize = parent.getResources().getDimensionPixelSize(R.dimen.item_announcement_icon_size); @@ -58,6 +59,7 @@ public class AnnouncementHolder extends ViewHolder implements OnClickListener { AppStyles.setTheme(container, Color.TRANSPARENT); container.setOnClickListener(this); + dismiss.setOnClickListener(this); this.listener = listener; } @@ -68,6 +70,8 @@ public class AnnouncementHolder extends ViewHolder implements OnClickListener { if (position != RecyclerView.NO_POSITION) { if (v.getId() == R.id.item_announcement_container) { listener.onItemClick(position, OnHolderClickListener.ANNOUNCEMENT_CLICK); + } else if (v.getId() == R.id.item_announcement_dismiss) { + listener.onItemClick(position, OnHolderClickListener.ANNOUNCEMENT_DISMISS); } } } diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/OnHolderClickListener.java b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/OnHolderClickListener.java index 256c35fc..2328b763 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/OnHolderClickListener.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/OnHolderClickListener.java @@ -23,6 +23,8 @@ public interface OnHolderClickListener { int STATUS_POLL = 7; + int NOTIFICATION_USER_CLICK = 8; + int ACCOUNT_SELECT = 12; int ACCOUNT_REMOVE = 13; @@ -57,6 +59,8 @@ public interface OnHolderClickListener { int ANNOUNCEMENT_CLICK = 28; + int ANNOUNCEMENT_DISMISS = 29; + /** * called when an item was clicked * diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/StatusHolder.java b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/StatusHolder.java index ca7ed3d8..70f9248f 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/StatusHolder.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/StatusHolder.java @@ -55,7 +55,6 @@ public class StatusHolder extends ViewHolder implements OnClickListener { private ImageView profile, repostUserIcon, verifiedIcon, lockedIcon, repostIcon, favoriteIcon, replyStatus, labelIcon; private TextView username, screenname, statusText, repost, favorite, reply, reposter, created, replyname, label; - private View dismissButton; private RecyclerView iconList; private Drawable placeholder; @@ -82,8 +81,8 @@ public class StatusHolder extends ViewHolder implements OnClickListener { CardView cardLayout = (CardView) itemView; ViewGroup container = itemView.findViewById(R.id.item_status_container); + View dismiss = itemView.findViewById(R.id.item_status_notification_dismiss); label = itemView.findViewById(R.id.item_status_label); - dismissButton = itemView.findViewById(R.id.item_status_notification_dismiss); profile = itemView.findViewById(R.id.item_status_profile_image); verifiedIcon = itemView.findViewById(R.id.item_status_verified_icon); lockedIcon = itemView.findViewById(R.id.item_status_locked_icon); @@ -117,15 +116,15 @@ public class StatusHolder extends ViewHolder implements OnClickListener { label.setVisibility(View.VISIBLE); labelIcon.setVisibility(View.VISIBLE); if (settings.getLogin().getConfiguration().notificationDismissEnabled()) { - dismissButton.setVisibility(View.VISIBLE); + dismiss.setVisibility(View.VISIBLE); } } AppStyles.setTheme(container, Color.TRANSPARENT); cardLayout.setCardBackgroundColor(settings.getCardColor()); label.setOnClickListener(this); - itemView.setOnClickListener(this); - dismissButton.setOnClickListener(this); + container.setOnClickListener(this); + dismiss.setOnClickListener(this); } @@ -133,11 +132,11 @@ public class StatusHolder extends ViewHolder implements OnClickListener { public void onClick(View v) { int position = getLayoutPosition(); if (position != RecyclerView.NO_POSITION) { - if (v == itemView) { + if (v.getId() == R.id.item_status_container) { listener.onItemClick(position, OnHolderClickListener.STATUS_CLICK); - } else if (v == label) { + } else if (v.getId() == R.id.item_status_label) { listener.onItemClick(position, OnHolderClickListener.STATUS_LABEL); - } else if (v == dismissButton) { + } else if (v.getId() == R.id.item_status_notification_dismiss) { listener.onItemClick(position, OnHolderClickListener.NOTIFICATION_DISMISS); } } diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/TagHolder.java b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/TagHolder.java index 640f96d7..e4dbab49 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/TagHolder.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/TagHolder.java @@ -51,7 +51,7 @@ public class TagHolder extends ViewHolder implements OnClickListener { } else { btnRemove.setVisibility(View.GONE); } - itemView.setOnClickListener(this); + container.setOnClickListener(this); btnRemove.setOnClickListener(this); } @@ -63,7 +63,7 @@ public class TagHolder extends ViewHolder implements OnClickListener { if (position != RecyclerView.NO_POSITION) { listener.onItemClick(position, OnHolderClickListener.TAG_REMOVE); } - } else if (v == itemView) { + } else if (v.getId() == R.id.item_tag_container) { if (position != RecyclerView.NO_POSITION) { listener.onItemClick(position, OnHolderClickListener.TAG_CLICK); } diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/UserHolder.java b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/UserHolder.java index a8ec75d5..30964bd9 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/UserHolder.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/adapter/recyclerview/holder/UserHolder.java @@ -10,7 +10,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; -import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; @@ -51,8 +50,6 @@ public class UserHolder extends ViewHolder implements OnClickListener, AsyncCall private TextView username, screenname, followingCount, followerCount, label; private ImageView profileImg, verifyIcon, lockedIcon, labelIcon; - private ImageButton delete; - private View notificationDismiss; private Drawable placeholder; private GlobalSettings settings; @@ -71,13 +68,12 @@ public class UserHolder extends ViewHolder implements OnClickListener, AsyncCall settings = GlobalSettings.get(parent.getContext()); picasso = PicassoBuilder.get(parent.getContext()); emojiLoader = new TextEmojiLoader(parent.getContext()); - this.listener = listener; - CardView background = (CardView) itemView; ViewGroup container = itemView.findViewById(R.id.item_user_container); + View dismiss = itemView.findViewById(R.id.item_user_notification_dismiss); + View delete = itemView.findViewById(R.id.item_user_delete_button); label = itemView.findViewById(R.id.item_user_label); labelIcon = itemView.findViewById(R.id.item_user_label_icon); - notificationDismiss = itemView.findViewById(R.id.item_user_notification_dismiss); username = itemView.findViewById(R.id.item_user_username); screenname = itemView.findViewById(R.id.item_user_screenname); followingCount = itemView.findViewById(R.id.item_user_following_count); @@ -85,8 +81,8 @@ public class UserHolder extends ViewHolder implements OnClickListener, AsyncCall profileImg = itemView.findViewById(R.id.item_user_profile); verifyIcon = itemView.findViewById(R.id.item_user_verified); lockedIcon = itemView.findViewById(R.id.item_user_private); - delete = itemView.findViewById(R.id.item_user_delete_button); placeholder = new ColorDrawable(EMPTY_COLOR); + this.listener = listener; AppStyles.setTheme(container, Color.TRANSPARENT); background.setCardBackgroundColor(settings.getCardColor()); @@ -99,12 +95,13 @@ public class UserHolder extends ViewHolder implements OnClickListener, AsyncCall label.setVisibility(View.VISIBLE); labelIcon.setVisibility(View.VISIBLE); if (settings.getLogin().getConfiguration().notificationDismissEnabled()) { - notificationDismiss.setVisibility(View.VISIBLE); + dismiss.setVisibility(View.VISIBLE); } } - itemView.setOnClickListener(this); - notificationDismiss.setOnClickListener(this); + dismiss.setOnClickListener(this); delete.setOnClickListener(this); + label.setOnClickListener(this); + container.setOnClickListener(this); } @@ -112,12 +109,14 @@ public class UserHolder extends ViewHolder implements OnClickListener, AsyncCall public void onClick(View v) { int position = getLayoutPosition(); if (position != RecyclerView.NO_POSITION) { - if (v == itemView) { + if (v.getId() == R.id.item_user_container) { listener.onItemClick(position, OnHolderClickListener.USER_CLICK); - } else if (v == delete) { + } else if (v.getId() == R.id.item_user_delete_button) { listener.onItemClick(position, OnHolderClickListener.USER_REMOVE); - } else if (v == notificationDismiss) { + } else if (v.getId() == R.id.item_user_notification_dismiss) { listener.onItemClick(position, OnHolderClickListener.NOTIFICATION_DISMISS); + } else if (v.getId() == R.id.item_user_label) { + listener.onItemClick(position, OnHolderClickListener.NOTIFICATION_USER_CLICK); } } } diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/AnnouncementFragment.java b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/AnnouncementFragment.java index 10357a2b..53e0a7f3 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/AnnouncementFragment.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/AnnouncementFragment.java @@ -92,6 +92,12 @@ public class AnnouncementFragment extends ListFragment implements OnAnnouncement // todo implement this } + + @Override + public void onAnnouncementDismiss(Announcement announcement) { + // todo implement this + } + /** * */ diff --git a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/NotificationFragment.java b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/NotificationFragment.java index 5f1dd51c..908fd0f8 100644 --- a/app/src/main/java/org/nuclearfog/twidda/ui/fragments/NotificationFragment.java +++ b/app/src/main/java/org/nuclearfog/twidda/ui/fragments/NotificationFragment.java @@ -120,7 +120,7 @@ public class NotificationFragment extends ListFragment implements OnNotification public void onNotificationClick(Notification notification, int action) { if (!isRefreshing()) { switch (action) { - case OnNotificationClickListener.NOTIFICATION_VIEW: + case OnNotificationClickListener.NOTIFICATION_VIEW_STATUS: Intent intent = new Intent(requireContext(), StatusActivity.class); intent.putExtra(StatusActivity.KEY_DATA, notification); activityResultLauncher.launch(intent); @@ -139,11 +139,14 @@ public class NotificationFragment extends ListFragment implements OnNotification confirmDialog.show(ConfirmDialog.FOLLOW_REQUEST); select = notification; } - } else { - intent = new Intent(requireContext(), ProfileActivity.class); - intent.putExtra(ProfileActivity.KEY_USER, notification.getUser()); - startActivity(intent); + break; } + // fall through + + case OnNotificationClickListener.NOTIFICATION_VIEW_USER: + intent = new Intent(requireContext(), ProfileActivity.class); + intent.putExtra(ProfileActivity.KEY_USER, notification.getUser()); + startActivity(intent); break; } } diff --git a/app/src/main/res/layout/item_announcement.xml b/app/src/main/res/layout/item_announcement.xml index 66ca233f..4ab35855 100644 --- a/app/src/main/res/layout/item_announcement.xml +++ b/app/src/main/res/layout/item_announcement.xml @@ -1,23 +1,41 @@ - - + android:layout_marginBottom="@dimen/item_announcement_view_margin" + app:layout_constraintHorizontal_weight="1" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintEnd_toStartOf="@id/item_announcement_dismiss" /> + + + android:layout_marginBottom="@dimen/item_announcement_view_margin" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/item_announcement_timestamp" + app:layout_constraintEnd_toEndOf="parent" /> + android:layout_height="@dimen/item_announcement_list_reaction_height" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/item_announcement_content" + app:layout_constraintEnd_toEndOf="parent" /> - + \ No newline at end of file diff --git a/app/src/main/res/menu/main_navigation.xml b/app/src/main/res/menu/main_navigation.xml index 55dd4120..c7834a49 100644 --- a/app/src/main/res/menu/main_navigation.xml +++ b/app/src/main/res/menu/main_navigation.xml @@ -35,5 +35,5 @@ + android:title="@string/menu_instance_info" /> \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 1727d05e..73901b92 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -114,6 +114,7 @@ Standortnamen eingeben Keine Karten App gefunden! Keine Galerie App gefunden! + Instanz Bannerbild Liste löschen Liste löschen? Liste entfolgen? @@ -180,6 +181,7 @@ Link teilen Floating-Button aktivieren Aussehen + Instanzinformation Linkvorschau Bild Status-Filter übersetzen @@ -361,4 +363,5 @@ Bearbeitungsverlauf Dauer Ankündigungen + Instanz-Ankündigung loschen \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index e164fc74..b5a136e7 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -334,6 +334,7 @@ 14sp 12sp 14sp + 5dp @dimen/toolbar_height diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 51ac9940..44988dee 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -132,7 +132,6 @@ write status - Instance information scheduled posts Hashtags follow hashtag @@ -225,6 +224,7 @@ Image preview add new image dismiss notification + dismiss announcement share status Status preferences add poll