@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.select_recipients_list_screen); if (savedInstanceState != null) { mMode = savedInstanceState.getInt(MODE); } else { mMode = getIntent().getIntExtra(MODE, MODE_INFO); } if (mMode == MODE_INFO || mMode == MODE_VCARD) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.edit().putBoolean(PREF_SHOW_GROUPS, false).commit(); } else { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.edit().putBoolean(PREF_SHOW_GROUPS, true).commit(); } switch (mMode) { case MODE_INFO: setTitle(R.string.attach_add_contact_as_text); break; case MODE_VCARD: setTitle(R.string.attach_add_contact_as_vcard); break; default: // leave it be } mProgressSpinner = findViewById(R.id.progress_spinner); // List view ListView listView = getListView(); if (mMode == MODE_VCARD) { listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); } else { listView.setChoiceMode(ListView.CHOICE_MODE_NONE); } listView.setFastScrollEnabled(true); listView.setFastScrollAlwaysVisible(true); listView.setDivider(null); listView.setDividerHeight(0); listView.setEmptyView(findViewById(R.id.empty)); listView.setOnItemClickListener(this); // Get things ready mCheckedPhoneNumbers = new HashSet<PhoneNumber>(); mLocalGroups = new HashSet<Group>(); getLoaderManager().initLoader(0, null, this); ActionBar mActionBar = getActionBar(); if (mActionBar != null) { mActionBar.setDisplayHomeAsUpEnabled(true); } }
@SuppressLint("InflateParams") @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { controller = Controller.getInstance(); ViewGroup root = (ViewGroup) inflater.inflate(R.layout.ampache_songs, null); ListView listview = (ListView) root.findViewById(R.id.songs_listview); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { listview.setFastScrollAlwaysVisible(true); } if (controller.getServer() != null) { ArrayList<String> list = new ArrayList<String>(); for (Album a : controller.getAlbums()) { list.add(a.toString()); } AlbumArrayAdapter adapter = new AlbumArrayAdapter( getActivity().getApplicationContext(), list, controller.getAlbums()); listview.setAdapter(adapter); registerForContextMenu(listview); listview.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, final View view, int position, long id) { Album a = controller.getAlbums().get(position); controller.getSelectedSongs().clear(); controller.findSongs( a, new AsyncTaskCallback() { public void onTaskDone(ArrayList<Song> s) { setAlbumSongs(s); } }); /*for (Song s : controller.findSongs(a)) { Log.d("Song title=",s.getTitle()); controller.getSelectedSongs().add(s); }*/ // Create new fragment and transaction SelectedSongsView newFragment = new SelectedSongsView(); FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); // Replace whatever is in the fragment_container view with this fragment, // and add the transaction to the back stack transaction.replace(R.id.content_frame, newFragment, SONGS_VIEW_FRAGMENT); transaction.addToBackStack(null); ((MainActivity) getActivity()).setActiveFragment(6); // Commit the transaction transaction.commit(); } }); } return root; }
public void onViewCreated(View paramView, Bundle paramBundle) { super.onViewCreated(paramView, paramBundle); ListView localListView = getListView(); localListView.setFastScrollEnabled(true); FragmentActivity localFragmentActivity = getActivity(); FrameLayout localFrameLayout = new FrameLayout(localFragmentActivity); this.mPlayTutorialHeader = localFrameLayout; ViewGroup localViewGroup = this.mPlayTutorialHeader; localListView.addHeaderView(localViewGroup, null, false); updateCardHeader(); if (Build.VERSION.SDK_INT < 11) return; localListView.setScrollBarStyle(16777216); localListView.setFastScrollAlwaysVisible(true); }
@SuppressLint("NewApi") public ListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (context instanceof Activity) { setActivity((Activity) context); } if (HoloEverywhere.DISABLE_OVERSCROLL_EFFECT && VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) { setOverScrollMode(OVER_SCROLL_NEVER); } mOnItemLongClickListenerWrapper = new OnItemLongClickListenerWrapper(); super.setOnItemLongClickListener(mOnItemLongClickListenerWrapper); setLongClickable(false); if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) { super.setFastScrollAlwaysVisible(false); } super.setFastScrollEnabled(false); super.setChoiceMode(CHOICE_MODE_NONE); TypedArray a = context.obtainStyledAttributes( attrs, new int[] { android.R.attr.fastScrollEnabled, android.R.attr.fastScrollAlwaysVisible, android.R.attr.choiceMode, android.R.attr.overScrollFooter, android.R.attr.overScrollHeader }, defStyle, R.style.Holo_ListView); setFastScrollEnabled(a.getBoolean(0, false)); setFastScrollAlwaysVisible(a.getBoolean(1, false)); setChoiceMode(a.getInt(2, CHOICE_MODE_NONE)); if (!a.hasValue(3) && VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) { super.setOverscrollFooter(null); } if (!a.hasValue(4) && VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) { super.setOverscrollHeader(null); } a.recycle(); }
private void configureVerticalScrollbar() { boolean hasScrollbar = isVisibleScrollbarEnabled() && isSectionHeaderDisplayEnabled(); if (mListView != null) { mListView.setFastScrollEnabled(hasScrollbar); mListView.setFastScrollAlwaysVisible(hasScrollbar); mListView.setVerticalScrollbarPosition(mVerticalScrollbarPosition); mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY); int leftPadding = 0; int rightPadding = 0; if (mVerticalScrollbarPosition == View.SCROLLBAR_POSITION_LEFT) { leftPadding = mContext.getResources().getDimensionPixelOffset(R.dimen.list_visible_scrollbar_padding); } else { rightPadding = mContext.getResources().getDimensionPixelOffset(R.dimen.list_visible_scrollbar_padding); } mListView.setPadding( leftPadding, mListView.getPaddingTop(), rightPadding, mListView.getPaddingBottom()); } }