List of usage examples for android.widget ListView setCacheColorHint
@Override public void setCacheColorHint(int color)
From source file:com.rvl.android.getnzb.LocalNZB.java
public void listLocalFiles() { Log.d(Tags.LOG, "- localnzb.listLocalFiles()"); setContentView(R.layout.localnzb);//from ww w.j av a 2 s. com SharedPreferences prefs = GetNZB.preferences; String preferredMethod = prefs.getString("preferredUploadMethod", ""); TextView statusbar = (TextView) findViewById(R.id.hellaStatus); statusbar.setText("Local files. Click to upload to " + preferredMethod + ", long click for options:"); Log.d(Tags.LOG, "Opening database."); Log.d(Tags.LOG, "Files dir: " + getFilesDir()); LocalNZBMetadata.openDatabase(); Cursor cur; // -- Bind the itemlist to the itemarray with the arrayadapter ArrayList<String> items = new ArrayList<String>(); ArrayAdapter<String> localFilesArrayAdapter = new LocalNZBRowAdapter(this, items); ListView localFilesListView = (ListView) findViewById(R.id.localFileList); localFilesListView.setCacheColorHint(00000000); localFilesListView.setAdapter(localFilesArrayAdapter); registerForContextMenu(localFilesListView); localFilesListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View v, int position, long id) { String localFilesArray[] = fileList(); SharedPreferences prefs = GetNZB.preferences; String preferredMethod = prefs.getString("preferredUploadMethod", ""); if (preferredMethod.equals("HellaNZB")) { Log.d(Tags.LOG, "itemclik(): uploading with HellaNZB."); uploadLocalFileHellaNZB(localFilesArray[position]); return; } if (preferredMethod.equals("FTP")) { Log.d(Tags.LOG, "itemclick(): uploading with FTP."); uploadLocalFileFTP(localFilesArray[position]); return; } } }); // Retrieve files from disc, retrieve metadata from DB, // combine this data and send it to the arrayadapter. Log.d(Tags.LOG, "Retrieving file metadata and building LocalNZB list."); String age = ""; String size = ""; String category = ""; String fileinfo = ""; String localFilesArray[] = fileList(); for (int c = 0; c < localFilesArray.length; c++) { cur = LocalNZBMetadata.myDatabase.query("file", new String[] { "_id", "name" }, "name = '" + localFilesArray[c] + "'", null, null, null, null); if (cur.moveToFirst()) { //if there is a hit, retrieve metadata int idIndex = cur.getColumnIndex("_id"); int file_id = cur.getInt(idIndex); cur = LocalNZBMetadata.myDatabase.query("meta", new String[] { "age", "size", "category" }, "file_id ='" + file_id + "'", null, null, null, null); if (cur.moveToFirst()) { int ageIndex = cur.getColumnIndex("age"); int sizeIndex = cur.getColumnIndex("size"); int catIndex = cur.getColumnIndex("category"); age = cur.getString(ageIndex); size = cur.getString(sizeIndex); category = cur.getString(catIndex); } else { // If there is no metadata for file set dummy metadata info. age = "???"; size = "???"; category = "???"; } } else { // If there is no file info in database set dummy info. age = "???"; size = "???"; category = "???"; } fileinfo = age + "#" + size + "#" + localFilesArray[c] + "#" + category; items.add(fileinfo); } Log.d(Tags.LOG, "Number of files in list: " + localFilesArray.length); localFilesArrayAdapter.notifyDataSetChanged(); LocalNZBMetadata.close(); }
From source file:com.google.android.apps.iosched.ui.MyScheduleFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_empty_container, container, false);/*from w w w .jav a 2 s . co m*/ inflater.inflate(R.layout.empty_waiting_for_sync, (ViewGroup) root.findViewById(android.R.id.empty), true); root.setBackgroundColor(Color.WHITE); ListView listView = (ListView) root.findViewById(android.R.id.list); listView.setItemsCanFocus(true); listView.setCacheColorHint(Color.WHITE); listView.setSelector(android.R.color.transparent); //listView.setEmptyView(root.findViewById(android.R.id.empty)); return root; }
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();/*ww w. j a va 2s.co 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:org.tanrabad.team.ChatFragment.java
private void turnOffListViewDecoration(ListView listView) { listView.setDivider(null);//from w w w . j a v a 2 s. c o m listView.setDividerHeight(0); listView.setHorizontalFadingEdgeEnabled(false); listView.setVerticalFadingEdgeEnabled(false); listView.setHorizontalScrollBarEnabled(false); listView.setVerticalScrollBarEnabled(true); listView.setSelector(new ColorDrawable(0x00ffffff)); listView.setCacheColorHint(0x00000000); // For Gingerbread scrolling bug fix }
From source file:com.rvl.android.getnzb.Search.java
public void buildItemList(int numhits) { String hits[][] = HITLIST;/* www . j a v a2s .c o m*/ setContentView(R.layout.links); String item = ""; Log.d(Tags.LOG, "* buildItemList()"); if (numhits == 0) { Toast.makeText(this, "No search result found!", Toast.LENGTH_LONG); return; } // -- Bind the itemlist to the itemarray with the arrayadapter ArrayList<String> items = new ArrayList<String>(); ArrayAdapter<String> aa = new SearchResultRowAdapter(this, items); //ArrayAdapter<String> aa = new ArrayAdapter<String>(this,com.rvl.android.getnzb.R.layout.itemslist,items); ListView itemlist = (ListView) findViewById(R.id.itemlist01); itemlist.setCacheColorHint(00000000); itemlist.setAdapter(aa); registerForContextMenu(itemlist); itemlist.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View v, int position, long id) { String pos = Integer.toString(position); Log.d(Tags.LOG, "Sending download command for position " + pos); new downloadfile().execute(pos); } }); // -- Log.d(Tags.LOG, "Building hitlist..."); for (int i = 0; i < hits.length; i++) { item += hits[i][0] + "#" + hits[i][1] + "#" + hits[i][2] + "#" + hits[i][4]; items.add(item); Log.d(Tags.LOG, "item:" + item); item = ""; } aa.notifyDataSetChanged(); // Enable or disable the button for next results page... Button nextbutton = (Button) findViewById(R.id.btn_next); nextbutton.setEnabled(ENABLE_NEXTBUTTON); }
From source file:dk.dr.radio.akt.P4kanalvalg_frag.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { kanalkoder = new ArrayList<String>(DRData.instans.grunddata.p4koder); for (String k : kanalkoder) { if (DRData.instans.grunddata.kanalFraKode.get(k) == null) { new IllegalStateException("Kanalkode mangler! Det her m ikke ske!").printStackTrace(); DRData.instans.grunddata.kanalFraKode.put(k, new Kanal()); // reparr problemet :-( }/*w w w . j a v a 2 s . co m*/ } // Da der er tale om et fast lille antal kanaler er der ikke grund til det store bogholderi // S vi husker bare viewsne i er array listeElementer = new View[kanalkoder.size()]; kanaladapter = new KanalAdapter(); // Opbyg arrayet p forhnd for jvnere visning for (int pos = 0; pos < listeElementer.length; pos++) kanaladapter.bygListeelement(pos); // St baggrunden. Normalt ville man gre det fra XML eller med //getListView().setBackgroundResource(R.drawable.main_app_bg); ListView lv = new ListView(getActivity()); lv.setAdapter(kanaladapter); lv.setOnItemClickListener(this); // lv.setBackgroundColor( 0xffa0a0a0); // lv.setDivider(new ColorDrawable(0x80ffffff)); // lv.setDividerHeight(2); // Srg for at baggrunden bliver tegnet, ogs nr listen scroller. // Se http://android-developers.blogspot.com/2009/01/why-is-my-list-black-android.html lv.setCacheColorHint(0x00000000); // Man kunne have en ensfarvet baggrund, det gr scroll mere flydende //getListView().setCacheColorHint(0xffe4e4e4); return lv; }
From source file:com.app4am.app4am.LatestNewsListFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (savedInstanceState != null) { mPosition = savedInstanceState.getInt(SwipeRefreshFragmentInterface.FRAGMENT_POSITION); }// www . jav a 2 s . co m // Change the colors displayed by the SwipeRefreshLayout by providing it with 4 // color resource ids setColorSchemeResources(R.color.color_scheme_1_1, R.color.color_scheme_1_2, R.color.color_scheme_1_3, R.color.color_scheme_1_4); // Set list view background color. view.setBackgroundResource(R.color.color_common_list_background); // List item divider and background color ListView listView = getListView(); listView.setDivider(getResources().getDrawable(R.drawable.common_list_divider)); listView.setDividerHeight((int) getResources().getDimension(R.dimen.common_list_divider_height)); listView.setBackgroundResource(R.color.color_common_list_background); listView.setCacheColorHint(0); // List selector listView.setSelector(R.drawable.list_view_selector); listView.setDrawSelectorOnTop(true); // Event handler listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO: Open topic information page (B01) ?! Log.d(LOG_TAG, "on click"); } }); listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { // TODO: Open topic introduction page (B02) ?! Log.d(LOG_TAG, "on long click"); return false; } }); /** * Create an ArrayAdapter to contain the data for the ListView. Each item in the ListView * uses the system-defined simple_list_item_1 layout that contains one TextView. */ ListAdapter adapter = new ArrayAdapter<String>(getActivity(), R.layout.latest_news_list_item, R.id.textView, Cheeses.randomList(LIST_ITEM_COUNT)); // Set the adapter between the ListView and its backing data. setListAdapter(adapter); // BEGIN_INCLUDE (setup_refreshlistener) /** * Implement {@link android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener}. When users do the "swipe to * refresh" gesture, SwipeRefreshLayout invokes * {@link android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener#onRefresh onRefresh()}. In * {@link android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener#onRefresh onRefresh()}, call a method that * refreshes the content. Call the same method in response to the Refresh action from the * action bar. */ setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { Log.i(LOG_TAG, "onRefresh called from SwipeRefreshLayout"); initiateRefresh(); } }); // END_INCLUDE (setup_refreshlistener) }
From source file:com.csipsimple.ui.account.AccountsEditListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView lv = getListView(); //getListView().setSelector(R.drawable.transparent); lv.setCacheColorHint(Color.TRANSPARENT); // View management View detailsFrame = getActivity().findViewById(R.id.details); dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE; if (savedInstanceState != null) { // Restore last state for checked position. curCheckPosition = savedInstanceState.getLong(CURRENT_CHOICE, SipProfile.INVALID_ID); //curCheckWizard = savedInstanceState.getString(CURRENT_WIZARD); }//ww w . j a v a 2 s . c om setListShown(false); if (mAdapter == null) { if (mHeaderView != null) { lv.addHeaderView(mHeaderView, null, true); } mAdapter = new AccountsEditListAdapter(getActivity(), null); mAdapter.setOnCheckedRowListener(this); //getListView().setEmptyView(getActivity().findViewById(R.id.progress_container)); //getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE); setListAdapter(mAdapter); registerForContextMenu(lv); // Prepare the loader. Either re-connect with an existing one, // or start a new one. getLoaderManager().initLoader(0, null, this); lv.setVerticalFadingEdgeEnabled(true); } if (dualPane) { // In dual-pane mode, the list view highlights the selected item. Log.d("lp", "dual pane mode"); lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); //lv.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT); lv.setVerticalScrollBarEnabled(false); lv.setFadingEdgeLength(50); updateCheckedItem(); // Make sure our UI is in the correct state. //showDetails(curCheckPosition, curCheckWizard); } else { //getListView().setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT); lv.setVerticalScrollBarEnabled(true); lv.setFadingEdgeLength(100); } }
From source file:com.fututel.ui.account.AccountsEditListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView lv = getListView(); //getListView().setSelector(R.drawable.transparent); lv.setCacheColorHint(Color.TRANSPARENT); // View management View detailsFrame = getActivity().findViewById(R.id.details); dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE; if (savedInstanceState != null) { // Restore last state for checked position. curCheckPosition = savedInstanceState.getLong(CURRENT_CHOICE, SipProfile.INVALID_ID); //curCheckWizard = savedInstanceState.getString(CURRENT_WIZARD); }/*from w w w.ja v a2s . com*/ setListShown(false); if (mAdapter == null) { if (mHeaderView != null) { // lv.addHeaderView(mHeaderView , null, true);//rangdong } mAdapter = new AccountsEditListAdapter(getActivity(), null); mAdapter.setOnCheckedRowListener(this); //getListView().setEmptyView(getActivity().findViewById(R.id.progress_container)); //getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE); setListAdapter(mAdapter); registerForContextMenu(lv); // Prepare the loader. Either re-connect with an existing one, // or start a new one. getLoaderManager().initLoader(0, null, this); lv.setVerticalFadingEdgeEnabled(true); } if (dualPane) { // In dual-pane mode, the list view highlights the selected item. Log.d("lp", "dual pane mode"); lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); //lv.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT); lv.setVerticalScrollBarEnabled(false); lv.setFadingEdgeLength(50); updateCheckedItem(); // Make sure our UI is in the correct state. //showDetails(curCheckPosition, curCheckWizard); } else { //getListView().setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT); lv.setVerticalScrollBarEnabled(true); lv.setFadingEdgeLength(100); } }
From source file:com.sft.blackcatapp.SearchCoachActivity.java
private void showOpenCityPopupWindow(View parent) { if (openCityPopupWindow == null) { LinearLayout popWindowLayout = (LinearLayout) View.inflate(mContext, R.layout.pop_window, null); popWindowLayout.removeAllViews(); // LinearLayout popWindowLayout = new LinearLayout(mContext); popWindowLayout.setOrientation(LinearLayout.VERTICAL); ListView OpenCityListView = new ListView(mContext); OpenCityListView.setDividerHeight(0); OpenCityListView.setCacheColorHint(android.R.color.transparent); OpenCityListView.setOnItemClickListener(new OnItemClickListener() { @Override//from w w w .ja v a 2 s.co m public void onItemClick(AdapterView<?> parent, View view, int position, long id) { OpenCityVO selectCity = openCityList.get(position); System.out.println(selectCity.getName()); cityname = selectCity.getName().replace("", ""); licensetype = ""; coachname = ""; ordertype = "0"; index = 1; obtainCaoch(); openCityPopupWindow.dismiss(); openCityPopupWindow = null; } }); LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); popWindowLayout.addView(OpenCityListView, param); OpenCityAdapter openCityAdapter = new OpenCityAdapter(mContext, openCityList); OpenCityListView.setAdapter(openCityAdapter); openCityPopupWindow = new PopupWindow(popWindowLayout, 130, LayoutParams.WRAP_CONTENT); } openCityPopupWindow.setFocusable(true); openCityPopupWindow.setOutsideTouchable(true); // Back??? openCityPopupWindow.setBackgroundDrawable(new BitmapDrawable()); openCityPopupWindow.showAsDropDown(parent); }