下面列出了android.os.SystemClock#currentThreadTimeMillis ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public void run() {
if (mZoomView != null) {
float f2;
ViewGroup.LayoutParams localLayoutParams;
if ((!mIsFinished) && (mScale > 1.0D)) {
float f1 = ((float) SystemClock.currentThreadTimeMillis() - (float) mStartTime) / (float) mDuration;
f2 = mScale - (mScale - 1.0F) * PullToZoomListViewEx.sInterpolator.getInterpolation(f1);
localLayoutParams = mHeaderContainer.getLayoutParams();
Log.d(TAG, "ScalingRunnable --> f2 = " + f2);
if (f2 > 1.0F) {
localLayoutParams.height = ((int) (f2 * mHeaderHeight));
mHeaderContainer.setLayoutParams(localLayoutParams);
post(this);
return;
}
mIsFinished = true;
}
}
}
public void run() {
if (mHeaderView != null) {
float f2;
ViewGroup.LayoutParams localLayoutParams;
if ((!mIsFinished) && (mScale > 1.0D)) {
float f1 = ((float) SystemClock.currentThreadTimeMillis() - (float) mStartTime) / (float) mDuration;
f2 = mScale - (mScale - 1.0F) * PullToZoomListView.sInterpolator.getInterpolation(f1);
localLayoutParams = mHeaderContainer.getLayoutParams();
if (f2 > 1.0F) {
Log.d(TAG, "f2>1.0");
localLayoutParams.height = ((int) (f2 * mHeaderHeight));
mHeaderContainer.setLayoutParams(localLayoutParams);
post(this);
return;
}
mIsFinished = true;
}
}
}
public void startForeground() {
if (mPosted) {
mOps = OPS_START_FOREGROUND;
} else {
long now = SystemClock.currentThreadTimeMillis();
if (now - mLastTime > DELAY) {
// Wait long enough, do it now
if (mService != null) {
mService.startForeground(mId, mBuilder.build());
}
} else {
// Too quick, post delay
mOps = OPS_START_FOREGROUND;
mPosted = true;
SimpleHandler.getInstance().postDelayed(this, DELAY);
}
}
}
public void run() {
if (mZoomView != null) {
float f2;
ViewGroup.LayoutParams localLayoutParams;
if ((!mIsFinished) && (mScale > 1.0D)) {
float f1 = ((float) SystemClock.currentThreadTimeMillis() - (float) mStartTime) / (float) mDuration;
f2 = mScale - (mScale - 1.0F) * PullToZoomScrollViewEx.sInterpolator.getInterpolation(f1);
localLayoutParams = mHeaderContainer.getLayoutParams();
Log.d(TAG, "ScalingRunnable --> f2 = " + f2);
if (f2 > 1.0F) {
localLayoutParams.height = ((int) (f2 * mHeaderHeight));
mHeaderContainer.setLayoutParams(localLayoutParams);
if (isCustomHeaderHeight) {
ViewGroup.LayoutParams zoomLayoutParams;
zoomLayoutParams = mZoomView.getLayoutParams();
zoomLayoutParams.height = ((int) (f2 * mHeaderHeight));
mZoomView.setLayoutParams(zoomLayoutParams);
}
post(this);
return;
}
mIsFinished = true;
}
}
}
public void run() {
if (mZoomView != null) {
float f2;
ViewGroup.LayoutParams localLayoutParams;
if ((!mIsFinished) && (mScale > 1.0D)) {
float f1 = ((float) SystemClock.currentThreadTimeMillis() - (float) mStartTime) / (float) mDuration;
f2 = mScale - (mScale - 1.0F) * PullToZoomScrollViewEx.sInterpolator.getInterpolation(f1);
localLayoutParams = mHeaderContainer.getLayoutParams();
Log.d(TAG, "ScalingRunnable --> f2 = " + f2);
if (f2 > 1.0F) {
localLayoutParams.height = ((int) (f2 * mHeaderHeight));
mHeaderContainer.setLayoutParams(localLayoutParams);
if (isCustomHeaderHeight) {
ViewGroup.LayoutParams zoomLayoutParams;
zoomLayoutParams = mZoomView.getLayoutParams();
zoomLayoutParams.height = ((int) (f2 * mHeaderHeight));
mZoomView.setLayoutParams(zoomLayoutParams);
}
post(this);
return;
}
mIsFinished = true;
}
}
}
public void run() {
if (mZoomView != null) {
float f2;
ViewGroup.LayoutParams localLayoutParams;
if ((!mIsFinished) && (mScale > 1.0D)) {
float f1 = ((float) SystemClock.currentThreadTimeMillis() - (float) mStartTime) / (float) mDuration;
f2 = mScale - (mScale - 1.0F) * PullToZoomScrollViewEx.sInterpolator.getInterpolation(f1);
localLayoutParams = mHeaderContainer.getLayoutParams();
Log.d(TAG, "ScalingRunnable --> f2 = " + f2);
if (f2 > 1.0F) {
localLayoutParams.height = ((int) (f2 * mHeaderHeight));
mHeaderContainer.setLayoutParams(localLayoutParams);
if (isCustomHeaderHeight) {
ViewGroup.LayoutParams zoomLayoutParams;
zoomLayoutParams = mZoomView.getLayoutParams();
zoomLayoutParams.height = ((int) (f2 * mHeaderHeight));
mZoomView.setLayoutParams(zoomLayoutParams);
}
post(this);
return;
}
mIsFinished = true;
}
}
}
public void stop(Type type) {
long time = SystemClock.elapsedRealtime() - timeMillis;
long timeThread = SystemClock.currentThreadTimeMillis() - threadTimeMillis;
if (!started) {
throw new RuntimeException("Not started");
}
started = false;
String name = type.name();
log(String.format(Locale.US, "%s: %d ms (thread: %d ms)", name, time, timeThread));
values.add(new Pair<>(name, Long.toString(time)));
if (storeThreadTime) {
values.add(new Pair<>(name + "-thread", Long.toString(timeThread)));
}
List<Long> typeMeasurements = measurements.get(type.ordinal());
if (typeMeasurements == null) {
typeMeasurements = new ArrayList<>();
measurements.put(type.ordinal(), typeMeasurements);
}
typeMeasurements.add(time);
}
private void a(boolean flag)
{
H = SystemClock.currentThreadTimeMillis();
android.view.WindowManager.LayoutParams layoutparams;
if (flag)
{
F = true;
} else
{
G = true;
}
I = d.height;
J = d.y;
layoutparams = d;
layoutparams.flags = 0x10 | layoutparams.flags;
f.updateViewLayout(e, d);
}
/**
* 保存文件
* @param bm
* @throws IOException
*/
public static String saveFile(Bitmap bm) throws IOException {
File dirFile = new File(ALBUM_PATH);
if(!dirFile.exists()){
dirFile.mkdir();
}
File myCaptureFile = new File(ALBUM_PATH + SystemClock.currentThreadTimeMillis() +".png");
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(myCaptureFile));
bm.compress(Bitmap.CompressFormat.JPEG, 80, bos);
bos.flush();
bos.close();
return myCaptureFile.getAbsolutePath();
}
public void startAnimation(long paramLong) {
if (mHeaderView != null) {
mStartTime = SystemClock.currentThreadTimeMillis();
mDuration = paramLong;
mScale = ((float) (mHeaderContainer.getBottom()) / mHeaderHeight);
mIsFinished = false;
post(this);
}
}
public void startAnimation(long paramLong) {
if (mZoomView != null) {
mStartTime = SystemClock.currentThreadTimeMillis();
mDuration = paramLong;
mScale = ((float) (mHeaderContainer.getBottom()) / mHeaderHeight);
mIsFinished = false;
post(this);
}
}
public void startAnimation(long paramLong) {
if (mZoomView != null) {
mStartTime = SystemClock.currentThreadTimeMillis();
mDuration = paramLong;
mScale = ((float) (mHeaderContainer.getBottom()) / mHeaderHeight);
mIsFinished = false;
post(this);
}
}
public void startAnimation(long paramLong) {
if (mZoomView != null) {
mStartTime = SystemClock.currentThreadTimeMillis();
mDuration = paramLong;
mScale = ((float) (mHeaderContainer.getBottom()) / mHeaderHeight);
mIsFinished = false;
post(this);
}
}
public void startAnimation(long paramLong) {
if (mZoomView != null) {
mStartTime = SystemClock.currentThreadTimeMillis();
mDuration = paramLong;
mScale = ((float) (mHeaderContainer.getBottom()) / mHeaderHeight);
mIsFinished = false;
post(this);
}
}
public void startAnimation(long paramLong) {
if (mZoomView != null) {
mStartTime = SystemClock.currentThreadTimeMillis();
mDuration = paramLong;
mScale = ((float) (mHeaderContainer.getBottom()) / mHeaderHeight);
mIsFinished = false;
post(this);
}
}
protected void dbOneTry(ScanParameters parameters) {
Cursor cursor = mApplicationContext.getContentResolver().query(
MediaStore.Files.getContentUri("external"),
MEDIA_PROJECTION,
//STAR,
null,
null,
null);
int data_column =
cursor.getColumnIndex(MediaStore.MediaColumns.DATA);
int modified_column =
cursor.getColumnIndex(MediaStore.MediaColumns.DATE_MODIFIED);
int totalSize = cursor.getCount();
int currentItem = 0;
int reportFreq = 0;
// Used to calibrate reporting frequency
long startTime = SystemClock.currentThreadTimeMillis();
while (cursor.moveToNext()) {
currentItem++;
try {
File file = new File(cursor.getString(data_column)).getCanonicalFile();
if ((!file.exists() ||
file.lastModified() / 1000L >
cursor.getLong(modified_column))
&& parameters.shouldScan(file, true)) {
// Media scanner handles these cases.
// Is a set, so OK if already present.
mFilesToProcess.add(file);
}
else {
// Don't want to waste time scanning an up-to-date
// file.
mFilesToProcess.remove(file);
}
if (reportFreq == 0) {
// Calibration phase
if (SystemClock.currentThreadTimeMillis() - startTime > 25) {
reportFreq = currentItem + 1;
}
}
else if (currentItem % reportFreq == 0) {
publishProgress(databaseUpdate(file.getPath(),
(100 * currentItem) / totalSize));
}
}
catch (IOException ex) {
// Just ignore it for now.
}
}
// Don't need the cursor any more.
cursor.close();
}
public void run()
{
boolean flag = true;
SystemClock.currentThreadTimeMillis();
b = (float)(0.10000000000000001D + (double)b);
float f = b;
if (f > 1.0F)
{
f = 1.0F;
}
boolean flag1;
int i;
if (f >= 1.0F)
{
flag1 = flag;
} else
{
flag1 = false;
}
i = (int)(TaskGuide.r(c).getInterpolation(f) * (float)TaskGuide.s(c));
if (a)
{
TaskGuide.k(c).y = i + TaskGuide.t(c);
} else
{
TaskGuide.k(c).y = TaskGuide.t(c) - i;
}
Log.d("TAG", (new StringBuilder()).append("mWinParams.y = ").append(TaskGuide.k(c).y).append("deltaDistence = ").append(i).toString());
if (TaskGuide.a(c))
{
TaskGuide.u(c).updateViewLayout(TaskGuide.b(c), TaskGuide.k(c));
flag = flag1;
}
if (flag)
{
TaskGuide.v(c);
return;
} else
{
TaskGuide.x(c).postDelayed(TaskGuide.w(c), 5L);
return;
}
}
public HNSegment process() throws HNSyntaxError {
long processStartTime = SystemClock.currentThreadTimeMillis();
HNSegment segment = new HNSegment();
segment.setDom(new HNDomTree(segment.getInlineStyles(), null, 0, 0));
try {
scanFor(StartAngleBracket);
scan(true);
/*
* skip the HTML version information. see https://www.w3.org/TR/html4/struct/global
* .html#h-7.2
*/
if (mCurToken.type() == Exclamation) {
mLexer.skipUntil('>');
// consume the reserved
scan();
scanFor(EndAngleBracket);
scanFor(StartAngleBracket);
scan(true);
}
if (mCurToken.type() == Html) {
scan();
scanFor(EndAngleBracket, StartAngleBracket);
processHtmlInside(segment);
} else {
processHtmlInside(segment);
}
scanFor(StartAngleBracket, Slash, Html, EndAngleBracket);
} catch (EOFException ignored) {
Log.w(TAG, "Reach the end of file!");
} finally {
mLexer.close();
mTracker.record("Parse Css + Html", SystemClock.currentThreadTimeMillis() -
processStartTime);
Log.i(PERFORMANCE_TAG, mTracker.dump());
if (mSyntaxErrorHandler.hasError()) {
Log.e(TAG, mSyntaxErrorHandler.forceDump());
}
return segment;
}
}
@MainThread
final View render(@NonNull Context context, @NonNull HNSegment segment) throws
HNRenderException {
Trace.beginSection("NHRenderer render start");
mTracker.reset();
HNLog.d(HNLog.RENDER, "start to render " + segment.toString());
HNRootView rootViewGroup = new HNRootView(context);
HNSandBoxContext sandBoxContext = HNSandBoxContextImpl.createContext(rootViewGroup,
segment, context);
mInheritStyleStack.reset();
LayoutParamsCreator rootCreator = new LayoutParamsCreator();
long renderStartTime = SystemClock.currentThreadTimeMillis();
View v = renderInternal(context, sandBoxContext, segment.getDom(), segment,
rootViewGroup, rootCreator, rootViewGroup, segment.getStyleSheet());
if (v != null) {
rootViewGroup.addContent(v, LayoutParamsCreator.createLayoutParams(rootViewGroup,
rootCreator));
mTracker.record("Render View", SystemClock.currentThreadTimeMillis() - renderStartTime);
long createTime = SystemClock.currentThreadTimeMillis();
this.performCreate(sandBoxContext);
mTracker.record("Create View", SystemClock.currentThreadTimeMillis() - createTime);
long afterCreate = SystemClock.currentThreadTimeMillis();
this.performCreated(sandBoxContext);
mTracker.record("After View Created", SystemClock.currentThreadTimeMillis() -
afterCreate);
Log.i(PERFORMANCE_TAG, mTracker.dump());
HNLog.d(HNLog.RENDER, sandBoxContext.allIdTag());
Trace.endSection();
return rootViewGroup;
}
Trace.endSection();
return null;
}
private void processTemplate(HNDomTree tree) throws HNSyntaxError, EOFException {
long timeStart = SystemClock.currentThreadTimeMillis();
if (mCurToken.type() != Template) {
mSyntaxErrorHandler.throwException("Look for Template, but " + mCurToken.toString());
}
tree.setType(mCurToken.stringValue());
processInternal(tree);
mTracker.record("Parse Html", SystemClock.currentThreadTimeMillis() - timeStart);
}