use of de.pixart.messenger.ui.util.ScrollState in project Pix-Art-Messenger by kriztan.
the class ConversationFragment method onSaveInstanceState.
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (conversation != null) {
outState.putString(STATE_CONVERSATION_UUID, conversation.getUuid());
final Uri uri = pendingTakePhotoUri.peek();
if (uri != null) {
outState.putString(STATE_PHOTO_URI, uri.toString());
}
final ScrollState scrollState = getScrollPosition();
if (scrollState != null) {
outState.putParcelable(STATE_SCROLL_POSITION, scrollState);
}
}
}
use of de.pixart.messenger.ui.util.ScrollState in project Pix-Art-Messenger by kriztan.
the class ConversationFragment method onBackendConnected.
@Override
public void onBackendConnected() {
Log.d(Config.LOGTAG, "ConversationFragment.onBackendConnected()");
String uuid = pendingConversationsUuid.pop();
if (uuid != null) {
Conversation conversation = activity.xmppConnectionService.findConversationByUuid(uuid);
if (conversation == null) {
Log.d(Config.LOGTAG, "unable to restore activity");
clearPending();
return;
}
reInit(conversation);
ScrollState scrollState = pendingScrollState.pop();
if (scrollState != null) {
setScrollPosition(scrollState);
}
}
ActivityResult activityResult = postponedActivityResult.pop();
if (activityResult != null) {
handleActivityResult(activityResult);
}
clearPending();
}
use of de.pixart.messenger.ui.util.ScrollState in project Pix-Art-Messenger by kriztan.
the class ConversationsOverviewFragment method onSaveInstanceState.
@Override
public void onSaveInstanceState(Bundle bundle) {
super.onSaveInstanceState(bundle);
ScrollState scrollState = getScrollState();
if (scrollState != null) {
bundle.putParcelable(STATE_SCROLL_POSITION, scrollState);
}
}
use of de.pixart.messenger.ui.util.ScrollState in project Pix-Art-Messenger by kriztan.
the class ConversationsOverviewFragment method refresh.
@Override
void refresh() {
if (this.binding == null || this.activity == null) {
Log.d(Config.LOGTAG, "ConversationsOverviewFragment.refresh() skipped updated because view binding or activity was null");
return;
}
this.activity.xmppConnectionService.populateWithOrderedConversations(this.conversations);
this.conversationsAdapter.notifyDataSetChanged();
ScrollState scrollState = pendingScrollState.pop();
if (scrollState != null) {
setScrollPosition(scrollState);
}
}
use of de.pixart.messenger.ui.util.ScrollState in project Pix-Art-Messenger by kriztan.
the class ConversationFragment method getScrollPosition.
private ScrollState getScrollPosition() {
final ListView listView = this.binding.messagesView;
if (listView.getCount() == 0 || listView.getLastVisiblePosition() == listView.getCount() - 1) {
return null;
} else {
final int pos = listView.getFirstVisiblePosition();
final View view = listView.getChildAt(0);
if (view == null) {
return null;
} else {
return new ScrollState(pos, view.getTop());
}
}
}
Aggregations