Skip to content

Instantly share code, notes, and snippets.

View drakestone's full-sized avatar

Seokmin, Lee drakestone

  • Seoul, South Korea
View GitHub Profile
@drakestone
drakestone / gist:4950611
Last active December 13, 2015 17:48
This is SlidingMenu patch code to get notice when SlidingMenu is opening.
--- SlidingMenu.java 2013-02-14 13:24:19.000000000 +0900
+++ /tmp/SlidingMenu.java 2013-02-14 13:24:15.000000000 +0900
@@ -86,7 +86,7 @@
/**
* On open.
*/
- public void onOpen();
+ public void onOpen(int position);
}
@drakestone
drakestone / gist:4974780
Created February 18, 2013 02:27
Patched SlidingMenu.java Full source
package com.slidingmenu.lib;
import java.lang.reflect.Method;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
@drakestone
drakestone / gist:5002888
Last active December 14, 2015 00:59
PackageManager 에서 application package 명 얻어내기.
final PackageManager pm = getPackageManager();
List<ApplicationInfo> applications = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo appInfo : applications) {
PackageInfo pkgInfo;
try {
pkgInfo = pm.getPackageInfo(appInfo.packageName,
PackageManager.GET_META_DATA |
PackageManager.GET_PERMISSIONS);
@drakestone
drakestone / gist:5002890
Created February 21, 2013 07:15
ActivityManager 로 부터 package 명 가져오기
final ActivityManager am = (ActivityManager)getSystemService(ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> infos = am.getRunningTasks(100);
for (ActivityManager.RunningTaskInfo info : infos) {
Log.d(TAG, info.baseActivity.getPackageName());
}
@drakestone
drakestone / gist:5002897
Created February 21, 2013 07:17
Package 명으로 Application 실행하기
Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.settings");
if (intent != null)
startActivity(intent);
else
Toast.makeText(MainActivity.this,
"Could not launch this package.",
Toast.LENGTH_LONG).show();
@drakestone
drakestone / custom_rules.xml
Last active December 23, 2015 14:19
Ant 빌드시 company name 입력 받아서 빌드 코드에 반영하는 custom 빌드 스크립트
<?xml version="1.0" encoding="UTF-8"?>
<project name="Gee" default="help">
<target name="deploy" depends="clean">
<property file="build.properties" />
<property name="config-target-path" value="${source.dir}/com/example/gee"/>
<input message="Please input company name" addproperty="company" />
<!-- Copy the configuration file, replacing tokens in the file. -->
<copy file="config/Config.java" todir="${config-target-path}"
package com.example.gee;
public class Config {
public final static String Company = "Google";
}
package com.example.gee;
public class Config {
public final static String Company = "@COMPANY@";
}
package com.example.gee;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
import java.util.List;
import java.util.ArrayList;
public class SortingString {
public static void main(String args[]) {
String s = "typewriter";
final long start = System.currentTimeMillis();
for (int i = 0; i < Integer.MAX_VALUE; i++) {