use of android.widget.SimpleAdapter in project CurtainView by aicaprio.
the class SampleActivity method showSample2.
private void showSample2() {
setContentView(R.layout.activity_sample2);
final CurtainView curtainView = (CurtainView) findViewById(R.id.cv1);
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 AnimeTaste by daimajia.
the class StartActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContext = this;
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
mVideoList = (ListView) findViewById(R.id.videoList);
mDrawerList = (ListView) findViewById(R.id.function_list);
mDrawer = (LinearLayout) findViewById(R.id.drawer);
mLayoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mCategoryList = (ListView) findViewById(R.id.category_list);
mFooterView = mLayoutInflater.inflate(R.layout.load_item, null);
mLoadProgress = (ProgressBar) mFooterView.findViewById(R.id.loading);
mLoadText = (TextView) mFooterView.findViewById(R.id.load_text);
mVideoList.addFooterView(mFooterView);
mVideoList.setOnScrollListener(this);
mDrawer.setOnTouchListener(this);
View headerView = mLayoutInflater.inflate(R.layout.gallery_item, null, false);
mVideoList.addHeaderView(headerView);
mRecommendPager = (ViewPager) headerView.findViewById(R.id.pager);
mRecommendPager.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
PointF downP = new PointF();
PointF curP = new PointF();
int act = event.getAction();
if (act == MotionEvent.ACTION_DOWN || act == MotionEvent.ACTION_MOVE || act == MotionEvent.ACTION_UP) {
((ViewGroup) v).requestDisallowInterceptTouchEvent(true);
if (downP.x == curP.x && downP.y == curP.y) {
return false;
}
}
return false;
}
});
mRecommendIndicator = (UnderlinePageIndicator) headerView.findViewById(R.id.indicator);
if (getIntent().hasExtra("Success")) {
init(getIntent());
} else {
Toast.makeText(mContext, R.string.init_failed, Toast.LENGTH_SHORT).show();
finish();
}
mDrawerAapter = new SimpleAdapter(this, getDrawerItems(), R.layout.drawer_item, new String[] { "img", "title" }, new int[] { R.id.item_icon, R.id.item_name });
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_action_navigation_menu, R.string.app_name, R.string.app_name) {
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
if (mPreviousType != mType || mPreviousCategoryId != mCategoryId) {
mCurrentPage = 1;
mIsEnd = false;
mVideoAdapter.removeAllData();
mFooterView.findViewById(R.id.loading).setVisibility(View.VISIBLE);
mFooterView.findViewById(R.id.load_text).setVisibility(View.INVISIBLE);
triggerApiConnector();
}
}
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
mPreviousType = mType;
mPreviousCategoryId = mCategoryId;
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
mDrawerList.setAdapter(mDrawerAapter);
mDrawerList.setOnItemClickListener(this);
ViewUtils.setListViewHeightBasedOnChildren(mDrawerList);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayUseLogoEnabled(true);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
getSupportActionBar().setLogo(R.drawable.rsz_ab_icon);
rateForUsOrCheckUpdate();
showWhatsNew();
}
use of android.widget.SimpleAdapter in project android-demos by novoda.
the class DynamicListItems method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dynamic_list);
newValue = (EditText) findViewById(R.id.new_value_field);
setListAdapter(new SimpleAdapter(this, list, R.layout.row, new String[] { ITEM_KEY }, new int[] { R.id.list_value }));
((ImageButton) findViewById(R.id.button)).setOnClickListener(getBtnClickListener());
}
use of android.widget.SimpleAdapter in project android_frameworks_base by ResurrectionRemix.
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 android_frameworks_base by ResurrectionRemix.
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