Example usage for android.widget ListView getTranscriptMode

List of usage examples for android.widget ListView getTranscriptMode

Introduction

In this page you can find the example usage for android.widget ListView getTranscriptMode.

Prototype

public int getTranscriptMode() 

Source Link

Document

Returns the current transcript mode.

Usage

From source file:org.solovyev.android.messenger.messages.MessagesFragment.java

private void syncOlderMessages() {
    final ListView lv = getListViewById();
    final FragmentActivity activity = getActivity();
    if (lv != null && activity != null) {
        final Integer transcriptMode = lv.getTranscriptMode();
        lv.setTranscriptMode(ListView.TRANSCRIPT_MODE_DISABLED);

        final PublicPullToRefreshListView pullToRefreshListView = getPullToRefreshListView();
        if (pullToRefreshListView != null) {
            pullToRefreshListView.setRefreshingInternal(false);
        }//from  w  w w.  j  a v  a  2  s .c o m

        new SyncMessagesForChatAsyncTask(this, activity) {
            @Override
            protected void onSuccessPostExecute(@Nonnull Input result) {
                try {
                    super.onSuccessPostExecute(result);
                } finally {
                    setTranscriptMode(lv, transcriptMode);
                }
            }

            @Override
            protected void onFailurePostExecute(@Nonnull Exception e) {
                try {
                    super.onFailurePostExecute(e);
                } finally {
                    setTranscriptMode(lv, transcriptMode);
                }
            }
        }.executeInParallel(
                new SyncMessagesForChatAsyncTask.Input(getUser().getEntity(), chat.getEntity(), true));
    }
}