This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# @name : log_args.py | |
# @author : cat | |
# @date : 2017/7/1. | |
import logging | |
def upper(text): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def git_shell(git_command): | |
try: | |
return os.popen(git_command).read().strip() | |
except: | |
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TextView tvChar = view.findViewById(R.id.char_tv); | |
ValueAnimator animator = ValueAnimator.ofObject((fraction, startValue, endValue) -> { | |
char start = (Character) startValue; | |
char end = (Character) endValue; | |
return (int) (start + (end - start) * fraction); | |
}, 'A', 'Z'); | |
animator.addUpdateListener(animation -> { | |
int s = (Integer) animation.getAnimatedValue(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CharTextView tvChar = view.findViewById(R.id.char_tv); | |
tvChar.setCharText('X'); | |
PropertyValuesHolder charHolder = PropertyValuesHolder.ofObject("CharText", | |
new CharEvaluator(), 'A', 'Z'); | |
charHolder.setKeyframes(Keyframe.ofObject(0, 'A'), | |
Keyframe.ofObject(0.1f, 'M'), | |
Keyframe.ofObject(0.5f, 'G'), | |
Keyframe.ofObject(0.8f, 'M'), | |
Keyframe.ofObject(1f, 'Z') | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
View callRing = view.findViewById(R.id.iv_call_ring); | |
PropertyValuesHolder rotationH = PropertyValuesHolder.ofFloat("rotation", | |
-60f, -10f, 0, 60f, 0f); | |
PropertyValuesHolder scaleXH = PropertyValuesHolder.ofFloat("scaleX", | |
1.0f, 0.7f, 1.2f, 1, 0.3f, 1f); | |
scaleXH.setKeyframes(Keyframe.ofFloat(0, 1f), | |
Keyframe.ofFloat(0.3f, 0.4f), | |
Keyframe.ofFloat(0.5f, 2f), | |
Keyframe.ofFloat(0.8f, 0.8f), | |
Keyframe.ofFloat(1f, 1f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ListView lv = view.findViewById(R.id.list_view); | |
ArrayAdapter<String> adapter = new ArrayAdapter<>(lv.getContext(), | |
android.R.layout.simple_expandable_list_item_1); | |
adapter.addAll(getResources().getStringArray(android.R.array.postalAddressTypes)); | |
lv.setAdapter(adapter); | |
view.findViewById(R.id.btn_add) | |
.setOnClickListener(v -> { | |
int bound = adapter.getCount() - 1; | |
bound = bound <= 1 ? 1 : bound; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TextUI extends View { | |
private Paint textPaint; | |
private Paint ascentPaint; | |
private Paint descentPaint; | |
private Paint topPaint; | |
private Paint bottomPaint; | |
private Paint basePaint; | |
private Paint rectPaint; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.clear(); | |
right = document.getElementsByClassName('recommend-fixed-box'); | |
for(var index = right.length-1;index>=0;index--){ | |
right[index].remove(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mac: command + j | |
win: ctrl + q |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
int ws = MeasureSpec.getSize(widthMeasureSpec); | |
int wm = MeasureSpec.getMode(widthMeasureSpec); | |
int hs = MeasureSpec.getSize(heightMeasureSpec); | |
int hm = MeasureSpec.getMode(heightMeasureSpec); | |
boolean needMaxWidth = false; | |
boolean needMaxHeight = false; | |
this.maxWidth = ws; |
OlderNewer