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>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

View File

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

View File

@ -144,9 +144,7 @@ public class ListAdapter extends Adapter<ViewHolder> {
int position = vh.getLayoutPosition();
if (position != NO_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();
if (position != NO_POSITION) {
TwitterList list = data.get(position);
TwitterUser owner = list.getListOwner();
if (list.isListOwner()) {
listener.onClick(list, ListClickListener.Action.DELETE);
} else if (!owner.isLocked()) {
} else {
listener.onClick(list, ListClickListener.Action.FOLLOW);
}
}
@ -171,9 +168,7 @@ public class ListAdapter extends Adapter<ViewHolder> {
int position = vh.getLayoutPosition();
if (position != NO_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();
if (position != NO_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
*
* @see AppSettings
*/
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
*
* @see MessagePopup
*/
public class MessageUploader extends AsyncTask<Void, Void, Boolean> {
@ -28,7 +29,7 @@ public class MessageUploader extends AsyncTask<Void, Void, Boolean> {
* send direct message
*
* @param callback Activity context
* @param message message to send
* @param message message to send
*/
public MessageUploader(@NonNull MessagePopup callback, MessageHolder message) {
super();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,8 +35,9 @@ public abstract class FontTool {
/**
* Set fonts to all text elements in a view
*
* @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) {
if (v instanceof ViewGroup) {

View File

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

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<item name="colorAccent">@android:color/white</item>
<item name="android:colorBackground">@android:color/black</item>
@ -56,12 +57,11 @@
</style>
<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 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>
</resources>