2012年11月23日 星期五

IOS


2012年11月13日 星期二

EditPlus

1.選取區塊
alt+shift+E
alt+mouse

2012年11月9日 星期五

android WAKE_LOCK DIM





/*WAKE_LOCK SCREEN_DIM_WAKE_LOCK
*/
package tw.com.kevin.ae1_18;

import android.os.Bundle;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;


public class MainActivity extends Activity {
private WakeLock wakeLock;
public static String TAG = "HIPPO_DEBUG";

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       
        PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
        wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "led"); //screen is on (but may be dimmed)
        //wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "led");
        //wakeLock = powerManager.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.FULL_WAKE_LOCK , "led");
       
        final TextView tv = (TextView) findViewById(R.id.textView1);
        tv.setText("off");
        Button button01 = (Button) findViewById(R.id.button1);
        button01.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.i(TAG,"isisHeld()1"+wakeLock.isHeld());
if(!wakeLock.isHeld()){
wakeLock.acquire();
tv.setText("SCREEN_DIM_WAKE_LOCK---acquire()");
Log.i(TAG,"acquire();");
}
}
});
       
        Button button02 = (Button) findViewById(R.id.button2);
        button02.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(wakeLock.isHeld())
{
wakeLock.release();
tv.setText("SCREEN_DIM_WAKE_LOCK---release()");
Log.i(TAG,"release();");
}
}
});
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}