bug fix, code cleanup and reformat

This commit is contained in:
nuclearfog 2020-10-23 23:14:16 +02:00
parent 43693d7f60
commit 54baac22d0
No known key found for this signature in database
GPG Key ID: D5490E4A81F97B14
16 changed files with 96 additions and 48 deletions

View File

@ -28,6 +28,7 @@
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />

View File

@ -324,6 +324,7 @@ public class FragmentAdapter extends FragmentStatePagerAdapter {
/** /**
* called to scroll page to top * called to scroll page to top
*
* @param index tab position of page * @param index tab position of page
*/ */
public void scrollToTop(int index) { public void scrollToTop(int index) {

View File

@ -144,9 +144,7 @@ public class ListAdapter extends Adapter<ViewHolder> {
int position = vh.getLayoutPosition(); int position = vh.getLayoutPosition();
if (position != NO_POSITION) { if (position != NO_POSITION) {
TwitterList list = data.get(position); TwitterList list = data.get(position);
if (!list.getListOwner().isLocked()) { listener.onClick(list, ListClickListener.Action.PROFILE);
listener.onClick(list, ListClickListener.Action.PROFILE);
}
} }
} }
}); });
@ -156,10 +154,9 @@ public class ListAdapter extends Adapter<ViewHolder> {
int position = vh.getLayoutPosition(); int position = vh.getLayoutPosition();
if (position != NO_POSITION) { if (position != NO_POSITION) {
TwitterList list = data.get(position); TwitterList list = data.get(position);
TwitterUser owner = list.getListOwner();
if (list.isListOwner()) { if (list.isListOwner()) {
listener.onClick(list, ListClickListener.Action.DELETE); listener.onClick(list, ListClickListener.Action.DELETE);
} else if (!owner.isLocked()) { } else {
listener.onClick(list, ListClickListener.Action.FOLLOW); listener.onClick(list, ListClickListener.Action.FOLLOW);
} }
} }
@ -171,9 +168,7 @@ public class ListAdapter extends Adapter<ViewHolder> {
int position = vh.getLayoutPosition(); int position = vh.getLayoutPosition();
if (position != NO_POSITION) { if (position != NO_POSITION) {
TwitterList list = data.get(position); TwitterList list = data.get(position);
if (!list.getListOwner().isLocked()) { listener.onClick(list, ListClickListener.Action.SUBSCRIBER);
listener.onClick(list, ListClickListener.Action.SUBSCRIBER);
}
} }
} }
}); });
@ -183,9 +178,7 @@ public class ListAdapter extends Adapter<ViewHolder> {
int position = vh.getLayoutPosition(); int position = vh.getLayoutPosition();
if (position != NO_POSITION) { if (position != NO_POSITION) {
TwitterList list = data.get(position); TwitterList list = data.get(position);
if (!list.getListOwner().isLocked()) { listener.onClick(list, ListClickListener.Action.MEMBER);
listener.onClick(list, ListClickListener.Action.MEMBER);
}
} }
} }
}); });

View File

@ -14,6 +14,7 @@ import java.util.List;
/** /**
* Background task to load location information used by twitter such as location names and world ID's * Background task to load location information used by twitter such as location names and world ID's
*
* @see AppSettings * @see AppSettings
*/ */
public class LocationListLoader extends AsyncTask<Void, Void, List<TrendLocation>> { public class LocationListLoader extends AsyncTask<Void, Void, List<TrendLocation>> {

View File

@ -14,6 +14,7 @@ import java.lang.ref.WeakReference;
/** /**
* Background task to send a direct messages to a user * Background task to send a direct messages to a user
*
* @see MessagePopup * @see MessagePopup
*/ */
public class MessageUploader extends AsyncTask<Void, Void, Boolean> { public class MessageUploader extends AsyncTask<Void, Void, Boolean> {
@ -28,7 +29,7 @@ public class MessageUploader extends AsyncTask<Void, Void, Boolean> {
* send direct message * send direct message
* *
* @param callback Activity context * @param callback Activity context
* @param message message to send * @param message message to send
*/ */
public MessageUploader(@NonNull MessagePopup callback, MessageHolder message) { public MessageUploader(@NonNull MessagePopup callback, MessageHolder message) {
super(); super();

View File

@ -30,6 +30,7 @@ public class MessageHolder {
/** /**
* Get receiver screen name * Get receiver screen name
*
* @return receiver name * @return receiver name
*/ */
public String getUsername() { public String getUsername() {
@ -38,6 +39,7 @@ public class MessageHolder {
/** /**
* get message text * get message text
*
* @return message * @return message
*/ */
public String getMessage() { public String getMessage() {
@ -46,6 +48,7 @@ public class MessageHolder {
/** /**
* get local path of media * get local path of media
*
* @return media path * @return media path
*/ */
public String[] getMediaPath() { public String[] getMediaPath() {
@ -54,6 +57,7 @@ public class MessageHolder {
/** /**
* check if media is attached * check if media is attached
*
* @return if media is set * @return if media is set
*/ */
public boolean hasMedia() { public boolean hasMedia() {

View File

@ -38,8 +38,9 @@ public class TweetHolder {
/** /**
* Add media paths to the holder * Add media paths to the holder
*
* @param mediaLinks array of media paths from storage * @param mediaLinks array of media paths from storage
* @param mType type of media * @param mType type of media
*/ */
public void addMedia(String[] mediaLinks, MediaType mType) { public void addMedia(String[] mediaLinks, MediaType mType) {
this.mediaPaths = mediaLinks; this.mediaPaths = mediaLinks;
@ -48,6 +49,7 @@ public class TweetHolder {
/** /**
* Add location to a tweet * Add location to a tweet
*
* @param location location information * @param location location information
*/ */
public void addLocation(Location location) { public void addLocation(Location location) {
@ -58,6 +60,7 @@ public class TweetHolder {
/** /**
* get tweet message * get tweet message
*
* @return tweet text * @return tweet text
*/ */
public String getText() { public String getText() {
@ -66,6 +69,7 @@ public class TweetHolder {
/** /**
* get ID of the replied tweet * get ID of the replied tweet
*
* @return Tweet ID * @return Tweet ID
*/ */
public long getReplyId() { public long getReplyId() {
@ -74,6 +78,7 @@ public class TweetHolder {
/** /**
* get type of attached media if any * get type of attached media if any
*
* @return media type * @return media type
*/ */
public MediaType getMediaType() { public MediaType getMediaType() {
@ -100,6 +105,7 @@ public class TweetHolder {
/** /**
* get longitude of the location * get longitude of the location
*
* @return longitude * @return longitude
*/ */
public double getLongitude() { public double getLongitude() {
@ -108,6 +114,7 @@ public class TweetHolder {
/** /**
* get latitude of the location * get latitude of the location
*
* @return latitude * @return latitude
*/ */
public double getLatitude() { public double getLatitude() {
@ -116,6 +123,7 @@ public class TweetHolder {
/** /**
* return if holder has location information attached * return if holder has location information attached
*
* @return true if location is attached * @return true if location is attached
*/ */
public boolean hasLocation() { public boolean hasLocation() {
@ -124,6 +132,7 @@ public class TweetHolder {
/** /**
* return if tweet is a reply * return if tweet is a reply
*
* @return true if tweet is a reply * @return true if tweet is a reply
*/ */
public boolean isReply() { public boolean isReply() {

View File

@ -12,11 +12,11 @@ public class UserHolder {
/** /**
* create user information holder * create user information holder
* *
* @param name user name * @param name user name
* @param link profile link * @param link profile link
* @param location profile location string * @param location profile location string
* @param bio description string * @param bio description string
* @param profileImage local profile image path * @param profileImage local profile image path
* @param profileBanner local profile image path * @param profileBanner local profile image path
*/ */
public UserHolder(String name, String link, String location, String bio, String profileImage, String profileBanner) { public UserHolder(String name, String link, String location, String bio, String profileImage, String profileBanner) {
@ -31,6 +31,7 @@ public class UserHolder {
/** /**
* get sser name * get sser name
*
* @return user name * @return user name
*/ */
public String getName() { public String getName() {
@ -39,6 +40,7 @@ public class UserHolder {
/** /**
* get profile link * get profile link
*
* @return link * @return link
*/ */
public String getLink() { public String getLink() {
@ -47,6 +49,7 @@ public class UserHolder {
/** /**
* get location * get location
*
* @return location name * @return location name
*/ */
public String getLocation() { public String getLocation() {
@ -55,6 +58,7 @@ public class UserHolder {
/** /**
* get profile description * get profile description
*
* @return profile bio * @return profile bio
*/ */
public String getBio() { public String getBio() {
@ -63,6 +67,7 @@ public class UserHolder {
/** /**
* get local image path * get local image path
*
* @return image path * @return image path
*/ */
public String getProfileImage() { public String getProfileImage() {
@ -71,6 +76,7 @@ public class UserHolder {
/** /**
* check if profile image path is included * check if profile image path is included
*
* @return true if image path is included * @return true if image path is included
*/ */
public boolean hasProfileImage() { public boolean hasProfileImage() {

View File

@ -31,11 +31,12 @@ public class Message {
/** /**
* construct message object from database information * construct message object from database information
*
* @param messageId ID of direct message * @param messageId ID of direct message
* @param sender sender user * @param sender sender user
* @param receiver receiver user * @param receiver receiver user
* @param time timestamp long format * @param time timestamp long format
* @param message message text * @param message message text
*/ */
public Message(long messageId, TwitterUser sender, TwitterUser receiver, long time, String message) { public Message(long messageId, TwitterUser sender, TwitterUser receiver, long time, String message) {
this.messageId = messageId; this.messageId = messageId;

View File

@ -30,8 +30,9 @@ public class TrendLocation {
/** /**
* construct location object from local * construct location object from local
*
* @param placeName name of locale * @param placeName name of locale
* @param id woe id * @param id woe id
*/ */
public TrendLocation(String placeName, int id) { public TrendLocation(String placeName, int id) {
this.placeName = placeName; this.placeName = placeName;
@ -40,6 +41,7 @@ public class TrendLocation {
/** /**
* get place name * get place name
*
* @return country followed by place * @return country followed by place
*/ */
public String getName() { public String getName() {
@ -48,6 +50,7 @@ public class TrendLocation {
/** /**
* get World ID * get World ID
*
* @return woeID * @return woeID
*/ */
public int getWoeId() { public int getWoeId() {

View File

@ -60,11 +60,12 @@ public class Tweet {
/** /**
* Tweet constructor * Tweet constructor
* @param status twitter4j status *
* @param retweetCount set retweet count * @param status twitter4j status
* @param retweeted set if tweet is retweeted by current user * @param retweetCount set retweet count
* @param retweeted set if tweet is retweeted by current user
* @param favoriteCount set favor count * @param favoriteCount set favor count
* @param favored set if tweet is favored by current user * @param favored set if tweet is favored by current user
*/ */
public Tweet(Status status, int retweetCount, boolean retweeted, int favoriteCount, boolean favored) { public Tweet(Status status, int retweetCount, boolean retweeted, int favoriteCount, boolean favored) {
this.retweetCount = retweetCount; this.retweetCount = retweetCount;
@ -141,24 +142,25 @@ public class Tweet {
/** /**
* Tweet constructor for database tweets * Tweet constructor for database tweets
* @param tweetID unique id of tweet *
* @param retweetCount number of retweets * @param tweetID unique id of tweet
* @param favoriteCount number of favors * @param retweetCount number of retweets
* @param user tweet author * @param favoriteCount number of favors
* @param tweet tweet text * @param user tweet author
* @param time time long format * @param tweet tweet text
* @param replyName author's name of replied tweet * @param time time long format
* @param replyUserId quthor's ID of replied tweet * @param replyName author's name of replied tweet
* @param medias Media links attached to tweet * @param replyUserId quthor's ID of replied tweet
* @param source used API of the tweet * @param medias Media links attached to tweet
* @param replyID ID of replied tweet * @param source used API of the tweet
* @param embedded quoted tweet * @param replyID ID of replied tweet
* @param myRetweetId ID of the current users retweeted tweet * @param embedded quoted tweet
* @param retweeted tweet is retweeted by current user * @param myRetweetId ID of the current users retweeted tweet
* @param favored tweet is favored by current user * @param retweeted tweet is retweeted by current user
* @param favored tweet is favored by current user
* @param sensitiveMedia tweet contains sensitie media content * @param sensitiveMedia tweet contains sensitie media content
* @param geo location gps coordinates * @param geo location gps coordinates
* @param place location full place name * @param place location full place name
*/ */
public Tweet(long tweetID, int retweetCount, int favoriteCount, TwitterUser user, String tweet, long time, public Tweet(long tweetID, int retweetCount, int favoriteCount, TwitterUser user, String tweet, long time,
String replyName, long replyUserId, String[] medias, MediaType mediaType, String source, long replyID, String replyName, long replyUserId, String[] medias, MediaType mediaType, String source, long replyID,

View File

@ -98,6 +98,7 @@ public class TwitterUser {
/** /**
* get user id * get user id
*
* @return id * @return id
*/ */
public long getId() { public long getId() {
@ -106,6 +107,7 @@ public class TwitterUser {
/** /**
* get User name * get User name
*
* @return username * @return username
*/ */
public String getUsername() { public String getUsername() {
@ -114,6 +116,7 @@ public class TwitterUser {
/** /**
* get @screenname * get @screenname
*
* @return screen name * @return screen name
*/ */
public String getScreenname() { public String getScreenname() {
@ -122,6 +125,7 @@ public class TwitterUser {
/** /**
* get date of creation * get date of creation
*
* @return raw time * @return raw time
*/ */
public long getCreatedAt() { public long getCreatedAt() {
@ -130,6 +134,7 @@ public class TwitterUser {
/** /**
* get Profile image_add link * get Profile image_add link
*
* @return link * @return link
*/ */
public String getImageLink() { public String getImageLink() {
@ -138,6 +143,7 @@ public class TwitterUser {
/** /**
* get banner image_add link * get banner image_add link
*
* @return link * @return link
*/ */
public String getBannerLink() { public String getBannerLink() {
@ -146,6 +152,7 @@ public class TwitterUser {
/** /**
* get user bio * get user bio
*
* @return bio text * @return bio text
*/ */
public String getBio() { public String getBio() {
@ -154,6 +161,7 @@ public class TwitterUser {
/** /**
* get location name * get location name
*
* @return name * @return name
*/ */
public String getLocation() { public String getLocation() {
@ -162,6 +170,7 @@ public class TwitterUser {
/** /**
* get link * get link
*
* @return link * @return link
*/ */
public String getLink() { public String getLink() {
@ -170,6 +179,7 @@ public class TwitterUser {
/** /**
* user verified * user verified
*
* @return if verified * @return if verified
*/ */
public boolean isVerified() { public boolean isVerified() {
@ -178,6 +188,7 @@ public class TwitterUser {
/** /**
* user locked * user locked
*
* @return if locked * @return if locked
*/ */
public boolean isLocked() { public boolean isLocked() {
@ -186,6 +197,7 @@ public class TwitterUser {
/** /**
* requested follow * requested follow
*
* @return if a follow was requested * @return if a follow was requested
*/ */
public boolean followRequested() { public boolean followRequested() {
@ -194,6 +206,7 @@ public class TwitterUser {
/** /**
* get following count * get following count
*
* @return following * @return following
*/ */
public int getFollowing() { public int getFollowing() {
@ -202,6 +215,7 @@ public class TwitterUser {
/** /**
* get follower count * get follower count
*
* @return follower count * @return follower count
*/ */
public int getFollower() { public int getFollower() {
@ -210,6 +224,7 @@ public class TwitterUser {
/** /**
* get Tweet count of user * get Tweet count of user
*
* @return tweet count * @return tweet count
*/ */
public int getTweetCount() { public int getTweetCount() {
@ -218,6 +233,7 @@ public class TwitterUser {
/** /**
* get count of favored tweets * get count of favored tweets
*
* @return tweet count * @return tweet count
*/ */
public int getFavorCount() { public int getFavorCount() {

View File

@ -34,6 +34,7 @@ public class UserRelation {
/** /**
* screen name of target user * screen name of target user
*
* @return screen name * @return screen name
*/ */
public String getTargetScreenname() { public String getTargetScreenname() {
@ -42,6 +43,7 @@ public class UserRelation {
/** /**
* return if target user is authenticating user * return if target user is authenticating user
*
* @return true if target user is current user * @return true if target user is current user
*/ */
public boolean isHome() { public boolean isHome() {
@ -50,6 +52,7 @@ public class UserRelation {
/** /**
* return if target user is followed by current user * return if target user is followed by current user
*
* @return true if target user is followed by current user * @return true if target user is followed by current user
*/ */
public boolean isFriend() { public boolean isFriend() {
@ -58,6 +61,7 @@ public class UserRelation {
/** /**
* return if target user is following current user * return if target user is following current user
*
* @return true if target user is following current user * @return true if target user is following current user
*/ */
public boolean isFollower() { public boolean isFollower() {
@ -66,6 +70,7 @@ public class UserRelation {
/** /**
* return if current user is blocking target user * return if current user is blocking target user
*
* @return true if current user is blocking target user * @return true if current user is blocking target user
*/ */
public boolean isBlocked() { public boolean isBlocked() {
@ -74,6 +79,7 @@ public class UserRelation {
/** /**
* return if current user is muting target user * return if current user is muting target user
*
* @return true if current user is muting target user * @return true if current user is muting target user
*/ */
public boolean isMuted() { public boolean isMuted() {
@ -82,6 +88,7 @@ public class UserRelation {
/** /**
* return if target user can receive direct message * return if target user can receive direct message
*
* @return true if target user can receive direct messages * @return true if target user can receive direct messages
*/ */
public boolean canDm() { public boolean canDm() {

View File

@ -35,8 +35,9 @@ public abstract class FontTool {
/** /**
* Set fonts to all text elements in a view * Set fonts to all text elements in a view
*
* @param settings current font settings * @param settings current font settings
* @param v Root view containing views * @param v Root view containing views
*/ */
public static void setViewFont(GlobalSettings settings, View v) { public static void setViewFont(GlobalSettings settings, View v) {
if (v instanceof ViewGroup) { if (v instanceof ViewGroup) {

View File

@ -2,4 +2,6 @@
<resources> <resources>
<color name="half_transparent">#40000000</color> <color name="half_transparent">#40000000</color>
<color name="bright_transparent">#afffffff</color> <color name="bright_transparent">#afffffff</color>
<color name="positive_button">#ffff4000</color>
<color name="negative_button">#ff0040ff</color>
</resources> </resources>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar"> <style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<item name="colorAccent">@android:color/white</item> <item name="colorAccent">@android:color/white</item>
<item name="android:colorBackground">@android:color/black</item> <item name="android:colorBackground">@android:color/black</item>
@ -56,12 +57,11 @@
</style> </style>
<style name="NegativeButton" parent="Widget.AppCompat.ButtonBar.AlertDialog"> <style name="NegativeButton" parent="Widget.AppCompat.ButtonBar.AlertDialog">
<item name="android:textColor">@android:color/holo_red_dark</item> <item name="android:textColor">@color/negative_button</item>
</style> </style>
<style name="PositiveButton" parent="Widget.AppCompat.ButtonBar.AlertDialog"> <style name="PositiveButton" parent="Widget.AppCompat.ButtonBar.AlertDialog">
<item name="android:textColor">@android:color/holo_red_light</item> <item name="android:textColor">@color/positive_button</item>
</style> </style>
</resources> </resources>