Skip to content

Instantly share code, notes, and snippets.

@shaobin0604
shaobin0604 / dialog_theme_activity.xml
Created June 6, 2013 12:09
dialog_theme_activity.xml
<style name="custom_dialog" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".LoginActivity" >
<!-- Login progress -->
<LinearLayout
android:id="@+id/login_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@shaobin0604
shaobin0604 / TestPackageManager.java
Created May 16, 2013 13:32
load not installed package
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mAppName = (TextView) findViewById(R.id.app_name);
mAppIcon = (ImageView) findViewById(R.id.app_icon);
PackageManager packageManager = getPackageManager();
String archiveFilePath = "/mnt/sdcard/1/codoonfitness.apk";
PackageInfo packageArchiveInfo = packageManager.getPackageArchiveInfo(archiveFilePath, PackageManager.GET_ACTIVITIES);
<resources>
<!-- Style you can use with a container (typically a horizontal
LinearLayout) to get the standard "button bar" background and
spacing. @hide -->
<style name="ButtonBar">
<item name="android:paddingTop">5dip</item>
<item name="android:paddingStart">4dip</item>
<item name="android:paddingEnd">4dip</item>
<item name="android:paddingBottom">1dip</item>
<item name="android:background">@android:drawable/bottom_bar</item>
@shaobin0604
shaobin0604 / android_jni_dev.c
Created May 8, 2013 16:18
ao code from csipsimple
JavaVM *android_jvm;
JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved)
{
android_jvm = vm;
return JNI_VERSION_1_4;
}
static pj_bool_t attach_jvm(JNIEnv **jni_env)
@shaobin0604
shaobin0604 / rwav.c
Created April 22, 2013 13:30
libav api examples
/*
* rwav.c
*
* Author: Arash Shafiei
* Email: arash dot shafiei at gmail dot com
*/
#include "rwav.h"
#define MAX_AUDIO_PACKET_SIZE (128 * 1024)
@shaobin0604
shaobin0604 / gist:5382380
Created April 14, 2013 11:31
fm887 top 6:48 - 7:16
User 13%, System 7%, IOW 0%, IRQ 0%
User 42 + Nice 0 + Sys 24 + Idle 235 + IOW 0 + IRQ 0 + SIRQ 3 = 304
PID PR CPU% S #THR VSS RSS PCY UID Name
2355 0 12% S 15 490928K 34048K fg app_86 cn.yo2.aquarium.mmsplayer
3 0 4% R 1 0K 0K fg root ksoftirqd/0
88 0 2% S 6 36880K 3284K fg media /system/bin/mediaserver
@shaobin0604
shaobin0604 / AntZipFileObject.java
Created April 8, 2013 10:10
modified apache commons vfs which support zip file containing GBK encoded file name. dependency: ant.jar from apache ant
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
private static final Comparator<File> FILE_COMPARATOR = new Comparator<File>() {
@Override
public int compare(File lhs, File rhs) {
boolean ldir = lhs.isDirectory();
boolean rdir = rhs.isDirectory();
if (ldir == rdir) {
// both are files or directories
return lhs.getName().compareToIgnoreCase(rhs.getName());
} else if (ldir) {
--------- beginning of /dev/log/main
02-06 18:35:18.722 D/dalvikvm(16573): GC_CONCURRENT freed 323K, 5% free 8146K/8519K, paused 12ms+2ms, total 30ms
02-06 18:35:18.722 D/dalvikvm(16573): WAIT_FOR_CONCURRENT_GC blocked 11ms
02-06 18:35:18.734 I/System.out(16573): local ip size :1
02-06 18:35:18.785 D/dalvikvm(16573): GC_CONCURRENT freed 325K, 5% free 8336K/8711K, paused 2ms+2ms, total 27ms
02-06 18:35:18.785 D/dalvikvm(16573): WAIT_FOR_CONCURRENT_GC blocked 13ms
02-06 18:35:18.793 D/dalvikvm(16573): WAIT_FOR_CONCURRENT_GC blocked 16ms
02-06 18:35:18.828 I/System.out(16573): connection checker is started
02-06 18:35:18.851 D/dalvikvm(16573): GC_CONCURRENT freed 46K, 2% free 8786K/8903K, paused 2ms+2ms, total 20ms
02-06 18:35:18.851 D/dalvikvm(16573): WAIT_FOR_CONCURRENT_GC blocked 8ms