mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-01 04:17:21 +01:00
version upgrade to 3.5.1, added instance announcement dismiss icon, bug fix
This commit is contained in:
parent
fa27f358c5
commit
93040a30a9
@ -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'
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,11 @@ public class AnnouncementAdapter extends Adapter<AnnouncementHolder> 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<AnnouncementHolder> 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);
|
||||
}
|
||||
}
|
@ -157,6 +157,10 @@ public class NotificationAdapter extends Adapter<ViewHolder> 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<ViewHolder> 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<ViewHolder> 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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,6 +92,12 @@ public class AnnouncementFragment extends ListFragment implements OnAnnouncement
|
||||
// todo implement this
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAnnouncementDismiss(Announcement announcement) {
|
||||
// todo implement this
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/item_announcement_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/item_announcement_card_padding">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_announcement_timestamp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"
|
||||
android:textSize="@dimen/item_announcement_textsize_time"
|
||||
android:layout_marginBottom="@dimen/item_announcement_view_margin" />
|
||||
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" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/item_announcement_dismiss"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/cross"
|
||||
android:contentDescription="@string/announcement_dismiss"
|
||||
android:layout_marginStart="@dimen/item_announcement_icon_margin"
|
||||
app:layout_constraintStart_toEndOf="@id/item_announcement_timestamp"
|
||||
app:layout_constraintTop_toTopOf="@id/item_announcement_timestamp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/item_announcement_timestamp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintDimensionRatio="1.0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_announcement_content"
|
||||
@ -25,13 +43,19 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="15"
|
||||
android:textSize="@dimen/item_announcement_textsize_content"
|
||||
android:layout_marginBottom="@dimen/item_announcement_view_margin" />
|
||||
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" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/item_announcement_list_reactions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/item_announcement_list_reaction_height" />
|
||||
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" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
@ -35,5 +35,5 @@
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_navigator_instance"
|
||||
android:title="@string/menu_instance" />
|
||||
android:title="@string/menu_instance_info" />
|
||||
</menu>
|
@ -114,6 +114,7 @@
|
||||
<string name="edit_location_hint">Standortnamen eingeben</string>
|
||||
<string name="error_no_card_app">Keine Karten App gefunden!</string>
|
||||
<string name="error_no_media_app">Keine Galerie App gefunden!</string>
|
||||
<string name="description_instance_banner">Instanz Bannerbild</string>
|
||||
<string name="delete_list">Liste löschen</string>
|
||||
<string name="confirm_delete_list">Liste löschen?</string>
|
||||
<string name="confirm_unfollow_list">Liste entfolgen?</string>
|
||||
@ -180,6 +181,7 @@
|
||||
<string name="button_share">Link teilen</string>
|
||||
<string name="settings_enable_floating_button">Floating-Button aktivieren</string>
|
||||
<string name="settings_look">Aussehen</string>
|
||||
<string name="menu_instance_info">Instanzinformation</string>
|
||||
<string name="dialog_link_image_preview">Linkvorschau Bild</string>
|
||||
<string name="toolbar_title_filter">Status-Filter</string>
|
||||
<string name="status_translate_text">übersetzen</string>
|
||||
@ -361,4 +363,5 @@
|
||||
<string name="menu_status_history">Bearbeitungsverlauf</string>
|
||||
<string name="hint_duration">Dauer</string>
|
||||
<string name="instance_announcement_label">Ankündigungen</string>
|
||||
<string name="announcement_dismiss">Instanz-Ankündigung loschen</string>
|
||||
</resources>
|
@ -334,6 +334,7 @@
|
||||
<dimen name="item_announcement_textsize_content">14sp</dimen>
|
||||
<dimen name="item_announcement_textsize_time">12sp</dimen>
|
||||
<dimen name="item_announcement_icon_size">14sp</dimen>
|
||||
<dimen name="item_announcement_icon_margin">5dp</dimen>
|
||||
|
||||
<!--dimens of page_instance.xml-->
|
||||
<dimen name="page_instance_toolbar_height">@dimen/toolbar_height</dimen>
|
||||
|
@ -132,7 +132,6 @@
|
||||
|
||||
<!-- menu icon strings -->
|
||||
<string name="menu_status">write status</string>
|
||||
<string name="menu_instance">Instance information</string>
|
||||
<string name="menu_schedule">scheduled posts</string>
|
||||
<string name="menu_tags">Hashtags</string>
|
||||
<string name="menu_tag_follow">follow hashtag</string>
|
||||
@ -225,6 +224,7 @@
|
||||
<string name="image_preview">Image preview</string>
|
||||
<string name="status_add_image">add new image</string>
|
||||
<string name="notification_dismiss">dismiss notification</string>
|
||||
<string name="announcement_dismiss">dismiss announcement</string>
|
||||
<string name="send_status">share status</string>
|
||||
<string name="status_pref">Status preferences</string>
|
||||
<string name="status_add_poll">add poll</string>
|
||||
|
Loading…
Reference in New Issue
Block a user