PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/WebAccess/src/com/ideal/webreader/PrefsActivity.java

http://eyes-free.googlecode.com/
Java | 77 lines | 50 code | 9 blank | 18 comment | 1 complexity | 87954162c73feafc317a079ac261fd78 MD5 | raw file
 1/*
 2 * Copyright (C) 2010 The IDEAL Group
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License");
 5 * you may not use this file except in compliance with the License.
 6 * You may obtain a copy of the License at
 7 *
 8 *      http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.ideal.webreader;
18
19import com.ideal.webaccess.R;
20
21import android.content.Intent;
22import android.os.Bundle;
23import android.os.Environment;
24import android.preference.Preference;
25import android.preference.PreferenceActivity;
26import android.preference.Preference.OnPreferenceClickListener;
27
28import java.io.File;
29
30/**
31 * Preferences activity for adjusting the various settings in IDEAL Web Reader.
32 */
33public class PrefsActivity extends PreferenceActivity {
34
35    @Override
36    protected void onCreate(Bundle savedInstanceState) {
37        super.onCreate(savedInstanceState);
38        addPreferencesFromResource(R.xml.settings);
39
40        Preference ttsPref = findPreference("tts_settings");
41        ttsPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
42            @Override
43            public boolean onPreferenceClick(Preference preference) {
44                Intent i = new Intent();
45                i.setClassName("com.android.settings", "com.android.settings.TextToSpeechSettings");
46                startActivity(i);
47                return false;
48            }
49        });
50
51        Preference defineGesturesPref = findPreference("define_gestures");
52        defineGesturesPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
53            @Override
54            public boolean onPreferenceClick(Preference preference) {
55                Intent i = new Intent();
56                i.setClassName("com.ideal.webaccess",
57                        "com.ideal.webreader.CreateGestureWizardActivity");
58                startActivity(i);
59                return false;
60            }
61        });
62
63        Preference resetGesturesPref = findPreference("reset_gestures");
64        resetGesturesPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
65            @Override
66            public boolean onPreferenceClick(Preference preference) {
67                File storeFile = new File(Environment.getExternalStorageDirectory()
68                        + "/ideal-webaccess/gestures");
69                if (storeFile.exists()) {
70                    storeFile.delete();
71                }
72                finish();
73                return false;
74            }
75        });
76    }
77}