List of usage examples for android.widget ListView setSelector
public void setSelector(@DrawableRes int resID)
From source file:com.andrewshu.android.reddit.common.Common.java
/** * Set the Drawable for the list selector etc. based on the current theme. */// w ww .j av a2 s .c o m public static void updateListDrawables(ListActivity la, int theme) { ListView lv = la.getListView(); if (Util.isLightTheme(theme)) { lv.setBackgroundResource(android.R.color.background_light); lv.setSelector(R.drawable.list_selector_blue); } else /* if (Common.isDarkTheme(theme)) */ { lv.setSelector(android.R.drawable.list_selector_background); } }
From source file:in.shick.diode.common.Common.java
/** * Set the Drawable for the list selector etc. based on the current theme. *//*w w w .j a v a 2 s . c o m*/ public static void updateListDrawables(ListActivity la, int theme) { ListView lv = la.getListView(); if (Util.isLightTheme(theme)) { lv.setBackgroundResource(android.R.color.background_light); lv.setSelector(R.drawable.list_selector_blue); } else { /* if (Common.isDarkTheme(theme)) */ lv.setSelector(android.R.drawable.list_selector_background); } }
From source file:org.mariotaku.twidere.fragment.support.BaseActivitiesListFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mAdapter = createListAdapter(getActivity()); mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE); setListAdapter(mAdapter);/*from w ww. j a va2s . c o m*/ final ListView lv = getListView(); lv.setDivider(null); lv.setSelector(android.R.color.transparent); getLoaderManager().initLoader(0, getArguments(), this); setListShown(false); }
From source file:net.abcdroid.devfest12.ui.ExploreFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final ListView listView = getListView(); listView.setSelector(android.R.color.transparent); }
From source file:com.conferenceengineer.android.iosched.ui.ExploreFragment.java
@Override public void onViewCreated(final View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); view.setBackgroundColor(Color.WHITE); final ListView listView = getListView(); listView.setSelector(android.R.color.transparent); listView.setCacheColorHint(Color.WHITE); mAdapter = new TracksAdapter(getActivity(), false); setListAdapter(mAdapter);// w w w .j av a 2 s.c o m // Override default ListView empty-view handling listView.setEmptyView(null); mEmptyView.setVisibility(View.VISIBLE); mAdapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { if (mAdapter.getCount() > 0) { mEmptyView.setVisibility(View.GONE); mAdapter.unregisterDataSetObserver(this); } } }); }
From source file:de.vanita5.twittnuker.fragment.support.BaseActivitiesListFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE); final boolean plainListStyle = mPreferences.getBoolean(KEY_PLAIN_LIST_STYLE, false); final boolean compactCards = mPreferences.getBoolean(KEY_COMPACT_CARDS, false); mAdapter = createListAdapter(getActivity(), compactCards, plainListStyle); setListAdapter(mAdapter);/*from w ww . j a va 2 s . c om*/ final ListView lv = getListView(); if (!plainListStyle) { lv.setDivider(null); } lv.setSelector(android.R.color.transparent); getLoaderManager().initLoader(0, getArguments(), this); setListShown(false); }
From source file:com.gdgdevfest.android.apps.devfestbcn.ui.ExploreFragment.java
@Override public void onViewCreated(final View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); view.setBackgroundColor(Color.WHITE); final ListView listView = getListView(); listView.setSelector(android.R.color.transparent); listView.setCacheColorHint(Color.WHITE); addMapHeaderView();// w ww . ja va 2 s. co m mAdapter = new TracksAdapter(getActivity(), false); setListAdapter(mAdapter); // Override default ListView empty-view handling listView.setEmptyView(null); mEmptyView.setVisibility(View.VISIBLE); mAdapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { if (mAdapter.getCount() > 0) { mEmptyView.setVisibility(View.GONE); mAdapter.unregisterDataSetObserver(this); } } }); }
From source file:com.conferenceengineer.android.iosched.ui.SandboxFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); view.setBackgroundColor(Color.WHITE); final ListView listView = getListView(); listView.setSelector(android.R.color.transparent); listView.setCacheColorHint(Color.WHITE); }
From source file:drawnzer.anurag.archivereaddemo.RarFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { // TODO Auto-generated method stub final ListView lsView = (ListView) view.findViewById(R.id.ls); lsView.setSelector(R.drawable.button_click); lsView.setAdapter(new FileAdapter(getActivity(), new File(path).listFiles())); lsView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/*from w w w .jav a2s .c o m*/ public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub if (opened) { //zip file already opened.... //we are selecting sub files inside of zip file.... //getting selected entry from list view.... RarObj obj = (RarObj) lsView.getAdapter().getItem(arg2); //getting path of selected folder inside zip archive.... rar_path = obj.getPath(); if (obj.isFile()) { // a files is selected inside of archive.... Toast.makeText(getActivity(), "A file is selected....", Toast.LENGTH_SHORT).show(); } else { //a folder is selected inside zip archive.... //so further listing the selected folder.... try { lsView.setAdapter(read_rar.getAdapter(rar_path, getActivity())); } catch (ZipException e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(getActivity(), "Something went wrong....", Toast.LENGTH_SHORT).show(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(getActivity(), "Something went wrong....", Toast.LENGTH_SHORT).show(); } } return; } //folder or some file is selected.... //getting the file.... File getFile = (File) lsView.getAdapter().getItem(arg2); if (getFile.isDirectory()) { //updating th path.... path = path + "/" + getFile.getName(); //updating the listview as per new path.... lsView.setAdapter(new FileAdapter(getActivity(), new File(path).listFiles())); } else { //file is selected.... if (getFile.getName().endsWith(".rar")) { //open the zip file.... opened = true; read_rar = new ReadArchive(getFile); if (rar_path == null) rar_path = "/"; try { lsView.setAdapter(read_rar.getAdapter(rar_path, getActivity())); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(getActivity(), "Invalid zip file....", Toast.LENGTH_SHORT).show(); } } else Toast.makeText(getActivity(), "Choose a rar file to open....", Toast.LENGTH_SHORT).show(); } } }); lsView.setOnItemLongClickListener(null); }
From source file:drawnzer.anurag.archivereaddemo.ZipFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { // TODO Auto-generated method stub final ListView lsView = (ListView) view.findViewById(R.id.ls); lsView.setSelector(R.drawable.button_click); lsView.setAdapter(new FileAdapter(getActivity(), new File(path).listFiles())); lsView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override// w w w . ja va2 s . c o m public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub if (opened) { //zip file already opened.... //we are selecting sub files inside of zip file.... //getting selected entry from list view.... ZipObj obj = (ZipObj) lsView.getAdapter().getItem(arg2); //getting path of selected folder inside zip archive.... zip_path = obj.getPath(); if (obj.isFile()) { // a files is selected inside of archive.... Toast.makeText(getActivity(), "A file is selected....", Toast.LENGTH_SHORT).show(); } else { //a folder is selected inside zip archive.... //so further listing the selected folder.... try { lsView.setAdapter(read_zip.getAdapter(zip_path, getActivity())); } catch (ZipException e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(getActivity(), "Something went wrong....", Toast.LENGTH_SHORT).show(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(getActivity(), "Something went wrong....", Toast.LENGTH_SHORT).show(); } } return; } //folder or some file is selected.... //getting the file.... File getFile = (File) lsView.getAdapter().getItem(arg2); if (getFile.isDirectory()) { //updating th path.... path = path + "/" + getFile.getName(); //updating the listview as per new path.... lsView.setAdapter(new FileAdapter(getActivity(), new File(path).listFiles())); } else { //file is selected.... if (getFile.getName().endsWith(".zip")) { //open the zip file.... opened = true; read_zip = new ReadArchive(getFile); if (zip_path == null) zip_path = "/"; try { lsView.setAdapter(read_zip.getAdapter(zip_path, getActivity())); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(getActivity(), "Invalid zip file....", Toast.LENGTH_SHORT).show(); } } else Toast.makeText(getActivity(), "Choose a zip file to open....", Toast.LENGTH_SHORT).show(); } } }); lsView.setOnItemLongClickListener(null); }