Beispiel #1
0
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   CategoryInfo mCategoryInfo = (CategoryInfo) mCategoryAdapter.getItem(position);
   if (mCategoryInfo.hasChildren()) {
     Intent intent = new Intent(getActivity(), SecondCategoryActivity.class);
     if (!TextUtils.isEmpty(mCategoryInfo.getCategoryId())) {
       intent.putExtra(Constants.Intent.EXTRA_CATEGORY_ID, mCategoryInfo.getCategoryId());
       intent.putExtra(Constants.Intent.EXTRA_CATEGORY_NAME, mCategoryInfo.getName());
       getActivity().startActivity(intent);
     }
   } else {
     Intent intent = new Intent(getActivity(), ProductActivity.class);
     if (!TextUtils.isEmpty(mCategoryInfo.getCategoryId())) {
       intent.putExtra(Constants.Intent.EXTRA_CATEGORY_ID, mCategoryInfo.getCategoryId());
       intent.putExtra(Constants.Intent.EXTRA_CATEGORY_NAME, mCategoryInfo.getName());
       intent.putExtra(
           Constants.Intent.EXTRA_CATEGORY_DATA_TYPE, mCategoryInfo.getDataType());
       getActivity().startActivity(intent);
     }
   }
 }
Beispiel #2
0
 @Override
 public void onLoadFinished(Loader<Result> loader, Result data) {
   mCategoryAdapter.updateData(data.mCategoryInfos);
 }