mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-01-31 08:54:57 +01:00
fixed instance state saving
This commit is contained in:
parent
e8e96b3606
commit
c10d3adbed
@ -713,8 +713,9 @@ public class ComposeActivity extends BaseActivity implements OnMenuItemClickList
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
// Restore from previous saved state
|
||||
mAccountsAdapter.setSelectedAccountIds(Utils.newParcelableArray(
|
||||
savedInstanceState.getParcelableArray(EXTRA_ACCOUNT_KEY), UserKey.CREATOR));
|
||||
final UserKey[] selected = Utils.newParcelableArray(savedInstanceState
|
||||
.getParcelableArray(EXTRA_ACCOUNT_KEYS), UserKey.CREATOR);
|
||||
mAccountsAdapter.setSelectedAccountIds(selected);
|
||||
mIsPossiblySensitive = savedInstanceState.getBoolean(EXTRA_IS_POSSIBLY_SENSITIVE);
|
||||
final ArrayList<ParcelableMediaUpdate> mediaList = savedInstanceState.getParcelableArrayList(EXTRA_MEDIA);
|
||||
if (mediaList != null) {
|
||||
|
@ -320,8 +320,8 @@ public final class DummyItemAdapter implements IStatusesAdapter<Object>,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Object o) {
|
||||
|
||||
public boolean setData(Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -210,7 +210,7 @@ public abstract class ParcelableStatusesAdapter extends LoadMoreSupportAdapter<R
|
||||
return mData.get(dataPosition).account_key;
|
||||
}
|
||||
|
||||
public void setData(List<ParcelableStatus> data) {
|
||||
public boolean setData(List<ParcelableStatus> data) {
|
||||
mData = data;
|
||||
if (data instanceof ObjectCursor || data == null || data.isEmpty()) {
|
||||
mLastItemFiltered = false;
|
||||
@ -218,6 +218,7 @@ public abstract class ParcelableStatusesAdapter extends LoadMoreSupportAdapter<R
|
||||
mLastItemFiltered = data.get(data.size() - 1).is_filtered;
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<ParcelableStatus> getData() {
|
||||
|
@ -71,9 +71,10 @@ public class ParcelableUserListsAdapter extends LoadMoreSupportAdapter<RecyclerV
|
||||
|
||||
|
||||
@Override
|
||||
public void setData(List<ParcelableUserList> data) {
|
||||
public boolean setData(List<ParcelableUserList> data) {
|
||||
mData = data;
|
||||
notifyDataSetChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void bindUserList(UserListViewHolder holder, int position) {
|
||||
|
@ -73,9 +73,10 @@ public class ParcelableUsersAdapter extends LoadMoreSupportAdapter<RecyclerView.
|
||||
|
||||
|
||||
@Override
|
||||
public void setData(List<ParcelableUser> data) {
|
||||
public boolean setData(List<ParcelableUser> data) {
|
||||
mData = data;
|
||||
notifyDataSetChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void bindUser(UserViewHolder holder, int position) {
|
||||
|
@ -50,7 +50,7 @@ public interface IStatusesAdapter<Data> extends IContentCardAdapter, IGapSupport
|
||||
|
||||
boolean isSensitiveContentEnabled();
|
||||
|
||||
void setData(Data data);
|
||||
boolean setData(Data data);
|
||||
|
||||
boolean shouldShowAccountsColor();
|
||||
|
||||
|
@ -37,7 +37,7 @@ public interface IUserListsAdapter<Data> extends IContentCardAdapter {
|
||||
|
||||
int getUserListsCount();
|
||||
|
||||
void setData(Data data);
|
||||
boolean setData(Data data);
|
||||
|
||||
boolean shouldShowAccountsColor();
|
||||
|
||||
|
@ -38,7 +38,7 @@ public interface IUsersAdapter<Data> extends IContentCardAdapter {
|
||||
|
||||
int getUserCount();
|
||||
|
||||
void setData(Data data);
|
||||
boolean setData(Data data);
|
||||
|
||||
@Nullable
|
||||
UserClickListener getUserClickListener();
|
||||
|
@ -643,9 +643,9 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
||||
}
|
||||
|
||||
private void setConversation(List<ParcelableStatus> data) {
|
||||
mHasMoreConversation = data != null && !data.isEmpty();
|
||||
final ReadPosition readPosition = saveReadPosition();
|
||||
mStatusAdapter.setData(data);
|
||||
final boolean changed = mStatusAdapter.setData(data);
|
||||
mHasMoreConversation = data != null && changed;
|
||||
restoreReadPosition(readPosition);
|
||||
}
|
||||
|
||||
@ -1930,9 +1930,10 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(List<ParcelableStatus> data) {
|
||||
public boolean setData(List<ParcelableStatus> data) {
|
||||
final ParcelableStatus status = mStatus;
|
||||
if (status == null) return;
|
||||
if (status == null) return false;
|
||||
boolean changed = !CompareUtils.objectEquals(mData, data);
|
||||
mData = data;
|
||||
if (data == null || data.isEmpty()) {
|
||||
setTypeCount(ITEM_IDX_CONVERSATION, 0);
|
||||
@ -1967,6 +1968,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
updateItemDecoration();
|
||||
return changed;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -111,20 +111,20 @@ public final class TwidereLinkify implements Constants {
|
||||
}
|
||||
|
||||
public void applyAllLinks(@Nullable Spannable text, final UserKey accountKey,
|
||||
final long extraId, final boolean sensitive,
|
||||
final boolean skipLinksInText) {
|
||||
final long extraId, final boolean sensitive,
|
||||
final boolean skipLinksInText) {
|
||||
applyAllLinks(text, mOnLinkClickListener, accountKey, extraId, sensitive,
|
||||
mHighlightOption, skipLinksInText);
|
||||
}
|
||||
|
||||
public void applyAllLinks(@Nullable Spannable text, final UserKey accountKey,
|
||||
final boolean sensitive, final boolean skipLinksInText) {
|
||||
final boolean sensitive, final boolean skipLinksInText) {
|
||||
applyAllLinks(text, mOnLinkClickListener, accountKey, -1, sensitive, mHighlightOption, skipLinksInText);
|
||||
}
|
||||
|
||||
public void applyAllLinks(@Nullable Spannable text, final UserKey accountKey,
|
||||
final long extraId, final boolean sensitive,
|
||||
final int highlightOption, final boolean skipLinksInText) {
|
||||
final long extraId, final boolean sensitive,
|
||||
final int highlightOption, final boolean skipLinksInText) {
|
||||
applyAllLinks(text, mOnLinkClickListener, accountKey, extraId, sensitive, highlightOption, skipLinksInText);
|
||||
}
|
||||
|
||||
@ -258,6 +258,7 @@ public final class TwidereLinkify implements Constants {
|
||||
break;
|
||||
}
|
||||
case LINK_TYPE_STATUS: {
|
||||
if (!USER_TYPE_TWITTER_COM.equals(accountKey.getHost())) break;
|
||||
final int length = string.length();
|
||||
final URLSpan[] spans = string.getSpans(0, length, URLSpan.class);
|
||||
for (final URLSpan span : spans) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user