Search in sources :

Example 1 with NavigationModel

use of cn.eoe.app.entity.NavigationModel in project android-app by eoecn.

the class MainActivity method initListView.

private void initListView() {
    lvAdapter = new SimpleAdapter(this, getData(), R.layout.behind_list_show, new String[] { LIST_TEXT, LIST_IMAGEVIEW }, new int[] { R.id.textview_behind_title, R.id.imageview_behind_icon }) {

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            // TODO Auto-generated method stub.
            View view = super.getView(position, convertView, parent);
            if (position == mTag) {
                view.setBackgroundResource(R.drawable.back_behind_list);
                lvTitle.setTag(view);
            } else {
                view.setBackgroundColor(Color.TRANSPARENT);
            }
            return view;
        }
    };
    lvTitle.setAdapter(lvAdapter);
    lvTitle.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            NavigationModel navModel = navs.get(position);
            mAboveTitle.setText(navModel.getName());
            current_page = navModel.getTags();
            if (lvTitle.getTag() != null) {
                if (lvTitle.getTag() == view) {
                    MainActivity.this.showContent();
                    return;
                }
                ((View) lvTitle.getTag()).setBackgroundColor(Color.TRANSPARENT);
            }
            lvTitle.setTag(view);
            view.setBackgroundResource(R.drawable.back_behind_list);
            imgQuery.setVisibility(View.VISIBLE);
            switch(position) {
                case 0:
                    imgQuery.setVisibility(View.GONE);
                    new MyTask().execute(topDao);
                    break;
                case 1:
                    new MyTask().execute(newsDao);
                    break;
                case 2:
                    new MyTask().execute(wikiDao);
                    break;
                case 3:
                    new MyTask().execute(blogsDao);
                    break;
            }
        }
    });
}
Also used : NavigationModel(cn.eoe.app.entity.NavigationModel) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) ViewGroup(android.view.ViewGroup) SimpleAdapter(android.widget.SimpleAdapter) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 2 with NavigationModel

use of cn.eoe.app.entity.NavigationModel in project android-app by eoecn.

the class MainActivity method initNav.

private void initNav() {
    navs = new ArrayList<NavigationModel>();
    NavigationModel nav1 = new NavigationModel(getResources().getString(R.string.menuGood), "");
    NavigationModel nav2 = new NavigationModel(getResources().getString(R.string.menuNews), Constants.TAGS.NEWS_TAG);
    NavigationModel nav3 = new NavigationModel(getResources().getString(R.string.menuStudio), Constants.TAGS.WIKI_TAG);
    NavigationModel nav4 = new NavigationModel(getResources().getString(R.string.menuBlog), Constants.TAGS.BLOG_TAG);
    Collections.addAll(navs, nav1, nav2, nav3, nav4);
}
Also used : NavigationModel(cn.eoe.app.entity.NavigationModel)

Aggregations

NavigationModel (cn.eoe.app.entity.NavigationModel)2 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 SimpleAdapter (android.widget.SimpleAdapter)1 TextView (android.widget.TextView)1