Search in sources :

Example 86 with ListView

use of android.widget.ListView in project Hummingbird-for-Android by xiprox.

the class NavigationDrawerFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_navigation_drawer, null);
    String[] ArrayMain = getResources().getStringArray(R.array.list_main_strings);
    String[] ArraySecond = getResources().getStringArray(R.array.list_secondary_strings);
    ListView mListMain = (ListView) rootView.findViewById(R.id.nav_list_main);
    ListView mListSecondary = (ListView) rootView.findViewById(R.id.nav_list_second);
    mUsername = (TextView) rootView.findViewById(R.id.navigation_drawer_username);
    mAvatar = (ImageView) rootView.findViewById(R.id.navigation_drawer_avatar);
    mCoverImage = (ImageView) rootView.findViewById(R.id.navigation_drawer_cover);
    mProfile = (FrameLayout) rootView.findViewById(R.id.navigation_drawer_profile);
    mProfile.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            getFragmentManager().beginTransaction().replace(R.id.container, new UserInfoFragment()).commit();
            mDrawerLayout.closeDrawer(mFragmentContainerView);
            selectItem(ITEM_POSITION_PROFILE);
        }
    });
    username = prefMan.getUsername();
    mUsername.setText(username);
    new LoadTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    mListMain.setAdapter(new ArrayAdapter<String>(getActivity(), R.layout.item_nav_main, ArrayMain));
    mListSecondary.setAdapter(new ArrayAdapter<String>(getActivity(), R.layout.item_nav_secondary, ArraySecond));
    mListMain.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            selectItem(position);
        }
    });
    mListSecondary.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            switch(position) {
                case 0:
                    // TODO - Settings
                    Toast.makeText(context, "YOU SHALL NOT PASS!", Toast.LENGTH_LONG).show();
                    break;
                case 1:
                    showLogoutDialog();
                    break;
            }
        }
    });
    selectItem(mCurrentSelectedPosition);
    return rootView;
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView)

Example 87 with ListView

use of android.widget.ListView in project ExpandTabView by yueyueniao2012.

the class ViewMiddle method init.

private void init(Context context) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.view_region, this, true);
    regionListView = (ListView) findViewById(R.id.listView);
    plateListView = (ListView) findViewById(R.id.listView2);
    setBackgroundDrawable(getResources().getDrawable(R.drawable.choosearea_bg_left));
    for (int i = 0; i < 10; i++) {
        groups.add(i + "行");
        LinkedList<String> tItem = new LinkedList<String>();
        for (int j = 0; j < 15; j++) {
            tItem.add(i + "行" + j + "列");
        }
        children.put(i, tItem);
    }
    earaListViewAdapter = new TextAdapter(context, groups, R.drawable.choose_item_selected, R.drawable.choose_eara_item_selector);
    earaListViewAdapter.setTextSize(17);
    earaListViewAdapter.setSelectedPositionNoNotify(tEaraPosition);
    regionListView.setAdapter(earaListViewAdapter);
    earaListViewAdapter.setOnItemClickListener(new TextAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            if (position < children.size()) {
                childrenItem.clear();
                childrenItem.addAll(children.get(position));
                plateListViewAdapter.notifyDataSetChanged();
            }
        }
    });
    if (tEaraPosition < children.size())
        childrenItem.addAll(children.get(tEaraPosition));
    plateListViewAdapter = new TextAdapter(context, childrenItem, R.drawable.choose_item_right, R.drawable.choose_plate_item_selector);
    plateListViewAdapter.setTextSize(15);
    plateListViewAdapter.setSelectedPositionNoNotify(tBlockPosition);
    plateListView.setAdapter(plateListViewAdapter);
    plateListViewAdapter.setOnItemClickListener(new TextAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(View view, final int position) {
            showString = childrenItem.get(position);
            if (mOnSelectListener != null) {
                mOnSelectListener.getValue(showString);
            }
        }
    });
    if (tBlockPosition < childrenItem.size())
        showString = childrenItem.get(tBlockPosition);
    if (showString.contains("不限")) {
        showString = showString.replace("不限", "");
    }
    setDefaultSelect();
}
Also used : LayoutInflater(android.view.LayoutInflater) TextAdapter(com.example.adapter.TextAdapter) View(android.view.View) ListView(android.widget.ListView) LinkedList(java.util.LinkedList)

Example 88 with ListView

use of android.widget.ListView in project android-priority-jobqueue by yigit.

the class SampleTwitterClient method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    dataDirty = true;
    setContentView(R.layout.main);
    jobManager = TwitterApplication.getInstance().getJobManager();
    ListView listView = (ListView) findViewById(R.id.tweet_list);
    tweetAdapter = new TweetAdapter(getLayoutInflater());
    findViewById(R.id.send_tweet).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            EditText text = (EditText) findViewById(R.id.edit_status);
            if (text.getText().toString().trim().length() > 0) {
                sendTweet(text.getText().toString());
                text.setText("");
            }
        }
    });
    listView.setAdapter(tweetAdapter);
    EventBus.getDefault().register(this);
}
Also used : EditText(android.widget.EditText) ListView(android.widget.ListView) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView)

Example 89 with ListView

use of android.widget.ListView in project XobotOS by xamarin.

the class AlertController method setBackground.

private void setBackground(LinearLayout topPanel, LinearLayout contentPanel, View customPanel, boolean hasButtons, TypedArray a, boolean hasTitle, View buttonPanel) {
    /* Get all the different background required */
    int fullDark = a.getResourceId(R.styleable.AlertDialog_fullDark, R.drawable.popup_full_dark);
    int topDark = a.getResourceId(R.styleable.AlertDialog_topDark, R.drawable.popup_top_dark);
    int centerDark = a.getResourceId(R.styleable.AlertDialog_centerDark, R.drawable.popup_center_dark);
    int bottomDark = a.getResourceId(R.styleable.AlertDialog_bottomDark, R.drawable.popup_bottom_dark);
    int fullBright = a.getResourceId(R.styleable.AlertDialog_fullBright, R.drawable.popup_full_bright);
    int topBright = a.getResourceId(R.styleable.AlertDialog_topBright, R.drawable.popup_top_bright);
    int centerBright = a.getResourceId(R.styleable.AlertDialog_centerBright, R.drawable.popup_center_bright);
    int bottomBright = a.getResourceId(R.styleable.AlertDialog_bottomBright, R.drawable.popup_bottom_bright);
    int bottomMedium = a.getResourceId(R.styleable.AlertDialog_bottomMedium, R.drawable.popup_bottom_medium);
    /*
         * We now set the background of all of the sections of the alert.
         * First collect together each section that is being displayed along
         * with whether it is on a light or dark background, then run through
         * them setting their backgrounds.  This is complicated because we need
         * to correctly use the full, top, middle, and bottom graphics depending
         * on how many views they are and where they appear.
         */
    View[] views = new View[4];
    boolean[] light = new boolean[4];
    View lastView = null;
    boolean lastLight = false;
    int pos = 0;
    if (hasTitle) {
        views[pos] = topPanel;
        light[pos] = false;
        pos++;
    }
    /* The contentPanel displays either a custom text message or
         * a ListView. If it's text we should use the dark background
         * for ListView we should use the light background. If neither
         * are there the contentPanel will be hidden so set it as null.
         */
    views[pos] = (contentPanel.getVisibility() == View.GONE) ? null : contentPanel;
    light[pos] = mListView != null;
    pos++;
    if (customPanel != null) {
        views[pos] = customPanel;
        light[pos] = mForceInverseBackground;
        pos++;
    }
    if (hasButtons) {
        views[pos] = buttonPanel;
        light[pos] = true;
    }
    boolean setView = false;
    for (pos = 0; pos < views.length; pos++) {
        View v = views[pos];
        if (v == null) {
            continue;
        }
        if (lastView != null) {
            if (!setView) {
                lastView.setBackgroundResource(lastLight ? topBright : topDark);
            } else {
                lastView.setBackgroundResource(lastLight ? centerBright : centerDark);
            }
            setView = true;
        }
        lastView = v;
        lastLight = light[pos];
    }
    if (lastView != null) {
        if (setView) {
            /* ListViews will use the Bright background but buttons use
                 * the Medium background.
                 */
            lastView.setBackgroundResource(lastLight ? (hasButtons ? bottomMedium : bottomBright) : bottomDark);
        } else {
            lastView.setBackgroundResource(lastLight ? fullBright : fullDark);
        }
    }
    if ((mListView != null) && (mAdapter != null)) {
        mListView.setAdapter(mAdapter);
        if (mCheckedItem > -1) {
            mListView.setItemChecked(mCheckedItem, true);
            mListView.setSelection(mCheckedItem);
        }
    }
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) CheckedTextView(android.widget.CheckedTextView) ListView(android.widget.ListView)

Example 90 with ListView

use of android.widget.ListView in project Android-skin-support by ximsfei.

the class SplashActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    initToolbar();
    mListView = (ListView) findViewById(R.id.list);
    mListView.setCacheColorHint(Color.TRANSPARENT);
    mListView.setFadingEdgeLength(0);
    mListView.setAdapter(new HomeAdapter(mContext, mItems));
    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent(mContext, mClasses[position]);
            startActivity(intent);
        }
    });
}
Also used : AdapterView(android.widget.AdapterView) Intent(android.content.Intent) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Aggregations

ListView (android.widget.ListView)1139 View (android.view.View)739 AdapterView (android.widget.AdapterView)444 TextView (android.widget.TextView)389 ImageView (android.widget.ImageView)167 Intent (android.content.Intent)148 AbsListView (android.widget.AbsListView)135 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)97 ArrayAdapter (android.widget.ArrayAdapter)97 ArrayList (java.util.ArrayList)81 ViewGroup (android.view.ViewGroup)75 ListAdapter (android.widget.ListAdapter)71 OnClickListener (android.view.View.OnClickListener)65 LayoutInflater (android.view.LayoutInflater)63 Bundle (android.os.Bundle)57 Button (android.widget.Button)55 LinearLayout (android.widget.LinearLayout)50 SuppressLint (android.annotation.SuppressLint)34 DialogInterface (android.content.DialogInterface)34 ScrollView (android.widget.ScrollView)31