From fe2ad0690af52cd6bcf0a1c866fc88be40771c79 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Thu, 19 Dec 2013 06:38:13 +0000 Subject: [PATCH 01/37] Update develop to 1.4.0 --- android/client/AndroidManifest.xml | 4 ++-- android/clientbeta/AndroidManifest.xml | 4 ++-- android/libraries/TweetLanesCore/res/xml/changelog.xml | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/android/client/AndroidManifest.xml b/android/client/AndroidManifest.xml index 2e1193ca..46ad52e4 100644 --- a/android/client/AndroidManifest.xml +++ b/android/client/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="56" + android:versionName="1.4.0"> diff --git a/android/clientbeta/AndroidManifest.xml b/android/clientbeta/AndroidManifest.xml index 9eb2e286..3136cdc2 100644 --- a/android/clientbeta/AndroidManifest.xml +++ b/android/clientbeta/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="56" + android:versionName="1.4.0_b1"> diff --git a/android/libraries/TweetLanesCore/res/xml/changelog.xml b/android/libraries/TweetLanesCore/res/xml/changelog.xml index 7c6b14b7..6a35f119 100644 --- a/android/libraries/TweetLanesCore/res/xml/changelog.xml +++ b/android/libraries/TweetLanesCore/res/xml/changelog.xml @@ -1,5 +1,8 @@ + + + Feature - Added account remover in settings Feature - Mention & DM notification status load into timeline without second refresh From eac2c7445a9a16c4ba8769ddad33d4ec934af13d Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sat, 21 Dec 2013 10:29:12 +0000 Subject: [PATCH 02/37] Fix issue #379 where text for autolink is null. --- .../org/tweetalib/android/model/TwitterDirectMessage.java | 8 ++++++-- .../android/core/view/DirectMessageFeedFragment.java | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/android/libraries/SocialNetLib/src/org/tweetalib/android/model/TwitterDirectMessage.java b/android/libraries/SocialNetLib/src/org/tweetalib/android/model/TwitterDirectMessage.java index 5aec3387..5c446b26 100644 --- a/android/libraries/SocialNetLib/src/org/tweetalib/android/model/TwitterDirectMessage.java +++ b/android/libraries/SocialNetLib/src/org/tweetalib/android/model/TwitterDirectMessage.java @@ -81,10 +81,14 @@ public TwitterDirectMessage(String jsonAsString) { if (object.has(KEY_STATUS_MARKUP)) { mStatusFullMarkup = object.getString(KEY_STATUS_MARKUP); - } else { + } else if(mText != null) { mStatusFullMarkup = TwitterUtil.getStatusMarkup(mText, new MediaEntity[0], new URLEntity[0]); } - mTextSpanned = URLSpanNoUnderline.stripUnderlines(Html.fromHtml(mStatusFullMarkup.replace("\n", "
") + " ")); + + if(mStatusFullMarkup!= null) + { + mTextSpanned = URLSpanNoUnderline.stripUnderlines(Html.fromHtml(mStatusFullMarkup.replace("\n", "
") + " ")); + } if (object.has(KEY_CREATED_AT)) { long createdAt = object.getLong(KEY_CREATED_AT); diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/DirectMessageFeedFragment.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/DirectMessageFeedFragment.java index 0eb78a89..126f2b27 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/DirectMessageFeedFragment.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/DirectMessageFeedFragment.java @@ -288,7 +288,10 @@ boolean addCachedStatusesFromString(String statusesAsString) throws JSONExceptio for (int i = 0; i < jsonArray.length(); i++) { String statusString = jsonArray.getString(i); TwitterDirectMessage status = new TwitterDirectMessage(statusString); - mDirectMessagesCache.add(status); + if(status.getText() != null) + { + mDirectMessagesCache.add(status); + } } setDirectMessages(mDirectMessagesCache, false); From 013debe97f4649b4b23d37f93026fe62d5cee64b Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sat, 21 Dec 2013 10:31:45 +0000 Subject: [PATCH 03/37] Fix for #380 handle activity being null. --- .../android/core/view/TweetFeedFragment.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java index ae552467..f9e3e8db 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java @@ -20,6 +20,7 @@ import android.content.res.Configuration; import android.os.Bundle; import android.os.Handler; +import android.support.v4.app.FragmentActivity; import android.support.v4.content.LocalBroadcastManager; import android.util.Log; import android.view.ActionMode; @@ -1251,11 +1252,15 @@ private void onTweetFeedItemSingleTap(View view, int position) { if (mSelectedItems.size() == 0) { TweetFeedItemView tweetFeedItemView = (TweetFeedItemView) (view); TwitterStatus status = tweetFeedItemView.getTwitterStatus(); - Intent tweetSpotlightIntent = new Intent(getActivity(), TweetSpotlightActivity.class); - tweetSpotlightIntent.putExtra("statusId", Long.toString(status.mId)); - tweetSpotlightIntent.putExtra("status", status.toString()); - tweetSpotlightIntent.putExtra("clearCompose", "true"); - getActivity().startActivityForResult(tweetSpotlightIntent, Constant.REQUEST_CODE_SPOTLIGHT); + FragmentActivity activity = getActivity(); + if(activity!= null) + { + Intent tweetSpotlightIntent = new Intent(activity, TweetSpotlightActivity.class); + tweetSpotlightIntent.putExtra("statusId", Long.toString(status.mId)); + tweetSpotlightIntent.putExtra("status", status.toString()); + tweetSpotlightIntent.putExtra("clearCompose", "true"); + activity.startActivityForResult(tweetSpotlightIntent, Constant.REQUEST_CODE_SPOTLIGHT); + } } else { onTweetFeedItemLongPress(view, position); } From ff1b381989139811604a8a82c63f9afec29e4d12 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sat, 21 Dec 2013 10:39:00 +0000 Subject: [PATCH 04/37] Fix for #382 handle an out of memory being caught --- .../src/org/tweetalib/android/TwitterFetchUsers.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/android/libraries/SocialNetLib/src/org/tweetalib/android/TwitterFetchUsers.java b/android/libraries/SocialNetLib/src/org/tweetalib/android/TwitterFetchUsers.java index 742b76f2..79528e0c 100644 --- a/android/libraries/SocialNetLib/src/org/tweetalib/android/TwitterFetchUsers.java +++ b/android/libraries/SocialNetLib/src/org/tweetalib/android/TwitterFetchUsers.java @@ -771,6 +771,10 @@ protected FetchUsersTaskOutput doInBackground( errorDescription += "\nTry again in " + e.getRateLimitStatus().getSecondsUntilReset() + " " + "seconds"; } + } catch (OutOfMemoryError e) { + e.printStackTrace(); + errorDescription = e.getMessage(); + Log.e("api-call", errorDescription, e); } if (users != null && twitterUsers == null) { From dd742ab476baadfcf0681352045ced28f7e2bd66 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sat, 21 Dec 2013 10:42:22 +0000 Subject: [PATCH 05/37] Fix for 383 handle type being null --- .../src/com/tweetlanes/android/core/view/HomeActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/HomeActivity.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/HomeActivity.java index b42636ac..d75d7a73 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/HomeActivity.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/HomeActivity.java @@ -250,9 +250,9 @@ void onCreateHandleIntents() { if(extras != null) { - if (intent.getAction() == Intent.ACTION_SEND) { + String type = intent.getType(); + if (intent.getAction() == Intent.ACTION_SEND && type != null) { - String type = intent.getType(); if (type.equals("text/plain") && extras.containsKey(Intent.EXTRA_TEXT)) { String shareString = extras.getString(Intent.EXTRA_TEXT); From 27cbb8d48e3dff70f2925a4773ca79a292bb150e Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sat, 21 Dec 2013 10:56:42 +0000 Subject: [PATCH 06/37] Fix for #376 --- android/libraries/TweetLanesCore/res/xml/changelog.xml | 3 ++- .../tweetlanes/android/core/view/ComposeBaseFragment.java | 6 ++---- .../tweetlanes/android/core/view/ComposeTweetFragment.java | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/android/libraries/TweetLanesCore/res/xml/changelog.xml b/android/libraries/TweetLanesCore/res/xml/changelog.xml index 6a35f119..d105e8d3 100644 --- a/android/libraries/TweetLanesCore/res/xml/changelog.xml +++ b/android/libraries/TweetLanesCore/res/xml/changelog.xml @@ -1,7 +1,8 @@ - + Fix - Update remaining characters as soon as media attached + Fix - Various errors reported by fatal crashes Feature - Added account remover in settings diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeBaseFragment.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeBaseFragment.java index 483d0e43..0e79fe5c 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeBaseFragment.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeBaseFragment.java @@ -786,10 +786,8 @@ void configureCharacterCountForString(String string) { int length = mStatusValidator.getTweetLength(string); if (length > 0) { int remaining = getMaxPostLength() - length; - if (_mComposeDefault != null - && _mComposeDefault.getMediaFilePath() != null) { - int SHORT_URL_LENGTH_HTTPS = 23; - remaining -= SHORT_URL_LENGTH_HTTPS - 1; + if (_mComposeDefault != null && _mComposeDefault.getMediaFilePath() != null) { + remaining -= 22; } mCharacterCountTextView.setText("" + remaining); diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeTweetFragment.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeTweetFragment.java index a286de08..94860549 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeTweetFragment.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeTweetFragment.java @@ -399,6 +399,7 @@ void setMediaFilePath(String filePath) { } setMediaPreviewVisibility(); + updateStatusHint(); } /* @@ -407,8 +408,7 @@ void setMediaFilePath(String filePath) { public void setMediaPreviewVisibility() { mAttachImagePreview.setVisibility(View.GONE); - if (_mComposeDefault != null - && _mComposeDefault.getMediaFilePath() != null) { + if (_mComposeDefault != null && _mComposeDefault.getMediaFilePath() != null) { File imgFile = new File(_mComposeDefault.getMediaFilePath()); if (imgFile.exists()) { try { From d15d9948db411ea19fa511203b9da3ba60b4c9f1 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sat, 21 Dec 2013 10:58:19 +0000 Subject: [PATCH 07/37] Fix for #374 - VolScroll defaulted to off --- android/libraries/TweetLanesCore/res/xml/changelog.xml | 1 + .../src/com/tweetlanes/android/core/AppSettings.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/android/libraries/TweetLanesCore/res/xml/changelog.xml b/android/libraries/TweetLanesCore/res/xml/changelog.xml index d105e8d3..9821dd54 100644 --- a/android/libraries/TweetLanesCore/res/xml/changelog.xml +++ b/android/libraries/TweetLanesCore/res/xml/changelog.xml @@ -1,6 +1,7 @@ + Fix - Set VolScroll to be defaulted off Fix - Update remaining characters as soon as media attached Fix - Various errors reported by fatal crashes diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/AppSettings.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/AppSettings.java index 7205c2a5..b59c00de 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/AppSettings.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/AppSettings.java @@ -22,7 +22,7 @@ public class AppSettings { public static final boolean DEFAULT_DOWNLOAD_IMAGES = true; - public static final boolean DEFAULT_VOLSCROLL = true; + public static final boolean DEFAULT_VOLSCROLL = false; public static final boolean DEFAULT_AUTO_REFRESH = false; public static final boolean DEFAULT_SHOW_TABLET_MARGIN = true; public static final boolean DEFAULT_SHOW_TWEET_SOURCE = false; From eafb071f379ca43a150f785a9aa511ce482a7305 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sat, 21 Dec 2013 11:28:47 +0000 Subject: [PATCH 08/37] Fix for #371 change to add option to use display URLs rather than full URLs (default to full) --- .../src/com/twitter/Autolink.java | 12 +++++----- .../org/tweetalib/android/TwitterUtil.java | 24 ++++++++++++++----- .../TweetLanesCore/res/values-ru/strings.xml | 4 ++++ .../TweetLanesCore/res/values/strings.xml | 4 ++++ .../TweetLanesCore/res/xml/preferences.xml | 5 ++++ .../tweetlanes/android/core/AppSettings.java | 18 +++++++++++++- .../android/core/view/BaseLaneActivity.java | 3 +++ .../android/core/view/SettingsActivity.java | 9 +++++++ 8 files changed, 66 insertions(+), 13 deletions(-) diff --git a/android/libraries/SocialNetLib/src/com/twitter/Autolink.java b/android/libraries/SocialNetLib/src/com/twitter/Autolink.java index 1e137336..815a6c73 100644 --- a/android/libraries/SocialNetLib/src/com/twitter/Autolink.java +++ b/android/libraries/SocialNetLib/src/com/twitter/Autolink.java @@ -166,11 +166,11 @@ void linkToMentionAndList(Entity entity, String text, } void linkToURL(Entity entity, String text, StringBuilder builder, - URLEntity urlEntity) { + URLEntity urlEntity, boolean showFullUrl) { CharSequence url = entity.getValue(); String linkText = escapeHTML(url).toString(); - if (urlEntity != null && urlEntity.getExpandedURL() != null) { + if (urlEntity != null && urlEntity.getExpandedURL() != null && showFullUrl) { linkText = urlEntity.getExpandedURL(); } else if (urlEntity != null && urlEntity.getDisplayURL() != null) { linkText = urlEntity.getDisplayURL(); @@ -194,7 +194,7 @@ void linkToURL(Entity entity, String text, StringBuilder builder, } String autoLinkEntities(String text, List entities, - MediaEntity[] mediaEntities, URLEntity[] urlEntities) { + MediaEntity[] mediaEntities, URLEntity[] urlEntities, boolean showFullUrl) { StringBuilder builder = new StringBuilder(text.length() * 2); int beginIndex = 0; @@ -225,7 +225,7 @@ String autoLinkEntities(String text, List entities, } } - linkToURL(entity, text, builder, urlEntity); + linkToURL(entity, text, builder, urlEntity, showFullUrl); break; case HASHTAG: linkToHashtag(entity, text, builder); @@ -245,12 +245,12 @@ String autoLinkEntities(String text, List entities, } public String autoLinkAll(String text, MediaEntity[] mediaEntities, - URLEntity[] urlEntities) { + URLEntity[] urlEntities, boolean showFullUrl) { text = escapeBrackets(text); // extract entities List entities = extractor.extractEntitiesWithIndices(text); return autoLinkEntities(text, entities, - mediaEntities, urlEntities); + mediaEntities, urlEntities, showFullUrl); } } diff --git a/android/libraries/SocialNetLib/src/org/tweetalib/android/TwitterUtil.java b/android/libraries/SocialNetLib/src/org/tweetalib/android/TwitterUtil.java index 5a441a81..719b30e6 100644 --- a/android/libraries/SocialNetLib/src/org/tweetalib/android/TwitterUtil.java +++ b/android/libraries/SocialNetLib/src/org/tweetalib/android/TwitterUtil.java @@ -35,6 +35,7 @@ public class TwitterUtil { private static Autolink mAutoLink; + private static boolean showFullUrl = true; private static boolean mAllowReInit = true; private static void initCommon() { @@ -48,6 +49,11 @@ private static void initCommon() { } } + public static void setShowFullUrl(boolean newValue) + { + showFullUrl = newValue; + } + /* * */ @@ -57,7 +63,7 @@ public static String stripMarkup(String text) { } public static String getTextMarkup(String text, URLEntity[] urlEntities) { - return getStatusMarkup(text, null, urlEntities); + return getStatusMarkup(text, null, urlEntities, showFullUrl); } /* @@ -65,7 +71,7 @@ public static String getTextMarkup(String text, URLEntity[] urlEntities) { * visible links */ public static String getStatusMarkup(Status status) { - return getStatusMarkup(status.getText(), status.getMediaEntities(), status.getURLEntities()); + return getStatusMarkup(status.getText(), status.getMediaEntities(), status.getURLEntities(), showFullUrl); } /* @@ -77,21 +83,27 @@ public static String getStatusMarkup(AdnPost post) { mAutoLink.setExtractURLWithoutProtocol(true); mAllowReInit = false; - String statusMarkup = getStatusMarkup(post.mText, null, post.mUrls); + String statusMarkup = getStatusMarkup(post.mText, null, post.mUrls, showFullUrl); mAllowReInit = true; return statusMarkup; } + public static String getStatusMarkup(String statusText, MediaEntity[] mediaEntities, + URLEntity[] urlEntities) { + + return getStatusMarkup(statusText, mediaEntities, urlEntities, showFullUrl); + } + /* * */ - public static String getStatusMarkup(String statusText, MediaEntity[] mediaEntities, - URLEntity[] urlEntities) { + private static String getStatusMarkup(String statusText, MediaEntity[] mediaEntities, + URLEntity[] urlEntities, boolean showFullUrl) { initCommon(); - return mAutoLink.autoLinkAll(statusText, mediaEntities, urlEntities); + return mAutoLink.autoLinkAll(statusText, mediaEntities, urlEntities, showFullUrl); } /* diff --git a/android/libraries/TweetLanesCore/res/values-ru/strings.xml b/android/libraries/TweetLanesCore/res/values-ru/strings.xml index 41f6d877..07de589b 100644 --- a/android/libraries/TweetLanesCore/res/values-ru/strings.xml +++ b/android/libraries/TweetLanesCore/res/values-ru/strings.xml @@ -503,6 +503,10 @@ Отображение приложения, из которого было отправлено сообщение. + Показать URL + Показать полный адрес в твитов, а не отделан "..." + + Загрузка изображения Предворительный просмотр изображения diff --git a/android/libraries/TweetLanesCore/res/values/strings.xml b/android/libraries/TweetLanesCore/res/values/strings.xml index 2aca7617..ad5d2dbd 100644 --- a/android/libraries/TweetLanesCore/res/values/strings.xml +++ b/android/libraries/TweetLanesCore/res/values/strings.xml @@ -527,6 +527,10 @@ from + Display URL + Show the full URL in tweets rather than trimmed with "..." + + Image loading Image preview diff --git a/android/libraries/TweetLanesCore/res/xml/preferences.xml b/android/libraries/TweetLanesCore/res/xml/preferences.xml index 8227419a..da793ccf 100644 --- a/android/libraries/TweetLanesCore/res/xml/preferences.xml +++ b/android/libraries/TweetLanesCore/res/xml/preferences.xml @@ -67,6 +67,11 @@ android:title="@string/title_showtweetsource_preference" android:summary="@string/summary_showtweetsource_preference"/> + + Date: Sat, 21 Dec 2013 12:46:14 +0000 Subject: [PATCH 09/37] Updated changelog for #371 change --- android/libraries/TweetLanesCore/res/xml/changelog.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/android/libraries/TweetLanesCore/res/xml/changelog.xml b/android/libraries/TweetLanesCore/res/xml/changelog.xml index 9821dd54..081da6d8 100644 --- a/android/libraries/TweetLanesCore/res/xml/changelog.xml +++ b/android/libraries/TweetLanesCore/res/xml/changelog.xml @@ -1,6 +1,7 @@ + Feature - Added option to use display urls rather than full URLs Fix - Set VolScroll to be defaulted off Fix - Update remaining characters as soon as media attached Fix - Various errors reported by fatal crashes From 59f5c858c2772626ea7d5ccfe5b9287d48bf12f7 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sun, 22 Dec 2013 12:05:54 +0000 Subject: [PATCH 10/37] Fix for #239 added auto complete mid status --- .../TweetLanesCore/res/xml/changelog.xml | 1 + .../core/view/ComposeBaseFragment.java | 38 ++++++++++++------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/android/libraries/TweetLanesCore/res/xml/changelog.xml b/android/libraries/TweetLanesCore/res/xml/changelog.xml index 081da6d8..cf425ae0 100644 --- a/android/libraries/TweetLanesCore/res/xml/changelog.xml +++ b/android/libraries/TweetLanesCore/res/xml/changelog.xml @@ -2,6 +2,7 @@ Feature - Added option to use display urls rather than full URLs + Feature - Added auto complete mid status rather than needing to be the last word in compose box Fix - Set VolScroll to be defaulted off Fix - Update remaining characters as soon as media attached Fix - Various errors reported by fatal crashes diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeBaseFragment.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeBaseFragment.java index 0e79fe5c..22c7ba7b 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeBaseFragment.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeBaseFragment.java @@ -199,7 +199,7 @@ && getActivity().getApplicationContext() != null) { } /* - * + * */ void showSimpleAlert(int stringID) { AlertDialog alertDialog = new AlertDialog.Builder(getActivity()) @@ -215,21 +215,21 @@ public void onClick(DialogInterface dialog, int which) { } /* - * + * */ public boolean hasFocus() { return mHasFocus; } /* - * + * */ void setComposeTweetListener(ComposeListener listener) { mListener = listener; } /* - * + * */ public void releaseFocus(boolean saveCurrentTweet) { @@ -336,12 +336,23 @@ void autoComplete(String text, EditText editText) { return; } - int spaceIndex = text.lastIndexOf(" "); - int dotIndex = text.lastIndexOf("."); + int currentStart = editText.getSelectionStart(); + int currentEnd = editText.getSelectionEnd(); + int currentPosition = text.length() - 1; + if (currentStart == currentEnd) { + currentPosition = currentStart; + } + if (currentPosition < 0) currentPosition = 0; - int index = Math.max(spaceIndex, dotIndex); + String lastWholeWord = ""; - String lastWholeWord = text.substring(index + 1).toLowerCase(); + for (int i = currentPosition; i > 0; i--) { + String nextChar = text.substring(i-1,i).toLowerCase(); + if (nextChar.equals(" ") || nextChar.equals(".")) { + break; + } + lastWholeWord = nextChar + lastWholeWord; + } if (lastWholeWord.startsWith("@")) { List autoCompleteMentions = getAutoCompleteMentions(lastWholeWord); @@ -585,6 +596,7 @@ public int compare(Object o1, Object o2) { String s2 = (String) o2; return s1.toLowerCase().compareTo(s2.toLowerCase()); } + } protected void lockScreenRotation() { @@ -607,8 +619,8 @@ protected void resetScreenRotation() { } /* - * - */ + * + */ private final OnClickListener mOnSendTweetClickListener = new OnClickListener() { @Override @@ -632,7 +644,7 @@ public void onClick(View v) { protected abstract void setMediaPreviewVisibility(); /* - */ + */ private final EditClearTextListener mEditClearTextListener = new EditClearTextListener() { @Override @@ -749,8 +761,8 @@ static String getStatusHintSnippet(String status, int maxLength) { } /* - * - */ + * + */ ComposeTweetDefault _mComposeDefault; ComposeTweetDefault getComposeTweetDefault() { From 5762d40c3e6a4e7eda61178ec8252052aa2ec921 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sun, 22 Dec 2013 13:19:00 +0000 Subject: [PATCH 11/37] Fix for #312 & #6 Larger and no inline image previews --- .../res/layout/tweet_feed_item_received.xml | 43 ++++++++++++--- .../TweetLanesCore/res/values-ru/arrays.xml | 12 +++++ .../TweetLanesCore/res/values-ru/strings.xml | 7 ++- .../TweetLanesCore/res/values/arrays.xml | 12 +++++ .../TweetLanesCore/res/values/dimens.xml | 1 + .../TweetLanesCore/res/values/strings.xml | 3 ++ .../TweetLanesCore/res/xml/preferences.xml | 9 ++++ .../tweetlanes/android/core/AppSettings.java | 38 +++++++++++++ .../android/core/view/SettingsActivity.java | 10 ++++ .../android/core/view/TweetFeedItemView.java | 53 ++++++++++++++++--- 10 files changed, 171 insertions(+), 17 deletions(-) diff --git a/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml b/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml index dfb320fd..7ebb1f99 100644 --- a/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml +++ b/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml @@ -122,6 +122,14 @@ android:adjustViewBounds="true" android:orientation="vertical"> + + + + + + + android:id="@+id/preview_image_view_large" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:scaleType="centerCrop" + /> - + + + Ручка только + + небольшой + большой + от + + + + Small + Large + Off + + Both Name diff --git a/android/libraries/TweetLanesCore/res/values-ru/strings.xml b/android/libraries/TweetLanesCore/res/values-ru/strings.xml index 07de589b..ab2075e0 100644 --- a/android/libraries/TweetLanesCore/res/values-ru/strings.xml +++ b/android/libraries/TweetLanesCore/res/values-ru/strings.xml @@ -430,8 +430,11 @@ Размер изображения профиля Размер изображения профиля - Дисплей Название Формат - Дисплей Название Формат + Дисплей Название Формат + Дисплей Название Формат + + Дисплей Размер Media + Дисплей Размер Media Формат отображения имени Формат отображения имени diff --git a/android/libraries/TweetLanesCore/res/values/arrays.xml b/android/libraries/TweetLanesCore/res/values/arrays.xml index 9235d810..db1c9f7d 100644 --- a/android/libraries/TweetLanesCore/res/values/arrays.xml +++ b/android/libraries/TweetLanesCore/res/values/arrays.xml @@ -36,6 +36,18 @@ Handle + + Small + Large + Off + + + + Small + Large + Off + + Holo Light Holo Light w/ Dark Bar diff --git a/android/libraries/TweetLanesCore/res/values/dimens.xml b/android/libraries/TweetLanesCore/res/values/dimens.xml index d213202b..48c92477 100644 --- a/android/libraries/TweetLanesCore/res/values/dimens.xml +++ b/android/libraries/TweetLanesCore/res/values/dimens.xml @@ -40,6 +40,7 @@ All Rights Reserved. --> 80dp 80dp + 140dp 0dp 0dp diff --git a/android/libraries/TweetLanesCore/res/values/strings.xml b/android/libraries/TweetLanesCore/res/values/strings.xml index ad5d2dbd..6eea40e8 100644 --- a/android/libraries/TweetLanesCore/res/values/strings.xml +++ b/android/libraries/TweetLanesCore/res/values/strings.xml @@ -453,6 +453,9 @@ Display Name Format Display Name Format + Display Media Size + Display Media Size + Name Display Format Name Display Format diff --git a/android/libraries/TweetLanesCore/res/xml/preferences.xml b/android/libraries/TweetLanesCore/res/xml/preferences.xml index da793ccf..1c8ad332 100644 --- a/android/libraries/TweetLanesCore/res/xml/preferences.xml +++ b/android/libraries/TweetLanesCore/res/xml/preferences.xml @@ -72,6 +72,15 @@ android:title="@string/title_displayurl_preference" android:summary="@string/summary_displayurl_preference"/> + + Date: Sun, 22 Dec 2013 13:19:59 +0000 Subject: [PATCH 12/37] Update change log --- android/libraries/TweetLanesCore/res/xml/changelog.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/android/libraries/TweetLanesCore/res/xml/changelog.xml b/android/libraries/TweetLanesCore/res/xml/changelog.xml index cf425ae0..cfbb2e2f 100644 --- a/android/libraries/TweetLanesCore/res/xml/changelog.xml +++ b/android/libraries/TweetLanesCore/res/xml/changelog.xml @@ -1,6 +1,7 @@ + Feature - Large media previews & option to turn off media previews Feature - Added option to use display urls rather than full URLs Feature - Added auto complete mid status rather than needing to be the last word in compose box Fix - Set VolScroll to be defaulted off From 022d890b50de22f3a94150261888db6d28353dde Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sun, 22 Dec 2013 13:31:41 +0000 Subject: [PATCH 13/37] Change layout as put conversation arrow in the wrong place --- .../res/layout/tweet_feed_item_received.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml b/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml index 7ebb1f99..a17f4f97 100644 --- a/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml +++ b/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml @@ -122,14 +122,6 @@ android:adjustViewBounds="true" android:orientation="vertical"> - - + + Date: Sun, 22 Dec 2013 13:36:04 +0000 Subject: [PATCH 14/37] Add padding to large image preview --- .../TweetLanesCore/res/layout/tweet_feed_item_received.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml b/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml index a17f4f97..4b9bcb4c 100644 --- a/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml +++ b/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml @@ -165,6 +165,7 @@ android:layout_width="fill_parent" android:layout_height="@dimen/image_preview_height_large" android:layout_gravity="center" + android:paddingLeft="@dimen/message_item_text_padding_left_right" xmlns:android="http://schemas.android.com/apk/res/android"> Date: Tue, 24 Dec 2013 07:18:49 +0000 Subject: [PATCH 15/37] Tweaks to large media display --- .../res/layout/tweet_feed_item_received.xml | 1 + .../src/com/tweetlanes/android/core/App.java | 12 ++++++++++-- .../android/core/view/TweetFeedFragment.java | 10 ++++++---- .../android/core/view/TweetFeedItemView.java | 8 ++++++-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml b/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml index 4b9bcb4c..82abae80 100644 --- a/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml +++ b/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_received.xml @@ -166,6 +166,7 @@ android:layout_height="@dimen/image_preview_height_large" android:layout_gravity="center" android:paddingLeft="@dimen/message_item_text_padding_left_right" + android:paddingRight="@dimen/message_item_text_padding_left_right" xmlns:android="http://schemas.android.com/apk/res/android"> 0) { - setStatusFeed(feed, true); - } + setStatusFeed(feed, true); mTweetFeedListView.onRefreshComplete(); mTweetFeedListAdapter.notifyDataSetChanged(); diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java index 9553c34b..ae10ba8a 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java @@ -449,8 +449,12 @@ void setPreviewImage(TwitterMediaEntity mediaEntity, AdnMedia adnMedia, Callback } String mediaUrl = adnMedia != null ? adnMedia.mUrl : mediaEntity.getMediaUrl(Size.LARGE); - String thumbUrl = mediaUrl; - if(!useLarge) + String thumbUrl; + if(useLarge) + { + thumbUrl = adnMedia != null ? adnMedia.mUrl : mediaEntity.getMediaUrl(Size.SMALL); + } + else { thumbUrl = adnMedia != null ? adnMedia.mThumbnailUrl : mediaEntity.getMediaUrl(Size.THUMB); } From dd663b381c73c1e3fb74e3ef2bd7b000e0d42ab3 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Tue, 24 Dec 2013 14:56:57 +0000 Subject: [PATCH 16/37] Add image width of 1024 when using large preview to prevent scaling too much and making images blured --- .../TweetLanesCore/src/com/tweetlanes/android/core/App.java | 1 + 1 file changed, 1 insertion(+) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/App.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/App.java index 15495da2..f52b3d48 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/App.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/App.java @@ -727,6 +727,7 @@ public LazyImageLoader getPreviewImageLoader() { if(mediaImageSize== AppSettings.MediaImageSize.Large){ preview_image_height = getResources() .getDimensionPixelSize(R.dimen.image_preview_height_large); + preview_image_width = 1024; } mPreviewImageLoader = new LazyImageLoader(this, From 1b3cc35d4e467476ce7f9bc2414c391440a38f6e Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Fri, 27 Dec 2013 09:10:13 +0000 Subject: [PATCH 17/37] Added option for no image scaling. Using this on media scaling so only scale by 2 on large media. Too much scaling seriously impacts look of images --- .../src/com/tweetlanes/android/core/App.java | 16 +++++---- .../android/core/util/LazyImageLoader.java | 33 ++++++++++--------- .../android/core/view/TweetFeedFragment.java | 3 +- .../android/core/view/TweetFeedItemView.java | 2 +- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/App.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/App.java index f52b3d48..ed15a8af 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/App.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/App.java @@ -362,7 +362,7 @@ public boolean getTutorialCompleted() { } /* - * + * */ public void saveUpdatedAccountDescriptor(AccountDescriptor account) { final Editor edit = mPreferences.edit(); @@ -719,20 +719,22 @@ public LazyImageLoader getPreviewImageLoader() { if (mPreviewImageLoader == null) { AppSettings.MediaImageSize mediaImageSize = AppSettings.get().getCurrentMediaImageSize(); + boolean noScale = false; + int preview_image_width = getResources() .getDimensionPixelSize(R.dimen.image_preview_width); int preview_image_height = getResources() .getDimensionPixelSize(R.dimen.image_preview_height); - if(mediaImageSize== AppSettings.MediaImageSize.Large){ - preview_image_height = getResources() - .getDimensionPixelSize(R.dimen.image_preview_height_large); - preview_image_width = 1024; + if (mediaImageSize == AppSettings.MediaImageSize.Large) { + preview_image_height = 0; + preview_image_width = 0; + noScale = true; } mPreviewImageLoader = new LazyImageLoader(this, Constant.DIR_NAME_CACHED_THUMBNAILS, R.drawable.white, - preview_image_width, preview_image_height, 30); + preview_image_width, preview_image_height, noScale, 30); } return mPreviewImageLoader; } @@ -747,7 +749,7 @@ public LazyImageLoader getProfileImageLoader() { mProfileImageLoader = new LazyImageLoader(this, Constant.DIR_NAME_PROFILE_IMAGES, R.drawable.ic_contact_picture, profile_image_size, - profile_image_size, 60); + profile_image_size, false, 60); } return mProfileImageLoader; } diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/util/LazyImageLoader.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/util/LazyImageLoader.java index 9012185b..96bf540d 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/util/LazyImageLoader.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/util/LazyImageLoader.java @@ -67,34 +67,32 @@ public class LazyImageLoader { private final MemoryCache mMemoryCache; - private final Context mContext; private final FileCache mFileCache; private final Map mImageViews = Collections .synchronizedMap(new WeakHashMap()); private final ExecutorService mExecutorService; private final int mFallbackRes; private final int mRequiredWidth, mRequiredHeight; + private final boolean mNoScale; + private final Context mContext; private Proxy mProxy; - // private final SharedPreferences mPreferences; - public LazyImageLoader(Context context, String cache_dir_name, int fallback_image_res, int required_width, int required_height, - int mem_cache_capacity) { + boolean noScale, int mem_cache_capacity) { mContext = context; + mMemoryCache = new MemoryCache(mem_cache_capacity); - mFileCache = new FileCache(context, cache_dir_name); + mFileCache = new FileCache(mContext, cache_dir_name); mExecutorService = Executors.newFixedThreadPool(5); mFallbackRes = fallback_image_res; mRequiredWidth = required_width % 2 == 0 ? required_width : required_width + 1; mRequiredHeight = required_height % 2 == 0 ? required_height : required_height + 1; - // mPreferences = mContext.getSharedPreferences(SHARED_PREFERENCES_NAME, - // Context.MODE_PRIVATE); - mProxy = Util.getProxy(context); - // mIgnoreSSLError = - // mPreferences.getBoolean(PREFERENCE_KEY_IGNORE_SSL_ERROR, false); + mNoScale = noScale; + mProxy = Util.getProxy(mContext); + } public void clearCache() { @@ -151,13 +149,16 @@ private Bitmap decodeFile(File f) { BitmapFactory.decodeStream(enter, null, options); // Find the correct scale value. It should be the power of 2. - int width_tmp = options.outWidth, height_tmp = options.outHeight; int scale = 1; - while (width_tmp / 2 >= mRequiredWidth - || height_tmp / 2 >= mRequiredHeight) { - width_tmp /= 2; - height_tmp /= 2; - scale *= 2; + if(!mNoScale) + { + int width_tmp = options.outWidth, height_tmp = options.outHeight; + while (width_tmp / 2 >= mRequiredWidth + || height_tmp / 2 >= mRequiredHeight) { + width_tmp /= 2; + height_tmp /= 2; + scale *= 2; + } } // decode with inSampleSize diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java index ec5a6867..c5365317 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java @@ -353,7 +353,7 @@ public void finished(TwitterFetchResult fetchResult, TwitterStatuses feed, fetchNewestTweets(sinceStatusId, feed.getNewStatusesMaxId()); } } else { - onRefreshFinished(feed); + onRefreshFinished(null); } } }; @@ -361,6 +361,7 @@ public void finished(TwitterFetchResult fetchResult, TwitterStatuses feed, if (mLastTwitterStatusIdSeen == null || mLastTwitterStatusIdSeen == 0) { showToast(getString(R.string.pottential_lost_position)); onRefreshFinished(null); + } mTimesFetchCalled++; diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java index ae10ba8a..5d5291bb 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java @@ -452,7 +452,7 @@ void setPreviewImage(TwitterMediaEntity mediaEntity, AdnMedia adnMedia, Callback String thumbUrl; if(useLarge) { - thumbUrl = adnMedia != null ? adnMedia.mUrl : mediaEntity.getMediaUrl(Size.SMALL); + thumbUrl = adnMedia != null ? adnMedia.mUrl : mediaEntity.getMediaUrl(Size.MEDIUM); } else { From 4c423908dfd185efbc59e50dc9bffdc127744deb Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sun, 5 Jan 2014 11:12:37 +0000 Subject: [PATCH 18/37] Fix for #386. Changes to re-make the spotlight image preview show. --- .../res/layout/tweet_feed_item_spotlight.xml | 10 +- .../android/core/view/TweetFeedItemView.java | 104 +++++++----------- .../core/view/TweetSpotlightFragment.java | 2 +- 3 files changed, 48 insertions(+), 68 deletions(-) diff --git a/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_spotlight.xml b/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_spotlight.xml index a907147c..7ebce716 100644 --- a/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_spotlight.xml +++ b/android/libraries/TweetLanesCore/res/layout/tweet_feed_item_spotlight.xml @@ -134,28 +134,28 @@ android:text="Retweeted by @WayneRooney"/> - + diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java index 5d5291bb..3d869ac8 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java @@ -17,7 +17,6 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; -import android.graphics.drawable.Drawable; import android.net.Uri; import android.text.Layout; import android.text.Spanned; @@ -41,8 +40,6 @@ import com.tweetlanes.android.core.R; import com.tweetlanes.android.core.util.LazyImageLoader; import com.tweetlanes.android.core.util.Util; -import com.tweetlanes.android.core.widget.urlimageviewhelper.UrlImageViewCallback; -import com.tweetlanes.android.core.widget.urlimageviewhelper.UrlImageViewHelper; import org.appdotnet4j.model.AdnMedia; import org.socialnetlib.android.SocialNetConstant; @@ -122,7 +119,7 @@ void init(Context context) { /* * */ - public void configure(TwitterStatus twitterStatus, int position, Callbacks callbacks, boolean loadsTweetSpotlight, + public void configure(TwitterStatus twitterStatus, int position, Callbacks callbacks, boolean tweetFeedItem, boolean showRetweetCount, boolean showConversationView, boolean isConversationItem, boolean resize, final SocialNetConstant.Type socialNetType, final String currentAccountKey) { @@ -390,7 +387,7 @@ public void onClick(View v) { authorNameTextView.setOnTouchListener(mOnTouchListener); } - setPreviewImage(twitterStatus.mMediaEntity, twitterStatus.mAdnMedia, callbacks); + setPreviewImage(twitterStatus.mMediaEntity, twitterStatus.mAdnMedia, callbacks, tweetFeedItem); } /* @@ -408,54 +405,42 @@ void insertConversationView() { /* * */ - void setPreviewImage(TwitterMediaEntity mediaEntity, AdnMedia adnMedia, Callbacks callbacks) { + void setPreviewImage(TwitterMediaEntity mediaEntity, AdnMedia adnMedia, Callbacks callbacks, boolean tweetFeedItem) { if (mHolder != null) { - RelativeLayout previewImageContainerSmall = mHolder.previewImageContainer; - RelativeLayout previewImageContainerLarge = mHolder.previewImageContainerLarge; + RelativeLayout previewImageContainer; + ImageView previewImageView; + ImageView previewPlayImageView; AppSettings.MediaImageSize mediaImageSize = AppSettings.get().getCurrentMediaImageSize(); - if ((mediaEntity == null && adnMedia == null) || !AppSettings.get().downloadFeedImages() || mediaImageSize == AppSettings.MediaImageSize.Off) { - if (previewImageContainerSmall != null) { - previewImageContainerSmall.setVisibility(View.GONE); - } - if (previewImageContainerLarge != null) { - previewImageContainerLarge.setVisibility(View.GONE); - } + if ((mediaEntity == null && adnMedia == null) || !AppSettings.get().downloadFeedImages()) { + return; + } else if (mediaImageSize == AppSettings.MediaImageSize.Off && tweetFeedItem) { return; } - RelativeLayout previewImageContainer; - ImageView previewImageView; - ImageView previewPlayImageView; - boolean useLarge = mediaImageSize == AppSettings.MediaImageSize.Large; - if(useLarge) - { - previewImageContainer = previewImageContainerLarge; - previewImageView = mHolder.previewImageViewLarge; - previewPlayImageView = mHolder.previewPlayImageViewLarge; - if (previewImageContainerSmall != null) { - previewImageContainerSmall.setVisibility(View.GONE); - } - } - else - { - previewImageContainer = previewImageContainerSmall; - previewImageView = mHolder.previewImageView; - previewPlayImageView = mHolder.previewPlayImageView; - if (previewImageContainerLarge != null) { - previewImageContainerLarge.setVisibility(View.GONE); + boolean useLarge = true; + if (tweetFeedItem) { + useLarge = mediaImageSize == AppSettings.MediaImageSize.Large; + if (useLarge) { + previewImageContainer = mHolder.previewImageContainerLarge; + previewImageView = mHolder.previewImageViewLarge; + previewPlayImageView = mHolder.previewPlayImageViewLarge; + } else { + previewImageContainer = mHolder.previewImageContainer; + previewImageView = mHolder.previewImageView; + previewPlayImageView = mHolder.previewPlayImageView; } + } else { + previewImageContainer = mHolder.previewImageContainerSpotlight; + previewImageView = mHolder.previewImageViewSpotlight; + previewPlayImageView = mHolder.previewPlayImageViewSpotlight; } - String mediaUrl = adnMedia != null ? adnMedia.mUrl : mediaEntity.getMediaUrl(Size.LARGE); String thumbUrl; - if(useLarge) - { + if (useLarge) { thumbUrl = adnMedia != null ? adnMedia.mUrl : mediaEntity.getMediaUrl(Size.MEDIUM); - } - else - { + } else { thumbUrl = adnMedia != null ? adnMedia.mThumbnailUrl : mediaEntity.getMediaUrl(Size.THUMB); } TwitterMediaEntity.Source source = adnMedia != null ? null : mediaEntity.getSource(); @@ -464,25 +449,9 @@ void setPreviewImage(TwitterMediaEntity mediaEntity, AdnMedia adnMedia, Callback final boolean isVideo = source == TwitterMediaEntity.Source.YOUTUBE; previewImageContainer.setVisibility(View.VISIBLE); - if (previewImageView == null) { - previewImageView = (ImageView) findViewById(R.id.preview_large_image_view); - UrlImageViewHelper.setUrlDrawable(previewImageView, mediaUrl, new UrlImageViewCallback() { - - @Override - public void onLoaded(ImageView imageView, Drawable loadedDrawable, String url, - boolean loadedFromCache) { - //Chris's code did nothing special in this case, yo I've left it like that for now. - if (loadedDrawable == null) { - } - - } - }); - - } else { - LazyImageLoader previewImageLoader = callbacks.getPreviewImageLoader(); - if (previewImageLoader != null) { - previewImageLoader.displayImage(thumbUrl, previewImageView); - } + LazyImageLoader previewImageLoader = callbacks.getPreviewImageLoader(); + if (previewImageLoader != null) { + previewImageLoader.displayImage(thumbUrl, previewImageView); } previewImageView.setVisibility(VISIBLE); @@ -600,7 +569,7 @@ public boolean onTouch(View v, MotionEvent event) { }; /* - * + * */ private final GestureDetector mGestureDetector = new GestureDetector( new GestureDetector.SimpleOnGestureListener() { @@ -630,7 +599,7 @@ public TwitterStatus getTwitterStatus() { } /* - * + * */ void onProfileImageClick() { Intent profileIntent = new Intent(mContext, ProfileActivity.class); @@ -754,6 +723,9 @@ private static class ViewHolder { public RelativeLayout previewImageContainerLarge; public ImageView previewImageViewLarge; public ImageView previewPlayImageViewLarge; + public RelativeLayout previewImageContainerSpotlight; + public ImageView previewImageViewSpotlight; + public ImageView previewPlayImageViewSpotlight; public ViewHolder(View v) { avatar = (QuickContactDivot) v.findViewById(R.id.avatar); @@ -768,14 +740,22 @@ public ViewHolder(View v) { messageBlock = v.findViewById(R.id.message_block); previewImageContainer = (RelativeLayout) v.findViewById(R.id.preview_image_container); if (previewImageContainer != null) { + previewImageContainer.setVisibility(GONE); previewImageView = (ImageView) previewImageContainer.findViewById(R.id.preview_image_view); previewPlayImageView = (ImageView) previewImageContainer.findViewById(R.id.preview_image_play_view); } previewImageContainerLarge = (RelativeLayout) v.findViewById(R.id.preview_image_container_large); if (previewImageContainerLarge != null) { + previewImageContainerLarge.setVisibility(GONE); previewImageViewLarge = (ImageView) previewImageContainerLarge.findViewById(R.id.preview_image_view_large); previewPlayImageViewLarge = (ImageView) previewImageContainerLarge.findViewById(R.id.preview_image_play_view_large); } + previewImageContainerSpotlight = (RelativeLayout) v.findViewById(R.id.preview_spotlight_image_container); + if (previewImageContainerSpotlight != null) { + previewImageContainerSpotlight.setVisibility(GONE); + previewImageViewSpotlight = (ImageView) previewImageContainerSpotlight.findViewById(R.id.preview_spotlight_image_view); + previewPlayImageViewSpotlight = (ImageView) previewImageContainerSpotlight.findViewById(R.id.preview_spotlight_image_play_view); + } } } diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetSpotlightFragment.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetSpotlightFragment.java index bf59031a..d1e96734 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetSpotlightFragment.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetSpotlightFragment.java @@ -329,7 +329,7 @@ public LazyImageLoader getProfileImageLoader() { @Override public LazyImageLoader getPreviewImageLoader() { - return null; + return getApp().getPreviewImageLoader(); } }; From 0b9deec6d9a1323c0d9dfb3a80f92370b5830766 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sun, 5 Jan 2014 11:28:12 +0000 Subject: [PATCH 19/37] Fix for #388 handle that the file object could be null (since the function being called can return a null) --- .../socialnetlib/android/AppdotnetApi.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/android/libraries/SocialNetLib/src/org/socialnetlib/android/AppdotnetApi.java b/android/libraries/SocialNetLib/src/org/socialnetlib/android/AppdotnetApi.java index ca1b3e31..2e8e45b3 100644 --- a/android/libraries/SocialNetLib/src/org/socialnetlib/android/AppdotnetApi.java +++ b/android/libraries/SocialNetLib/src/org/socialnetlib/android/AppdotnetApi.java @@ -234,7 +234,7 @@ public AdnPosts getAdnGlobalStream(AdnPaging paging) { } /* - * + * */ public AdnPosts getAdnMentions(int userId, AdnPaging paging) { return getPosts("/stream/0/users/" + userId + "/mentions", null, paging); @@ -335,25 +335,24 @@ public AdnPost setAdnStatus(AdnPostCompose compose) { JSONObject post; String fileToken = null; try { - post = new JSONObject() .put("text", compose.mText) .put("reply_to", compose.mInReplyTo); - if (compose.mMediaFile != null) { AdnFile file = setAdnFile(compose.mMediaFile); - - JSONObject ann = new JSONObject(); - ann.put("type", "net.app.core.oembed"); - ann.put("value", new JSONObject() - .put("+net.app.core.file", new JSONObject() - .put("file_id", file.mId) - .put("file_token", file.mFileToken) - .put("format", "oembed") - ) - ); - post.put("annotations", new JSONArray().put(ann)); + if (file != null) { + JSONObject ann = new JSONObject(); + ann.put("type", "net.app.core.oembed"); + ann.put("value", new JSONObject() + .put("+net.app.core.file", new JSONObject() + .put("file_id", file.mId) + .put("file_token", file.mFileToken) + .put("format", "oembed") + ) + ); + post.put("annotations", new JSONArray().put(ann)); + } } } catch (JSONException e) { From e6dc799de5e47ce9dc97c343c6046bb4390deee6 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sun, 5 Jan 2014 11:37:39 +0000 Subject: [PATCH 20/37] Fix for #387. Correctly clear selected status on screen rotate. --- .../android/core/view/TweetFeedFragment.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java index c5365317..a51a623c 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java @@ -120,6 +120,8 @@ public void addValues(Bundle args) { private final ArrayList mConverstaionViewIds = new ArrayList(); private MultipleTweetSelectionCallback mMultipleTweetSelectionCallback; + + private Long mNewestTweetId; private Long mOldestTweetId; private Long mRefreshingOldestTweetId; @@ -240,6 +242,15 @@ public void onSaveInstanceState(Bundle state) { state.putInt("NewStatuses", mNewStatuses); state.putBoolean("HidingListHeading", mHidingListHeading); + + mSelectedItems.clear(); + android.util.SparseBooleanArray items = mTweetFeedListView.getRefreshableView().getCheckedItemPositions(); + for(int i = 0; i Date: Sun, 5 Jan 2014 14:36:34 +0000 Subject: [PATCH 21/37] Move where visibility set, the holders are re-used, so this idea doesn't work --- .../tweetlanes/android/core/view/TweetFeedItemView.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java index 3d869ac8..3bf8bfa3 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java @@ -411,6 +411,10 @@ void setPreviewImage(TwitterMediaEntity mediaEntity, AdnMedia adnMedia, Callback ImageView previewImageView; ImageView previewPlayImageView; + if(mHolder.previewImageContainer != null) mHolder.previewImageContainer.setVisibility(GONE); + if(mHolder.previewImageContainerLarge != null) mHolder.previewImageContainerLarge.setVisibility(GONE); + if(mHolder.previewImageContainerSpotlight != null) mHolder.previewImageContainerSpotlight.setVisibility(GONE); + AppSettings.MediaImageSize mediaImageSize = AppSettings.get().getCurrentMediaImageSize(); if ((mediaEntity == null && adnMedia == null) || !AppSettings.get().downloadFeedImages()) { @@ -740,19 +744,16 @@ public ViewHolder(View v) { messageBlock = v.findViewById(R.id.message_block); previewImageContainer = (RelativeLayout) v.findViewById(R.id.preview_image_container); if (previewImageContainer != null) { - previewImageContainer.setVisibility(GONE); previewImageView = (ImageView) previewImageContainer.findViewById(R.id.preview_image_view); previewPlayImageView = (ImageView) previewImageContainer.findViewById(R.id.preview_image_play_view); } previewImageContainerLarge = (RelativeLayout) v.findViewById(R.id.preview_image_container_large); if (previewImageContainerLarge != null) { - previewImageContainerLarge.setVisibility(GONE); previewImageViewLarge = (ImageView) previewImageContainerLarge.findViewById(R.id.preview_image_view_large); previewPlayImageViewLarge = (ImageView) previewImageContainerLarge.findViewById(R.id.preview_image_play_view_large); } previewImageContainerSpotlight = (RelativeLayout) v.findViewById(R.id.preview_spotlight_image_container); if (previewImageContainerSpotlight != null) { - previewImageContainerSpotlight.setVisibility(GONE); previewImageViewSpotlight = (ImageView) previewImageContainerSpotlight.findViewById(R.id.preview_spotlight_image_view); previewPlayImageViewSpotlight = (ImageView) previewImageContainerSpotlight.findViewById(R.id.preview_spotlight_image_play_view); } From 5f70cec4b72516993194f14a53e31e6b285477ba Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Wed, 15 Jan 2014 14:11:23 +0000 Subject: [PATCH 22/37] Fix for #393 - Lock orientation to a sensor landscape, meaning the screen doesn't do an odd flip when in landscape mode. --- .../com/tweetlanes/android/core/view/TweetFeedFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java index a51a623c..7c1f99bd 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java @@ -304,10 +304,10 @@ private void lockScreenRotation() { if (getActivity() != null) { switch (getActivity().getResources().getConfiguration().orientation) { case Configuration.ORIENTATION_PORTRAIT: - getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); break; case Configuration.ORIENTATION_LANDSCAPE: - getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); + getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); break; } } From c665603abbf652ba37f4c44ea7201c32130068f3 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Wed, 15 Jan 2014 14:12:33 +0000 Subject: [PATCH 23/37] Attempted fix for #396. Try and prevent an infinate loop --- .../com/tweetlanes/android/core/view/TweetFeedFragment.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java index 7c1f99bd..303f0f88 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java @@ -357,7 +357,7 @@ public void finished(TwitterFetchResult fetchResult, TwitterStatuses feed, doneGettingStatus = false; } - if (doneGettingStatus) { + if (doneGettingStatus || mTimesFetchCalled > 8) { beginListHeadingCount(); onRefreshFinished(feed); } else { @@ -1002,6 +1002,10 @@ private void onRefreshFinished(TwitterStatuses feed) { } if (feed == null || feed.getStatusCount() == 0) { + mTweetFeedListView.onRefreshComplete(); + mTweetFeedListAdapter.notifyDataSetChanged(); + mTweetDataRefreshCallback = null; + resetScreenRotation(); return; } From 7ec43e40ef4c6446ffe36937fefe5d73ead3410e Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Wed, 15 Jan 2014 14:41:31 +0000 Subject: [PATCH 24/37] Fix for #392 - error with auto complete mid status --- .../core/view/ComposeBaseFragment.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeBaseFragment.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeBaseFragment.java index 22c7ba7b..47522d91 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeBaseFragment.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/ComposeBaseFragment.java @@ -533,11 +533,28 @@ public void onItemClick(AdapterView parent, View view, int position, long id) String autoCompleteText = String.valueOf(textView.getText()); String editText = String.valueOf(mAutocompleteTarget.getText()); - int index = editText.lastIndexOf(" "); + int currentStart = mAutocompleteTarget.getSelectionStart(); + int currentEnd = mAutocompleteTarget.getSelectionEnd(); + int currentPosition = editText.length() - 1; + if (currentStart == currentEnd) { + currentPosition = currentStart; + } + if (currentPosition < 0) currentPosition = 0; + + int autoCompleteStart = 0; + + for (int i = currentPosition; i > 0; i--) { + String nextChar = editText.substring(i-1,i).toLowerCase(); + if (nextChar.equals(" ") || nextChar.equals(".")) { + break; + } + autoCompleteStart = i-1; + } + - String newText = editText.substring(0, index + 1) + autoCompleteText; - mAutocompleteTarget.setText(newText + " "); - mAutocompleteTarget.setSelection(newText.length() + 1); + String newText = editText.substring(0,autoCompleteStart) + autoCompleteText + " " + editText.substring(currentPosition); + mAutocompleteTarget.setText(newText); + mAutocompleteTarget.setSelection(autoCompleteStart + autoCompleteText.length()); mAutocompleteListView.setVisibility(View.GONE); } From eda961d7ef11b54462d6d0b51a8299db6216e212 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Wed, 15 Jan 2014 18:41:33 +0000 Subject: [PATCH 25/37] Update changelog.xml --- android/libraries/TweetLanesCore/res/xml/changelog.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android/libraries/TweetLanesCore/res/xml/changelog.xml b/android/libraries/TweetLanesCore/res/xml/changelog.xml index cfbb2e2f..cdf71d8d 100644 --- a/android/libraries/TweetLanesCore/res/xml/changelog.xml +++ b/android/libraries/TweetLanesCore/res/xml/changelog.xml @@ -6,6 +6,9 @@ Feature - Added auto complete mid status rather than needing to be the last word in compose box Fix - Set VolScroll to be defaulted off Fix - Update remaining characters as soon as media attached + Fix - Rotate flip on landscape refresh + Fix - Prevent infinite refresh loop + Fix - Auto complete mid status bug fix Fix - Various errors reported by fatal crashes From 2baec1dd357c01e9e25ad0b9befe6d3049659895 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Wed, 15 Jan 2014 18:42:36 +0000 Subject: [PATCH 26/37] Update changelog.xml --- android/libraries/TweetLanesCore/res/xml/changelog.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/android/libraries/TweetLanesCore/res/xml/changelog.xml b/android/libraries/TweetLanesCore/res/xml/changelog.xml index cdf71d8d..ada41f63 100644 --- a/android/libraries/TweetLanesCore/res/xml/changelog.xml +++ b/android/libraries/TweetLanesCore/res/xml/changelog.xml @@ -8,7 +8,6 @@ Fix - Update remaining characters as soon as media attached Fix - Rotate flip on landscape refresh Fix - Prevent infinite refresh loop - Fix - Auto complete mid status bug fix Fix - Various errors reported by fatal crashes From fb85055af75da709154d490d0890ea1c43d53f5e Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sat, 8 Feb 2014 12:04:19 +0000 Subject: [PATCH 27/37] Fix for #394 - Change status cache size to 300 from 100 --- .../com/tweetlanes/android/core/view/TweetFeedFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java index 303f0f88..ca778714 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java @@ -491,8 +491,8 @@ public String getDataToCache() { // mTweetFeedListAdapter.getCount())); int endIndex = Math.min(visibleIndex + 10, feed.getStatusCount()); - if (endIndex > 100) { - startIndex = endIndex - 100; + if (endIndex > 300) { + startIndex = endIndex - 300; } TwitterStatuses statuses = new TwitterStatuses(); From bcafe227232022e340c468eccba683f1aa054e96 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sat, 8 Feb 2014 12:04:44 +0000 Subject: [PATCH 28/37] Fix for #402 - Change the URL & display text for ADN share --- .../android/model/TwitterStatus.java | 4 ++++ .../TweetLanesCore/res/values-ru/strings.xml | 1 + .../TweetLanesCore/res/values/strings.xml | 1 + .../android/core/view/BaseLaneActivity.java | 19 +++++++++++++++++-- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/android/libraries/SocialNetLib/src/org/tweetalib/android/model/TwitterStatus.java b/android/libraries/SocialNetLib/src/org/tweetalib/android/model/TwitterStatus.java index 78cb47f2..9f0fd3f6 100644 --- a/android/libraries/SocialNetLib/src/org/tweetalib/android/model/TwitterStatus.java +++ b/android/libraries/SocialNetLib/src/org/tweetalib/android/model/TwitterStatus.java @@ -537,6 +537,10 @@ public String getTwitterComStatusUrl() { return "https://twitter.com/" + getAuthorScreenName() + "/status/" + mId; } + public String getAdnStatusUrl() { + return "https://alpha.app.net/" + getAuthorScreenName() + "/post/" + mId; + } + /* * (non-Javadoc) * diff --git a/android/libraries/TweetLanesCore/res/values-ru/strings.xml b/android/libraries/TweetLanesCore/res/values-ru/strings.xml index ab2075e0..69f7ac53 100644 --- a/android/libraries/TweetLanesCore/res/values-ru/strings.xml +++ b/android/libraries/TweetLanesCore/res/values-ru/strings.xml @@ -178,6 +178,7 @@ Текст твита Ссылка на твит + Ссылка на твит Ссылка в твите Ссылка в твите diff --git a/android/libraries/TweetLanesCore/res/values/strings.xml b/android/libraries/TweetLanesCore/res/values/strings.xml index 6eea40e8..d62f7fc7 100644 --- a/android/libraries/TweetLanesCore/res/values/strings.xml +++ b/android/libraries/TweetLanesCore/res/values/strings.xml @@ -178,6 +178,7 @@ Tweet Text Link to Tweet + Link to Post Link in Tweet Link in Tweet diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/BaseLaneActivity.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/BaseLaneActivity.java index 2174e6cd..278dd7fa 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/BaseLaneActivity.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/BaseLaneActivity.java @@ -53,6 +53,7 @@ import com.tweetlanes.android.core.Constant.SystemEvent; import com.tweetlanes.android.core.ConsumerKeyConstants; import com.tweetlanes.android.core.R; +import com.tweetlanes.android.core.model.AccountDescriptor; import com.tweetlanes.android.core.model.ComposeTweetDefault; import com.tweetlanes.android.core.util.Util; import com.tweetlanes.android.core.view.BaseLaneFragment.InitialDownloadState; @@ -1401,7 +1402,21 @@ public void shareSelected(TwitterStatus status) { if (status != null) { - final String statusUrl = status.getTwitterComStatusUrl(); + App application = (App) getApplication(); + AccountDescriptor currentAccount = application.getCurrentAccount(); + + String url; + String shareText; + if(currentAccount.getSocialNetType() == SocialNetConstant.Type.Twitter){ + url = status.getTwitterComStatusUrl(); + shareText = getString(R.string.share_tweet_link); + } + else + { + url = status.getAdnStatusUrl(); + shareText = getString(R.string.share_tweet_post); + } + final String statusUrl = url; final String statusText = status.mStatus; final ArrayList urls = Util.getUrlsInString(status.mStatus); @@ -1422,7 +1437,7 @@ public void onClick(DialogInterface dialog, } }); - alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.share_tweet_link), + alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, shareText, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { From 01ea186799baacbbf0e1323156753535893b6d31 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Sat, 8 Feb 2014 12:05:44 +0000 Subject: [PATCH 29/37] Make large the default image size --- .../src/com/tweetlanes/android/core/AppSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/AppSettings.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/AppSettings.java index 2eae88db..113cab03 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/AppSettings.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/AppSettings.java @@ -55,7 +55,7 @@ public class AppSettings { private static final String MEDIA_IMAGE_SIZE_SMALL = "Small"; private static final String MEDIA_IMAGE_SIZE_LARGE = "Large"; private static final String MEDIA_IMAGE_SIZE_OFF = "Off"; - private static final String MEDIA_IMAGE_SIZE_DEFAULT = MEDIA_IMAGE_SIZE_SMALL; + private static final String MEDIA_IMAGE_SIZE_DEFAULT = MEDIA_IMAGE_SIZE_LARGE; private static final String THEME_LIGHT = "Holo Light"; private static final String THEME_DARK = "Holo Dark"; From dc2c1cd867cded354336df6036455dbd5de825df Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Tue, 18 Feb 2014 07:09:19 +0000 Subject: [PATCH 30/37] After data is used in the boot activity to get the URI set it to null to prevent a subsequent load running the same logic again. --- .../src/com/tweetlanes/android/core/view/BootActivity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/BootActivity.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/BootActivity.java index ae6d3c84..41259c42 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/BootActivity.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/BootActivity.java @@ -92,6 +92,7 @@ void jumpToNext() { if (!ReadUrl(uriData, false)) { startHomeActivity("", uriData.toString()); } + getIntent().setData(null); } else if (mLastStartedClass != HomeActivity.class) { mLastStartedClass = HomeActivity.class; // We don't want to come back here, so remove from the From 1beea577139eac035e3e8e591e3a4a5a12b9fc12 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Tue, 18 Feb 2014 07:22:01 +0000 Subject: [PATCH 31/37] Added a setting for cache size default to 100 with options of 100,200,300 and unlimited --- .../TweetLanesCore/res/values-ru/arrays.xml | 16 +++++++++++++++- .../TweetLanesCore/res/values-ru/strings.xml | 3 +++ .../TweetLanesCore/res/values/arrays.xml | 14 ++++++++++++++ .../TweetLanesCore/res/values/strings.xml | 3 +++ .../TweetLanesCore/res/xml/preferences.xml | 9 ++++++++- .../tweetlanes/android/core/AppSettings.java | 8 +++++++- .../android/core/view/SettingsActivity.java | 10 ++++++++++ .../android/core/view/TweetFeedFragment.java | 19 ++++++++++--------- 8 files changed, 70 insertions(+), 12 deletions(-) diff --git a/android/libraries/TweetLanesCore/res/values-ru/arrays.xml b/android/libraries/TweetLanesCore/res/values-ru/arrays.xml index 7a5a5973..d1c4ac3d 100644 --- a/android/libraries/TweetLanesCore/res/values-ru/arrays.xml +++ b/android/libraries/TweetLanesCore/res/values-ru/arrays.xml @@ -61,11 +61,25 @@ - Обычно + standard rt via + + 100 Статусы + 200 Статусы + 300 Статусы + Неограниченное Статусы + + + + 100 + 200 + 300 + 0 + + \@username Имя diff --git a/android/libraries/TweetLanesCore/res/values-ru/strings.xml b/android/libraries/TweetLanesCore/res/values-ru/strings.xml index 69f7ac53..6c4526a6 100644 --- a/android/libraries/TweetLanesCore/res/values-ru/strings.xml +++ b/android/libraries/TweetLanesCore/res/values-ru/strings.xml @@ -457,6 +457,9 @@ Вид цитирования Вид цитирования + Размер кэша + Количество статусов, чтобы держать в кэше + Затемнение экрана Экран будет затухать после определённого периода бездействия. diff --git a/android/libraries/TweetLanesCore/res/values/arrays.xml b/android/libraries/TweetLanesCore/res/values/arrays.xml index db1c9f7d..2f9d183f 100644 --- a/android/libraries/TweetLanesCore/res/values/arrays.xml +++ b/android/libraries/TweetLanesCore/res/values/arrays.xml @@ -66,6 +66,20 @@ via + + 100 Statuses + 200 Statuses + 300 Statuses + Unlimited + + + + 100 + 200 + 300 + 0 + + \@username Name diff --git a/android/libraries/TweetLanesCore/res/values/strings.xml b/android/libraries/TweetLanesCore/res/values/strings.xml index d62f7fc7..ff2840dd 100644 --- a/android/libraries/TweetLanesCore/res/values/strings.xml +++ b/android/libraries/TweetLanesCore/res/values/strings.xml @@ -479,6 +479,9 @@ Quote Format Quote Format + Cache Size + Number of statuses to keep in cache + Dim Screen The screen will dim after a period of inactivity. diff --git a/android/libraries/TweetLanesCore/res/xml/preferences.xml b/android/libraries/TweetLanesCore/res/xml/preferences.xml index 1c8ad332..e5c1027e 100644 --- a/android/libraries/TweetLanesCore/res/xml/preferences.xml +++ b/android/libraries/TweetLanesCore/res/xml/preferences.xml @@ -153,7 +153,14 @@ android:title="@string/title_autorefresh_preference" android:summary="@string/summary_autorefresh_preference"/> - + 300) { - startIndex = endIndex - 300; + int cacheSize = AppSettings.get().getCacheSize(); + + if (cacheSize > 0) { + if (endIndex > cacheSize) { + startIndex = endIndex - cacheSize; + } } TwitterStatuses statuses = new TwitterStatuses(); @@ -993,7 +995,7 @@ private TwitterStatus getVisibleStatus() { } /* - * + * */ private void onRefreshFinished(TwitterStatuses feed) { @@ -1271,8 +1273,7 @@ private void onTweetFeedItemSingleTap(View view, int position) { TweetFeedItemView tweetFeedItemView = (TweetFeedItemView) (view); TwitterStatus status = tweetFeedItemView.getTwitterStatus(); FragmentActivity activity = getActivity(); - if(activity!= null) - { + if (activity != null) { Intent tweetSpotlightIntent = new Intent(activity, TweetSpotlightActivity.class); tweetSpotlightIntent.putExtra("statusId", Long.toString(status.mId)); tweetSpotlightIntent.putExtra("status", status.toString()); From 8d084bd632b6b0efeac63c9de7d0f73b2dd8f6bb Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Tue, 18 Feb 2014 07:27:17 +0000 Subject: [PATCH 32/37] Change to use a parse from string rather than an incline cast --- .../src/com/tweetlanes/android/core/AppSettings.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/AppSettings.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/AppSettings.java index 2c997060..10983e79 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/AppSettings.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/AppSettings.java @@ -27,7 +27,7 @@ public class AppSettings { public static final boolean DEFAULT_AUTO_REFRESH = false; public static final boolean DEFAULT_SHOW_TABLET_MARGIN = true; public static final boolean DEFAULT_SHOW_TWEET_SOURCE = false; - public static final int DEFAULT_CACHE_SIZE = 100; + public static final String DEFAULT_CACHE_SIZE = "100"; private static final String DISAPLY_TIME_RELATIVE = "Relative"; private static final String DISAPLY_TIME_ABSOLUTE = "Absolute"; @@ -260,9 +260,11 @@ public boolean showTweetSource() { } public int getCacheSize() { - return mSharedPreferences.getInt( + String value = mSharedPreferences.getString( SettingsActivity.KEY_CACHE_SIZE_PREFERENCE, DEFAULT_CACHE_SIZE); + + return Integer.parseInt(value); } /* From c4409ca47f19362751b54dc88057c8f0dcd0cebc Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Wed, 19 Feb 2014 08:16:56 +0000 Subject: [PATCH 33/37] Update changelog.xml --- android/libraries/TweetLanesCore/res/xml/changelog.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/android/libraries/TweetLanesCore/res/xml/changelog.xml b/android/libraries/TweetLanesCore/res/xml/changelog.xml index ada41f63..b6440d1b 100644 --- a/android/libraries/TweetLanesCore/res/xml/changelog.xml +++ b/android/libraries/TweetLanesCore/res/xml/changelog.xml @@ -4,6 +4,7 @@ Feature - Large media previews & option to turn off media previews Feature - Added option to use display urls rather than full URLs Feature - Added auto complete mid status rather than needing to be the last word in compose box + Feature - Added configuration for tweet cache size Fix - Set VolScroll to be defaulted off Fix - Update remaining characters as soon as media attached Fix - Rotate flip on landscape refresh From f5424c8723b9709ff5d416086047b2d386871ce6 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Wed, 19 Feb 2014 13:50:24 +0000 Subject: [PATCH 34/37] Fix for #399 - Conversations appearing under wrong status' --- .../TweetLanesCore/res/xml/changelog.xml | 3 ++- .../android/core/view/TweetFeedItemView.java | 16 ++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/android/libraries/TweetLanesCore/res/xml/changelog.xml b/android/libraries/TweetLanesCore/res/xml/changelog.xml index b6440d1b..c0105afb 100644 --- a/android/libraries/TweetLanesCore/res/xml/changelog.xml +++ b/android/libraries/TweetLanesCore/res/xml/changelog.xml @@ -4,11 +4,12 @@ Feature - Large media previews & option to turn off media previews Feature - Added option to use display urls rather than full URLs Feature - Added auto complete mid status rather than needing to be the last word in compose box - Feature - Added configuration for tweet cache size + Feature - Added configuration for statuses cache size Fix - Set VolScroll to be defaulted off Fix - Update remaining characters as soon as media attached Fix - Rotate flip on landscape refresh Fix - Prevent infinite refresh loop + Fix - Correct issue with conversations appearing under the wrong statuses Fix - Various errors reported by fatal crashes diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java index 3bf8bfa3..cdf3692e 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java @@ -203,7 +203,13 @@ public void configure(TwitterStatus twitterStatus, int position, Callbacks callb mConversationExpanded = showConversationView; mConversationToggle = mHolder.conversationToggle; + if (mConversationToggle != null) { + mConversationToggle.setVisibility(GONE); + if (mConversationView != null) { + removeView(mConversationView); + mConversationView = null; + } if (twitterStatus.mInReplyToStatusId != null) { mConversationToggle.setVisibility(VISIBLE); @@ -219,14 +225,12 @@ public void onClick(View v) { if (showConversationView) { insertConversationView(); mConversationView.setVisibility(GONE); + int drawable = AppSettings.get().getCurrentTheme() == AppSettings.Theme.Holo_Dark ? R.drawable.ic_action_expand_dark + : R.drawable.ic_action_expand_light; + mConversationToggle.setImageDrawable(getResources().getDrawable( + drawable)); configureConversationView(socialNetType, currentAccountKey); } - } else { - mConversationToggle.setVisibility(GONE); - if (mConversationView != null) { - removeView(mConversationView); - mConversationView = null; - } } } From 14620404c99290f7e2d399d5ea65e79dba44bf25 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Wed, 19 Feb 2014 14:08:25 +0000 Subject: [PATCH 35/37] Correct issue with conversation icon being the wrong one when it's made to disappear --- .../tweetlanes/android/core/view/TweetFeedItemView.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java index cdf3692e..bd5a8642 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedItemView.java @@ -210,6 +210,10 @@ public void configure(TwitterStatus twitterStatus, int position, Callbacks callb removeView(mConversationView); mConversationView = null; } + int drawable = AppSettings.get().getCurrentTheme() == AppSettings.Theme.Holo_Dark ? R.drawable.ic_action_expand_dark + : R.drawable.ic_action_expand_light; + mConversationToggle.setImageDrawable(getResources().getDrawable( + drawable)); if (twitterStatus.mInReplyToStatusId != null) { mConversationToggle.setVisibility(VISIBLE); @@ -225,10 +229,6 @@ public void onClick(View v) { if (showConversationView) { insertConversationView(); mConversationView.setVisibility(GONE); - int drawable = AppSettings.get().getCurrentTheme() == AppSettings.Theme.Holo_Dark ? R.drawable.ic_action_expand_dark - : R.drawable.ic_action_expand_light; - mConversationToggle.setImageDrawable(getResources().getDrawable( - drawable)); configureConversationView(socialNetType, currentAccountKey); } } From f46849b17692c5b7d288fe6382695b0dba4381a9 Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Mon, 3 Mar 2014 13:22:05 +0000 Subject: [PATCH 36/37] Fix for #407 - Favorites getting persisted to social network --- .../android/TwitterModifyStatuses.java | 57 +++++++++---------- .../TweetLanesCore/res/xml/changelog.xml | 1 + 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/android/libraries/SocialNetLib/src/org/tweetalib/android/TwitterModifyStatuses.java b/android/libraries/SocialNetLib/src/org/tweetalib/android/TwitterModifyStatuses.java index 74b4eb21..4f79163e 100644 --- a/android/libraries/SocialNetLib/src/org/tweetalib/android/TwitterModifyStatuses.java +++ b/android/libraries/SocialNetLib/src/org/tweetalib/android/TwitterModifyStatuses.java @@ -123,7 +123,7 @@ public void setWorkerCallbacks(ModifyStatusesWorkerCallbacks callbacks) { */ /* - * + * */ FinishedCallback getModifyStatusesCallback(Integer callbackHandle) { return mFinishedCallbackMap.get(callbackHandle); @@ -258,14 +258,13 @@ protected ModifyStatusesTaskOutput doInBackground(ModifyStatusesTaskInput... inp if (input.mStatuses != null) { for (int i = 0; i < input.mStatuses.getStatusCount(); i++) { TwitterStatus twitterStatus = input.mStatuses.getStatus(i); - if (twitterStatus.mIsFavorited != favorite) { - AdnPost post = appdotnetApi.setAdnFavorite(twitterStatus.mId, favorite); - if (post != null) { - twitterStatus = new TwitterStatus(post); - twitterStatus.setFavorite(favorite); - contentFeed.add(twitterStatus); - } + AdnPost post = appdotnetApi.setAdnFavorite(twitterStatus.mId, favorite); + + if (post != null) { + twitterStatus = new TwitterStatus(post); + twitterStatus.setFavorite(favorite); + contentFeed.add(twitterStatus); } } } @@ -292,27 +291,27 @@ protected ModifyStatusesTaskOutput doInBackground(ModifyStatusesTaskInput... inp if (input.mStatuses != null) { for (int i = 0; i < input.mStatuses.getStatusCount(); i++) { TwitterStatus twitterStatus = input.mStatuses.getStatus(i); - if (twitterStatus.mIsFavorited != favorite) { - try { - twitter4j.Status status; - if (favorite) { - status = twitter.createFavorite(twitterStatus.mId); - } else { - status = twitter.destroyFavorite(twitterStatus.mId); - } - - // Yuck: See the comment for - // TwitterStatus.setFavorite() for - // reasons for this - twitterStatus = new TwitterStatus(status); - twitterStatus.setFavorite(favorite); - - contentFeed.add(twitterStatus); - } catch (TwitterException e) { - // we might get errors setting the favorite - // state to the same - // value again. - // Just ignore those ones... + try { + twitter4j.Status status; + if (favorite) { + status = twitter.createFavorite(twitterStatus.mId); + } else { + status = twitter.destroyFavorite(twitterStatus.mId); + } + + // Yuck: See the comment for + // TwitterStatus.setFavorite() for + // reasons for this + twitterStatus = new TwitterStatus(status); + twitterStatus.setFavorite(favorite); + + contentFeed.add(twitterStatus); + } catch (TwitterException e) { + e.printStackTrace(); + errorDescription = e.getErrorMessage(); + Log.e("api-call", errorDescription, e); + if (e.getRateLimitStatus() != null && e.getRateLimitStatus().getRemaining() <= 0) { + throw e; } } } diff --git a/android/libraries/TweetLanesCore/res/xml/changelog.xml b/android/libraries/TweetLanesCore/res/xml/changelog.xml index c0105afb..07b29dbf 100644 --- a/android/libraries/TweetLanesCore/res/xml/changelog.xml +++ b/android/libraries/TweetLanesCore/res/xml/changelog.xml @@ -10,6 +10,7 @@ Fix - Rotate flip on landscape refresh Fix - Prevent infinite refresh loop Fix - Correct issue with conversations appearing under the wrong statuses + Fix - Favorites now correctly get sent to twitter Fix - Various errors reported by fatal crashes From f75a8c2ade3bfd06711066c531ee20640b4a58ab Mon Sep 17 00:00:00 2001 From: Chris Blyth Date: Mon, 3 Mar 2014 13:23:40 +0000 Subject: [PATCH 37/37] Change to 1.4.0 beta 2 --- android/clientbeta/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/clientbeta/AndroidManifest.xml b/android/clientbeta/AndroidManifest.xml index 3136cdc2..1c4e73a9 100644 --- a/android/clientbeta/AndroidManifest.xml +++ b/android/clientbeta/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="1.4.0_b2">