This file contains hidden or 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
@IBAction func cleanResult(_ sender: Any) { | |
if !resultLabel.isHidden { | |
resultLabel.isHidden = true | |
resultLabel.text = "" | |
} | |
} |
This file contains hidden or 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
import com.google.gson.Gson; | |
import com.google.gson.JsonArray; | |
import com.google.gson.JsonElement; | |
import com.google.gson.JsonParser; | |
import org.apache.commons.lang3.StringUtils; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class GsonUtils { |
This file contains hidden or 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
/** | |
* 移动 | |
* @return | |
*/ | |
public Animation getTranslateAnimation() { | |
//实例化TranslateAnimation | |
//以自身为坐标系和长度单位,从(0,0)移动到(1,1) | |
TranslateAnimation animation = new TranslateAnimation( | |
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, | |
1.0f, Animation.RELATIVE_TO_SELF, 0.0f, |
This file contains hidden or 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
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.drawable.BitmapDrawable; | |
import android.util.AttributeSet; | |
import android.util.Log; | |
import android.view.MotionEvent; | |
import android.view.ScaleGestureDetector; | |
import android.view.View; | |
public class MyImageView extends View { |
This file contains hidden or 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
/******************************************************************************* | |
* Copyright 2011, 2012 Chris Banes. 2013 readyState Software Ltd. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains hidden or 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
/** | |
* QuadEncoder.cpp - Library for reading moves from a quadrature rotary encoder | |
* Created by Pedro Rodrigues (medecau@gmail.com) 9, January of 2010 | |
* Released into the public domain. | |
*/ | |
#include "Arduino.h" | |
#include "QuadEncoder.h" | |
QuadEncoder::QuadEncoder(int pin1, int pin2) |
This file contains hidden or 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
/* Method-1: Get size of screen in Activity */ | |
public void getScreenSizeinActivity(){ | |
Display display = getWindowManager().getDefaultDisplay(); //Activity#getWindowManager() | |
Point size = new Point(); | |
display.getSize(size); | |
int width = size.x; | |
int height = size.y; | |
} | |
/* Method-2: Get size of screen in other class */ |
This file contains hidden or 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
// Some existing RelativeLayout from your layout xml | |
RelativeLayout rl = (RelativeLayout) findViewById(R.id.my_relative_layout); | |
ImageView iv = new ImageView(this); | |
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(30, 40); | |
params.leftMargin = 50; | |
params.topMargin = 60; | |
rl.addView(iv, params); |
NewerOlder