Search in sources :

Example 1 with SearchAdapter

use of cn.liuyin.manhua.adapter.SearchAdapter in project Manhua by ag2s20150909.

the class SearchActivity method showList.

private void showList(final SearchResult data) {
    SearchAdapter adapter = new SearchAdapter(this, data);
    lv.setLayoutAnimation(new LayoutAnimationController(AnimationUtils.loadAnimation(this, R.anim.list_animation), 0.5f));
    lv.setAdapter(adapter);
    Toast.makeText(getApplicationContext(), "共有" + (data.results.size()) + "条结果", Toast.LENGTH_LONG).show();
    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> p1, View p2, int p3, long p4) {
            try {
                BookShelf.addBook(data.results.get(p3));
                Intent i = new Intent(getApplicationContext(), ListActivity.class);
                i.putExtra("url", data.results.get(p3).link);
                i.putExtra("book", data.results.get(p3));
                // Toast.makeText(getApplicationContext(), data.get(p3).get("link"), 1).show();
                startActivity(i);
            } catch (Exception e) {
                mHander.obtainMessage(0, e.getMessage()).sendToTarget();
            }
        }
    });
}
Also used : SearchAdapter(cn.liuyin.manhua.adapter.SearchAdapter) LayoutAnimationController(android.view.animation.LayoutAnimationController) AdapterView(android.widget.AdapterView) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Example 2 with SearchAdapter

use of cn.liuyin.manhua.adapter.SearchAdapter in project Manhua by ag2s20150909.

the class HomeActivity method showList.

private void showList(final SearchResult data) {
    SearchAdapter adapter = new SearchAdapter(this, data);
    lv.setLayoutAnimation(new LayoutAnimationController(AnimationUtils.loadAnimation(this, R.anim.list_animation), 0.5f));
    lv.setAdapter(adapter);
    Toast.makeText(getApplicationContext(), "共有" + (data.results.size()) + "条结果", Toast.LENGTH_LONG).show();
    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> p1, View p2, int p3, long p4) {
            try {
                BookShelf.addBook(data.results.get(p3));
                Intent i = new Intent(getApplicationContext(), ListActivity.class);
                i.putExtra("url", data.results.get(p3).link);
                i.putExtra("book", data.results.get(p3));
                // Toast.makeText(getApplicationContext(), data.get(p3).get("link"), 1).show();
                startActivity(i);
            } catch (Exception e) {
                mHander.obtainMessage(0, e.getMessage()).sendToTarget();
            }
        }
    });
}
Also used : SearchAdapter(cn.liuyin.manhua.adapter.SearchAdapter) LayoutAnimationController(android.view.animation.LayoutAnimationController) AdapterView(android.widget.AdapterView) Intent(android.content.Intent) HorizontalScrollView(android.widget.HorizontalScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Aggregations

Intent (android.content.Intent)2 View (android.view.View)2 LayoutAnimationController (android.view.animation.LayoutAnimationController)2 AdapterView (android.widget.AdapterView)2 ListView (android.widget.ListView)2 SearchAdapter (cn.liuyin.manhua.adapter.SearchAdapter)2 HorizontalScrollView (android.widget.HorizontalScrollView)1