added multiple user mentoring, directmessage delete fix
Signed-off-by: nuclearfog <hatespirit666@gmail.com>
This commit is contained in:
parent
c7f118914b
commit
58ddc2eddd
|
@ -1,5 +1,29 @@
|
||||||
package org.nuclearfog.twidda.activity;
|
package org.nuclearfog.twidda.activity;
|
||||||
|
|
||||||
|
import static android.os.AsyncTask.Status.RUNNING;
|
||||||
|
import static android.view.View.GONE;
|
||||||
|
import static android.view.View.VISIBLE;
|
||||||
|
import static android.widget.Toast.LENGTH_SHORT;
|
||||||
|
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_LINK;
|
||||||
|
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_TYPE;
|
||||||
|
import static org.nuclearfog.twidda.activity.MediaViewer.MEDIAVIEWER_ANGIF;
|
||||||
|
import static org.nuclearfog.twidda.activity.MediaViewer.MEDIAVIEWER_IMAGE;
|
||||||
|
import static org.nuclearfog.twidda.activity.MediaViewer.MEDIAVIEWER_VIDEO;
|
||||||
|
import static org.nuclearfog.twidda.activity.SearchPage.KEY_SEARCH_QUERY;
|
||||||
|
import static org.nuclearfog.twidda.activity.TweetEditor.KEY_TWEETPOPUP_REPLYID;
|
||||||
|
import static org.nuclearfog.twidda.activity.TweetEditor.KEY_TWEETPOPUP_TEXT;
|
||||||
|
import static org.nuclearfog.twidda.activity.UserDetail.KEY_USERDETAIL_ID;
|
||||||
|
import static org.nuclearfog.twidda.activity.UserDetail.KEY_USERDETAIL_MODE;
|
||||||
|
import static org.nuclearfog.twidda.activity.UserDetail.USERLIST_RETWEETS;
|
||||||
|
import static org.nuclearfog.twidda.fragment.TweetFragment.INTENT_TWEET_REMOVED_ID;
|
||||||
|
import static org.nuclearfog.twidda.fragment.TweetFragment.INTENT_TWEET_UPDATE_DATA;
|
||||||
|
import static org.nuclearfog.twidda.fragment.TweetFragment.KEY_FRAG_TWEET_ID;
|
||||||
|
import static org.nuclearfog.twidda.fragment.TweetFragment.KEY_FRAG_TWEET_MODE;
|
||||||
|
import static org.nuclearfog.twidda.fragment.TweetFragment.KEY_FRAG_TWEET_SEARCH;
|
||||||
|
import static org.nuclearfog.twidda.fragment.TweetFragment.RETURN_TWEET_NOT_FOUND;
|
||||||
|
import static org.nuclearfog.twidda.fragment.TweetFragment.RETURN_TWEET_UPDATE;
|
||||||
|
import static org.nuclearfog.twidda.fragment.TweetFragment.TWEET_FRAG_ANSWER;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
|
@ -50,30 +74,6 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import jp.wasabeef.picasso.transformations.RoundedCornersTransformation;
|
import jp.wasabeef.picasso.transformations.RoundedCornersTransformation;
|
||||||
|
|
||||||
import static android.os.AsyncTask.Status.RUNNING;
|
|
||||||
import static android.view.View.GONE;
|
|
||||||
import static android.view.View.VISIBLE;
|
|
||||||
import static android.widget.Toast.LENGTH_SHORT;
|
|
||||||
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_LINK;
|
|
||||||
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_TYPE;
|
|
||||||
import static org.nuclearfog.twidda.activity.MediaViewer.MEDIAVIEWER_ANGIF;
|
|
||||||
import static org.nuclearfog.twidda.activity.MediaViewer.MEDIAVIEWER_IMAGE;
|
|
||||||
import static org.nuclearfog.twidda.activity.MediaViewer.MEDIAVIEWER_VIDEO;
|
|
||||||
import static org.nuclearfog.twidda.activity.SearchPage.KEY_SEARCH_QUERY;
|
|
||||||
import static org.nuclearfog.twidda.activity.TweetEditor.KEY_TWEETPOPUP_REPLYID;
|
|
||||||
import static org.nuclearfog.twidda.activity.TweetEditor.KEY_TWEETPOPUP_TEXT;
|
|
||||||
import static org.nuclearfog.twidda.activity.UserDetail.KEY_USERDETAIL_ID;
|
|
||||||
import static org.nuclearfog.twidda.activity.UserDetail.KEY_USERDETAIL_MODE;
|
|
||||||
import static org.nuclearfog.twidda.activity.UserDetail.USERLIST_RETWEETS;
|
|
||||||
import static org.nuclearfog.twidda.fragment.TweetFragment.INTENT_TWEET_REMOVED_ID;
|
|
||||||
import static org.nuclearfog.twidda.fragment.TweetFragment.INTENT_TWEET_UPDATE_DATA;
|
|
||||||
import static org.nuclearfog.twidda.fragment.TweetFragment.KEY_FRAG_TWEET_ID;
|
|
||||||
import static org.nuclearfog.twidda.fragment.TweetFragment.KEY_FRAG_TWEET_MODE;
|
|
||||||
import static org.nuclearfog.twidda.fragment.TweetFragment.KEY_FRAG_TWEET_SEARCH;
|
|
||||||
import static org.nuclearfog.twidda.fragment.TweetFragment.RETURN_TWEET_NOT_FOUND;
|
|
||||||
import static org.nuclearfog.twidda.fragment.TweetFragment.RETURN_TWEET_UPDATE;
|
|
||||||
import static org.nuclearfog.twidda.fragment.TweetFragment.TWEET_FRAG_ANSWER;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tweet Activity for tweet and user information
|
* Tweet Activity for tweet and user information
|
||||||
*
|
*
|
||||||
|
@ -307,7 +307,7 @@ public class TweetActivity extends AppCompatActivity implements OnClickListener,
|
||||||
clickedTweet = tweet.getEmbeddedTweet();
|
clickedTweet = tweet.getEmbeddedTweet();
|
||||||
// answer to the tweet
|
// answer to the tweet
|
||||||
if (v.getId() == R.id.tweet_answer) {
|
if (v.getId() == R.id.tweet_answer) {
|
||||||
String tweetPrefix = clickedTweet.getUser().getScreenname() + " ";
|
String tweetPrefix = clickedTweet.getMentionedUsers() + " ";
|
||||||
Intent tweetPopup = new Intent(this, TweetEditor.class);
|
Intent tweetPopup = new Intent(this, TweetEditor.class);
|
||||||
tweetPopup.putExtra(KEY_TWEETPOPUP_REPLYID, clickedTweet.getId());
|
tweetPopup.putExtra(KEY_TWEETPOPUP_REPLYID, clickedTweet.getId());
|
||||||
tweetPopup.putExtra(KEY_TWEETPOPUP_TEXT, tweetPrefix);
|
tweetPopup.putExtra(KEY_TWEETPOPUP_TEXT, tweetPrefix);
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
package org.nuclearfog.twidda.activity;
|
package org.nuclearfog.twidda.activity;
|
||||||
|
|
||||||
|
import static android.os.AsyncTask.Status.RUNNING;
|
||||||
|
import static android.view.View.GONE;
|
||||||
|
import static android.view.View.INVISIBLE;
|
||||||
|
import static android.view.View.VISIBLE;
|
||||||
|
import static android.widget.Toast.LENGTH_LONG;
|
||||||
|
import static android.widget.Toast.LENGTH_SHORT;
|
||||||
|
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_LINK;
|
||||||
|
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_TYPE;
|
||||||
|
import static org.nuclearfog.twidda.activity.MediaViewer.MEDIAVIEWER_IMAGE;
|
||||||
|
import static org.nuclearfog.twidda.activity.MediaViewer.MEDIAVIEWER_VIDEO;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
|
@ -32,17 +43,6 @@ import org.nuclearfog.twidda.dialog.ProgressDialog.OnProgressStopListener;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static android.os.AsyncTask.Status.RUNNING;
|
|
||||||
import static android.view.View.GONE;
|
|
||||||
import static android.view.View.INVISIBLE;
|
|
||||||
import static android.view.View.VISIBLE;
|
|
||||||
import static android.widget.Toast.LENGTH_LONG;
|
|
||||||
import static android.widget.Toast.LENGTH_SHORT;
|
|
||||||
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_LINK;
|
|
||||||
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_TYPE;
|
|
||||||
import static org.nuclearfog.twidda.activity.MediaViewer.MEDIAVIEWER_IMAGE;
|
|
||||||
import static org.nuclearfog.twidda.activity.MediaViewer.MEDIAVIEWER_VIDEO;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tweet editor activity. Media files and location can be attached to a tweet.
|
* Tweet editor activity. Media files and location can be attached to a tweet.
|
||||||
*
|
*
|
||||||
|
@ -78,7 +78,7 @@ public class TweetEditor extends MediaActivity implements OnClickListener, OnPro
|
||||||
/**
|
/**
|
||||||
* max amount of mentions in a tweet
|
* max amount of mentions in a tweet
|
||||||
*/
|
*/
|
||||||
private static final int MAX_MENTIONS = 8;
|
private static final int MAX_MENTIONS = 10;
|
||||||
|
|
||||||
private TweetUpdater uploaderAsync;
|
private TweetUpdater uploaderAsync;
|
||||||
private GlobalSettings settings;
|
private GlobalSettings settings;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.io.Serializable;
|
||||||
import twitter4j.MediaEntity;
|
import twitter4j.MediaEntity;
|
||||||
import twitter4j.Status;
|
import twitter4j.Status;
|
||||||
import twitter4j.URLEntity;
|
import twitter4j.URLEntity;
|
||||||
|
import twitter4j.UserMentionEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tweet class containing information about a tweet
|
* Tweet class containing information about a tweet
|
||||||
|
@ -50,6 +51,7 @@ public class Tweet implements Serializable {
|
||||||
private boolean sensitiveMedia;
|
private boolean sensitiveMedia;
|
||||||
|
|
||||||
private String[] medias = {};
|
private String[] medias = {};
|
||||||
|
private String userMentions = "";
|
||||||
private String locationName = "";
|
private String locationName = "";
|
||||||
private String locationCoordinates = "";
|
private String locationCoordinates = "";
|
||||||
private String replyName = "";
|
private String replyName = "";
|
||||||
|
@ -106,7 +108,7 @@ public class Tweet implements Serializable {
|
||||||
* @param tweet tweet text
|
* @param tweet tweet text
|
||||||
* @param time time long format
|
* @param time time long format
|
||||||
* @param replyName author's name of replied tweet
|
* @param replyName author's name of replied tweet
|
||||||
* @param replyUserId quthor's ID of replied tweet
|
* @param replyUserId author's ID of replied tweet
|
||||||
* @param medias Media links attached to tweet
|
* @param medias Media links attached to tweet
|
||||||
* @param source used API of the tweet
|
* @param source used API of the tweet
|
||||||
* @param replyID ID of replied tweet
|
* @param replyID ID of replied tweet
|
||||||
|
@ -114,7 +116,7 @@ public class Tweet implements Serializable {
|
||||||
* @param myRetweetId ID of the current users retweeted tweet
|
* @param myRetweetId ID of the current users retweeted tweet
|
||||||
* @param retweeted tweet is retweeted by current user
|
* @param retweeted tweet is retweeted by current user
|
||||||
* @param favored tweet is favored by current user
|
* @param favored tweet is favored by current user
|
||||||
* @param sensitiveMedia tweet contains sensitie media content
|
* @param sensitiveMedia tweet contains sensitive media content
|
||||||
* @param geo location gps coordinates
|
* @param geo location gps coordinates
|
||||||
* @param place location full place name
|
* @param place location full place name
|
||||||
*/
|
*/
|
||||||
|
@ -126,8 +128,10 @@ public class Tweet implements Serializable {
|
||||||
this.tweet = tweet;
|
this.tweet = tweet;
|
||||||
if (source != null)
|
if (source != null)
|
||||||
this.source = source;
|
this.source = source;
|
||||||
if (replyName != null)
|
if (replyName != null) {
|
||||||
this.replyName = replyName;
|
this.replyName = replyName;
|
||||||
|
this.userMentions = replyName;
|
||||||
|
}
|
||||||
if (place != null)
|
if (place != null)
|
||||||
this.locationName = place;
|
this.locationName = place;
|
||||||
if (geo != null)
|
if (geo != null)
|
||||||
|
@ -266,6 +270,15 @@ public class Tweet implements Serializable {
|
||||||
return medias;
|
return medias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get user names mentioned in this tweet
|
||||||
|
*
|
||||||
|
* @return string of screen names
|
||||||
|
*/
|
||||||
|
public String getMentionedUsers() {
|
||||||
|
return userMentions;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check tweet media type
|
* check tweet media type
|
||||||
*
|
*
|
||||||
|
@ -388,6 +401,16 @@ public class Tweet implements Serializable {
|
||||||
if (start > 0 && end > start)
|
if (start > 0 && end > start)
|
||||||
source = source.substring(start, end);
|
source = source.substring(start, end);
|
||||||
}
|
}
|
||||||
|
UserMentionEntity[] mentionedUsers = status.getUserMentionEntities();
|
||||||
|
if (mentionedUsers != null && mentionedUsers.length > 0) {
|
||||||
|
StringBuilder userMentions = new StringBuilder(user.getScreenname());
|
||||||
|
for (UserMentionEntity mention : mentionedUsers) {
|
||||||
|
userMentions.append(" @").append(mention.getScreenName());
|
||||||
|
}
|
||||||
|
this.userMentions = userMentions.toString();
|
||||||
|
} else {
|
||||||
|
this.userMentions = user.getScreenname();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,18 @@
|
||||||
package org.nuclearfog.twidda.database;
|
package org.nuclearfog.twidda.database;
|
||||||
|
|
||||||
|
import static android.database.sqlite.SQLiteDatabase.CONFLICT_IGNORE;
|
||||||
|
import static android.database.sqlite.SQLiteDatabase.CONFLICT_REPLACE;
|
||||||
|
import static org.nuclearfog.twidda.backend.model.Tweet.MediaType.GIF;
|
||||||
|
import static org.nuclearfog.twidda.backend.model.Tweet.MediaType.IMAGE;
|
||||||
|
import static org.nuclearfog.twidda.backend.model.Tweet.MediaType.VIDEO;
|
||||||
|
import static org.nuclearfog.twidda.database.DatabaseAdapter.FavoriteTable;
|
||||||
|
import static org.nuclearfog.twidda.database.DatabaseAdapter.MessageTable;
|
||||||
|
import static org.nuclearfog.twidda.database.DatabaseAdapter.TrendTable;
|
||||||
|
import static org.nuclearfog.twidda.database.DatabaseAdapter.TweetRegisterTable;
|
||||||
|
import static org.nuclearfog.twidda.database.DatabaseAdapter.TweetTable;
|
||||||
|
import static org.nuclearfog.twidda.database.DatabaseAdapter.UserRegisterTable;
|
||||||
|
import static org.nuclearfog.twidda.database.DatabaseAdapter.UserTable;
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
@ -17,19 +30,6 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static android.database.sqlite.SQLiteDatabase.CONFLICT_IGNORE;
|
|
||||||
import static android.database.sqlite.SQLiteDatabase.CONFLICT_REPLACE;
|
|
||||||
import static org.nuclearfog.twidda.backend.model.Tweet.MediaType.GIF;
|
|
||||||
import static org.nuclearfog.twidda.backend.model.Tweet.MediaType.IMAGE;
|
|
||||||
import static org.nuclearfog.twidda.backend.model.Tweet.MediaType.VIDEO;
|
|
||||||
import static org.nuclearfog.twidda.database.DatabaseAdapter.FavoriteTable;
|
|
||||||
import static org.nuclearfog.twidda.database.DatabaseAdapter.MessageTable;
|
|
||||||
import static org.nuclearfog.twidda.database.DatabaseAdapter.TrendTable;
|
|
||||||
import static org.nuclearfog.twidda.database.DatabaseAdapter.TweetRegisterTable;
|
|
||||||
import static org.nuclearfog.twidda.database.DatabaseAdapter.TweetTable;
|
|
||||||
import static org.nuclearfog.twidda.database.DatabaseAdapter.UserRegisterTable;
|
|
||||||
import static org.nuclearfog.twidda.database.DatabaseAdapter.UserTable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SQLite database class to store and load tweets, messages, trends and user information
|
* SQLite database class to store and load tweets, messages, trends and user information
|
||||||
*
|
*
|
||||||
|
@ -622,7 +622,7 @@ public class AppDatabase {
|
||||||
int idxReceiver = cursor.getColumnIndexOrThrow(MessageTable.RECEIVER);
|
int idxReceiver = cursor.getColumnIndexOrThrow(MessageTable.RECEIVER);
|
||||||
int idxMessage = cursor.getColumnIndexOrThrow(MessageTable.MESSAGE);
|
int idxMessage = cursor.getColumnIndexOrThrow(MessageTable.MESSAGE);
|
||||||
int idxTime = cursor.getColumnIndexOrThrow(MessageTable.SINCE);
|
int idxTime = cursor.getColumnIndexOrThrow(MessageTable.SINCE);
|
||||||
int idxId = cursor.getColumnIndexOrThrow(MessageTable.SINCE);
|
int idxId = cursor.getColumnIndexOrThrow(MessageTable.ID);
|
||||||
do {
|
do {
|
||||||
// fetch message information
|
// fetch message information
|
||||||
long senderID = cursor.getLong(idxSender);
|
long senderID = cursor.getLong(idxSender);
|
||||||
|
|
Loading…
Reference in New Issue