Android 使用片段时复制ActionBar
我正在尝试用片段和ActionBar构建一个运行在Android 4.0上的应用程序。我遇到的问题是,有时,当使用片段时,我的ActionBar会被复制,如下所示: 主屏幕,一切正常: [主屏幕][ 另一个屏幕,复制的ActionBar: [商店屏幕][ 您将在下面找到主导航.xml代码:Android 使用片段时复制ActionBar,android,android-layout,android-fragments,android-actionbar,android-actionbar-compat,Android,Android Layout,Android Fragments,Android Actionbar,Android Actionbar Compat,我正在尝试用片段和ActionBar构建一个运行在Android 4.0上的应用程序。我遇到的问题是,有时,当使用片段时,我的ActionBar会被复制,如下所示: 主屏幕,一切正常: [主屏幕][ 另一个屏幕,复制的ActionBar: [商店屏幕][ 您将在下面找到主导航.xml代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/Theme.AppCompat.NoActionBar">
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include
layout="@layout/cart_sidebar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="#ffffff"
/>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
然后我的ShopActivity类扩展了AppCompatActivity:
public class ShopActivity extends AppCompatActivity {
ListView lvShopItems, lvCategorylist;
ArrayList<ProductCategory> prodCats = new ArrayList<ProductCategory>();
ArrayList<Item> products = new ArrayList<Item>();
ArrayList<Category> categories;
ArrayList<Item> items;
static String slug = "0";
GiloAdapter mAdapter;
CategoryItemsAdapter catAdapter;
ArrayList<Category> categories_with_slug = new ArrayList<Category>();
ShopItemsAdapter shopItemsAdapter;
ArrayList<Item> items_with_slug = new ArrayList<Item>();
static ArrayList<Category> path = new ArrayList<Category>();
HListView hlBreadCrumbs;
SlidingMenu menuRight, menu ;
Thread timer;
BackPressListener backPressListener;
public static Item curr_item;
BreadCrumbsAdapter breadCrumbsAdapter;
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.sliding_menu);
final DataContainer dataContainer = ((DataContainer) getApplicationContext());
menu = (SlidingMenu) findViewById(R.id.slidingmenulayout);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidth(30);
// menu.setShadowDrawable(R.drawable.shadow);
menu.setBehindOffset(getResources().getDisplayMetrics().widthPixels/2 - 100);
menu.setFadeDegree(0.35f);
//menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setMenu(R.layout.category_sidebar);
menu.showMenu();
slug = ShopDrawerActivity.slug;
slug="0";
//categories = dataContainer.getCategories();
//items = dataContainer.getItems();
categories = new ArrayList<Category>();
for(Category category : dataContainer.getCategories()){
categories.add(category);
}
Collections.sort(categories, new SequenceComparator());
items = new ArrayList<Item>();
for(Item item : dataContainer.getItems()){
items.add(item);
}
products = items;
Log.d("items number", String.valueOf(items.size()));
//prodCats = dataContainer.getProdcats();
prodCats = new ArrayList<ProductCategory>();
for(ProductCategory prodCat : dataContainer.getProdcats()){
prodCats.add(prodCat);
}
getPath(slug);
lvShopItems = (ListView) findViewById(R.id.lvShopItems);
getItems(slug);
shopItemsAdapter = new ShopItemsAdapter(ShopActivity.this, items_with_slug);
lvShopItems.setAdapter(shopItemsAdapter);
lvCategorylist = (ListView) findViewById(R.id.lvCategoryItems);
getCategories(slug);
catAdapter = new CategoryItemsAdapter(this, categories_with_slug);
lvCategorylist.setAdapter(catAdapter);
lvCategorylist.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
long arg3) {
// TODO Auto-generated method stub
if (pos > 1) {
slug = categories_with_slug.get(pos - 2).getSlug();
updateLists();
}
}
});
breadCrumbsAdapter = new BreadCrumbsAdapter(this, path);
hlBreadCrumbs = (HListView) findViewById(R.id.hlShop_breadcrumb);
hlBreadCrumbs.setAdapter(breadCrumbsAdapter);
// hlBreadCrumbs.setOnItemClickListener(new OnItemClickListener() {
//
// @Override
// public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
// long arg3) {
// // TODO Auto-generated method stub
//
// if(pos == 0){
// slug = "none";
// }else{
// slug = path.get(path.size() - pos).getSlug();
// }
// updateLists();
//
// }
// });
final Handler myHandler = new Handler() {
public void handleMessage(Message msg) {
onDrawerBackPressed();
}
};
ShopDrawerActivity.setBackPressListener(new BackPressListener() {
@Override
public void onPreExecute() {
// TODO Auto-generated method stub
}
@Override
public void onComplete(Boolean back_pressed) {
// TODO Auto-generated method stub
onDrawerBackPressed();
}
});
Log.d("Category with slug 0", getCategoryWithSlug("0").getName());
}
public void onDrawerBackPressed() {
if(path.size() == 0){
finish();
}else{
path.remove(0);
if(path.size() != 0){
slug = path.get(0).getSlug();
updateLists();
}else{
slug = "0";
updateLists();
}
}
Log.d("Back Pressed", "back pressed");
}
public void updateLists() {
while (categories_with_slug.size() != 0) {
categories_with_slug.remove(0);
}
while (items_with_slug.size() != 0) {
items_with_slug.remove(0);
}
while (path.size() != 0) {
path.remove(0);
}
getPath(slug);
getCategories(slug);
getItems(slug);
catAdapter.notifyDataSetChanged();
shopItemsAdapter.notifyDataSetChanged();
breadCrumbsAdapter.notifyDataSetChanged();
hlBreadCrumbs.smoothScrollToPosition(breadCrumbsAdapter.getCount() - 1);
}
public void getCategories(String slug) {
for (Category category : categories) {
Log.d("category parent id", String.valueOf(category.getParent_id()));
if (category.getParent_id() == Integer.parseInt(slug)) {
categories_with_slug.add(category);
Log.d("slug", category.getSlug());
}
}
Log.d("categories with slug size", String.valueOf(categories_with_slug.size()));
}
public void getPath(String slug){
String parent = slug;
String cats = "";
int i = 50;
while (!parent.equals("0") && i > 0) {
cats+= parent;
Log.d("path", cats);
Category category = getCategoryWithSlug(parent);
if(!path.contains(category))
path.add(category);
parent = category.getParent();
i--;
}
Log.d("path", cats);
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem searchViewMenuItem = menu.findItem(R.id.mnSearch);
SearchView mSearchView = (SearchView) searchViewMenuItem.getActionView();
int searchImgId = getResources().getIdentifier("android:id/search_button", null, null);
ImageView v = (ImageView) mSearchView.findViewById(searchImgId);
v.setImageResource(R.drawable.search);
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_shopping, menu);
return true;
}
public Category getCategoryWithSlug(String slug) {
Category result = new Category();
for (Category category : categories) {
if (Integer.parseInt(category.getSlug()) == Integer.parseInt(slug)) {
return category;
}
}
return result;
}
public int getItemsUnderCategory(String slug) {
int result = 0;
for (ProductCategory prodcat : prodCats) {
if (prodcat.getCategory_id() == Integer.parseInt(slug)) {
result++;
}
}
return result;
}
public void getItems(String slug) {
ArrayList<Item> items_to_remove = new ArrayList<Item>();
for (Item item : items) {
if(!items_with_slug.contains(item)){
items_with_slug.add(item);
}
}
for (Item item : items_with_slug) {
for(Category category : path){
if(!item.getCategory().toLowerCase().contains(category.getSlug().toLowerCase())){
items_to_remove.add(item);
}
}
}
items_with_slug.removeAll(items_to_remove);
while(items_with_slug.size() != 0){
items_with_slug.remove(0);
}
for (ProductCategory prodcat : prodCats) {
if (prodcat.getCategory_id() == Integer.parseInt(slug) ) {
items_with_slug.add(getItemWithId(prodcat.getProduct_id()));
}
}
if(Integer.parseInt(slug) == 0){
for(Item item : products){
items_with_slug.add(item);
}
}
}
public class SequenceComparator implements Comparator<Category>
{
public int compare(Category left, Category right) {
return left.getSequence() - right.getSequence();
}
}
private Item getItemWithId(int product_id) {
// TODO Auto-generated method stub
for(Item item : items){
if(item.getId() == product_id){
return item;
}
}
return null;
}
public class ShopItemsAdapter extends BaseAdapter {
Context context;
ArrayList<Item> items;
Typeface font, font_light;
public ShopItemsAdapter(Context c, ArrayList<Item> items) {
this.context = c;
this.items = items;
font = Typeface.createFromAsset(context.getAssets(),
"fonts/HelveticaNeueLTPro-Roman.otf");
font_light = Typeface.createFromAsset(context.getAssets(),
"fonts/HelveticaNeueLTPro-Lt.otf");
}
@Override
public boolean isEmpty() {
// TODO Auto-generated method stub
return super.isEmpty();
}
public int getCount() {
// TODO Auto-generated method stub
if (items.size() % 2 == 1)
return items.size() / 2 + 1;
return items.size() / 2;
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
public View getView(final int position, View convertView,
ViewGroup parent) {
// TODO Auto-generated method stub
final LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.shop_single_item, null, false);
LinearLayout llSingleItemCol1 = (LinearLayout) v
.findViewById(R.id.llsingle_item_col1);
ImageView ivImage1 = (ImageView) v
.findViewById(R.id.ivshop_single_image1);
ImageView ivBannerNew1 = (ImageView) v
.findViewById(R.id.ivshop_single_banner_new1);
ImageView ivBannerHot1 = (ImageView) v
.findViewById(R.id.ivshop_single_banner_hot1);
TextView tvName1 = (TextView) v
.findViewById(R.id.tvshop_single_name1);
TextView tvBrand1 = (TextView) v
.findViewById(R.id.tvshop_single_brand1);
TextView tvPrice1 = (TextView) v
.findViewById(R.id.tvshop_single_price1);
TextView tvStock1 = (TextView) v
.findViewById(R.id.tvshop_single_stock1);
RatingBar rbRate1 = (RatingBar) v
.findViewById(R.id.rbshop_single_rate1);
LinearLayout llSingleItemCol2 = (LinearLayout) v
.findViewById(R.id.llsingle_item_col2);
ImageView ivImage2 = (ImageView) v
.findViewById(R.id.ivshop_single_image2);
ImageView ivBannerNew2 = (ImageView) v
.findViewById(R.id.ivshop_single_banner_new2);
ImageView ivBannerHot2 = (ImageView) v
.findViewById(R.id.ivshop_single_banner_hot2);
TextView tvName2 = (TextView) v
.findViewById(R.id.tvshop_single_name2);
TextView tvBrand2 = (TextView) v
.findViewById(R.id.tvshop_single_brand2);
TextView tvPrice2 = (TextView) v
.findViewById(R.id.tvshop_single_price2);
TextView tvStock2 = (TextView) v
.findViewById(R.id.tvshop_single_stock2);
RatingBar rbRate2 = (RatingBar) v
.findViewById(R.id.rbshop_single_rate2);
tvName1.setTypeface(font);
tvName2.setTypeface(font);
tvBrand1.setTypeface(font_light);
tvBrand2.setTypeface(font_light);
tvPrice1.setTypeface(font);
tvPrice2.setTypeface(font);
llSingleItemCol1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
curr_item = items.get(position * 2 );
Intent intent = new Intent(ShopActivity.this,
SingleProductDrawerActivity.class);
intent.putExtra("item_id", items.get(position * 2).getId());
startActivity(intent);
}
});
Picasso.with(context).load(Config.IMAGE_THUMBNAIL+ items.get(position * 2).getFeatured_image()).placeholder(R.drawable.placeholder).into(ivImage1);
if (items.get(position * 2).getIsHot()) {
ivBannerHot1.setVisibility(ImageView.VISIBLE);
}
if (items.get(position * 2).getIsNew()) {
ivBannerNew1.setVisibility(ImageView.VISIBLE);
}
String name = items.get(position * 2).getName();
tvName1.setText(name);
String brand = items.get(position * 2).getShop();
tvBrand1.setText(brand);
tvStock1.setText(items.get(position * 2).getStock());
tvPrice1.setText(String.format("%.2f", items.get(position * 2).getPrice())
+ context.getResources().getString(R.string.currency));
rbRate1.setRating(items.get(position * 2).getReview());
if (position * 2 + 1 != items.size()) {
name = items.get(position * 2 + 1).getName();
tvName2.setText(name);
brand = items.get(position * 2 + 1).getShop();
tvBrand2.setText(brand);
tvStock2.setText(items.get(position * 2 + 1).getStock());
tvPrice2.setText(String.format("%.2f", items.get(position * 2 + 1)
.getPrice())
+context.getResources().getString(R.string.currency));
rbRate2.setRating(items.get(position * 2 + 1).getReview());
Picasso.with(context).load(Config.IMAGE_THUMBNAIL + items.get(position * 2 + 1).getFeatured_image()).placeholder(R.drawable.placeholder).into(ivImage2);
if (items.get(position * 2 + 1).getIsHot()) {
ivBannerHot2.setVisibility(ImageView.VISIBLE);
}
if (items.get(position * 2 + 1).getIsNew()) {
ivBannerNew2.setVisibility(ImageView.VISIBLE);
}
llSingleItemCol2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
curr_item = items.get(position * 2 + 1);
Intent intent = new Intent(ShopActivity.this,
SingleProductDrawerActivity.class);
intent.putExtra("item_id", items.get(position * 2 + 1)
.getId());
startActivity(intent);
}
});
}
if (position == items.size() / 2 && items.size() % 2 == 1) {
llSingleItemCol2.setVisibility(LinearLayout.INVISIBLE);
}
return v;
}
}
public class CategoryItemsAdapter extends BaseAdapter {
Context context;
Typeface font, font_light;
ArrayList<Category> categories;
public CategoryItemsAdapter(Context c, ArrayList<Category> categories) {
this.context = c;
font = Typeface.createFromAsset(context.getAssets(),
"fonts/HelveticaNeueLTPro-Roman.otf");
font_light = Typeface.createFromAsset(context.getAssets(),
"fonts/HelveticaNeueLTPro-Lt.otf");
this.categories = categories;
}
public int getCount() {
// TODO Auto-generated method stub
return categories.size() + 2;
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
final LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.shop_single_category_indented,
null, false);
if (position == 0) {
v = inflater.inflate(R.layout.shop_categories_header, null,
false);
return v;
} else if (position == 1) {
v = inflater
.inflate(R.layout.shop_single_category, null, false);
TextView name = (TextView) v
.findViewById(R.id.tvshop_single_category_name);
name.setText(getCategoryWithSlug(slug).getName());
return v;
}
TextView name = (TextView) v
.findViewById(R.id.tvshop_single_category_name);
name.setText(categories.get(position - 2).getName());
name.setTypeface(font);
TextView tvResults = (TextView) v
.findViewById(R.id.tvshop_single_category_results);
tvResults.setText(String.format("%d results",
getItemsUnderCategory(categories.get(position - 2)
.getSlug())));
tvResults.setTypeface(font_light);
return v;
}
}
public class BreadCrumbsAdapter extends BaseAdapter {
Context context;
Typeface font, font_light;
ArrayList<Category> categories;
public BreadCrumbsAdapter(Context c, ArrayList<Category> categories) {
this.context = c;
font = Typeface.createFromAsset(context.getAssets(),
"fonts/HelveticaNeueLTPro-Roman.otf");
font_light = Typeface.createFromAsset(context.getAssets(),
"fonts/HelveticaNeueLTPro-Lt.otf");
this.categories = categories;
}
public int getCount() {
// TODO Auto-generated method stub
return categories.size() + 1;
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
final LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.single_breadcrumb,
null, false);
TextView tvTitle = (TextView) v.findViewById(R.id.tvSingleBreadCrumb_text);
v.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(position == 0){
slug = "0";
}else{
slug = path.get(path.size() - position).getSlug();
}
updateLists();
}
});
if(position == categories.size() ){
tvTitle.setTypeface(font);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
params.setMargins(0,0,150,0);
//tvTitle.setLayoutParams(params);
ImageView image = (ImageView) v.findViewById(R.id.ivSingleBreadCrumb_image_divider);
image.setLayoutParams(params);
}else{
tvTitle.setTypeface(font_light);
}
if(position == 0){
//tvTitle.setTypeface(font);
tvTitle.setText(getString(R.string.categories));
return v;
}
tvTitle.setText(categories.get(categories.size() - position).getName());
return v;
}
}
private class GiloAdapter extends PagerAdapter {
Context context;
CategoryItemsAdapter adapter;
ArrayList<Category> categories_with_slug;
public GiloAdapter(Context c) {
this.context = c;
}
// This is the number of pages -- 5
@Override
public int getCount() {
// TODO Auto-generated method stub
return 2;
}
@Override
public float getPageWidth(int position) {
if (position == 0)
return 0.5f;
return 1.0f;
}
@Override
public boolean isViewFromObject(View v, Object o) {
// TODO Auto-generated method stub
return v.equals(o);
}
// This is the title of the page that will apppear on the "tab"
public CharSequence getPageTitle(int position) {
return "";
}
// This is where all the magic happen
public Object instantiateItem(View pager, int position) {
final LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.shop, null, false);
if (position == 1) {
lvShopItems = (ListView) v.findViewById(R.id.lvShopItems);
lvShopItems.setAdapter(new ShopItemsAdapter(ShopActivity.this,
new ItemsInitiator(ShopActivity.this).getItems()));
} else {
v = inflater.inflate(R.layout.shop_categories, null, false);
lvShopItems = (ListView) v.findViewById(R.id.lvShopItems);
for (Category cat : categories_with_slug) {
Log.d("cat_with_slu", cat.getSlug());
}
adapter = new CategoryItemsAdapter(ShopActivity.this,
categories_with_slug);
lvShopItems.setAdapter(adapter);
lvShopItems.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int pos, long arg3) {
// TODO Auto-generated method stub
if (pos > 1) {
Intent intent = new Intent(ShopActivity.this,
ShopActivity.class);
intent.putExtra("slug",
categories_with_slug.get(pos - 2).getSlug());
startActivity(intent);
}
}
});
}
// This is very important
((ViewPager) pager).addView(v, 0);
return v;
}
@Override
public void destroyItem(View pager, int position, Object view) {
((ViewPager) pager).removeView((View) view);
}
@Override
public void finishUpdate(View view) {
}
@Override
public void restoreState(Parcelable p, ClassLoader c) {
}
@Override
public Parcelable saveState() {
return null;
}
@Override
public void startUpdate(View view) {
}
}
}
公共类ShopActivity扩展了AppCompatActivity{
ListView lvShopItems、lvCategorylist;
ArrayList prodCats=新的ArrayList();
ArrayList产品=新的ArrayList();
阵列列表类别;
数组列表项;
静态字符串slug=“0”;
Gilodapter mAdapter;
分类项适应器;分类项适应器;
ArrayList categories_with_slug=new ArrayList();
ShopItemsAdapter ShopItemsAdapter;
ArrayList items_与_slug=new ArrayList();
静态ArrayList路径=新建ArrayList();
HListView hlBreadCrumbs;
滑动菜单菜单右键,菜单;
线程定时器;
BackPressListener BackPressListener;
公共静态项当前项;
面包屑适配器面包屑适配器;
创建公共空间(捆绑冰柱){
超级冰柱;
setContentView(R.layout.滑动菜单);
final DataContainer DataContainer=((DataContainer)getApplicationContext());
菜单=(滑动菜单)findViewById(R.id.slidingmenulayout);
菜单.设置模式(滑动菜单.左);
上面的menu.SetTouchMode(滑动菜单.TOUCHMODE\u全屏);
菜单。设置阴影宽度(30);
//menu.setShadowDrawable(R.drawable.shadow);
menu.setBehindOffset(getResources().getDisplayMetrics().widthPixels/2-100);
菜单。设置FADEGREE(0.35f);
//menu.attachToActivity(这是滑动菜单.滑动内容);
menu.setMenu(R.LAYOU.category_侧边栏);
menu.showMenu();
slug=shopperactivity.slug;
slug=“0”;
//categories=dataContainer.getCategories();
//items=dataContainer.getItems();
categories=newarraylist();
对于(类别:dataContainer.getCategories()){
类别。添加(类别);
}
Collections.sort(categories,newsequencecomparator());
items=newarraylist();
对于(项:dataContainer.getItems()){
项目。添加(项目);
}
产品=项目;
Log.d(“项目编号”,String.valueOf(items.size());
//prodCats=dataContainer.getProdcats();
prodCats=newarraylist();
对于(ProductCategory prodCat:dataContainer.GetProdCAT()){
添加(prodCat);
}
getPath(slug);
lvShopItems=(ListView)findViewById(R.id.lvShopItems);
getItems(slug);
shopItemsAdapter=新的shopItemsAdapter(ShopActivity.this,items_和_slug);
lvShopItems.setAdapter(shopItemsAdapter);
lvCategorylist=(ListView)findViewById(R.id.lvCategoryItems);
getCategories(slug);
catAdapter=新的CategoryItemsAdapter(这是带有_段塞的_类);
lvCategorylist.setAdapter(catAdapter);
lvCategorylist.setOnItemClickListener(新的OnItemClickListener(){
@凌驾
公共链接(适配器视图arg0、视图arg1、内部位置、,
长arg3){
//TODO自动生成的方法存根
如果(位置>1){
slug=categories_with_slug.get(pos-2.getSlug();
更新列表();
}
}
});
breadCrumbsAdapter=新的breadCrumbsAdapter(该路径);
hlBreadCrumbs=(HListView)findviewbyd(R.id.hlShop\u breadcrumb);
hlBreadCrumbs.setAdapter(breadCrumbsAdapter);
//setOnItemClickListener(新的OnItemClickListener(){
//
//@覆盖
//公共链接(适配器视图arg0、视图arg1、内部位置、,
//长arg3){
////TODO自动生成的方法存根
//
//如果(位置==0){
//slug=“无”;
//}否则{
//slug=path.get(path.size()-pos.getSlug();
// }
//更新列表();
//
// }
// });
最终处理程序myHandler=新处理程序(){
公共无效handleMessage(消息消息消息){
onDrawerBackPressed();
}
};
ShopDrawerActivity.setBackPressListener(新的BackPressListener(){
@凌驾
公共无效onPreExecute(){
//TODO自动生成的方法存根
}
@凌驾
未完成的公共空白(按布尔返回){
//TODO自动生成的方法存根
onDrawerBackPressed();
}
});
Log.d(“带有slug 0的类别”,getCategoryWithSlug(“0”).getName();
}
公共无效onDrawerBackPressed(){
if(path.size()==0){
完成();
}否则{
移除路径(0);
如果(path.size()!=0){
slug=path.get(0.getSlug();
更新列表();
}否则{
slug=“0”;
更新列表();
}
}
Log.d(“反压”、“反压”);
}
公共无效更新列表(){
while(带有_slug.size()!=0的类别_){
类别_与_slug.remove(0);
}
while(带有\u slug.size()!=0的项目){
带有塞块的项目移除(0);
}
while(path.size()!=0){
移除路径(0);
}
getPath(slug);
getCategories(slug);
getItems(slug);
catAdapter.notifyDataSetChanged();
shopItemsAdapter.notifyDataSetChanged();
breadCrumbsAdapter.notifyDataSetChanged();
hlBreadCrumbs.smoothScrollToPosition(breadCrumbsAdapter.getCount()-1);
}
公共类别(字符串)
public class MainActivity extends Activity {
ProgressDialog pDialog;
public static final int NUM_PAGES = 3;
ViewPager mPager, vpMarqueeText;
ArrayList<Banner> banners = new ArrayList<Banner>();
TextView tvCategories;
GiloAdapter mAdapter;
ArrayList<Product> products = new ArrayList<Product>();
ArrayList<ItemImage> images = new ArrayList<ItemImage>();
ArrayList<Option> options = new ArrayList<Option>();
ArrayList<OptionGroup> optionGroups = new ArrayList<OptionGroup>();
ArrayList<Item> items = new ArrayList<Item>();
ArrayList<Category> categories = new ArrayList<Category>();
ArrayList<ProductCategory> prodcats = new ArrayList<ProductCategory>();
ArrayList<Country> countries = new ArrayList<Country>();
ArrayList<Zone> zones = new ArrayList<Zone>();
static HTTPExecutionListener httpExecutionListener = new HTTPExecutionListener() {
@Override
public void onPreExecute() {
// TODO Auto-generated method stub
}
@Override
public void onComplete(int task_number) {
// TODO Auto-generated method stub
}
};
DataContainer dataContainer;
Time now;
static int task_number = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.intro);
// Added to allow makeHttpRequest anywhere in the code (without AsyncTask...) - not the best solution but working...
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
now = new Time();
now.setToNow();
pDialog = new ProgressDialog(MainActivity.this);
Log.d("start time" , String.valueOf(now.minute) + ":" + String.valueOf(now.second));
dataContainer = ((DataContainer) getApplicationContext());
tvCategories = (TextView) findViewById(R.id.tvIntro_categoriess);
banners = new ArrayList<Banner>();
// Instantiating the adapter
mAdapter = new GiloAdapter(this, banners);
// instantiate the Views
mPager = (ViewPager) findViewById(R.id.pager);
vpMarqueeText = (ViewPager) findViewById(R.id.vpMarqueeText);
vpMarqueeText.setAdapter(new MarqueeTextAdapter(this));
mPager.setAdapter(mAdapter);
mPager.setOffscreenPageLimit(banners.size());
vpMarqueeText.setOffscreenPageLimit(5);
UnderlinePageIndicator mIndicator = (UnderlinePageIndicator) findViewById(R.id.indicator);
mIndicator.setViewPager(mPager);
startTimerForSlides();
startMarqueeing();
String number = String.valueOf(new ItemsInitiator(this).itemCount());
Date now = new Date();
new DataGetterLocal().execute();
// doStuff();
}
...
...
if (savedInstanceState == null) {
// on first time display view for first nav item
displayView(ShopActivity.class);
}
public class ShopActivity extends AppCompatActivity {
ListView lvShopItems, lvCategorylist;
ArrayList<ProductCategory> prodCats = new ArrayList<ProductCategory>();
ArrayList<Item> products = new ArrayList<Item>();
ArrayList<Category> categories;
ArrayList<Item> items;
static String slug = "0";
GiloAdapter mAdapter;
CategoryItemsAdapter catAdapter;
ArrayList<Category> categories_with_slug = new ArrayList<Category>();
ShopItemsAdapter shopItemsAdapter;
ArrayList<Item> items_with_slug = new ArrayList<Item>();
static ArrayList<Category> path = new ArrayList<Category>();
HListView hlBreadCrumbs;
SlidingMenu menuRight, menu ;
Thread timer;
BackPressListener backPressListener;
public static Item curr_item;
BreadCrumbsAdapter breadCrumbsAdapter;
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.sliding_menu);
final DataContainer dataContainer = ((DataContainer) getApplicationContext());
menu = (SlidingMenu) findViewById(R.id.slidingmenulayout);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidth(30);
// menu.setShadowDrawable(R.drawable.shadow);
menu.setBehindOffset(getResources().getDisplayMetrics().widthPixels/2 - 100);
menu.setFadeDegree(0.35f);
//menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setMenu(R.layout.category_sidebar);
menu.showMenu();
slug = ShopDrawerActivity.slug;
slug="0";
//categories = dataContainer.getCategories();
//items = dataContainer.getItems();
categories = new ArrayList<Category>();
for(Category category : dataContainer.getCategories()){
categories.add(category);
}
Collections.sort(categories, new SequenceComparator());
items = new ArrayList<Item>();
for(Item item : dataContainer.getItems()){
items.add(item);
}
products = items;
Log.d("items number", String.valueOf(items.size()));
//prodCats = dataContainer.getProdcats();
prodCats = new ArrayList<ProductCategory>();
for(ProductCategory prodCat : dataContainer.getProdcats()){
prodCats.add(prodCat);
}
getPath(slug);
lvShopItems = (ListView) findViewById(R.id.lvShopItems);
getItems(slug);
shopItemsAdapter = new ShopItemsAdapter(ShopActivity.this, items_with_slug);
lvShopItems.setAdapter(shopItemsAdapter);
lvCategorylist = (ListView) findViewById(R.id.lvCategoryItems);
getCategories(slug);
catAdapter = new CategoryItemsAdapter(this, categories_with_slug);
lvCategorylist.setAdapter(catAdapter);
lvCategorylist.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
long arg3) {
// TODO Auto-generated method stub
if (pos > 1) {
slug = categories_with_slug.get(pos - 2).getSlug();
updateLists();
}
}
});
breadCrumbsAdapter = new BreadCrumbsAdapter(this, path);
hlBreadCrumbs = (HListView) findViewById(R.id.hlShop_breadcrumb);
hlBreadCrumbs.setAdapter(breadCrumbsAdapter);
// hlBreadCrumbs.setOnItemClickListener(new OnItemClickListener() {
//
// @Override
// public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
// long arg3) {
// // TODO Auto-generated method stub
//
// if(pos == 0){
// slug = "none";
// }else{
// slug = path.get(path.size() - pos).getSlug();
// }
// updateLists();
//
// }
// });
final Handler myHandler = new Handler() {
public void handleMessage(Message msg) {
onDrawerBackPressed();
}
};
ShopDrawerActivity.setBackPressListener(new BackPressListener() {
@Override
public void onPreExecute() {
// TODO Auto-generated method stub
}
@Override
public void onComplete(Boolean back_pressed) {
// TODO Auto-generated method stub
onDrawerBackPressed();
}
});
Log.d("Category with slug 0", getCategoryWithSlug("0").getName());
}
public void onDrawerBackPressed() {
if(path.size() == 0){
finish();
}else{
path.remove(0);
if(path.size() != 0){
slug = path.get(0).getSlug();
updateLists();
}else{
slug = "0";
updateLists();
}
}
Log.d("Back Pressed", "back pressed");
}
public void updateLists() {
while (categories_with_slug.size() != 0) {
categories_with_slug.remove(0);
}
while (items_with_slug.size() != 0) {
items_with_slug.remove(0);
}
while (path.size() != 0) {
path.remove(0);
}
getPath(slug);
getCategories(slug);
getItems(slug);
catAdapter.notifyDataSetChanged();
shopItemsAdapter.notifyDataSetChanged();
breadCrumbsAdapter.notifyDataSetChanged();
hlBreadCrumbs.smoothScrollToPosition(breadCrumbsAdapter.getCount() - 1);
}
public void getCategories(String slug) {
for (Category category : categories) {
Log.d("category parent id", String.valueOf(category.getParent_id()));
if (category.getParent_id() == Integer.parseInt(slug)) {
categories_with_slug.add(category);
Log.d("slug", category.getSlug());
}
}
Log.d("categories with slug size", String.valueOf(categories_with_slug.size()));
}
public void getPath(String slug){
String parent = slug;
String cats = "";
int i = 50;
while (!parent.equals("0") && i > 0) {
cats+= parent;
Log.d("path", cats);
Category category = getCategoryWithSlug(parent);
if(!path.contains(category))
path.add(category);
parent = category.getParent();
i--;
}
Log.d("path", cats);
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem searchViewMenuItem = menu.findItem(R.id.mnSearch);
SearchView mSearchView = (SearchView) searchViewMenuItem.getActionView();
int searchImgId = getResources().getIdentifier("android:id/search_button", null, null);
ImageView v = (ImageView) mSearchView.findViewById(searchImgId);
v.setImageResource(R.drawable.search);
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_shopping, menu);
return true;
}
public Category getCategoryWithSlug(String slug) {
Category result = new Category();
for (Category category : categories) {
if (Integer.parseInt(category.getSlug()) == Integer.parseInt(slug)) {
return category;
}
}
return result;
}
public int getItemsUnderCategory(String slug) {
int result = 0;
for (ProductCategory prodcat : prodCats) {
if (prodcat.getCategory_id() == Integer.parseInt(slug)) {
result++;
}
}
return result;
}
public void getItems(String slug) {
ArrayList<Item> items_to_remove = new ArrayList<Item>();
for (Item item : items) {
if(!items_with_slug.contains(item)){
items_with_slug.add(item);
}
}
for (Item item : items_with_slug) {
for(Category category : path){
if(!item.getCategory().toLowerCase().contains(category.getSlug().toLowerCase())){
items_to_remove.add(item);
}
}
}
items_with_slug.removeAll(items_to_remove);
while(items_with_slug.size() != 0){
items_with_slug.remove(0);
}
for (ProductCategory prodcat : prodCats) {
if (prodcat.getCategory_id() == Integer.parseInt(slug) ) {
items_with_slug.add(getItemWithId(prodcat.getProduct_id()));
}
}
if(Integer.parseInt(slug) == 0){
for(Item item : products){
items_with_slug.add(item);
}
}
}
public class SequenceComparator implements Comparator<Category>
{
public int compare(Category left, Category right) {
return left.getSequence() - right.getSequence();
}
}
private Item getItemWithId(int product_id) {
// TODO Auto-generated method stub
for(Item item : items){
if(item.getId() == product_id){
return item;
}
}
return null;
}
public class ShopItemsAdapter extends BaseAdapter {
Context context;
ArrayList<Item> items;
Typeface font, font_light;
public ShopItemsAdapter(Context c, ArrayList<Item> items) {
this.context = c;
this.items = items;
font = Typeface.createFromAsset(context.getAssets(),
"fonts/HelveticaNeueLTPro-Roman.otf");
font_light = Typeface.createFromAsset(context.getAssets(),
"fonts/HelveticaNeueLTPro-Lt.otf");
}
@Override
public boolean isEmpty() {
// TODO Auto-generated method stub
return super.isEmpty();
}
public int getCount() {
// TODO Auto-generated method stub
if (items.size() % 2 == 1)
return items.size() / 2 + 1;
return items.size() / 2;
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
public View getView(final int position, View convertView,
ViewGroup parent) {
// TODO Auto-generated method stub
final LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.shop_single_item, null, false);
LinearLayout llSingleItemCol1 = (LinearLayout) v
.findViewById(R.id.llsingle_item_col1);
ImageView ivImage1 = (ImageView) v
.findViewById(R.id.ivshop_single_image1);
ImageView ivBannerNew1 = (ImageView) v
.findViewById(R.id.ivshop_single_banner_new1);
ImageView ivBannerHot1 = (ImageView) v
.findViewById(R.id.ivshop_single_banner_hot1);
TextView tvName1 = (TextView) v
.findViewById(R.id.tvshop_single_name1);
TextView tvBrand1 = (TextView) v
.findViewById(R.id.tvshop_single_brand1);
TextView tvPrice1 = (TextView) v
.findViewById(R.id.tvshop_single_price1);
TextView tvStock1 = (TextView) v
.findViewById(R.id.tvshop_single_stock1);
RatingBar rbRate1 = (RatingBar) v
.findViewById(R.id.rbshop_single_rate1);
LinearLayout llSingleItemCol2 = (LinearLayout) v
.findViewById(R.id.llsingle_item_col2);
ImageView ivImage2 = (ImageView) v
.findViewById(R.id.ivshop_single_image2);
ImageView ivBannerNew2 = (ImageView) v
.findViewById(R.id.ivshop_single_banner_new2);
ImageView ivBannerHot2 = (ImageView) v
.findViewById(R.id.ivshop_single_banner_hot2);
TextView tvName2 = (TextView) v
.findViewById(R.id.tvshop_single_name2);
TextView tvBrand2 = (TextView) v
.findViewById(R.id.tvshop_single_brand2);
TextView tvPrice2 = (TextView) v
.findViewById(R.id.tvshop_single_price2);
TextView tvStock2 = (TextView) v
.findViewById(R.id.tvshop_single_stock2);
RatingBar rbRate2 = (RatingBar) v
.findViewById(R.id.rbshop_single_rate2);
tvName1.setTypeface(font);
tvName2.setTypeface(font);
tvBrand1.setTypeface(font_light);
tvBrand2.setTypeface(font_light);
tvPrice1.setTypeface(font);
tvPrice2.setTypeface(font);
llSingleItemCol1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
curr_item = items.get(position * 2 );
Intent intent = new Intent(ShopActivity.this,
SingleProductDrawerActivity.class);
intent.putExtra("item_id", items.get(position * 2).getId());
startActivity(intent);
}
});
Picasso.with(context).load(Config.IMAGE_THUMBNAIL+ items.get(position * 2).getFeatured_image()).placeholder(R.drawable.placeholder).into(ivImage1);
if (items.get(position * 2).getIsHot()) {
ivBannerHot1.setVisibility(ImageView.VISIBLE);
}
if (items.get(position * 2).getIsNew()) {
ivBannerNew1.setVisibility(ImageView.VISIBLE);
}
String name = items.get(position * 2).getName();
tvName1.setText(name);
String brand = items.get(position * 2).getShop();
tvBrand1.setText(brand);
tvStock1.setText(items.get(position * 2).getStock());
tvPrice1.setText(String.format("%.2f", items.get(position * 2).getPrice())
+ context.getResources().getString(R.string.currency));
rbRate1.setRating(items.get(position * 2).getReview());
if (position * 2 + 1 != items.size()) {
name = items.get(position * 2 + 1).getName();
tvName2.setText(name);
brand = items.get(position * 2 + 1).getShop();
tvBrand2.setText(brand);
tvStock2.setText(items.get(position * 2 + 1).getStock());
tvPrice2.setText(String.format("%.2f", items.get(position * 2 + 1)
.getPrice())
+context.getResources().getString(R.string.currency));
rbRate2.setRating(items.get(position * 2 + 1).getReview());
Picasso.with(context).load(Config.IMAGE_THUMBNAIL + items.get(position * 2 + 1).getFeatured_image()).placeholder(R.drawable.placeholder).into(ivImage2);
if (items.get(position * 2 + 1).getIsHot()) {
ivBannerHot2.setVisibility(ImageView.VISIBLE);
}
if (items.get(position * 2 + 1).getIsNew()) {
ivBannerNew2.setVisibility(ImageView.VISIBLE);
}
llSingleItemCol2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
curr_item = items.get(position * 2 + 1);
Intent intent = new Intent(ShopActivity.this,
SingleProductDrawerActivity.class);
intent.putExtra("item_id", items.get(position * 2 + 1)
.getId());
startActivity(intent);
}
});
}
if (position == items.size() / 2 && items.size() % 2 == 1) {
llSingleItemCol2.setVisibility(LinearLayout.INVISIBLE);
}
return v;
}
}
public class CategoryItemsAdapter extends BaseAdapter {
Context context;
Typeface font, font_light;
ArrayList<Category> categories;
public CategoryItemsAdapter(Context c, ArrayList<Category> categories) {
this.context = c;
font = Typeface.createFromAsset(context.getAssets(),
"fonts/HelveticaNeueLTPro-Roman.otf");
font_light = Typeface.createFromAsset(context.getAssets(),
"fonts/HelveticaNeueLTPro-Lt.otf");
this.categories = categories;
}
public int getCount() {
// TODO Auto-generated method stub
return categories.size() + 2;
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
final LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.shop_single_category_indented,
null, false);
if (position == 0) {
v = inflater.inflate(R.layout.shop_categories_header, null,
false);
return v;
} else if (position == 1) {
v = inflater
.inflate(R.layout.shop_single_category, null, false);
TextView name = (TextView) v
.findViewById(R.id.tvshop_single_category_name);
name.setText(getCategoryWithSlug(slug).getName());
return v;
}
TextView name = (TextView) v
.findViewById(R.id.tvshop_single_category_name);
name.setText(categories.get(position - 2).getName());
name.setTypeface(font);
TextView tvResults = (TextView) v
.findViewById(R.id.tvshop_single_category_results);
tvResults.setText(String.format("%d results",
getItemsUnderCategory(categories.get(position - 2)
.getSlug())));
tvResults.setTypeface(font_light);
return v;
}
}
public class BreadCrumbsAdapter extends BaseAdapter {
Context context;
Typeface font, font_light;
ArrayList<Category> categories;
public BreadCrumbsAdapter(Context c, ArrayList<Category> categories) {
this.context = c;
font = Typeface.createFromAsset(context.getAssets(),
"fonts/HelveticaNeueLTPro-Roman.otf");
font_light = Typeface.createFromAsset(context.getAssets(),
"fonts/HelveticaNeueLTPro-Lt.otf");
this.categories = categories;
}
public int getCount() {
// TODO Auto-generated method stub
return categories.size() + 1;
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
final LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.single_breadcrumb,
null, false);
TextView tvTitle = (TextView) v.findViewById(R.id.tvSingleBreadCrumb_text);
v.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(position == 0){
slug = "0";
}else{
slug = path.get(path.size() - position).getSlug();
}
updateLists();
}
});
if(position == categories.size() ){
tvTitle.setTypeface(font);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
params.setMargins(0,0,150,0);
//tvTitle.setLayoutParams(params);
ImageView image = (ImageView) v.findViewById(R.id.ivSingleBreadCrumb_image_divider);
image.setLayoutParams(params);
}else{
tvTitle.setTypeface(font_light);
}
if(position == 0){
//tvTitle.setTypeface(font);
tvTitle.setText(getString(R.string.categories));
return v;
}
tvTitle.setText(categories.get(categories.size() - position).getName());
return v;
}
}
private class GiloAdapter extends PagerAdapter {
Context context;
CategoryItemsAdapter adapter;
ArrayList<Category> categories_with_slug;
public GiloAdapter(Context c) {
this.context = c;
}
// This is the number of pages -- 5
@Override
public int getCount() {
// TODO Auto-generated method stub
return 2;
}
@Override
public float getPageWidth(int position) {
if (position == 0)
return 0.5f;
return 1.0f;
}
@Override
public boolean isViewFromObject(View v, Object o) {
// TODO Auto-generated method stub
return v.equals(o);
}
// This is the title of the page that will apppear on the "tab"
public CharSequence getPageTitle(int position) {
return "";
}
// This is where all the magic happen
public Object instantiateItem(View pager, int position) {
final LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.shop, null, false);
if (position == 1) {
lvShopItems = (ListView) v.findViewById(R.id.lvShopItems);
lvShopItems.setAdapter(new ShopItemsAdapter(ShopActivity.this,
new ItemsInitiator(ShopActivity.this).getItems()));
} else {
v = inflater.inflate(R.layout.shop_categories, null, false);
lvShopItems = (ListView) v.findViewById(R.id.lvShopItems);
for (Category cat : categories_with_slug) {
Log.d("cat_with_slu", cat.getSlug());
}
adapter = new CategoryItemsAdapter(ShopActivity.this,
categories_with_slug);
lvShopItems.setAdapter(adapter);
lvShopItems.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int pos, long arg3) {
// TODO Auto-generated method stub
if (pos > 1) {
Intent intent = new Intent(ShopActivity.this,
ShopActivity.class);
intent.putExtra("slug",
categories_with_slug.get(pos - 2).getSlug());
startActivity(intent);
}
}
});
}
// This is very important
((ViewPager) pager).addView(v, 0);
return v;
}
@Override
public void destroyItem(View pager, int position, Object view) {
((ViewPager) pager).removeView((View) view);
}
@Override
public void finishUpdate(View view) {
}
@Override
public void restoreState(Parcelable p, ClassLoader c) {
}
@Override
public Parcelable saveState() {
return null;
}
@Override
public void startUpdate(View view) {
}
}
}