GVKun编程网logo

淘宝Buy+VR购物怎么玩 淘宝Buy+ VR设备购物体验使用图文教程(淘宝的vr购物在哪)

24

如果您想了解淘宝Buy+VR购物怎么玩淘宝Buy+VR设备购物体验使用图文教程的相关知识,那么本文是一篇不可错过的文章,我们将对淘宝的vr购物在哪进行全面详尽的解释,并且为您提供关于2018淘宝双11

如果您想了解淘宝Buy+VR购物怎么玩 淘宝Buy+ VR设备购物体验使用图文教程的相关知识,那么本文是一篇不可错过的文章,我们将对淘宝的vr购物在哪进行全面详尽的解释,并且为您提供关于2018淘宝双11清空购物车活动怎么玩、Android仿淘宝购物车,玩转电商购物车、buy or not buy、Buyou:让你在iPad上轻松购物的有价值的信息。

本文目录一览:

淘宝Buy+VR购物怎么玩 淘宝Buy+ VR设备购物体验使用图文教程(淘宝的vr购物在哪)

淘宝Buy+VR购物怎么玩 淘宝Buy+ VR设备购物体验使用图文教程(淘宝的vr购物在哪)

虽然虚拟技术的时间完善,最近有淘宝推出的淘宝Buy+ app已经可以搭配VR设备进行购物了,那么,淘宝Buy+VR购物怎么玩呢?对此,本文就为大家图文详细介绍淘宝Buy+VR购物体验图文步骤,有兴趣的朋友们就来了解下吧

不知从什么时候开始,双11成了11月份最大的一个节日,每年的这个时候,各路商家都会变着花样的打折促销,作为领潮儿的淘宝当然也不例外,这不,在最近的淘宝APP中我们便发现了疯传已久的Buy+VR购物,这种购物方式到底有何不同呢?今天我们便通过这篇简单的试用体验将一些感受与大家分享。

软件名称:
淘宝buy+ app v1.0 安卓VR版
软件大小:
39.7MB
更新时间:
2016-05-19

淘宝Buy+VR购物怎么玩 淘宝Buy+VR购物体验使用教程

VR购物有优惠:

淘宝Buy+VR购物怎么玩 淘宝Buy+VR购物体验使用教程

VR购物的入口是在手机“淘宝APP”(非天猫)必备工具一栏中,iOS版本直接就能看到,Android版本需要多点击一步(如上图右侧)才能找到,我们体验的时候使用的手机是自己的iPhoen 6S(ios版淘宝APP),所以对于庞杂的安卓端手机体验如何这里不做评价。相比传统购物方式,VR购物除了能带来新奇的体验以外也会有专享价和税值折扣的优势,不过活动时间只限在11月1日00:00:00-11月11日23:59:59,活动中所有商品上线后,以双11的价格提前开卖,每个商品最多能被同一用户购买5件,超过5件后恢复原价。

两种不同的使用方式:

淘宝Buy+VR购物怎么玩 淘宝Buy+VR购物体验使用教程

考虑到可能有些用户手中没有VR设备,所以在VR购物中会出现两种使用方式——单屏全景模式(通过重力感应或者手指滑动进行方向选择,通过手指点击实现“确定”功能)和VR眼镜模式(通过摇摆头部进行方向选择、通过视线中心点悬停实现“确定”功能),需要注意的是,单屏全景模式中我们的新鲜体验较短,只有:商店选择-产品查看-加入购物车(之后就需要在普通的手机支付界面进行买单了);而VR模式则比较长一些,我们将体验到:商店选择-产品查看-立即购买-VR支付-支付成功。为了让大家可以看到更多的细节,我们前几步会使用单屏全景的模式,在买单的时候则会切换到VR眼镜模式。

店铺选择:

淘宝Buy+VR购物怎么玩 淘宝Buy+VR购物体验使用教程

我们可以通过点击墙上动态图的形式进行商店的选择,可选的商店只有7个,分别是美国的Costco、Macy·s、Target、日本的松本清、东京宅、澳大利亚的澳洲牧场以及Chemist-Warehouse商店,而且每个地区都有不同的进入全景动画,比如美国Costco进入的全景动画就是坐快艇-敞篷专车到达商店所在地、日本的松本清进入动画就是和学妹乘坐快轨然后步入商店、而澳大利亚牧场则是乘坐直升机到达那里,初次体验的时候还是特别有意思的。不过以我们用iPhone 6S体验为例,在商店选择和全景动画之间的过渡动画会特别的卡,所以多点几次后我们都会直接跳过该部分。

购物:

淘宝Buy+VR购物怎么玩 淘宝Buy+VR购物体验使用教程

需要注意的是,每个商店能购买的物品都比较有限,简单来说只有两排货架而已,从货架的一头走到另一头看到的(两边)商品便是这个店能带来的所有,想拐弯去另一排是无法实现的,另外关于商品的介绍信息也只有我们上图看到的这些,想要了解更多,只能另外百度去。虽然淘宝也贴心的让我们可以360度查看商品,不过其实用处不大,要知道我们看到的只是一个3D扫描图而已,和真实发货的产品生产日期或者一些细节是不同的。

下单、付款:

淘宝Buy+VR购物怎么玩 淘宝Buy+VR购物体验使用教程

下单后进入订单确定页面,我们可以在这个页面核实一下订单信息,如果有什么问题也可以点击个人信息右侧的那个按键选择更多地址,不过需要注意的一点是,这里的地址是只能选择不能修改的,想换个门牌号或者电话号码啥的只能去普通页面下完成付款。

淘宝Buy+VR购物怎么玩 淘宝Buy+VR购物体验使用教程

付款界面会显示的内容有产品价格、当地汇率、付款银行卡选择以及购物密码输入页面,当然这里的银行卡也是只能选择不能添加的,通过屏幕中心点悬停输入密码后便可完成购物,接下来等货物到家就行了。

整体体验总结:

购物成功后,淘宝会给你发一个证书类的东西,上面会显示你是全球第多少个(使用淘宝APP)完成VR购物的人,方便你分享到朋友圈,不过实际并没有什么用。对于本次体验,给我们的的整体感受就是好玩大于实用,不得不承认这种购物方式让我们觉得十分新鲜,但是作用不大,所谓的打折在我们拿来和JD比较后也发现其实只是说着玩的,并没有什么优惠可言。另外可购买的产品并没有多少,每个商店只有那么几款(还有重叠),显示的商品细节甚至不如手机普通模式显示的多,而体验其实也不咋地,画面显示效果模糊(这和手机有一定原因)、3D模型也十分的不清晰,有的时候还会出现卡顿的情况。

淘宝Buy+VR购物怎么玩 淘宝Buy+VR购物体验使用教程

总得来说,无论是在购物效率还是在一些购物细节方面,目前的Buy+VR购物也只是处在一个尝鲜的阶段,整体的实用性并不大,在这里购买一次产品后,基本不会让你有再次使用它的欲望,即便再次使用也是只玩不花钱那种,它更像是一个玩具而并非工具。这可能也是淘宝本次没有大力宣传的原因,不过话说回来,我们还是比较推荐大家试玩一下的,毕竟这确实是一个种较新奇的体验。

2018淘宝双11清空购物车活动怎么玩

2018淘宝双11清空购物车活动怎么玩

2018淘宝双11推出的清空购物车活动然很多朋友表示非常心动,那么这个活动要怎么玩呢?下面和小编一起来了解一下2018淘宝双11清空购物车的具体玩法吧。

淘宝双11清空购物车的活动攻略:

这次所谓的清空购物车大家,是按照双11合伙人活动里的团队能量排行决定的,其中团队能量最高的11个战队成员都可以得到清空购物车的奖励(既面额为49999元的大额红包)。

活动的结束时间为2018年10月31日的23点,而获得了清空购物车大奖的用户名单会在11月1日早上9点公布。时间不多了,对此感兴趣的朋友趁现在赶快去组队集能量吧!

想获得淘宝双11的清空购物车大奖,那就快去组队收集能量吧!

以上就是小编为大家带来的2018淘宝双11清空购物车活动玩法介绍,喜欢的朋友就来看看吧。

Android仿淘宝购物车,玩转电商购物车

Android仿淘宝购物车,玩转电商购物车

前言

其实做一个电商购物车,还真不是一个轻松的活。但是只要掌握思路,一步一步来做,就会发现也就这样。废物不多说,直接上效果图
完整代码,github链接,希望能给个星,谢谢


效果图
GIF1.gif

GIF6666.gif

主要思路

整一个布局就是ExpandableListView,然后自定义一个ActionBarActionBar上面显示购物车数量,通过ActionBar上面的编辑状态,店铺布局,所有商品布局,底部布局要进行相应的变化,编辑状态下需要改变商品的数量,删除商品,全选商品,隐藏店铺的编辑。非编辑状态可以显示店铺的编辑,显示结算,商品的信息。通过每一个店铺上面的编辑状态,该店铺旗下的所有商品布局都要进行相应的变化。编辑状态下,需要改变商品的数量和删除商品。非编辑状态下只需要显示商品的信息。当该店铺下所有商品都被勾选,对应的店铺也要被勾选。反之,该店铺下只要有一个商品没有被勾选,那么店铺就不用勾选。其实逻辑挺简单的,复杂的逻辑其实就是很多简单逻辑组成的,我们只需要把复杂的逻辑简单化成很多简单的逻辑,我们就能完成一个大概的思路


代码教学

我们第一步要做就是自定义一个ActionBar,几行代码就能解决。

private void initActionBar() {
    //隐藏标题栏
    if (getSupportActionBar() != null) {
        //去掉阴影
        getSupportActionBar().setElevation(0);
        getSupportActionBar().setDisplayShowTitleEnabled(false);
        getSupportActionBar().setDisplayShowCustomEnabled(true);
        View view = getLayoutInflater().inflate(R.layout.acitonbar, null);
        findView(view);
        getSupportActionBar().setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        ActionBar.LayoutParams lp = (ActionBar.LayoutParams) view.getLayoutParams();
        lp.gravity = Gravity.HORIZONTAL_GRAVITY_MASK | Gravity.CENTER_HORIZONTAL;
        getSupportActionBar().setCustomView(view, lp);
    }

完成之后效果图:

Paste_Image.png

第二步就是写整个布局xml文件了,基础知识也没有什么好说的。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:gravity="center_vertical"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <in.srain.cube.views.ptr.PtrFrameLayout
        android:background="#f1f1f1"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/mPtrframe"
        xmlns:cube_ptr="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        cube_ptr:ptr_resistance="1.7"
        cube_ptr:ptr_ratio_of_header_height_to_refresh="1.2"
        cube_ptr:ptr_duration_to_close="300"
        cube_ptr:ptr_duration_to_close_header="2000"
        cube_ptr:ptr_keep_header_when_refresh="true"
        cube_ptr:ptr_pull_to_fresh="false" >
    <FrameLayout
        android:background="@color/white"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <LinearLayout
        android:id="@+id/ll_cart"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <ExpandableListView
        android:id="@+id/listView"
        android:layout_width="match_parent"
        android:layout_weight="1"
        android:layout_height="0dp"/>
    <!--分割线-->
    <View
        android:layout_width="match_parent"
        android:layout_height="0.5dp"
        android:background="@color/gray" />
    <LinearLayout
        android:gravity="center"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="50dp">
        <CheckBox
            android:textSize="16sp"
            android:background="@null"
            android:clickable="true"
            android:drawablePadding="10dp"
            android:drawableLeft="@drawable/checkbox_bg"
            android:text="@string/all"
            android:id="@+id/all_checkBox"
            android:button="@null"
            android:minHeight="64dp"
            android:layout_marginStart="10dp"
            android:layout_gravity="center_vertical"
            android:layout_weight="0.3"
            android:layout_width="0dp"
            android:layout_height="wrap_content" />
        <LinearLayout
            android:gravity="center"
            android:orientation="horizontal"
            android:id="@+id/order_info"
            android:layout_weight="0.7"
            android:layout_width="0dp"
            android:layout_height="wrap_content">
            <LinearLayout
                android:layout_marginEnd="20dp"
                android:orientation="vertical"
                android:layout_weight="0.5"
                android:layout_width="0dp"
                android:layout_height="wrap_content">
                <LinearLayout
                    android:gravity="end"
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">
                    <TextView
                        android:textColor="@android:color/black"
                        android:textSize="18sp"
                        android:text="@string/order_total"
                        android:layout_marginStart="5dp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
                    <TextView
                        android:id="@+id/total_price"
                        android:text="¥0.00"
                        android:textSize="18sp"
                        android:textColor="@color/ic_taobao"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
                </LinearLayout>
                <TextView
                    android:gravity="right"
                    android:text="不含运费"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />
            </LinearLayout>
            <TextView
                android:id="@+id/go_pay"
                android:textSize="16sp"
                android:textColor="@android:color/white"
                android:background="@color/ic_taobao"
                android:gravity="center"
                android:text="结算(0)"
                android:layout_weight="0.5"
                android:layout_width="0dp"
                android:layout_height="60dp" />
            </LinearLayout>
        <LinearLayout
            android:visibility="gone"
            android:gravity="center"
            android:id="@+id/share_info"
            android:layout_weight="0.7"
            android:orientation="horizontal"
            android:layout_width="0dp"
            android:layout_height="match_parent">
            <TextView
                android:id="@+id/share_goods"
                android:textSize="16sp"
                android:textColor="@android:color/white"
                android:background="@color/ic_yellow"
                android:gravity="center"
                android:text="分享宝贝"
                android:layout_weight="0.3"
                android:layout_width="0dp"
                android:layout_height="match_parent" />
            <TextView
                android:layout_marginStart="1dp"
                android:id="@+id/collect_goods"
                android:textSize="16sp"
                android:textColor="@android:color/white"
                android:background="@color/ic_taobao"
                android:gravity="center"
                android:text="移到收藏夹"
                android:layout_weight="0.3"
                android:layout_width="0dp"
                android:layout_height="match_parent" />
            <TextView
                android:layout_marginStart="1dp"
                android:id="@+id/del_goods"
                android:textSize="16sp"
                android:textColor="@android:color/white"
                android:background="@color/ic_red"
                android:gravity="center"
                android:text="删除"
                android:layout_weight="0.3"
                android:layout_width="0dp"
                android:layout_height="match_parent" />
        </LinearLayout>
        </LinearLayout>
    </LinearLayout>
        <include
            android:id="@+id/layout_empty_shopcart"
            android:visibility="gone"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            layout="@layout/empty_shopcart" />
</FrameLayout>
    </in.srain.cube.views.ptr.PtrFrameLayout>
</LinearLayout>

完成之后效果图:


Paste_Image.png

第三步 就是写店铺的xml,商品的xml,商品为空xml,此处略。


第四步 重点讲代码

 case R.id.actionBar_edit:
                flag = !flag;
                setActionBarEditor();
                setVisiable();
                break;
 private void setActionBarEditor() {
        for (int i = 0; i < groups.size(); i++) {
            StoreInfo group = groups.get(i);
            if (group.isActionBarEditor()) {
                group.setActionBarEditor(false);
            } else {
                group.setActionBarEditor(true);
            }
        }
        adapter.notifyDataSetChanged();
    }
  private void setVisiable() {
        if (flag) {
            orderInfo.setVisibility(View.GONE);
            shareInfo.setVisibility(View.VISIBLE);
            actionBarEdit.setText("完成");
        } else {
            orderInfo.setVisibility(View.VISIBLE);
            shareInfo.setVisibility(View.GONE);
            actionBarEdit.setText("编辑");
        }
    }

checkBox的多选,勾选店铺,勾选商品的回调

    public interface CheckInterface {
       
        void checkGroup(int groupPosition, boolean isChecked);
        void checkChild(int groupPosition, int childPosition, boolean isChecked);
    }

通过监听checkBox的勾选状态,便于计算商品金额和删除商品,计算购物车数量等操作。


店铺对应的商品的数量增加,减少,删除,更新的回调

public interface ModifyCountInterface {
        void doIncrease(int groupPosition, int childPosition, View showCountView, boolean isChecked);
        void doDecrease(int groupPosition, int childPosition, View showCountView, boolean isChecked);
        void doUpdate(int groupPosition,int childPosition,View showCountView, boolean isChecked);
        void childDelete(int groupPosition, int childPosition);
    }

通过该店铺下的商品数量变化,来计算计算金额和购物车数量,当该店铺的商品删除完时,便把该店铺从购物车中删除掉。


增加商品数量

 @Override
    public void doIncrease(int groupPosition, int childPosition, View showCountView, boolean isChecked) {
        GoodsInfo good = (GoodsInfo) adapter.getChild(groupPosition, childPosition);
        int count = good.getCount();
        count++;
        good.setCount(count);
        ((TextView) showCountView).setText(String.valueOf(count));
        adapter.notifyDataSetChanged();
        calulate();
    }

减少商品数量

 @Override
    public void doDecrease(int groupPosition, int childPosition, View showCountView, boolean isChecked) {
        GoodsInfo good = (GoodsInfo) adapter.getChild(groupPosition, childPosition);
        int count = good.getCount();
        if (count == 1) {
            return;
        }
        count--;
        good.setCount(count);
        ((TextView) showCountView).setText("" + count);
        adapter.notifyDataSetChanged();
        calulate();
    }

删除商品

@Override
    public void childDelete(int groupPosition, int childPosition) {
        StoreInfo group = groups.get(groupPosition);
        List<GoodsInfo> child = childs.get(group.getId());
        child.remove(childPosition);
        if (child.size() == 0) {
            groups.remove(groupPosition);
        }
        adapter.notifyDataSetChanged();
        calulate();
    }

更新商品数量

 public void doUpdate(int groupPosition, int childPosition, View showCountView, boolean isChecked) {
        GoodsInfo good = (GoodsInfo) adapter.getChild(groupPosition, childPosition);
        int count = good.getCount();
        UtilsLog.i("进行更新数据,数量" + count + "");
        ((TextView) showCountView).setText(String.valueOf(count));
        adapter.notifyDataSetChanged();
        calulate();
    }

勾选店铺,商品

 @Override
    public void checkChild(int groupPosition, int childPosition, boolean isChecked) {
        boolean allChildSameState = true; //判断该组下面的所有子元素是否处于同一状态
        StoreInfo group = groups.get(groupPosition);
        List<GoodsInfo> child = childs.get(group.getId());
        for (int i = 0; i < child.size(); i++) {
            //不选全中
            if (child.get(i).isChoosed() != isChecked) {
                allChildSameState = false;
                break;
            }
        }

        if (allChildSameState) {
            group.setChoosed(isChecked);//如果子元素状态相同,那么对应的组元素也设置成这一种的同一状态
        } else {
            group.setChoosed(false);//否则一律视为未选中
        }

        if (isCheckAll()) {
            allCheckBox.setChecked(true);//全选
        } else {
            allCheckBox.setChecked(false);//反选
        }

        adapter.notifyDataSetChanged();
        calulate();

    }
 @Override
    public void checkGroup(int groupPosition, boolean isChecked) {
        StoreInfo group = groups.get(groupPosition);
        List<GoodsInfo> child = childs.get(group.getId());
        for (int i = 0; i < child.size(); i++) {
            child.get(i).setChoosed(isChecked);
        }
        if (isCheckAll()) {
            allCheckBox.setChecked(true);//全选
        } else {
            allCheckBox.setChecked(false);//反选
        }
        adapter.notifyDataSetChanged();
        calulate();
    }

底部的遍历删除商品

     删除操作
     1.不要边遍历边删除,容易出现数组越界的情况
     2.把将要删除的对象放进相应的容器中,待遍历完,用removeAll的方式进行删除
    private void doDelete() {
        List<StoreInfo> toBeDeleteGroups = new ArrayList<StoreInfo>(); 
        //待删除的组元素
        for (int i = 0; i < groups.size(); i++) {
            StoreInfo group = groups.get(i);
            if (group.isChoosed()) {
                toBeDeleteGroups.add(group);
            }
            List<GoodsInfo> toBeDeleteChilds = new ArrayList<GoodsInfo>();//待删除的子元素
            List<GoodsInfo> child = childs.get(group.getId());
            for (int j = 0; j < child.size(); j++) {
                if (child.get(j).isChoosed()) {
                    toBeDeleteChilds.add(child.get(j));
                }
            }
            child.removeAll(toBeDeleteChilds);
        }
        groups.removeAll(toBeDeleteGroups);
        //重新设置购物车
        setCartNum();
        adapter.notifyDataSetChanged();
    }

底部的全选商品和反选商品

private boolean isCheckAll() {
        for (StoreInfo group : groups) {
            if (!group.isChoosed()) {
                return false;
            }
        }
        return true;
    }

 private void doCheckAll() {
        for (int i = 0; i < groups.size(); i++) {
            StoreInfo group = groups.get(i);
            group.setChoosed(allCheckBox.isChecked());
            List<GoodsInfo> child = childs.get(group.getId());
            for (int j = 0; j < child.size(); j++) {
                child.get(j).setChoosed(allCheckBox.isChecked());//这里出现过错误
            }
        }
        adapter.notifyDataSetChanged();
        calulate();
    }

计算商品价格

private void calulate() {
        mtotalPrice = 0.00;
        mtotalCount = 0;
        for (int i = 0; i < groups.size(); i++) {
            StoreInfo group = groups.get(i);
            List<GoodsInfo> child = childs.get(group.getId());
            for (int j = 0; j < child.size(); j++) {
                GoodsInfo good = child.get(j);
                if (good.isChoosed()) {
                    mtotalCount++;
                    mtotalPrice += good.getPrice() * good.getCount();
                }
            }
        }
        totalPrice.setText("¥" + mtotalPrice + "");
        goPay.setText("去支付(" + mtotalCount + ")");
        if (mtotalCount == 0) {
            setCartNum();
        } else {
            shoppingcatNum.setText("购物车(" + mtotalCount + ")");
        }
    }

设置购物车数量和清空购物车

    private void setCartNum() {
        int count = 0;
        for (int i = 0; i < groups.size(); i++) {
            StoreInfo group = groups.get(i);
            group.setChoosed(allCheckBox.isChecked());
            List<GoodsInfo> Childs = childs.get(group.getId());
            for (GoodsInfo childs : Childs) {
                count++;
            }
        }
        //购物车已经清空
        if (count == 0) {
            clearCart();
        } else {
            shoppingcatNum.setText("购物车(" + count + ")");
        }
    }
    private void clearCart() {
        shoppingcatNum.setText("购物车(0)");
        actionBarEdit.setVisibility(View.GONE);
        llCart.setVisibility(View.GONE);
        empty_shopcart.setVisibility(View.VISIBLE);//这里发生过错误
    }

初始化店铺和商品信息

     *模拟数据<br>
      遵循适配器的数据列表填充原则,组元素被放在一个list中,对应着组元素的下辖子元素被放在Map中
      其Key是组元素的Id
    private void initData() {
        mcontext = this;
        groups = new ArrayList<StoreInfo>();
        childs = new HashMap<String, List<GoodsInfo>>();
        for (int i = 0; i < 5; i++) {
            groups.add(new StoreInfo(i + "", "小马的第" + (i + 1) + "号当铺"));
            List<GoodsInfo> goods = new ArrayList<>();
            for (int j = 0; j <= i; j++) {
                int[] img = {R.drawable.cmaz, R.drawable.cmaz, R.drawable.cmaz, R.drawable.cmaz, R.drawable.cmaz, R.drawable.cmaz};
                //i-j 就是商品的id, 对应着第几个店铺的第几个商品,1-1 就是第一个店铺的第一个商品
                goods.add(new GoodsInfo(i + "-" + j, "商品", groups.get(i).getName() + "的第" + (j + 1) + "个商品", 255.00 + new Random().nextInt(1500), 1555 + new Random().nextInt(3000), "第一排", "出头天者", img[j], new Random().nextInt(100)));
            }
            childs.put(groups.get(i).getId(), goods);
        }
    }

public class ShopcatAdapter extends BaseExpandableListAdapter {
    private List<StoreInfo> groups;
    //这个String对应着StoreInfo的Id,也就是店铺的Id
    private Map<String, List<GoodsInfo>> childrens;
    private Context mcontext;
    private CheckInterface checkInterface;
    private ModifyCountInterface modifyCountInterface;
    private GroupEditorListener groupEditorListener;
    private int count = 0;
    private boolean flag=true; //组的编辑按钮是否可见,true可见,false不可见


    public ShopcatAdapter(List<StoreInfo> groups, Map<String, List<GoodsInfo>> childrens, Context mcontext) {
        this.groups = groups;
        this.childrens = childrens;
        this.mcontext = mcontext;
    }

    @Override
    public int getGroupCount() {
        return groups.size();
    }

    @Override
    public int getChildrenCount(int groupPosition) {
        String groupId = groups.get(groupPosition).getId();
        return childrens.get(groupId).size();
    }

    @Override
    public Object getGroup(int groupPosition) {
        return groups.get(groupPosition);
    }

    @Override
    public Object getChild(int groupPosition, int childPosition) {
        List<GoodsInfo> childs = childrens.get(groups.get(groupPosition).getId());
        return childs.get(childPosition);
    }

    @Override
    public long getGroupId(int groupPosition) {
        return groupPosition;
    }

    @Override
    public long getChildId(int groupPosition, int childPosition) {
        return childPosition;
    }

    @Override
    public boolean hasStableIds() {
        return false;
    }

    @Override
    public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
        final GroupViewHolder groupViewHolder;
        if (convertView == null) {
            convertView = View.inflate(mcontext, R.layout.item_shopcat_group, null);
            groupViewHolder = new GroupViewHolder(convertView);
            convertView.setTag(groupViewHolder);
        } else {
            groupViewHolder = (GroupViewHolder) convertView.getTag();
        }
        final StoreInfo group = (StoreInfo) getGroup(groupPosition);
        groupViewHolder.storeName.setText(group.getName());
        groupViewHolder.storeCheckBox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                group.setChoosed(((CheckBox) v).isChecked());
                checkInterface.checkGroup(groupPosition, ((CheckBox) v).isChecked());
            }
        });
        groupViewHolder.storeCheckBox.setChecked(group.isChoosed());

        /**【文字指的是组的按钮的文字】
         * 当我们按下ActionBar的 "编辑"按钮, 应该把所有组的文字显示"编辑",并且设置按钮为不可见
         * 当我们完成编辑后,再把组的编辑按钮设置为可见
         * 不懂,请自己操作淘宝,观察一遍
         */
        if(group.isActionBarEditor()){
            group.setEditor(false);
            groupViewHolder.storeEdit.setVisibility(View.GONE);
            flag=false;
        }else{
            flag=true;
            groupViewHolder.storeEdit.setVisibility(View.VISIBLE);
        }

        /**
         * 思路:当我们按下组的"编辑"按钮后,组处于编辑状态,文字显示"完成"
         * 当我们点击“完成”按钮后,文字显示"编辑“,组处于未编辑状态
         */
        if (group.isEditor()) {
            groupViewHolder.storeEdit.setText("完成");
        } else {
            groupViewHolder.storeEdit.setText("编辑");
        }

        groupViewHolder.storeEdit.setOnClickListener(new GroupViewClick(group, groupPosition, groupViewHolder.storeEdit));
        return convertView;
    }

    @Override
    public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
        final ChildViewHolder childViewHolder;
        if (convertView == null) {
            convertView = View.inflate(mcontext, R.layout.item_shopcat_product, null);
            childViewHolder = new ChildViewHolder(convertView);
            convertView.setTag(childViewHolder);
        } else {
            childViewHolder = (ChildViewHolder) convertView.getTag();
        }

        /**
         * 根据组的编辑按钮的可见与不可见,去判断是组对下辖的子元素编辑  还是ActionBar对组的下瞎元素的编辑
         * 如果组的编辑按钮可见,那么肯定是组对自己下辖元素的编辑
         * 如果组的编辑按钮不可见,那么肯定是ActionBar对组下辖元素的编辑
         */
        if(flag){
            if (groups.get(groupPosition).isEditor()) {
                childViewHolder.editGoodsData.setVisibility(View.VISIBLE);
                childViewHolder.delGoods.setVisibility(View.VISIBLE);
                childViewHolder.goodsData.setVisibility(View.GONE);
            } else {
                childViewHolder.delGoods.setVisibility(View.VISIBLE);
                childViewHolder.goodsData.setVisibility(View.VISIBLE);
                childViewHolder.editGoodsData.setVisibility(View.GONE);
            }
        }else{

            if(groups.get(groupPosition).isActionBarEditor()){
                childViewHolder.delGoods.setVisibility(View.GONE);
                childViewHolder.editGoodsData.setVisibility(View.VISIBLE);
                childViewHolder.goodsData.setVisibility(View.GONE);
            }else{
                childViewHolder.delGoods.setVisibility(View.VISIBLE);
                childViewHolder.goodsData.setVisibility(View.VISIBLE);
                childViewHolder.editGoodsData.setVisibility(View.GONE);
            }
        }

        final GoodsInfo child = (GoodsInfo) getChild(groupPosition, childPosition);
        if (child != null) {
            childViewHolder.goodsName.setText(child.getDesc());
            childViewHolder.goodsPrice.setText("¥" + child.getPrice() + "");
            childViewHolder.goodsNum.setText(String.valueOf(child.getCount()));
            childViewHolder.goodsImage.setImageResource(R.drawable.cmaz);
            childViewHolder.goods_size.setText("门票:" + child.getColor() + ",类型:" + child.getSize());
            //设置打折前的原价
            SpannableString spannableString = new SpannableString("¥" + child.getPrime_price() + "");
            StrikethroughSpan span = new StrikethroughSpan();
            spannableString.setSpan(span,0,spannableString.length()-1+1, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
            //避免无限次的append
            if (childViewHolder.goodsPrimePrice.length() > 0) {
                childViewHolder.goodsPrimePrice.setText("");
            }
            childViewHolder.goodsPrimePrice.setText(spannableString);
            childViewHolder.goodsBuyNum.setText("x" + child.getCount() + "");
            childViewHolder.singleCheckBox.setChecked(child.isChoosed());
            childViewHolder.singleCheckBox.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    child.setChoosed(((CheckBox) v).isChecked());
                    childViewHolder.singleCheckBox.setChecked(((CheckBox) v).isChecked());
                    checkInterface.checkChild(groupPosition, childPosition, ((CheckBox) v).isChecked());
                }
            });
            childViewHolder.increaseGoodsNum.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    modifyCountInterface.doIncrease(groupPosition, childPosition, childViewHolder.goodsNum, childViewHolder.singleCheckBox.isChecked());
                }
            });
            childViewHolder.reduceGoodsNum.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    modifyCountInterface.doDecrease(groupPosition, childPosition, childViewHolder.goodsNum, childViewHolder.singleCheckBox.isChecked());
                }
            });
            childViewHolder.goodsNum.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    showDialog(groupPosition,childPosition,childViewHolder.goodsNum,childViewHolder.singleCheckBox.isChecked(),child);
                }
            });
            childViewHolder.delGoods.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    new AlertDialog.Builder(mcontext)
                            .setMessage("确定要删除该商品吗")
                            .setNegativeButton("取消",null)
                            .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    modifyCountInterface.childDelete(groupPosition,childPosition);
                                }
                            })
                            .create()
                            .show();;
                }
            });
        }
        return convertView;
    }
    private void showDialog(final int groupPosition, final int childPosition, final View showCountView,final  boolean isChecked, final  GoodsInfo child) {
        final AlertDialog.Builder alertDialog_Builder=new AlertDialog.Builder(mcontext);
        View view= LayoutInflater.from(mcontext).inflate(R.layout.dialog_change_num,null);
        final AlertDialog  dialog=alertDialog_Builder.create();
        dialog.setView(view);
        count=child.getCount();
        final EditText num= (EditText) view.findViewById(R.id.dialog_num);
        num.setText(count+"");
        dialog.setOnShowListener(new DialogInterface.OnShowListener() {
            @Override
            public void onShow(DialogInterface dialog) {
                UtilTool.showKeyboard(mcontext,showCountView);
            }
        });
        final TextView increase= (TextView) view.findViewById(R.id.dialog_increaseNum);
        final TextView DeIncrease=(TextView)view.findViewById(R.id.dialog_reduceNum);
        final TextView pButton= (TextView) view.findViewById(R.id.dialog_Pbutton);
        final TextView nButton= (TextView) view.findViewById(R.id.dialog_Nbutton);
        nButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        pButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int number=Integer.parseInt(num.getText().toString().trim());
                if(number==0){
                    dialog.dismiss();
                }else{
                    UtilsLog.i("数量="+number+"");
                    num.setText(String.valueOf(number));
                    child.setCount(number);
               modifyCountInterface.doUpdate(groupPosition,childPosition,showCountView,isChecked);
                 dialog.dismiss();
                }
            }
        });
        increase.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                count++;
                num.setText(String.valueOf(count));
            }
        });
        DeIncrease.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(count>1){
                    count--;
                    num.setText(String.valueOf(count));
                }
            }
        });
        dialog.show();
    }
    @Override
    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return false;
    }
    public GroupEditorListener getGroupEditorListener() {
        return groupEditorListener;
    }
    public void setGroupEditorListener(GroupEditorListener groupEditorListener) {
        this.groupEditorListener = groupEditorListener;
    }
    public CheckInterface getCheckInterface() {
        return checkInterface;
    }
    public void setCheckInterface(CheckInterface checkInterface) {
        this.checkInterface = checkInterface;
    }
    public ModifyCountInterface getModifyCountInterface() {
        return modifyCountInterface;
    }
    public void setModifyCountInterface(ModifyCountInterface modifyCountInterface) {
        this.modifyCountInterface = modifyCountInterface;
    }
    static class GroupViewHolder {
        @BindView(R.id.store_checkBox)
        CheckBox storeCheckBox;
        @BindView(R.id.store_name)
        TextView storeName;
        @BindView(R.id.store_edit)
        TextView storeEdit;

        public GroupViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
    public interface CheckInterface {
        void checkGroup(int groupPosition, boolean isChecked);
        void checkChild(int groupPosition, int childPosition, boolean isChecked);
    }
        void doIncrease(int groupPosition, int childPosition, View showCountView, boolean isChecked);

        void doDecrease(int groupPosition, int childPosition, View showCountView, boolean isChecked);

        void doUpdate(int groupPosition,int childPosition,View showCountView, boolean isChecked);
        void childDelete(int groupPosition, int childPosition);
    }
    public interface GroupEditorListener {
        void groupEditor(int groupPosition);
    }
    private class GroupViewClick implements View.OnClickListener {
        private StoreInfo group;
        private int groupPosition;
        private TextView editor;

        public GroupViewClick(StoreInfo group, int groupPosition, TextView editor) {
            this.group = group;
            this.groupPosition = groupPosition;
            this.editor = editor;
        }
        @Override
        public void onClick(View v) {
            if (editor.getId() == v.getId()) {
                groupEditorListener.groupEditor(groupPosition);
                if (group.isEditor()) {
                    group.setEditor(false);
                } else {
                    group.setEditor(true);
                }
                notifyDataSetChanged();
            }
        }
    }


    static class ChildViewHolder {
        @BindView(R.id.single_checkBox)
        CheckBox singleCheckBox;
        @BindView(R.id.goods_image)
        ImageView goodsImage;
        @BindView(R.id.goods_name)
        TextView goodsName;
        @BindView(R.id.goods_size)
        TextView goods_size;
        @BindView(R.id.goods_price)
        TextView goodsPrice;
        @BindView(R.id.goods_prime_price)
        TextView goodsPrimePrice;
        @BindView(R.id.goods_buyNum)
        TextView goodsBuyNum;
        @BindView(R.id.goods_data)
        RelativeLayout goodsData;
        @BindView(R.id.reduce_goodsNum)
        TextView reduceGoodsNum;
        @BindView(R.id.goods_Num)
        TextView goodsNum;
        @BindView(R.id.increase_goods_Num)
        TextView increaseGoodsNum;
        @BindView(R.id.goodsSize)
        TextView goodsSize;
        @BindView(R.id.del_goods)
        TextView delGoods;
        @BindView(R.id.edit_goods_data)
        LinearLayout editGoodsData;

        public ChildViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}

总结

其实代码量还是挺多的,主要的还是思路。思路理明白了,自然水到渠成。代码照着打一遍,思路自然明了。难点在于店铺与商品,单选框,编辑按钮之间的关系处理和布局的改变。

本文同步分享在 博客“cmazxiaoma”(JianShu)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

buy or not buy

buy or not buy

    

#include<stdio.h>
#include<stdbool.h>
#include<stdlib.h>
#include<string.h>
int main(int argc,char const *argv[]){
  int h[62]={0};
  int ret;
  char str1[1000],str2[1000];
  scanf("%s%s",str1,str2);
    //printf("%s\n",str1);
    //printf("%s\n",str2);

    for(int i=0;str1[i];i++){
       if(str1[i]>=''0''&&str1[i]<=''9''){
            ret = str1[i]-''0'';
       }else if(str1[i]>=''a''&&str1[i]<=''z''){
            ret = str1[i]-''a''+10;
       }else{
            ret = str1[i]-''A''+36;
       }
          h[ret]++;
    }
    /*
      for(int i=0;i<62;i++){
         printf("h[%d]=%d\n",i,h[i]);
      }
*/
    int  cnt = 0;
    int  num = 0;
    bool flag = true;
    for(int i=0;str2[i];i++){
        if(str2[i]>=''0''&&str2[i]<=''9''){
            ret = str2[i]-''0'';
       }else if(str2[i]>=''a''&&str2[i]<=''z''){
            ret = str2[i]-''a''+10;
       }else{
            ret = str2[i]-''A''+36;
       }
         if(h[ret]){
            cnt++;
            h[ret]--;
         }else{
            num++;
         }
    }
    if(cnt==strlen(str2)) printf("Yes %d\n",strlen(str1)-strlen(str2));
     else printf("No %d\n",num);
    return 0;
 }
 

 

Buyou:让你在iPad上轻松购物

Buyou:让你在iPad上轻松购物

我想去买衣服,我想去买耳环,我还想去买好吃的……肿么办?可是我没时间啊!我要吐槽啦!现在的工作这么忙,朝九晚五,弄不好周末还要加班…难得能在家休息就很不错了,很辛苦的说,哪还有精力和时间放在逛街上?肿么办肿么办?

这个时候,很多人第一时间肯定会想到网购,在电子商务发达的今天,网购已经成为一种时尚甚至是一种习惯。近年随着平板电脑的普及,越来越多的用户也喜欢用这样一种方式来进行网购,随之而来的是各种网购应用的诞生,现在iPad上很多应用软件就可以帮助大家随时随地的购买心仪的物品,实现达人们在家躺在床上或者沙发上动动手指便可以轻松购物的愿望!不过面对如此众多的应用软件,我们总是需要在不同的应用之间切换,这样太费劲了。

不过现在好了,有了Buyou一切问题就迎刃而解了。可是,它目前只针对美国用户哦,哎,无力吐槽,有木有啊。不过还是先来了解下这款应用吧,说不定哪天在中国就可以派上用场了,况且中国山寨这么强大,开发一款类似的应用还不是小 case的事情。

Buyou是创业公司Alley在2012 TechCrunch disrupt大会上向大众展示的产品。它是一家免费在线商城,将各种不同的品牌聚合在一个界面上,整个网站界面不但美观,而且操作起来也相当方便。更给力的是,该应用可以总结出用户的消费习惯和品味爱好并将其反馈给商家,然后商家有选择性地给用户推荐比较感兴趣的服装,给用户带来了很大的便利。这样就免去了“众里寻它千百度,蓦然回首,依旧没有找到心仪衣服”的困扰。

Buyou还有一个特色版块,该版块集中了特色商品、促销商品以及其他用户的交易反馈信息,进一步方便了消费者选购自己喜爱的产品,想要打折的商品直奔这个版块就ok啦。此外,整个应用的界面也不错啦,不仅可以分类搜索,还有收藏功能,犹豫的商品就偷偷收起来好好考虑下,大大避免了因为冲动乱消费的问题…这么人性化还替消费者考虑的软件不多了哦。

目前该应用可以在苹果商店里下载,平台里包含32家零售店,其中有Express,Bonobos,Gap,Lands’ End,LEGO,Nine West,Oakley以及 The Sharper Image等知名品牌,后续会有更多其他知名名牌的注入。

要想在购物方式日新月异的今天获得成功,零售商们需要知道,当消费者的设备发生变化之后他们的购物行为也随之改变,因此应该在各个渠道上面都优化消费者的购物体验,使得购物成为一件令人愉快的事情,从而保持销售收入的增长。

Via TC

@H_301_32@@H_301_32@(Danice 供雷锋网专稿,转载请注明!)

关于淘宝Buy+VR购物怎么玩 淘宝Buy+ VR设备购物体验使用图文教程淘宝的vr购物在哪的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于2018淘宝双11清空购物车活动怎么玩、Android仿淘宝购物车,玩转电商购物车、buy or not buy、Buyou:让你在iPad上轻松购物的相关知识,请在本站寻找。

本文标签:

上一篇全新滴滴版Uber界面大曝光:加入不少滴滴App上的功能(滴滴出行uber)

下一篇Uber优步怎样申请发票(uber优步怎样申请发票流程)