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
Update .gitmodules | |
[submodule "example"] | |
path = example | |
url = https://github.com/webhat/example.git | |
Update .git/config too | |
[submodule "example"] | |
url = https://github.com/webhat/example.git |
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
//Convert from String to byte[]: | |
String s = "some text here"; | |
byte[] b = s.getBytes("US-ASCII"); | |
//Convert from byte[] to String: | |
byte[] b = {(byte) 99, (byte)97, (byte)116}; | |
String s = new String(b, "UTF-8"); |
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
Set the CheckBox as focusable="false" in your XML layout. Otherwise it will steal click events from the list view. |
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 static Bitmap resizeImage(Bitmap inputBitmap, int newHeight, int newWidth) { | |
int width = inputBitmap.getWidth(); | |
int height = inputBitmap.getHeight(); | |
float scaleWidth = ((float) newWidth) / width; | |
float scaleHeight = ((float) newHeight) / height; | |
Matrix matrix = new Matrix(); | |
matrix.postScale(scaleWidth, scaleHeight); | |
return Bitmap.createBitmap(inputBitmap, 0, 0, width, height, matrix, false); | |
} |
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
document.body.addEventListener('touchstart', function(e) { | |
// | |
}); | |
document.body.addEventListener('touchmove', function(e) { | |
// | |
}); | |
document.body.addEventListener('touchend', function(e) { | |
// |
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
from: http://www.javascriptkit.com/javatutors/touchevents.shtml | |
touchstart | |
Triggers when the user makes contact with the touch surface and creates a touch point inside the element the event is bound to. | |
touchmove | |
Triggers when the user moves the touch point across the touch surface. | |
touchend | |
Triggers when the user removes a touch point from the surface. It fires regardless of whether the touch point is removed while inside the bound-to element, or outside, such as if the user's finger slides out of the element first or even off the edge of the screen. |
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
/////JS///// | |
$(window).scroll(function(){ | |
if ($(this).scrollTop() == 0) { | |
$('span').html("верх"); | |
} | |
else { | |
$('span').html("не верх"); | |
} | |
}); | |
////CSS//// |
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
//инициализация | |
var canvas = document.getElementById("canvas"); | |
var ctx = canvas.getContext("2d"); | |
//размеры канваса | |
w = canvas.width; | |
h = canvas.height; | |
//масштаб, например в 2 раза больше | |
ctx.scale(2,2) |
NewerOlder