首页 > 分享 > 基于云计算感应器的智能盆栽监测系统

基于云计算感应器的智能盆栽监测系统

all_screen_view = new ArrayList<LinkedList<View>>();

display = this.getWindowManager().getDefaultDisplay();

item_width = display.getWidth() / column_count + 2;

column_height = new int[column_count];

context = this;

pin_mark = new HashMap[column_count];

fb = new FinalBitmap(this).init();

fb.setCompleteListener(this);

this.lineIndex = new int[column_count];

this.bottomIndex = new int[column_count];

this.topIndex = new int[column_count];

for (int i = 0; i < column_count; i++) {

    lineIndex[i] = -1;

    bottomIndex[i] = -1;

    pin_mark[i] = new HashMap();

}

InitLayout();

private void InitLayout() {

waterfall_scroll = (TryPullToRefreshScrollView) findViewById(R.id.waterfall_scroll);

rv = (TryRefreshableView) findViewById(R.id.trymyRV);

rv.sv = waterfall_scroll;

rv.setRefreshListener(new TryRefreshableView.RefreshListener() {

    @Override

    public void onDownRefresh() {

        if (rv.mRefreshState == TryRefreshableView.READYTOREFRESH) {

            firstView = waterfall_items.get(0).getChildAt(0);

            refreshType = DOWNREFRESH;

            AddItemToContainer(++current_page, page_count);

        }

    }

});

rv.setOnBottomListener(new TryRefreshableView.OnBottomListener() {

    @Override

    public void onBottom() {

        if (rv.mRefreshState != TryRefreshableView.REFRESHING) {

            refreshType = UPREFRESH;

            AddItemToContainer(++current_page, page_count);

        }

    }

});

waterfall_scroll.setOnScrollListener(new TryPullToRefreshScrollView.OnScrollListener() {

    @Override

    public void onAutoScroll(int l, int t, int oldl, int oldt) {

        if (pin_mark.length <= 0) {

            return;

        }

        scroll_height = waterfall_scroll.getMeasuredHeight();

        Log.d("MainActivity", "scroll_height:" + scroll_height);

        if (t > oldt) {

            if (t > 3 * scroll_height) {

                for (int k = 0; k < column_count; k++) {

                    LinearLayout localLinearLayout = waterfall_items

                            .get(k);

                    if (pin_mark[k].get(Math.min(bottomIndex[k] + 1,

                            lineIndex[k])) <= t + 3 * scroll_height) {

                        View childAt = localLinearLayout

                                .getChildAt(Math.min(

                                        1 + bottomIndex[k],

                                        lineIndex[k]));

                        if(childAt != null){

                            FlowView picView = (FlowView) childAt

                                    .findViewById(R.id.news_pic);

                            if (picView.bitmap == null

                                    && !TextUtils.isEmpty(picView.get_url())) {

                                fb.reload(picView.get_url(), picView);

                            }

                            bottomIndex[k] = Math.min(1 + bottomIndex[k],

                                    lineIndex[k]);

                        }

                    }

                    if (pin_mark[k].get(topIndex[k]) < t - 2

                            * scroll_height) {

                        int i1 = topIndex[k];

                        topIndex[k]++;

                        ((FlowView) localLinearLayout.getChildAt(i1)

                                .findViewById(R.id.news_pic)).recycle();

                        Log.d("MainActivity", "recycle,k:" + k

                                + " headindex:" + topIndex[k]);

                    }

                }

            }

        } else {

            if (t > 3 * scroll_height) {

                for (int k = 0; k < column_count; k++) {

                    LinearLayout localLinearLayout = waterfall_items

                            .get(k);

                    if (pin_mark[k].get(bottomIndex[k]) > t + 3

                            * scroll_height) {

                        ((FlowView) localLinearLayout.getChildAt(

                                bottomIndex[k]).findViewById(

                                R.id.news_pic)).recycle();

                        Log.d("MainActivity", "recycle,k:" + k

                                + " headindex:" + topIndex[k]);

                        bottomIndex[k]--;

                    }

                    if (pin_mark[k].get(Math.max(topIndex[k] - 1, 0)) >= t

                            - 2 * scroll_height) {

                        FlowView picView = ((FlowView) localLinearLayout

                                .getChildAt(

                                        Math.max(-1 + topIndex[k], 0))

                                .findViewById(R.id.news_pic));

                        if (picView.bitmap == null

                                && !TextUtils.isEmpty(picView.get_url())) {

                            fb.reload(picView.get_url(), picView);

                        }

                        topIndex[k] = Math.max(topIndex[k] - 1, 0);

                    }

                }

            }

        }

    }

});

相关知识

基于机智云物联网的智能花卉栽培系统
基于物联网云的花园智能监控系统设计文档资源
基于智能可穿戴设备的实时健康监测系统
基于物联网的智能花卉栽培系统设计研究.pdf
物联网虫情监测系统:基于互联网技术的智能农业害虫管理解决方案
基于Android的车载智能监测系统的应用与研究
一种基于SoC和阿里云的智能家居系统设计方案
基于物联网的害虫智能监测系统设计与实现
一种害虫智能监测诱捕系统及害虫监测方法技术方案
一种基于物联网的盆栽植物智能浇水系统

网址: 基于云计算感应器的智能盆栽监测系统 https://m.huajiangbk.com/newsview636416.html

所属分类:花卉
上一篇: 关于室内花卉装饰与栽培养护的浅见
下一篇: 室内花卉的品种选择与养护