本文整理汇总了Java中android.support.v4.widget.AutoScrollHelper类的典型用法代码示例。如果您正苦于以下问题:Java AutoScrollHelper类的具体用法?Java AutoScrollHelper怎么用?Java AutoScrollHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AutoScrollHelper类属于android.support.v4.widget包,在下文中一共展示了AutoScrollHelper类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateMaxViewport
import android.support.v4.widget.AutoScrollHelper; //导入依赖的package包/类
private void calculateMaxViewport() {
this.tempMaximumViewport.set(AutoScrollHelper.NO_MAX, Float.MIN_VALUE, Float.MIN_VALUE, AutoScrollHelper.NO_MAX);
for (Line line : this.dataProvider.getLineChartData().getLines()) {
for (PointValue pointValue : line.getValues()) {
if (pointValue.getX() < this.tempMaximumViewport.left) {
this.tempMaximumViewport.left = pointValue.getX();
}
if (pointValue.getX() > this.tempMaximumViewport.right) {
this.tempMaximumViewport.right = pointValue.getX();
}
if (pointValue.getY() < this.tempMaximumViewport.bottom) {
this.tempMaximumViewport.bottom = pointValue.getY();
}
if (pointValue.getY() > this.tempMaximumViewport.top) {
this.tempMaximumViewport.top = pointValue.getY();
}
}
}
}
示例2: getClosestDecodedValue
import android.support.v4.widget.AutoScrollHelper; //导入依赖的package包/类
private static int getClosestDecodedValue(int[] moduleBitCount) {
int bitCountSum = PDF417Common.getBitCountSum(moduleBitCount);
float[] bitCountRatios = new float[8];
for (int i = 0; i < bitCountRatios.length; i++) {
bitCountRatios[i] = ((float) moduleBitCount[i]) / ((float) bitCountSum);
}
float bestMatchError = AutoScrollHelper.NO_MAX;
int bestMatch = -1;
for (int j = 0; j < RATIOS_TABLE.length; j++) {
float error = 0.0f;
float[] ratioTableRow = RATIOS_TABLE[j];
for (int k = 0; k < 8; k++) {
float diff = ratioTableRow[k] - bitCountRatios[k];
error += diff * diff;
if (error >= bestMatchError) {
break;
}
}
if (error < bestMatchError) {
bestMatchError = error;
bestMatch = PDF417Common.SYMBOL_TABLE[j];
}
}
return bestMatch;
}
示例3: init
import android.support.v4.widget.AutoScrollHelper; //导入依赖的package包/类
private void init() {
listView = (ListView) findViewById(R.id.list_view);
String[] strs = getData(100);
List<Map<String, Object>> list = new ArrayList<>();
for (String str : strs) {
Map<String, Object> map = new HashMap<>();
map.put("text", str);
list.add(map);
}
SimpleAdapter adapter = new SimpleAdapter(this, list, R.layout.item_simple, new String[]{"text"}, new int[]{R.id.text_view});
listView.setAdapter(adapter);
AutoScrollHelper autoScrollHelper = new ListViewAutoScrollHelper(listView);
listView.setOnTouchListener(autoScrollHelper);
autoScrollHelper.setEnabled(true);
// autoScrollHelper.setActivationDelay(3000);
// autoScrollHelper.setRampDownDuration(3000);
Toast.makeText(this, "长按上或下边缘", Toast.LENGTH_SHORT).show();
}
示例4: setScrollHelpers
import android.support.v4.widget.AutoScrollHelper; //导入依赖的package包/类
private void setScrollHelpers() {
mScrollHelper = new ListBuddiesAutoScrollHelper(mListViewLeft) {
@Override
public void scrollTargetBy(int deltaX, int deltaY) {
mListViewLeft.smoothScrollBy(mSpeedLeft, 0);
mListViewRight.smoothScrollBy(mSpeedRight, 0);
}
@Override
public boolean canTargetScrollHorizontally(int i) {
return false;
}
@Override
public boolean canTargetScrollVertically(int i) {
return true;
}
};
mScrollHelper.setEnabled(isEnable());
mScrollHelper.setEdgeType(AutoScrollHelper.EDGE_TYPE_OUTSIDE);
}
示例5: calculateMaxViewport
import android.support.v4.widget.AutoScrollHelper; //导入依赖的package包/类
private void calculateMaxViewport() {
float maxZ = Float.MIN_VALUE;
this.tempMaximumViewport.set(AutoScrollHelper.NO_MAX, Float.MIN_VALUE, Float.MIN_VALUE, AutoScrollHelper.NO_MAX);
BubbleChartData data = this.dataProvider.getBubbleChartData();
for (BubbleValue bubbleValue : data.getValues()) {
if (Math.abs(bubbleValue.getZ()) > maxZ) {
maxZ = Math.abs(bubbleValue.getZ());
}
if (bubbleValue.getX() < this.tempMaximumViewport.left) {
this.tempMaximumViewport.left = bubbleValue.getX();
}
if (bubbleValue.getX() > this.tempMaximumViewport.right) {
this.tempMaximumViewport.right = bubbleValue.getX();
}
if (bubbleValue.getY() < this.tempMaximumViewport.bottom) {
this.tempMaximumViewport.bottom = bubbleValue.getY();
}
if (bubbleValue.getY() > this.tempMaximumViewport.top) {
this.tempMaximumViewport.top = bubbleValue.getY();
}
}
this.maxRadius = (float) Math.sqrt(((double) maxZ) / 3.141592653589793d);
this.bubbleScaleX = this.tempMaximumViewport.width() / (this.maxRadius * aj.hA);
if (this.bubbleScaleX == 0.0f) {
this.bubbleScaleX = 1.0f;
}
this.bubbleScaleY = this.tempMaximumViewport.height() / (this.maxRadius * aj.hA);
if (this.bubbleScaleY == 0.0f) {
this.bubbleScaleY = 1.0f;
}
this.bubbleScaleX *= data.getBubbleScale();
this.bubbleScaleY *= data.getBubbleScale();
this.tempMaximumViewport.inset((-this.maxRadius) * this.bubbleScaleX, (-this.maxRadius) * this.bubbleScaleY);
this.minRawRadius = (float) ChartUtils.dp2px(this.density, this.dataProvider.getBubbleChartData().getMinBubbleRadius());
}
示例6: init
import android.support.v4.widget.AutoScrollHelper; //导入依赖的package包/类
private void init() {
recyclerView = (RecyclerView) findViewById(R.id.recyler_view);
linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
staggeredGridLayoutManager = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(new SimpleRecylerViewAdapter(this, getData(100)));
AutoScrollHelper autoScrollHelper = new RecyclerViewAutoScrollHelper(recyclerView);
autoScrollHelper.setEnabled(true);
recyclerView.setOnTouchListener(autoScrollHelper);
}
示例7: init
import android.support.v4.widget.AutoScrollHelper; //导入依赖的package包/类
private void init() {
scrollView = (ScrollView) findViewById(R.id.scroll_view);
AutoScrollHelper autoScrollHelper = new ScrollViewAutoScrollHelper(scrollView);
autoScrollHelper.setEnabled(true);
scrollView.setOnTouchListener(autoScrollHelper);
}