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
mRootContainer = (RelativeLayout) findViewById(R.id.root_container); | |
ViewTreeObserver vto = mRootContainer.getViewTreeObserver(); | |
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { | |
@Override | |
public void onGlobalLayout() { | |
// get current window size | |
int newWidth = mRootContainer.getWidth(); | |
int newHeight = mRootContainer.getHeight(); |
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
Redirect /path_to_redirect market://details?id=com.example.package |
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
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/<id>")); | |
List<ResolveInfo> activities = getPackageManager().queryIntentActivities(intent, 0); | |
if (activities.size() != 0) { | |
startActivity(intent); | |
} else { | |
intent.setData(Uri.parse("https://www.facebook.com/<你的專頁名稱>")); | |
startActivity(intent); | |
} |
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
[shakalaca@Shakas-MacBook-Pro.local:~ ] | |
$ cd /usr/local/ | |
[shakalaca@Shakas-MacBook-Pro.local:~ ] | |
$ brew versions gradle | |
1.4 git checkout 0b7303a /usr/local/Library/Formula/gradle.rb | |
1.3 git checkout c259bda /usr/local/Library/Formula/gradle.rb | |
1.2 git checkout 9b7d294 /usr/local/Library/Formula/gradle.rb | |
1.1 git checkout 7941972 /usr/local/Library/Formula/gradle.rb | |
1.0 git checkout dff67fb /usr/local/Library/Formula/gradle.rb | |
1.0-rc-3 git checkout 5f9e348 /usr/local/Library/Formula/gradle.rb |
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
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.5.+' | |
} | |
} | |
apply plugin: 'android' |
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
import android.os.Build; | |
import android.os.Process; | |
import java.io.ByteArrayOutputStream; | |
import java.io.DataInputStream; | |
import java.io.DataOutputStream; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileOutputStream; | |
import java.io.IOException; |
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.applicationVariants.all { variant -> | |
// replace output apk name to <product>-<version>-<buildtype>-<githash>.apk | |
def versionSuffix = variant.buildType.versionNameSuffix ? variant.buildType.versionNameSuffix : "" | |
def versionName = variant.mergedFlavor.versionName + versionSuffix + "-${gitHash}"; | |
if (variant.zipAlign) { | |
def apkFinal = variant.outputFile; | |
variant.outputFile = new File(apkFinal.parentFile, apkFinal.name.replace(variant.buildType.name, versionName)); | |
} |
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
configurations { | |
provided | |
} | |
dependencies { | |
provided files('libs/xxxx.jar') | |
} | |
android.applicationVariants.all { variant -> | |
variant.javaCompile.classpath += configurations.provided |
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
dependencies { | |
compile files('libs/xxxx.jar') | |
} | |
android.applicationVariants.all { variant -> | |
if (variant.buildType.name.equals("release")) { | |
variant.dex.libraries = variant.dex.libraries - files('libs/xxxx.jar') | |
} | |
} |
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
#!/bin/bash | |
adb wait-for-device > /dev/null 2>& 1 | |
read IP PORT GARBAGE <<< $(adb devices | awk -F"[:\t]" ' NR > 1 && NF { print $1; print $2; print $3 } ') | |
adb -s $IP:$PORT root | |
adb connect $IP:$PORT |