本文整理汇总了Java中com.andrognito.patternlockview.utils.ResourceUtils类的典型用法代码示例。如果您正苦于以下问题:Java ResourceUtils类的具体用法?Java ResourceUtils怎么用?Java ResourceUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourceUtils类属于com.andrognito.patternlockview.utils包,在下文中一共展示了ResourceUtils类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUpPatternLock
import com.andrognito.patternlockview.utils.ResourceUtils; //导入依赖的package包/类
private void setUpPatternLock() {
mPatternLockView.setDotCount(3);
mPatternLockView.setDotNormalSize((int) ResourceUtils.getDimensionInPx(this, R.dimen.pattern_lock_dot_size));
mPatternLockView.setDotSelectedSize((int) ResourceUtils.getDimensionInPx(this, R.dimen.pattern_lock_dot_selected_size));
mPatternLockView.setPathWidth((int) ResourceUtils.getDimensionInPx(this, R.dimen.pattern_lock_path_width));
mPatternLockView.setAspectRatioEnabled(true);
mPatternLockView.setAspectRatio(PatternLockView.AspectRatio.ASPECT_RATIO_HEIGHT_BIAS);
mPatternLockView.setViewMode(PatternLockView.PatternViewMode.CORRECT);
mPatternLockView.setDotAnimationDuration(150);
mPatternLockView.setPathEndAnimationDuration(100);
mPatternLockView.setCorrectStateColor(ResourceUtils.getColor(this, R.color.green));
mPatternLockView.setNormalStateColor(ResourceUtils.getColor(this, R.color.white));
mPatternLockView.setWrongStateColor(ResourceUtils.getColor(this, R.color.pomegranate));
mPatternLockView.setInStealthMode(false);
mPatternLockView.setTactileFeedbackEnabled(true);
mPatternLockView.setInputEnabled(true);
mPatternLockView.addPatternLockListener(mPatternLockViewListener);
}
示例2: onCreate
import com.andrognito.patternlockview.utils.ResourceUtils; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_lock_pattern);
mPatternLockView = (PatternLockView) findViewById(R.id.patter_lock_view);
mPatternLockView.setDotCount(3);
mPatternLockView.setDotNormalSize((int) ResourceUtils.getDimensionInPx(this, R.dimen.pattern_lock_dot_size));
mPatternLockView.setDotSelectedSize((int) ResourceUtils.getDimensionInPx(this, R.dimen.pattern_lock_dot_selected_size));
mPatternLockView.setPathWidth((int) ResourceUtils.getDimensionInPx(this, R.dimen.pattern_lock_path_width));
mPatternLockView.setAspectRatioEnabled(true);
mPatternLockView.setAspectRatio(PatternLockView.AspectRatio.ASPECT_RATIO_HEIGHT_BIAS);
mPatternLockView.setViewMode(PatternLockView.PatternViewMode.CORRECT);
mPatternLockView.setDotAnimationDuration(150);
mPatternLockView.setPathEndAnimationDuration(100);
mPatternLockView.setCorrectStateColor(ResourceUtils.getColor(this, R.color.white));
mPatternLockView.setInStealthMode(false);
mPatternLockView.setTactileFeedbackEnabled(true);
mPatternLockView.setInputEnabled(true);
mPatternLockView.addPatternLockListener(mPatternLockViewListener);
RxPatternLockView.patternComplete(mPatternLockView)
.subscribe(new Consumer<PatternLockCompleteEvent>() {
@Override
public void accept(PatternLockCompleteEvent patternLockCompleteEvent) throws Exception {
Log.d(TAG, "Complete: " + patternLockCompleteEvent.getPattern().toString());
}
});
RxPatternLockView.patternChanges(mPatternLockView)
.subscribe(new Consumer<PatternLockCompoundEvent>() {
@Override
public void accept(PatternLockCompoundEvent event) throws Exception {
if (event.getEventType() == PatternLockCompoundEvent.EventType.PATTERN_STARTED) {
Log.d(TAG, "Pattern drawing started");
} else if (event.getEventType() == PatternLockCompoundEvent.EventType.PATTERN_PROGRESS) {
Log.d(TAG, "Pattern progress: " +
PatternLockUtils.patternToString(mPatternLockView, event.getPattern()));
} else if (event.getEventType() == PatternLockCompoundEvent.EventType.PATTERN_COMPLETE) {
Log.d(TAG, "Pattern complete: " +
PatternLockUtils.patternToString(mPatternLockView, event.getPattern()));
} else if (event.getEventType() == PatternLockCompoundEvent.EventType.PATTERN_CLEARED) {
Log.d(TAG, "Pattern has been cleared");
}
}
});
}
示例3: onCreate
import com.andrognito.patternlockview.utils.ResourceUtils; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
mPatternLockView = (PatternLockView) findViewById(R.id.patter_lock_view);
mPatternLockView.setDotCount(3);
mPatternLockView.setDotNormalSize((int) ResourceUtils.getDimensionInPx(this, R.dimen.pattern_lock_dot_size));
mPatternLockView.setDotSelectedSize((int) ResourceUtils.getDimensionInPx(this, R.dimen.pattern_lock_dot_selected_size));
mPatternLockView.setPathWidth((int) ResourceUtils.getDimensionInPx(this, R.dimen.pattern_lock_path_width));
mPatternLockView.setAspectRatioEnabled(true);
mPatternLockView.setAspectRatio(PatternLockView.AspectRatio.ASPECT_RATIO_HEIGHT_BIAS);
mPatternLockView.setViewMode(PatternLockView.PatternViewMode.CORRECT);
mPatternLockView.setDotAnimationDuration(150);
mPatternLockView.setPathEndAnimationDuration(100);
mPatternLockView.setCorrectStateColor(ResourceUtils.getColor(this, R.color.white));
mPatternLockView.setInStealthMode(false);
mPatternLockView.setTactileFeedbackEnabled(true);
mPatternLockView.setInputEnabled(true);
mPatternLockView.addPatternLockListener(mPatternLockViewListener);
RxPatternLockView.patternComplete(mPatternLockView)
.subscribe(new Consumer<PatternLockCompleteEvent>() {
@Override
public void accept(PatternLockCompleteEvent patternLockCompleteEvent) throws Exception {
Log.d(getClass().getName(), "Complete: " + patternLockCompleteEvent.getPattern().toString());
}
});
RxPatternLockView.patternChanges(mPatternLockView)
.subscribe(new Consumer<PatternLockCompoundEvent>() {
@Override
public void accept(PatternLockCompoundEvent event) throws Exception {
if (event.getEventType() == PatternLockCompoundEvent.EventType.PATTERN_STARTED) {
Log.d(getClass().getName(), "Pattern drawing started");
} else if (event.getEventType() == PatternLockCompoundEvent.EventType.PATTERN_PROGRESS) {
Log.d(getClass().getName(), "Pattern progress: " +
PatternLockUtils.patternToString(mPatternLockView, event.getPattern()));
} else if (event.getEventType() == PatternLockCompoundEvent.EventType.PATTERN_COMPLETE) {
Log.d(getClass().getName(), "Pattern complete: " +
PatternLockUtils.patternToString(mPatternLockView, event.getPattern()));
} else if (event.getEventType() == PatternLockCompoundEvent.EventType.PATTERN_CLEARED) {
Log.d(getClass().getName(), "Pattern has been cleared");
}
}
});
}
示例4: PatternLockView
import com.andrognito.patternlockview.utils.ResourceUtils; //导入依赖的package包/类
public PatternLockView(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.PatternLockView);
try {
sDotCount = typedArray.getInt(R.styleable.PatternLockView_dotCount,
DEFAULT_PATTERN_DOT_COUNT);
mAspectRatioEnabled = typedArray.getBoolean(R.styleable.PatternLockView_aspectRatioEnabled,
false);
mAspectRatio = typedArray.getInt(R.styleable.PatternLockView_aspectRatio,
ASPECT_RATIO_SQUARE);
mPathWidth = (int) typedArray.getDimension(R.styleable.PatternLockView_pathWidth,
ResourceUtils.getDimensionInPx(getContext(), R.dimen.pattern_lock_path_width));
mNormalStateColor = typedArray.getColor(R.styleable.PatternLockView_normalStateColor,
ResourceUtils.getColor(getContext(), R.color.white));
mCorrectStateColor = typedArray.getColor(R.styleable.PatternLockView_correctStateColor,
ResourceUtils.getColor(getContext(), R.color.white));
mWrongStateColor = typedArray.getColor(R.styleable.PatternLockView_wrongStateColor,
ResourceUtils.getColor(getContext(), R.color.pomegranate));
mDotNormalSize = (int) typedArray.getDimension(R.styleable.PatternLockView_dotNormalSize,
ResourceUtils.getDimensionInPx(getContext(), R.dimen.pattern_lock_dot_size));
mDotSelectedSize = (int) typedArray.getDimension(R.styleable
.PatternLockView_dotSelectedSize,
ResourceUtils.getDimensionInPx(getContext(), R.dimen.pattern_lock_dot_selected_size));
mDotAnimationDuration = typedArray.getInt(R.styleable.PatternLockView_dotAnimationDuration,
DEFAULT_DOT_ANIMATION_DURATION);
mPathEndAnimationDuration = typedArray.getInt(R.styleable.PatternLockView_pathEndAnimationDuration,
DEFAULT_PATH_END_ANIMATION_DURATION);
} finally {
typedArray.recycle();
}
// The pattern will always be symmetrical
mPatternSize = sDotCount * sDotCount;
mPattern = new ArrayList<>(mPatternSize);
mPatternDrawLookup = new boolean[sDotCount][sDotCount];
mDotStates = new DotState[sDotCount][sDotCount];
for (int i = 0; i < sDotCount; i++) {
for (int j = 0; j < sDotCount; j++) {
mDotStates[i][j] = new DotState();
mDotStates[i][j].mSize = mDotNormalSize;
}
}
mPatternListeners = new ArrayList<>();
initView();
}