Esempio n. 1
0
        public void OnZoomed()
        {
            if (data.activeZoom > 0)
            {
                return;
            }
            //performClick();
            if (!chartView.legendSignatureView.canGoZoom)
            {
                return;
            }
            long x = chartView.GetSelectedDate();

            if (data.graphType == 4)
            {
                data.childChartData = new StackLinearChartData(data.chartData, x);
                ZoomChart(false);
                return;
            }

            if (data.zoomToken == null)
            {
                return;
            }

            //cancelZoom();
            //String cacheKey = data.zoomToken + "_" + x;
            //ChartData dataFromCache = childDataCache.get(cacheKey);
            //if (dataFromCache != null)
            //{
            //    data.childChartData = dataFromCache;
            //    zoomChart(false);
            //    return;
            //}

            //TLRPC.TL_stats_loadAsyncGraph request = new TLRPC.TL_stats_loadAsyncGraph();
            //request.token = data.zoomToken;
            //if (x != 0)
            //{
            //    request.x = x;
            //    request.flags |= 1;
            //}
            //ZoomCancelable finalCancelabel;
            //lastCancelable = finalCancelabel = new ZoomCancelable();
            //finalCancelabel.adapterPosition = recyclerListView.getChildAdapterPosition(ChartCell.this);

            //chartView.legendSignatureView.showProgress(true, false);

            //int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(request, (response, error)-> {
            //    ChartData childData = null;
            //    if (response instanceof TLRPC.TL_statsGraph) {
            //        String json = ((TLRPC.TL_statsGraph)response).json.data;
            //        try
            //        {
            //            childData = createChartData(new JSONObject(json), data.graphType, data == languagesData);
            //        }
            //        catch (JSONException e)
            //        {
            //            e.printStackTrace();
            //        }
            //    } else if (response instanceof TLRPC.TL_statsGraphError) {
            //        Toast.makeText(getContext(), ((TLRPC.TL_statsGraphError)response).error, Toast.LENGTH_LONG).show();
            //    }

            //    ChartData finalChildData = childData;
            //    AndroidUtilities.runOnUIThread(()-> {
            //        if (finalChildData != null)
            //        {
            //            childDataCache.put(cacheKey, finalChildData);
            //        }
            //        if (finalChildData != null && !finalCancelabel.canceled && finalCancelabel.adapterPosition >= 0)
            //        {
            //            View view = layoutManager.findViewByPosition(finalCancelabel.adapterPosition);
            //            if (view instanceof ChartCell) {
            //                data.childChartData = finalChildData;
            //                ((ChartCell)view).chartView.legendSignatureView.showProgress(false, false);
            //                ((ChartCell)view).zoomChart(false);
            //            }
            //        }
            //        cancelZoom();
            //    });
            //}, null, null, 0, chat.stats_dc, ConnectionsManager.ConnectionTypeGeneric, true);
            //ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId, classGuid);
        }