List of usage examples for android.widget ListView setFastScrollEnabled
public void setFastScrollEnabled(final boolean enabled)
From source file:com.github.mobile.gauges.ui.TrafficListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (gauge != null && gaugeId == null) gaugeId = gauge.getId();/* www.jav a2 s.c o m*/ ListView listView = getListView(); if (getListAdapter() == null) { listView.addHeaderView(getLayoutInflater(savedInstanceState).inflate(layout.traffic_graph, null), null, false); listView.addHeaderView( getLayoutInflater(savedInstanceState).inflate(layout.traffic_list_item_labels, null), null, false); } listView.setSelector(android.R.color.transparent); listView.setCacheColorHint(getResources().getColor(android.R.color.transparent)); listView.setDrawSelectorOnTop(false); listView.setFastScrollEnabled(true); listView.setDividerHeight(0); }
From source file:com.nachiket.titan.LibraryPagerAdapter.java
/** * Enables FastScroller on the given list, ensuring it is always visible * and suppresses the match drag position feature in newer versions of * Android./*from w w w . j a v a 2 s . co m*/ * * @param list The list to enable. */ private void enableFastScroll(ListView list) { mActivity.mFakeTarget = true; list.setFastScrollEnabled(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { CompatHoneycomb.setFastScrollAlwaysVisible(list); } mActivity.mFakeTarget = false; }
From source file:com.nachiket.titan.LibraryPagerAdapter.java
/** * Set the sort mode for the current adapter. Current adapter must be a * MediaAdapter. Saves this sort mode to preferences and updates the list * associated with the adapter to display the new sort mode. * * @param mode The sort mode. See {@link MediaAdapter#setSortMode(int)} for * details.// w ww.ja va2 s . co m */ public void setSortMode(int mode) { MediaAdapter adapter = (MediaAdapter) mCurrentAdapter; if (mode == adapter.getSortMode()) return; adapter.setSortMode(mode); requestRequery(adapter); // Force a new FastScroller to be created so the scroll sections // are updated. ListView view = mLists[mTabOrder[mCurrentPage]]; view.setFastScrollEnabled(false); enableFastScroll(view); Handler handler = mWorkerHandler; handler.sendMessage(handler.obtainMessage(MSG_SAVE_SORT, adapter)); }
From source file:no.digipost.android.gui.content.UploadActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((DigipostApplication) getApplication()).getTracker(DigipostApplication.TrackerName.APP_TRACKER); setContentView(R.layout.activity_upload); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*from w w w. jav a 2s. c o m*/ getSupportActionBar().setTitle(R.string.upload); getSupportActionBar().setHomeButtonEnabled(true); absolutePath = (TextView) findViewById(R.id.upload_file_path); availableSpace = (TextProgressBar) findViewById(R.id.upload_available_space); listEmpty = (TextView) findViewById(R.id.upload_list_empty); mDirectory = DEFAULT_INITIAL_DIRECTORY; mFiles = new ArrayList<File>(); ListView listView = (ListView) findViewById(R.id.upload_file_list); listView.setEmptyView(listEmpty); listView.setOnItemClickListener(new ListOnItemClickListener()); listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); listView.setFastScrollEnabled(true); listView.setMultiChoiceModeListener(new UploadMultiChoiceModeListener()); listAdapter = new UploadListAdapter(this, mFiles); listView.setAdapter(listAdapter); content = getIntent().getIntExtra(ApiConstants.UPLOAD, ApplicationConstants.MAILBOX); Permissions.requestWritePermissionsIfMissing(getApplicationContext(), UploadActivity.this); executeSetAccountInfoTask(); }
From source file:com.sentaroh.android.SMBSync.LogFileManagementFragment.java
private void initViewWidget() { if (DEBUG_ENABLE) Log.v(APPLICATION_TAG, "initViewWidget"); if (mGlblParms == null) return;/*from w w w . j a v a 2 s .c o m*/ mDialog.setContentView(R.layout.log_management_dlg); final TextView dlg_title = (TextView) mDialog.findViewById(R.id.log_management_dlg_title); dlg_title.setText(mDialogTitle); final ListView lv_log_file = (ListView) mDialog.findViewById(R.id.log_management_dlg_log_listview); final Button btn_close = (Button) mDialog.findViewById(R.id.log_management_dlg_log_close); final AdapterLogFileManagementList lfm_adapter = new AdapterLogFileManagementList(mContext, R.layout.log_management_list_item, mLogFileList); lv_log_file.setAdapter(lfm_adapter); lv_log_file.setClickable(true); lv_log_file.setFocusable(true); lv_log_file.setFastScrollEnabled(true); lv_log_file.setFocusableInTouchMode(true); lv_log_file.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) { if (lfm_adapter.getItem(0).log_file_name == null) return; if (mGlblParms.settingAltUiEnabled) { if (!isLogFileItemSelected(lfm_adapter)) processSelectedLogFile(lfm_adapter, pos); else lfm_adapter.getItem(pos).isChecked = !lfm_adapter.getItem(pos).isChecked; } else lfm_adapter.getItem(pos).isChecked = !lfm_adapter.getItem(pos).isChecked; lfm_adapter.notifyDataSetChanged(); } }); lv_log_file.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int pos, long arg3) { createContextMenu(lfm_adapter, pos); return true; } }); btn_close.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { mFragment.dismiss(); } }); // CommonDialog.setDlgBoxSizeLimit(mDialog, true); }
From source file:com.stylovid.fastbattery.LogViewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater, container, savedInstanceState); mInflater = inflater;/* w w w . ja v a 2 s . c o m*/ View logs_header = View.inflate(getActivity(), R.layout.logs_header, null); header_text = (TextView) logs_header.findViewById(R.id.header_text); ListView lv = (ListView) view.findViewById(android.R.id.list); lv.addHeaderView(logs_header, null, false); lv.setFastScrollEnabled(true); if (noDB) return view; setHeaderText(); setListAdapter(mAdapter); return view; }
From source file:net.kourlas.voipms_sms.activities.NewConversationActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new_conversation); Intent intent = getIntent();/*from w w w . j av a2 s.co m*/ String action = intent.getAction(); String type = intent.getType(); if (Intent.ACTION_SEND.equals(action) && type != null && type.equals("text/plain")) { this.messageText = intent.getStringExtra(Intent.EXTRA_TEXT); } Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); ViewCompat.setElevation(toolbar, getResources().getDimension(R.dimen.toolbar_elevation)); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setCustomView(R.layout.new_conversation_toolbar); actionBar.setDisplayShowCustomEnabled(true); } final Activity newConversationActivity = this; final NewConversationListViewAdapter newConversationListViewAdapter = new NewConversationListViewAdapter( this); if (actionBar != null) { SearchView searchView = (SearchView) actionBar.getCustomView().findViewById(R.id.search_view); searchView.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { String phoneNumber = newText.replaceAll("[^0-9]", ""); if (phoneNumber.equals("")) { newConversationListViewAdapter.hideTypedInItem(); } else { newConversationListViewAdapter.showTypedInItem(phoneNumber); } newConversationListViewAdapter.refresh(newText); return true; } }); searchView.requestFocus(); // Hide search icon ImageView searchMagIcon = (ImageView) searchView.findViewById(R.id.search_mag_icon); searchMagIcon.setLayoutParams(new LinearLayout.LayoutParams(0, 0)); } final ListView listView = (ListView) findViewById(R.id.list); listView.setAdapter(newConversationListViewAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ContactItem contactItem = (ContactItem) newConversationListViewAdapter.getItem(position); String phoneNumber = contactItem.getPhoneNumber().replaceAll("[^0-9]", ""); Intent intent = new Intent(newConversationActivity, ConversationActivity.class); intent.putExtra(getString(R.string.conversation_extra_contact), phoneNumber); if (messageText != null) { intent.putExtra(getString(R.string.conversation_extra_message_text), messageText); } intent.putExtra(getString(R.string.conversation_extra_focus), true); startActivity(intent); } }); listView.setFastScrollEnabled(true); newConversationListViewAdapter.refresh(""); }
From source file:com.googlecode.networklog.LogFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { MyLog.d("[LogFragment] onCreateView"); LinearLayout layout = new LinearLayout(getActivity().getApplicationContext()); layout.setOrientation(LinearLayout.VERTICAL); ListView listView = new ListView(getActivity().getApplicationContext()); listView.setAdapter(adapter);//from ww w . j a v a 2s.c om listView.setTextFilterEnabled(true); listView.setFastScrollEnabled(true); listView.setSmoothScrollbarEnabled(false); listView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL); listView.setStackFromBottom(true); listView.setOnItemClickListener(new CustomOnItemClickListener()); layout.addView(listView); registerForContextMenu(listView); startUpdater(); return layout; }
From source file:org.solovyev.android.messenger.BaseListFragment.java
protected void fillListView(@Nonnull ListView lv, @Nonnull Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) { lv.setScrollbarFadingEnabled(true); }/*ww w . ja va2s. c o m*/ lv.setBackgroundDrawable(null); lv.setCacheColorHint(Color.TRANSPARENT); ListViewScroller.createAndAttach(lv, this); lv.setFastScrollEnabled(true); lv.setTextFilterEnabled(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { lv.setOverscrollFooter(null); } lv.setVerticalFadingEdgeEnabled(false); lv.setFocusable(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { lv.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT); } lv.setDivider(new ColorDrawable(Color.LTGRAY)); lv.setDividerHeight(1); }
From source file:com.ubuntuone.android.files.activity.FilesActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mTracker = GoogleAnalyticsTracker.getInstance(); mTracker.start(Analytics.U1F_ACCOUNT, this); mTracker.trackPageView(TAG);/*from w w w . ja va 2s. c o m*/ mHandler = new Handler(); mReceiver = new DetachableResultReceiver(mHandler); mSignOutReceiver = new SignOutBroadcastReceiver(); IntentFilter intentFilter = new IntentFilter("com.ubuntuone.android.files.SIGN_OUT"); LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this); lbm.registerReceiver(mSignOutReceiver, intentFilter); mResolver = getContentResolver(); // Override splash screen background. getWindow().setBackgroundDrawableResource(android.R.drawable.screen_background_light); final ImageButton homeButton = (ImageButton) getActionBar().findViewById(R.id.gd_action_bar_home_item); homeButton.setImageResource(R.drawable.u1_logo); // Refresh addActionBarItem(Type.Refresh); mLoaderItem = (LoaderActionBarItem) getActionBar().getItem(ActionBar.REFRESH); mLoaderItem.setDrawable(R.drawable.ic_act_action_bar_refresh); // Upload addActionBarItem(Type.Add); mUploadItem = (NormalActionBarItem) getActionBar().getItem(ActionBar.UPLOAD); mUploadItem.setDrawable(R.drawable.ic_act_action_bar_add); onCreateUploadQuickActionGrid(); getActionBar().setBackgroundResource(R.drawable.action_bar_background); mEmptyTextView = (TextView) findViewById(android.R.id.empty); ListView listView = getListView(); listView.setEmptyView(mEmptyTextView); listView.setFastScrollEnabled(true); registerForContextMenu(getListView()); mPathTracker = new PathTracker(); if (NetworkUtil.getAvailableNetworkType(this) == -1) { UIUtil.showToast(this, R.string.toast_working_offline, true); } if (Preferences.hasTokens(this)) { mImageDownloader = U1CroppedImageDownloader.SMALL; onRefresh(null); suggestAutoUploadConfiguration(); ChangeLogUtils.maybeShowChangelog(this); } else { final Intent intent = getIntent(); final String data = (intent != null) ? intent.getDataString() : null; if (data != null && data.startsWith("x-ubuntuone-sso")) { validate(); } else { signIn(); } } String action = getIntent() != null ? getIntent().getAction() : null; if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action)) { mIsPickShareWithDirectoryMode = true; shareIntent = getIntent(); showDialog(DIALOG_PICK_UPLOAD_DIRECTORY_ID); } }