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
package com.? | |
import java.io.File; | |
import android.annotation.SuppressLint; | |
import android.content.Context; | |
import android.os.Build; | |
import android.os.StatFs; | |
import com.squareup.picasso.Downloader; |
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
// by Chris Banes (http://chris.banes.me/2014/03/27/measuring-text/) | |
int mTextWidth, mTextHeight; // Our calculated text bounds | |
Paint mTextPaint = new Paint(); | |
// Now lets calculate the size of the text | |
Rect textBounds = new Rect(); | |
mTextPaint.getTextBounds(mText, 0, mText.length(), textBounds); | |
mTextWidth = mTextPaint.measureText(mText); // Use measureText to calculate width | |
mTextHeight = textBounds.height(); // Use height from getTextBounds() |
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
Android, żeby obsłużyć wiele ekranów ma swoją specyfikę. | |
W najprostszej formie tła próbujemy sobie rozciągnąć lub skropować. | |
Ikon potrzebujemy w rozmiarze ok 72x72px (telefony) lub 96x96px (tablety), | |
które się obpowiednio skalują na różnych rozdzielczościach (przeważnie wyglądają marnie na rozdzielczościach innych od hdpi). | |
To przejdzie. Jednak aby było ładnie potrzebowalibyśmy assetów conajmniej w czterech rozdzielczościach wg proporcji 2:3:4:6. | |
Te najniższe dla ikon najczęściej przyjmuje się jako 48x48px. | |
http://stackoverflow.com/questions/11581649/about-android-image-size-and-assets-sizes |
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
package com.fada21.android.orientation; | |
import java.util.concurrent.locks.ReentrantLock; | |
import android.content.Context; | |
import android.content.res.Configuration; | |
import android.view.OrientationEventListener; | |
import android.view.Surface; | |
import android.view.WindowManager; |
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 String md5(String s) { | |
try { | |
// Create MD5 Hash | |
MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); | |
digest.update(s.getBytes()); | |
byte messageDigest[] = digest.digest(); | |
// Create Hex String | |
StringBuffer hexString = new StringBuffer(); | |
for (int i=0; i<messageDigest.length; i++) |
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
package com.coolands.open; | |
import android.graphics.Path; | |
import android.graphics.PathMeasure; | |
import android.view.animation.Animation; | |
import android.view.animation.Transformation; | |
/** | |
* Animation along path | |
* by Ewan Chou (https://github.com/coocood) |
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 Bitmap getCroppedBitmap(Bitmap bitmap) { | |
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888); | |
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); | |
Canvas canvas = new Canvas(output); | |
final Paint paint = new Paint(); | |
paint.setAntiAlias(true); |
NewerOlder