use of com.klinker.android.twitter.utils.api_helper.TwitLongerHelper in project Talon-for-Twitter by klinker24.
the class SendTweet method sendTweet.
public boolean sendTweet(AppSettings settings, Context context) {
try {
Twitter twitter = getTwitter();
if (remainingChars < 0 && !pwiccer) {
// twitlonger goes here
TwitLongerHelper helper = new TwitLongerHelper(message, twitter);
helper.setInReplyToStatusId(tweetId);
return helper.createPost() != 0;
} else {
twitter4j.StatusUpdate reply = new twitter4j.StatusUpdate(message);
reply.setInReplyToStatusId(tweetId);
if (!attachedUri.equals("")) {
// context being the Activity pointer
File outputDir = context.getCacheDir();
File f = File.createTempFile("compose", "picture", outputDir);
Bitmap bitmap = getBitmapToSend(Uri.parse(attachedUri), context);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bos);
byte[] bitmapdata = bos.toByteArray();
FileOutputStream fos = new FileOutputStream(f);
fos.write(bitmapdata);
fos.flush();
fos.close();
if (!settings.twitpic) {
reply.setMedia(f);
twitter.updateStatus(reply);
return true;
} else {
TwitPicHelper helper = new TwitPicHelper(twitter, message, f, context);
helper.setInReplyToStatusId(tweetId);
return helper.createPost() != 0;
}
} else {
// no picture
twitter.updateStatus(reply);
return true;
}
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
use of com.klinker.android.twitter.utils.api_helper.TwitLongerHelper in project Talon-for-Twitter by klinker24.
the class SendScheduledTweet method sendTweet.
public boolean sendTweet(AppSettings settings, Context context, String message, int account) {
try {
Twitter twitter;
if (account == settings.currentAccount) {
twitter = Utils.getTwitter(context, settings);
} else {
twitter = Utils.getSecondTwitter(context);
}
int size = getCount(message);
Log.v("talon_queued", "sending: " + message);
if (size > AppSettings.getInstance(this).tweetCharacterCount && settings.twitlonger) {
// twitlonger goes here
TwitLongerHelper helper = new TwitLongerHelper(message, twitter);
return helper.createPost() != 0;
} else if (size <= AppSettings.getInstance(this).tweetCharacterCount) {
twitter4j.StatusUpdate reply = new twitter4j.StatusUpdate(message);
twitter.updateStatus(reply);
} else {
return false;
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
use of com.klinker.android.twitter.utils.api_helper.TwitLongerHelper in project Talon-for-Twitter by klinker24.
the class SendQueue method sendTweet.
public boolean sendTweet(AppSettings settings, Context context, String message) {
try {
Twitter twitter = Utils.getTwitter(context, settings);
int size = getCount(message);
Log.v("talon_queued", "sending: " + message);
if (size > AppSettings.getInstance(this).tweetCharacterCount && settings.twitlonger) {
// twitlonger goes here
TwitLongerHelper helper = new TwitLongerHelper(message, twitter);
return helper.createPost() != 0;
} else if (size <= AppSettings.getInstance(this).tweetCharacterCount) {
twitter4j.StatusUpdate reply = new twitter4j.StatusUpdate(message);
twitter.updateStatus(reply);
} else {
return false;
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
Aggregations