Search in sources :

Example 36 with SimpleAdapter

use of android.widget.SimpleAdapter in project CurtainView by aicaprio.

the class MainActivity method showSample2.

private void showSample2() {
    setContentView(R.layout.activity_sample2);
    final CurtainView curtainView = (CurtainView) findViewById(R.id.cb1);
    final ImageView iv1 = (ImageView) findViewById(R.id.iv1);
    final GridView gv1 = (GridView) findViewById(R.id.gv1);
    final List<Map<String, Integer>> data = getData();
    gv1.setAdapter(new SimpleAdapter(this, data, R.layout.item_numbers, new String[] { TEXT_TAG }, new int[] { R.id.item_tvNum }));
    gv1.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            showToast(data.get(position).get(TEXT_TAG) + " clicked");
        }
    });
    iv1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            curtainView.toggleStatus();
        }
    });
    curtainView.setScrollerInterpolator(new BounceInterpolator());
    curtainView.post(new Runnable() {

        @Override
        public void run() {
            curtainView.setCurtainGravityAndFixedValue(null, iv1.getHeight());
        }
    });
}
Also used : BounceInterpolator(android.view.animation.BounceInterpolator) SimpleAdapter(android.widget.SimpleAdapter) GridView(android.widget.GridView) CurtainView(org.aicaprio.curtainview.CurtainView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) CurtainView(org.aicaprio.curtainview.CurtainView) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView) GridView(android.widget.GridView) HashMap(java.util.HashMap) Map(java.util.Map)

Example 37 with SimpleAdapter

use of android.widget.SimpleAdapter in project XCL-Charts by xcltapestry.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ListView mListView = new ListView(this);
    SimpleAdapter adapter = new SimpleAdapter(this, getData(), android.R.layout.simple_list_item_2, new String[] { "title", "description" }, new int[] { android.R.id.text1, android.R.id.text2 });
    mListView.setAdapter(adapter);
    final LinearLayout layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.addView(mListView);
    setContentView(layout);
    setTitle("XCL-Charts demo");
    OnItemClickListener listener = new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, android.view.View view, int position, long id) {
            // TODO Auto-generated method stub
            String[] chartsTitleCurr = getResources().getStringArray(R.array.chartsTitle);
            if (position > chartsTitleCurr.length - 1)
                return;
            Bundle bundleSimple = new Bundle();
            Intent intent = new Intent();
            bundleSimple.putString("title", chartsTitleCurr[position]);
            int id_desc_3_4 = chartsTitleCurr.length - 4;
            if (// 倒数1 仪表盘
            position == chartsTitleCurr.length - 1) {
                intent.setClass(MainActivity.this, GaugeChartActivity.class);
            } else if (// 倒数2  圆/半圆图
            position == chartsTitleCurr.length - 2) {
                intent.setClass(MainActivity.this, CircleChartActivity.class);
            // }else if(position >= id_desc_1_2_3) //倒数1,2,3 seekbar图
            // {
            // position = chartsTitleCurr.length - 1 - position;
            // intent.setClass(MainActivity.this,SeekBarActivity.class);
            } else if (// 倒数3,4 同源汇总图
            position >= id_desc_3_4) {
                position = chartsTitleCurr.length - 3 - position;
                intent.setClass(MainActivity.this, SpinnerActivity.class);
            } else if (// 倒数5  scroll view line
            position >= chartsTitleCurr.length - 5) {
                intent.setClass(MainActivity.this, HLNScrollActivity.class);
            } else if (// 倒数6  scroll view bar
            position >= chartsTitleCurr.length - 6) {
                intent.setClass(MainActivity.this, HBARScrollActivity.class);
            } else if (// 倒数6  scroll view bar
            position >= chartsTitleCurr.length - 7) {
                position = chartsTitleCurr.length - 7 - position;
                intent.setClass(MainActivity.this, ClickChartsActivity.class);
            } else if (// 倒数8  dial chart
            position >= chartsTitleCurr.length - 8) {
                position = chartsTitleCurr.length - 8 - position;
                intent.setClass(MainActivity.this, DialChartActivity.class);
            } else if (// 倒数9  dial chart
            position >= chartsTitleCurr.length - 9) {
                position = chartsTitleCurr.length - 9 - position;
                intent.setClass(MainActivity.this, DialChart2Activity.class);
            } else if (// 倒数9  dial chart
            position >= chartsTitleCurr.length - 10) {
                position = chartsTitleCurr.length - 10 - position;
                intent.setClass(MainActivity.this, DialChart3Activity.class);
            } else if (// 倒数9  dial chart
            position >= chartsTitleCurr.length - 11) {
                position = chartsTitleCurr.length - 11 - position;
                intent.setClass(MainActivity.this, DialChart4Activity.class);
            } else if (// 倒数9  dial chart
            position >= chartsTitleCurr.length - 12) {
                position = chartsTitleCurr.length - 12 - position;
                intent.setClass(MainActivity.this, DySpActivity.class);
            } else {
                intent.setClass(MainActivity.this, ChartsActivity.class);
            }
            /*
				 if(position >= chartsTitleCurr.length - 3) //倒数1,2,3 seekbar图
				 {
					 position = chartsTitleCurr.length - 1 - position;
					 intent.setClass(MainActivity.this,SeekBarActivity.class);						
				 }else if(position >= chartsTitleCurr.length - 5) ////倒数4,5 同源汇总图
				 {
					 position = chartsTitleCurr.length - 4 - position;
					 intent.setClass(MainActivity.this,SpinnerActivity.class);						
				 }else{				
					 intent.setClass(MainActivity.this,ChartsActivity.class);					
				 }	
				 */
            bundleSimple.putInt("selected", position);
            intent.putExtras(bundleSimple);
            startActivity(intent);
        }
    };
    mListView.setOnItemClickListener(listener);
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Bundle(android.os.Bundle) SimpleAdapter(android.widget.SimpleAdapter) Intent(android.content.Intent) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) LinearLayout(android.widget.LinearLayout)

Example 38 with SimpleAdapter

use of android.widget.SimpleAdapter in project platform_frameworks_base by android.

the class HwTests method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    String path = intent.getStringExtra("com.android.test.hwui.Path");
    if (path == null) {
        path = "";
    }
    setListAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
    getListView().setTextFilterEnabled(true);
}
Also used : SimpleAdapter(android.widget.SimpleAdapter) Intent(android.content.Intent)

Example 39 with SimpleAdapter

use of android.widget.SimpleAdapter in project platform_frameworks_base by android.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ListView lv = (ListView) findViewById(android.R.id.list);
    lv.setDrawSelectorOnTop(true);
    lv.setAdapter(new SimpleAdapter(this, SAMPLES, R.layout.item_layout, new String[] { KEY_NAME }, new int[] { android.R.id.text1 }));
    lv.setOnItemClickListener(this);
    getActionBar().setTitle("MainActivity");
}
Also used : ListView(android.widget.ListView) SimpleAdapter(android.widget.SimpleAdapter)

Example 40 with SimpleAdapter

use of android.widget.SimpleAdapter in project platform_frameworks_base by android.

the class MainActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    String path = intent.getStringExtra(EXTRA_PATH);
    if (path == null) {
        path = "";
    } else {
        // not root level, display where we are in the hierarchy
        setTitle(path);
    }
    FragmentManager fm = getSupportFragmentManager();
    if (fm.findFragmentById(android.R.id.content) == null) {
        ListFragment listFragment = new TestListFragment();
        listFragment.setListAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
        fm.beginTransaction().add(android.R.id.content, listFragment).commit();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) ListFragment(android.support.v4.app.ListFragment) SimpleAdapter(android.widget.SimpleAdapter) Intent(android.content.Intent)

Aggregations

SimpleAdapter (android.widget.SimpleAdapter)72 Intent (android.content.Intent)29 ListView (android.widget.ListView)18 HashMap (java.util.HashMap)15 View (android.view.View)12 AdapterView (android.widget.AdapterView)12 Map (java.util.Map)9 ImageView (android.widget.ImageView)6 TextView (android.widget.TextView)6 FragmentManager (android.support.v4.app.FragmentManager)4 ListFragment (android.support.v4.app.ListFragment)4 OnClickListener (android.view.View.OnClickListener)4 ArrayList (java.util.ArrayList)4 Context (android.content.Context)3 ViewGroup (android.view.ViewGroup)3 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)3 ListAdapter (android.widget.ListAdapter)3 SharedPreferences (android.content.SharedPreferences)2 AssetManager (android.content.res.AssetManager)2 SQLException (android.database.SQLException)2