Coder Social home page Coder Social logo

关于数据更新的问题 about imageshowpicker HOT 3 CLOSED

yaozs avatar yaozs commented on September 14, 2024
关于数据更新的问题

from imageshowpicker.

Comments (3)

yaozs avatar yaozs commented on September 14, 2024

你点+号的时候就是添加图片,不管他是否重复,点击原来图片的时候,只让他选择一张图片,或者仿照朋友圈,外面不要删除,里面放删除,就是不让他可以添加多张图片

from imageshowpicker.

pardonhan avatar pardonhan commented on September 14, 2024

刚试了一下下面这个方法,可以暂时实现我的需求

public <T extends ImageShowPickerBean> void addData(List<T> list) {
        if (list == null) {
            return;
        }
        for (int i = 0; i < list.size(); i++) {
            T t = list.get(i);
            for (ImageShowPickerBean bean : this.list) {
                if (TextUtils.equals(t.getImageShowPickerUrl(), bean.getImageShowPickerUrl())) {
                    list.remove(i);
                    i--;
                }
            }
        }
        this.list.addAll(list);
        if (isShowAnim) {
            if (adapter != null)
                adapter.notifyItemRangeChanged(this.list.size() - list.size(), list.size());
        } else {
            if (adapter != null)
                adapter.notifyDataSetChanged();
        }
    }

from imageshowpicker.

yaozs avatar yaozs commented on September 14, 2024

这样不太好吧,你这样处理的话,只要点击之前的已选中图片,就会触发全部重置,感觉逻辑不通

from imageshowpicker.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.