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());
}
});
}
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);
}
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);
}
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");
}
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();
}
}
Aggregations