/slidetext/src/com/google/marvin/slidetext/SlideText.java
Java | 70 lines | 34 code | 12 blank | 24 comment | 2 complexity | 5423728ae3f098f14b1294e1b55ff3e3 MD5 | raw file
1package com.google.marvin.slidetext; 2 3 4import com.google.tts.TTS; 5 6import android.app.Activity; 7import android.media.AudioManager; 8import android.os.Bundle; 9import android.view.View; 10 11/** 12 * Enables the user to type text without looking at the phone. 13 * 14 * There are 4 layers, with each layer having 8 characters arranged in a ring. 15 * Each layer has 2 entry points, arranged at opposite sides of the ring. When 16 * you first touch down, you choose which layer you want to enter by selecting 17 * either of the entry points. The entry points are letters themselves, so after 18 * entering a layer, if you immediately lift up, you will type the character you 19 * entered on. Otherwise, you can proceed through the ring, move over the letter 20 * that you want, and lift up. 21 * 22 * ASCII diagrams of the layers: Layer 0: a i q _ y u m e 23 * 24 * Layer 1: a b c h d g f e 25 * 26 * Layer 2: p i j o k n m l 27 * 28 * Layer 3: w x q v r u t s 29 * 30 * Layer 4: , ! MODE _ y . ? z 31 * 32 * @author clchen@google.com (Charles L. Chen) 33 */ 34public class SlideText extends Activity { 35 36 private SlideText self; 37 private SlideTextView mView; 38 public TTS tts; 39 40 41 /** Called when the activity is first created. */ 42 @Override 43 public void onCreate(Bundle savedInstanceState) { 44 super.onCreate(savedInstanceState); 45 self = this; 46 tts = new TTS(this, ttsInitListener, true); 47 setVolumeControlStream(AudioManager.STREAM_MUSIC); 48 } 49 50 51 private TTS.InitListener ttsInitListener = new TTS.InitListener() { 52 public void onInit(int version) { 53 String pkgName = SlideText.class.getPackage().getName(); 54 55 tts.addSpeech("Nothing to delete", pkgName, R.raw.nothing_to_delete); 56 57 if (mView != null) { 58 mView.setVisibility(View.GONE); 59 } 60 mView = new SlideTextView(self); 61 self.setContentView(mView); 62 } 63 }; 64 65 @Override 66 protected void onDestroy() { 67 tts.shutdown(); 68 super.onDestroy(); 69 } 70}