Example usage for android.widget AbsListView TRANSCRIPT_MODE_ALWAYS_SCROLL

List of usage examples for android.widget AbsListView TRANSCRIPT_MODE_ALWAYS_SCROLL

Introduction

In this page you can find the example usage for android.widget AbsListView TRANSCRIPT_MODE_ALWAYS_SCROLL.

Prototype

int TRANSCRIPT_MODE_ALWAYS_SCROLL

To view the source code for android.widget AbsListView TRANSCRIPT_MODE_ALWAYS_SCROLL.

Click Source Link

Document

The list will automatically scroll to the bottom, no matter what items are currently visible.

Usage

From source file:com.adstrosoftware.gpsplayground.activityrecognizer.ActivityRecognizerFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    adapter = new DetectedActivityAdapter(getActivity());
    setListAdapter(adapter);/* w  ww.ja  v  a 2s  . c o  m*/
    getListView().setTranscriptMode(AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
}

From source file:t0mm13b.dmesglog.ui.DMesgViewer.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_layout);
    this.mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    this.mPrefs.registerOnSharedPreferenceChangeListener(this);
    this.mAdapter = new DmesgListViewAdapter(this, R.layout.listview_dmesg_line_row, null);
    this.getListView().setAdapter(mAdapter);
    this.getListView().setTranscriptMode(AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
    this.getListView().setOnScrollListener(new OnScrollListener() {

        @Override/*from   ww  w . ja v  a  2s  .c o  m*/
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            if (mMIPause != null && totalItemCount > 0) {
                if ((firstVisibleItem + visibleItemCount) < totalItemCount) {
                    // we're scrolling upwards so trigger the pause event
                    handlePause(mMIPause);
                }
                if ((firstVisibleItem + visibleItemCount) == totalItemCount) {
                    // we've reached the bottom, so trigger the resume event
                    handleResume(mMIPause);
                }
            }
        }

        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
        }

    });
    this.getListView().setDivider(null);
    this.mDmesgVwrAct = this;
    this.mStrDropFolder = String.format(EXTERNAL_DROP_FOLDER_FMT, this.getPackageName());
    new asyncLoadInitialDmesg(this).execute();

    Log.d(TAG, "onCreate - CHECK!");
}

From source file:com.bccs.bsecure.Conversation.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    //If convo was opened from the main view, it will have a number value in the intent
    //currentNumber variable is used when loading messages from the DB.
    if (getIntent().hasExtra("contactid")) {
        currentNumber = new Contact(getIntent().getLongExtra("contactid", -1));
        //Cancel any notifications for this number
        if (currentNumber.getId() == SmsBroadcastReceiver.recentID)
            MessageReceivedNotification.cancel(this);
    } else {//from   w  w  w  .j  a v a  2 s.  c o  m
        //If it was not opened from the main view, use the most recent number an SMS
        //was received from.
        currentNumber = new Contact(SmsBroadcastReceiver.recentID);
    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_conversation);
    setTitle(currentNumber.getName());

    conversation = new ArrayList<>();
    typeMessage = (EditText) findViewById(R.id.messageEditText);
    listView = (ListView) findViewById(R.id.contactListView);
    send = (Button) findViewById(R.id.sendButton);

    chatAdapter = new chatAdapter();
    listView.setAdapter(chatAdapter);
    // Create the on-click listener for the send button
    send.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            String message = typeMessage.getText().toString();
            typeMessage.setText("");

            if (currentNumber.getNumber().length() > 0 && message.length() > 0) {
                MyMessage msgObj = HandleMessage.send(currentNumber.getId(), message, getApplicationContext());
                ConversationManager.ConversationHelper helper = ConversationManager
                        .getConversation(Conversation.this, currentNumber.getId());
                helper.addMessage(msgObj);
                updateConvo();
            }
        }
    });

    // Scrolls to the bottom in the event of data change.
    listView.setTranscriptMode(AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
    chatAdapter.registerDataSetObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            super.onChanged();
            listView.setSelection(chatAdapter.getCount());
        }
    });

    findViewById(R.id.wipeConversation).setOnClickListener(new Button.OnClickListener() {
        @Override
        public void onClick(View v) {
            WipeConversationDialog dialog = new WipeConversationDialog();
            dialog.show(getFragmentManager(), "conversation_option");
        }
    });

    //Register our receiver in the LocalBroadcastManager.
    //NOTE this is different from calling registerReceiver from the contextWrapper.
    LocalBroadcastManager.getInstance(this).registerReceiver(onNewMsg, onNewMsgFilter);
    receiversRegistered = true;

    updateConvo();
}

From source file:me.myatminsoe.myansms.MessageListActivity.java

/**
 * {@inheritDoc}/*  w  w w  . java2s.c  om*/
 */
@Override
protected final void onResume() {
    super.onResume();

    final ListView lv = getListView();
    lv.setTranscriptMode(AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
    lv.setAdapter(new MessageAdapter(this, uri));
    markedUnread = false;

    final AppCompatImageButton btn = (AppCompatImageButton) findViewById(R.id.send_);
    if (showTextField) {
        Intent i;
        ActivityInfo ai = null;
        final PackageManager pm = getPackageManager();
        try {
            i = buildIntent(false, false);
            if (pm != null && PreferenceManager.getDefaultSharedPreferences(this)
                    .getBoolean(PreferencesActivity.PREFS_SHOWTARGETAPP, true)) {
                ai = i.resolveActivityInfo(pm, 0);
            }
        } catch (NullPointerException e) {
            Log.e(TAG, "unable to build Intent", e);
        }
        etText.setMaxLines(MAX_EDITTEXT_LINES);

        if (ai == null) {
            etText.setMinLines(1);
        } else {
            if (chooserPackage == null) {
                try {
                    final ActivityInfo cai = buildIntent(false, true).resolveActivityInfo(pm, 0);
                    if (cai != null) {
                        chooserPackage = cai.packageName;
                    }
                } catch (NullPointerException e) {
                    Log.e(TAG, "unable to build Intent", e);
                }
            }
            if (ai.packageName.equals(chooserPackage)) {
            } else {

            }
            etText.setMinLines(3);
        }
    } else {
        btn.setImageResource(R.drawable.icn_send_disabled);
    }
}

From source file:de.ub0r.android.smsdroid.MessageListActivity.java

/**
 * {@inheritDoc}//from  www. j  av  a  2  s  .  c o  m
 */
@Override
protected final void onResume() {
    super.onResume();
    boolean noAds = DonationHelper.hideAds(this);
    if (!noAds) {
        Ads.loadAd(this, R.id.ad, ADMOB_PUBID, AD_KEYWORDS);
    }

    final ListView lv = this.getListView();
    lv.setTranscriptMode(AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
    lv.setAdapter(new MessageAdapter(this, this.uri));
    this.markedUnread = false;

    final Button btn = (Button) this.findViewById(R.id.send_);
    if (this.showTextField) {
        final Intent i = this.buildIntent(this.enableAutosend, false);
        final PackageManager pm = this.getPackageManager();
        ActivityInfo ai = null;
        if (PreferenceManager.getDefaultSharedPreferences(this)
                .getBoolean(PreferencesActivity.PREFS_SHOWTARGETAPP, true)) {
            ai = i.resolveActivityInfo(pm, 0);
        }
        if (ai == null) {
            btn.setText(null);
            this.etText.setMinLines(1);
        } else {
            if (chooserPackage == null) {
                final ActivityInfo cai = this.buildIntent(this.enableAutosend, true).resolveActivityInfo(pm, 0);
                if (cai != null) {
                    chooserPackage = cai.packageName;
                }
            }
            if (ai.packageName.equals(chooserPackage)) {
                btn.setText(R.string.chooser_);
            } else {
                Log.d(TAG, "ai.pn: " + ai.packageName);
                btn.setText(ai.loadLabel(pm));
            }
            this.etText.setMinLines(3);
        }
    } else {
        btn.setText(null);
    }
}

From source file:it.ciopper90.gojack2.MessageListActivity.java

/**
 * {@inheritDoc}/*w  ww  .j  a  va 2 s .com*/
 */
@Override
protected final void onResume() {
    super.onResume();
    // boolean noAds = DonationHelper.hideAds(this);
    // if (!noAds) {
    // Ads.loadAd(this, R.id.ad, ADMOB_PUBID, AD_KEYWORDS);
    // }

    final ListView lv = this.getListView();
    lv.setTranscriptMode(AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
    lv.setAdapter(new MessageAdapter(this, this.uri));
    this.markedUnread = false;

    // final Button btn = (Button) this.findViewById(R.id.send_);
    // if (this.showTextField) {
    // final Intent i = this.buildIntent(this.enableAutosend, false);
    // final PackageManager pm = this.getPackageManager();
    // ActivityInfo ai = null;
    // if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(
    // PreferencesActivity.PREFS_SHOWTARGETAPP, true)) {
    // ai = i.resolveActivityInfo(pm, 0);
    // }
    // if (ai == null) {
    // btn.setText(null);
    // this.etText.setMinLines(1);
    // } else {
    // if (chooserPackage == null) {
    // final ActivityInfo cai = this.buildIntent(this.enableAutosend, true)
    // .resolveActivityInfo(pm, 0);
    // if (cai != null) {
    // chooserPackage = cai.packageName;
    // }
    // }
    // if (ai.packageName.equals(chooserPackage)) {
    // btn.setText(R.string.chooser_);
    // } else {
    // Log.d(TAG, "ai.pn: " + ai.packageName);
    // btn.setText(ai.loadLabel(pm));
    // }
    // this.etText.setMinLines(3);
    // }
    // } else {
    // btn.setText(null);
    // }

}

From source file:com.nnm.smsviet.MessageListActivity.java

/**
 * {@inheritDoc}/* w  ww .j a  v  a  2s. com*/
 */
@Override
protected final void onResume() {
    super.onResume();
    Ads.loadAd(this, R.id.ad, ADMOB_PUBID, null);
    final ListView lv = this.getListView();
    lv.setTranscriptMode(AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
    lv.setAdapter(new MessageAdapter(this, this.uri));
    this.markedUnread = false;

    final Button btn = (Button) this.findViewById(R.id.send_);
    // if (this.showTextField) {
    // final Intent i = this.buildIntent(this.enableAutosend, false);
    // final PackageManager pm = this.getPackageManager();
    // ActivityInfo ai = null;
    // if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(
    // PreferencesActivity.PREFS_SHOWTARGETAPP, true)) {
    // ai = i.resolveActivityInfo(pm, 0);
    // }
    // if (ai == null) {
    // btn.setText(null);
    // this.etText.setMinLines(1);
    // } else {
    // if (chooserPackage == null) {
    // final ActivityInfo cai = this.buildIntent(this.enableAutosend, true)
    // .resolveActivityInfo(pm, 0);
    // if (cai != null) {
    // chooserPackage = cai.packageName;
    // }
    // }
    // if (ai.packageName.equals(chooserPackage)) {
    // btn.setText(R.string.chooser_);
    // } else {
    // Log.d(TAG, "ai.pn: " + ai.packageName);
    // btn.setText(ai.loadLabel(pm));
    // }
    // this.etText.setMinLines(3);
    // }
    // } else {
    btn.setText(null);
    // }
}