Android Open Source - translationKeyboard Main






From Project

Back to project page translationKeyboard.

License

The source code is released under:

GNU General Public License

If you think the Android project translationKeyboard listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright (C) 2011 The Android Open Source Project
 */* ww  w  . ja  v a2s  . c  o  m*/
 * Licensed 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
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package org.distantshoresmedia.translationkeyboard;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.Html;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.TextView.BufferType;

import org.distantshoresmedia.translationkeyboard.R;

public class Main extends Activity {

    private final static String MARKET_URI = "market://search?q=pub:\"Klaus Weidner\"";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        String html = getString(R.string.main_body);
        //html += "<p><i>Version: " + context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName + "</i></p>";
        Spanned content = Html.fromHtml(html);
        TextView description = (TextView) findViewById(R.id.main_description);
        description.setMovementMethod(LinkMovementMethod.getInstance());
        description.setText(content, BufferType.SPANNABLE);


        final Button setup1 = (Button) findViewById(R.id.main_setup_btn_configure_imes);
        setup1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                startActivityForResult(new Intent(android.provider.Settings.ACTION_INPUT_METHOD_SETTINGS), 0);
            }
        });

        final Button setup2 = (Button) findViewById(R.id.main_setup_btn_set_ime);
        setup2.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                mgr.showInputMethodPicker();
            }
        });
        
        final Activity that = this;

        final Button setup4 = (Button) findViewById(R.id.main_setup_btn_input_lang);
        setup4.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                startActivityForResult(new Intent(that, InputLanguageSelection.class), 0);
            }
        });

        final Button setup3 = (Button) findViewById(R.id.main_setup_btn_get_dicts);
        setup3.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent it = new Intent(Intent.ACTION_VIEW, Uri.parse(MARKET_URI));
                try {
                  startActivity(it);
                } catch (ActivityNotFoundException e) {
                    Toast.makeText(getApplicationContext(),
                            getResources().getString(
                                R.string.no_market_warning), Toast.LENGTH_LONG)
                            .show();
                }
            }
        });
        // PluginManager.getPluginDictionaries(getApplicationContext()); // why?
    }    
}




Java Source Code List

org.distantshoresmedia.translationkeyboard.AutoDictionary.java
org.distantshoresmedia.translationkeyboard.AutoSummaryEditTextPreference.java
org.distantshoresmedia.translationkeyboard.AutoSummaryListPreference.java
org.distantshoresmedia.translationkeyboard.BinaryDictionary.java
org.distantshoresmedia.translationkeyboard.CandidateView.java
org.distantshoresmedia.translationkeyboard.ComposeBase.java
org.distantshoresmedia.translationkeyboard.ComposeSequence.java
org.distantshoresmedia.translationkeyboard.ContactsDictionary.java
org.distantshoresmedia.translationkeyboard.DeadAccentSequence.java
org.distantshoresmedia.translationkeyboard.Dictionary.java
org.distantshoresmedia.translationkeyboard.EditingUtil.java
org.distantshoresmedia.translationkeyboard.ExpandableDictionary.java
org.distantshoresmedia.translationkeyboard.GlobalKeyboardSettings.java
org.distantshoresmedia.translationkeyboard.InputLanguageSelection.java
org.distantshoresmedia.translationkeyboard.KeyDetector.java
org.distantshoresmedia.translationkeyboard.KeyboardSwitcher.java
org.distantshoresmedia.translationkeyboard.Keyboard.java
org.distantshoresmedia.translationkeyboard.LanguageSwitcher.java
org.distantshoresmedia.translationkeyboard.LatinIMEBackupAgent.java
org.distantshoresmedia.translationkeyboard.LatinIMEDebugSettings.java
org.distantshoresmedia.translationkeyboard.LatinIMESettings.java
org.distantshoresmedia.translationkeyboard.LatinIMEUtil.java
org.distantshoresmedia.translationkeyboard.LatinIME.java
org.distantshoresmedia.translationkeyboard.LatinImeLogger.java
org.distantshoresmedia.translationkeyboard.LatinKeyboardBaseView.java
org.distantshoresmedia.translationkeyboard.LatinKeyboardView.java
org.distantshoresmedia.translationkeyboard.LatinKeyboard.java
org.distantshoresmedia.translationkeyboard.Main.java
org.distantshoresmedia.translationkeyboard.MiniKeyboardKeyDetector.java
org.distantshoresmedia.translationkeyboard.ModifierKeyState.java
org.distantshoresmedia.translationkeyboard.NotificationReceiver.java
org.distantshoresmedia.translationkeyboard.PluginManager.java
org.distantshoresmedia.translationkeyboard.PointerTracker.java
org.distantshoresmedia.translationkeyboard.PrefScreenActions.java
org.distantshoresmedia.translationkeyboard.PrefScreenFeedback.java
org.distantshoresmedia.translationkeyboard.PrefScreenView.java
org.distantshoresmedia.translationkeyboard.ProximityKeyDetector.java
org.distantshoresmedia.translationkeyboard.SeekBarPreferenceString.java
org.distantshoresmedia.translationkeyboard.SeekBarPreference.java
org.distantshoresmedia.translationkeyboard.SharedPreferencesCompat.java
org.distantshoresmedia.translationkeyboard.Suggest.java
org.distantshoresmedia.translationkeyboard.SwipeTracker.java
org.distantshoresmedia.translationkeyboard.TextEntryState.java
org.distantshoresmedia.translationkeyboard.Tutorial.java
org.distantshoresmedia.translationkeyboard.UserBigramDictionary.java
org.distantshoresmedia.translationkeyboard.UserDictionary.java
org.distantshoresmedia.translationkeyboard.VibratePreference.java
org.distantshoresmedia.translationkeyboard.WordComposer.java