Example usage for android.widget ListView setCacheColorHint

List of usage examples for android.widget ListView setCacheColorHint

Introduction

In this page you can find the example usage for android.widget ListView setCacheColorHint.

Prototype

@Override
    public void setCacheColorHint(int color) 

Source Link

Usage

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:net.ustyugov.jtalk.activity.XMLConsole.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    service = JTalkService.getInstance();
    setTheme(Colors.isLight ? R.style.AppThemeLight : R.style.AppThemeDark);
    setTitle("XML Console");
    getActionBar().setDisplayHomeAsUpEnabled(true);
    setContentView(R.layout.paged_activity);

    LinearLayout linear = (LinearLayout) findViewById(R.id.linear);
    linear.setBackgroundColor(Colors.BACKGROUND);

    LayoutInflater inflater = LayoutInflater.from(this);
    MainPageAdapter adapter = new MainPageAdapter(mPages);

    Cursor cursor = service.getContentResolver().query(JTalkProvider.ACCOUNT_URI, null,
            AccountDbHelper.ENABLED + " = '" + 1 + "'", null, null);
    if (cursor != null && cursor.getCount() > 0) {
        cursor.moveToFirst();/* www.  j a  v a  2 s.  co m*/
        do {
            final String account = cursor.getString(cursor.getColumnIndex(AccountDbHelper.JID)).trim();

            View page = inflater.inflate(R.layout.list_activity, null);
            page.setTag(account);
            mPages.add(page);

            ListView list = (ListView) page.findViewById(R.id.list);
            list.setDividerHeight(0);
            list.setCacheColorHint(0x00000000);
        } while (cursor.moveToNext());
        cursor.close();
    }

    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(adapter);
    mPager.setCurrentItem(0);

    TitlePageIndicator mTitleIndicator = (TitlePageIndicator) findViewById(R.id.indicator);
    mTitleIndicator.setTextColor(0xFF555555);
    mTitleIndicator.setViewPager(mPager);
}

From source file:mobisocial.musubi.ui.fragments.EmailUnclaimedMembersFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    ListView lv = getListView();
    lv.setTextFilterEnabled(true);/*from   ww  w .  j  av  a2  s .c o m*/
    lv.setFastScrollEnabled(true);
    //registerForContextMenu(lv);
    lv.setOnItemClickListener(this);
    lv.setCacheColorHint(Color.WHITE);
}

From source file:net.ustyugov.jtalk.activity.muc.Muc.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    service = JTalkService.getInstance();
    setTheme(Colors.isLight ? R.style.AppThemeLight : R.style.AppThemeDark);
    setTitle(R.string.MUC);// w w  w  .j a va 2 s .c  o  m
    getActionBar().setDisplayHomeAsUpEnabled(true);
    setContentView(R.layout.paged_activity);

    LinearLayout linear = (LinearLayout) findViewById(R.id.linear);
    linear.setBackgroundColor(Colors.BACKGROUND);

    MainPageAdapter adapter = new MainPageAdapter(mPages);
    LayoutInflater inflater = LayoutInflater.from(this);

    Cursor cursor = service.getContentResolver().query(JTalkProvider.ACCOUNT_URI, null,
            AccountDbHelper.ENABLED + " = '" + 1 + "'", null, null);
    if (cursor != null && cursor.getCount() > 0) {
        cursor.moveToFirst();
        do {
            final String account = cursor.getString(cursor.getColumnIndex(AccountDbHelper.JID)).trim();

            View page = inflater.inflate(R.layout.list_activity, null);
            page.setTag(account);
            mPages.add(page);

            ListView list = (ListView) page.findViewById(R.id.list);
            list.setDividerHeight(0);
            list.setCacheColorHint(0x00000000);
            list.setOnItemClickListener(new OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                    RosterItem item = (RosterItem) parent.getItemAtPosition(position);
                    String name = item.getName();
                    String account = item.getAccount();

                    if (item.isGroup()) {
                        if (item.isCollapsed()) {
                            while (service.getCollapsedGroups().contains(name))
                                service.getCollapsedGroups().remove(name);
                            item.setCollapsed(false);
                        } else {
                            service.getCollapsedGroups().add(name);
                            item.setCollapsed(true);
                        }
                        updateList();
                    } else if (item.isEntry()) {
                        RosterEntry re = item.getEntry();
                        String jid = re.getUser();
                        Intent i = new Intent(Muc.this, Chat.class);
                        i.putExtra("account", account);
                        i.putExtra("jid", jid);
                        startActivity(i);
                    } else if (item.isMuc()) {
                        Intent i = new Intent(Muc.this, Chat.class);
                        i.putExtra("account", account);
                        i.putExtra("jid", item.getName());
                        startActivity(i);
                    }
                }
            });

            list.setOnItemLongClickListener(new OnItemLongClickListener() {
                @Override
                public boolean onItemLongClick(AdapterView<?> parent, View v, int position, long id) {
                    RosterItem item = (RosterItem) parent.getItemAtPosition(position);
                    if (item.isGroup()) {
                        //
                    } else if (item.isEntry()) {
                        String j = item.getEntry().getUser();
                        String group = StringUtils.parseBareAddress(j);
                        String nick = StringUtils.parseResource(j);
                        MucDialogs.userMenu(Muc.this, item.getAccount(), group, nick);
                    } else if (item.isMuc()) {
                        MucDialogs.roomMenu(Muc.this, item.getAccount(), item.getName());
                    }
                    return true;
                }
            });

            MucRosterAdapter mra = new MucRosterAdapter(this, account);
            list.setAdapter(mra);
            adapters.add(mra);

        } while (cursor.moveToNext());
        cursor.close();
    }

    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(adapter);
    mPager.setCurrentItem(0);

    TitlePageIndicator mTitleIndicator = (TitlePageIndicator) findViewById(R.id.indicator);
    mTitleIndicator.setTextColor(0xFF555555);
    mTitleIndicator.setViewPager(mPager);
}

From source file:net.ustyugov.jtalk.activity.note.NotesActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    service = JTalkService.getInstance();
    setTheme(Colors.isLight ? R.style.AppThemeLight : R.style.AppThemeDark);
    setTitle(R.string.notes);/* w  ww.  jav a 2 s .c o m*/
    getActionBar().setDisplayHomeAsUpEnabled(true);
    setContentView(R.layout.paged_activity);

    LinearLayout linear = (LinearLayout) findViewById(R.id.linear);
    linear.setBackgroundColor(Colors.BACKGROUND);

    LayoutInflater inflater = LayoutInflater.from(this);
    MainPageAdapter adapter = new MainPageAdapter(mPages);

    Cursor cursor = service.getContentResolver().query(JTalkProvider.ACCOUNT_URI, null,
            AccountDbHelper.ENABLED + " = '" + 1 + "'", null, null);
    if (cursor != null && cursor.getCount() > 0) {
        cursor.moveToFirst();
        do {
            final String account = cursor.getString(cursor.getColumnIndex(AccountDbHelper.JID)).trim();

            View templatePage = inflater.inflate(R.layout.list_activity, null);
            templatePage.setTag(account);
            mPages.add(templatePage);

            ListView list = (ListView) templatePage.findViewById(R.id.list);
            list.setDividerHeight(1);
            list.setCacheColorHint(0x00000000);
            list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
                @Override
                public boolean onItemLongClick(AdapterView<?> parent, View v, int position, long id) {
                    final Note note = (Note) parent.getItemAtPosition(position);
                    CharSequence[] items = new CharSequence[2];
                    items[0] = getString(R.string.Edit);
                    items[1] = getString(R.string.Remove);

                    AlertDialog.Builder builder = new AlertDialog.Builder(NotesActivity.this);
                    builder.setTitle(R.string.Actions);
                    builder.setItems(items, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            switch (which) {
                            case 0:
                                createDialog(account, note);
                                break;
                            case 1:
                                try {
                                    NoteManager nm = NoteManager.getNoteManager(service.getConnection(account));
                                    nm.removeNote(note);
                                    updateNotes();
                                } catch (Exception ignored) {
                                }
                                break;
                            }
                        }
                    });
                    builder.create().show();
                    return true;
                }
            });

        } while (cursor.moveToNext());
        cursor.close();
    }

    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(adapter);
    mPager.setCurrentItem(0);

    TitlePageIndicator mTitleIndicator = (TitlePageIndicator) findViewById(R.id.indicator);
    mTitleIndicator.setTextColor(0xFF555555);
    mTitleIndicator.setViewPager(mPager);
}

From source file:com.mrpoid.mrplist.ui.MrpListFragment.java

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

    initPathStack();//w w w . j a  v a2 s  . co m

    setHasOptionsMenu(true);
    setListShown(false);

    mAdapter = new MrpListAdapter(getActivity());
    setListAdapter(mAdapter);

    ListView listView = getListView();
    registerForContextMenu(listView);
    listView.setOnItemLongClickListener(this);

    listView.setFastScrollEnabled(true);
    listView.setCacheColorHint(Color.TRANSPARENT);

    if (PreferencesProvider.Interface.General.getThemeImage(0) >= 2) {
        listView.setDivider(new ColorDrawable(Color.TRANSPARENT));
        listView.setDividerHeight(1);
    }

    getLoaderManager().initLoader(1001, null, this);
}

From source file:net.ustyugov.jtalk.activity.note.TemplatesActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    service = JTalkService.getInstance();
    setTheme(Colors.isLight ? R.style.AppThemeLight : R.style.AppThemeDark);
    setTitle(R.string.Templates);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    setContentView(R.layout.paged_activity);

    LinearLayout linear = (LinearLayout) findViewById(R.id.linear);
    linear.setBackgroundColor(Colors.BACKGROUND);

    LayoutInflater inflater = LayoutInflater.from(this);
    MainPageAdapter adapter = new MainPageAdapter(mPages);

    Cursor cursor = service.getContentResolver().query(JTalkProvider.ACCOUNT_URI, null,
            AccountDbHelper.ENABLED + " = '" + 1 + "'", null, null);
    if (cursor != null && cursor.getCount() > 0) {
        cursor.moveToFirst();//from   w  ww.  j  a  va  2  s. c  om
        do {
            final String account = cursor.getString(cursor.getColumnIndex(AccountDbHelper.JID)).trim();

            View templatePage = inflater.inflate(R.layout.list_activity, null);
            templatePage.setTag(account);
            mPages.add(templatePage);

            ListView list = (ListView) templatePage.findViewById(R.id.list);
            list.setDividerHeight(0);
            list.setCacheColorHint(0x00000000);
            list.setOnItemClickListener(new OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                    Note item = (Note) parent.getItemAtPosition(position);
                    setResult(RESULT_OK, new Intent().putExtra("text", item.getText()));
                    finish();
                }
            });

            list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
                @Override
                public boolean onItemLongClick(AdapterView<?> parent, View v, int position, long id) {
                    final Note note = (Note) parent.getItemAtPosition(position);
                    CharSequence[] items = new CharSequence[2];
                    items[0] = getString(R.string.Edit);
                    items[1] = getString(R.string.Remove);

                    AlertDialog.Builder builder = new AlertDialog.Builder(TemplatesActivity.this);
                    builder.setTitle(R.string.Actions);
                    builder.setItems(items, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            switch (which) {
                            case 0:
                                createDialog(account, note);
                                break;
                            case 1:
                                try {
                                    NoteManager nm = NoteManager.getNoteManager(service.getConnection(account));
                                    nm.removeNote(note);
                                    updateNotes();
                                } catch (Exception ignored) {
                                }
                                break;
                            }
                        }
                    });
                    builder.create().show();
                    return true;
                }
            });

        } while (cursor.moveToNext());
        cursor.close();
    }

    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(adapter);
    mPager.setCurrentItem(0);

    TitlePageIndicator mTitleIndicator = (TitlePageIndicator) findViewById(R.id.indicator);
    mTitleIndicator.setTextColor(0xFF555555);
    mTitleIndicator.setViewPager(mPager);
}

From source file:net.ustyugov.jtalk.activity.muc.Bookmarks.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    service = JTalkService.getInstance();
    setTheme(Colors.isLight ? R.style.AppThemeLight : R.style.AppThemeDark);
    setTitle(R.string.Bookmarks);/*from  w  ww  .  ja v a  2 s. com*/
    getActionBar().setDisplayHomeAsUpEnabled(true);
    setContentView(R.layout.paged_activity);

    LinearLayout linear = (LinearLayout) findViewById(R.id.linear);
    linear.setBackgroundColor(Colors.BACKGROUND);

    LayoutInflater inflater = LayoutInflater.from(this);
    MainPageAdapter adapter = new MainPageAdapter(mPages);

    Cursor cursor = service.getContentResolver().query(JTalkProvider.ACCOUNT_URI, null,
            AccountDbHelper.ENABLED + " = '" + 1 + "'", null, null);
    if (cursor != null && cursor.getCount() > 0) {
        cursor.moveToFirst();
        do {
            final String account = cursor.getString(cursor.getColumnIndex(AccountDbHelper.JID)).trim();

            View bookPage = inflater.inflate(R.layout.list_activity, null);
            bookPage.setTag(account);
            mPages.add(bookPage);

            ListView list = (ListView) bookPage.findViewById(R.id.list);
            list.setDividerHeight(0);
            list.setCacheColorHint(0x00000000);
            list.setOnItemClickListener(new OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                    RosterItem item = (RosterItem) parent.getItemAtPosition(position);
                    BookmarkedConference bc = (BookmarkedConference) item.getObject();
                    String account = item.getAccount();
                    String jid = bc.getJid();
                    String pass = bc.getPassword();
                    String nick = service.getDerivedNick(service.getConnection(account).getUser(), bc);
                    if (!service.getJoinedConferences().containsKey(jid)) {
                        Toast.makeText(Bookmarks.this, "Attempt joining to " + jid, Toast.LENGTH_SHORT).show();
                        service.joinRoom(account, jid, nick, pass);
                    }
                }
            });

            list.setOnItemLongClickListener(new OnItemLongClickListener() {
                @Override
                public boolean onItemLongClick(AdapterView<?> parent, View v, int position, long id) {
                    final RosterItem item = (RosterItem) parent.getItemAtPosition(position);
                    CharSequence[] items = new CharSequence[3];
                    items[0] = getString(R.string.Users);
                    items[1] = getString(R.string.Edit);
                    items[2] = getString(R.string.Remove);

                    AlertDialog.Builder builder = new AlertDialog.Builder(Bookmarks.this);
                    builder.setTitle(R.string.Actions);
                    builder.setItems(items, new OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            switch (which) {
                            case 0:
                                MucDialogs.showUsersDialog(Bookmarks.this, account,
                                        (BookmarkedConference) item.getObject());
                                break;
                            case 1:
                                BookmarksDialogs.EditDialog(Bookmarks.this, account,
                                        (BookmarkedConference) item.getObject());
                                break;
                            case 2:
                                try {
                                    BookmarkedConference bc = (BookmarkedConference) item.getObject();
                                    BookmarkManager bm = BookmarkManager
                                            .getBookmarkManager(service.getConnection(account));
                                    bm.removeBookmarkedConference(bc.getJid());
                                } catch (Exception e) {
                                    Log.e("Remove", e.getLocalizedMessage());
                                }
                                updateBookmarks();
                                break;
                            }
                        }
                    });
                    builder.create().show();
                    return true;
                }
            });

        } while (cursor.moveToNext());
        cursor.close();
    }

    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(adapter);
    mPager.setCurrentItem(0);

    TitlePageIndicator mTitleIndicator = (TitlePageIndicator) findViewById(R.id.indicator);
    mTitleIndicator.setTextColor(0xFF555555);
    mTitleIndicator.setViewPager(mPager);
}

From source file:com.csipsimple.ui.filters.AccountFiltersListFragment.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.
        curCheckFilterId = savedInstanceState.getLong(CURRENT_CHOICE, SipProfile.INVALID_ID);
        //curCheckWizard = savedInstanceState.getString(CURRENT_WIZARD);
    }//from   www  .  j  a v  a2  s . co  m
    setListShown(false);
    if (mAdapter == null) {
        if (mHeaderView != null) {
            lv.addHeaderView(mHeaderView, null, true);
        }
        mAdapter = new AccountFiltersListAdapter(getActivity(), null);
        //getListView().setEmptyView(getActivity().findViewById(R.id.progress_container));
        //getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE);
        setListAdapter(mAdapter);
        registerForContextMenu(lv);

        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.pentacog.mctracker.MCServerTrackerActivity.java

/** Called when the activity is first created. */
@Override/*from   w  w w.  j av a 2 s.c  om*/
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setCacheColorHint(Color.TRANSPARENT);
    lv.setBackgroundResource(R.drawable.dirt_tile);

    registerForContextMenu(lv);

}