Android Open Source - OrzEye Dictionary Tool






From Project

Back to project page OrzEye.

License

The source code is released under:

GNU General Public License

If you think the Android project OrzEye 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

package com.dylan.orzeye.dictionary;
/*from  ww  w  . ja  v a 2  s.  co  m*/
import java.io.File;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Environment;

public class DictionaryTool {
  public static final String DATABASE_PATH = Environment
      .getExternalStorageDirectory().toString()
      + "/OrzEye"
      + "/dictionary/";
  private final String DATABASE_FILENAME = "dictionary.db";
  private SQLiteDatabase database = null;

  public DictionaryTool() {
    database = openDatabase();
  }

  private SQLiteDatabase openDatabase() {
    String databaseFilename = DATABASE_PATH + DATABASE_FILENAME;
    if ((new File(databaseFilename)).exists()) {
      database = SQLiteDatabase.openOrCreateDatabase(databaseFilename,
          null);
    }
    return database;
  }

  public String lookUpDictionary(String recognizedText) {
    String sql = "select chinese from t_words where english=?";
    Cursor cursor = database.rawQuery(sql, new String[] { recognizedText });
    String result = "not found!";

    if (cursor.getCount() > 0) {
      cursor.moveToFirst();
      result = cursor.getString(cursor.getColumnIndex("chinese"));
    }
    return result;
  }

  public boolean isDictionaryReady() {
    return database == null ? false : true;
  }
}




Java Source Code List

com.dylan.orzeye.CameraActivity.java
com.dylan.orzeye.DrawRectView.java
com.dylan.orzeye.SplashActivity.java
com.dylan.orzeye.dictionary.DictionaryTool.java
com.dylan.orzeye.dictionary.YoudaoJsonParser.java
com.dylan.orzeye.dictionary.YoudaoTranslaterAPIConnection.java
com.dylan.orzeye.dictionary.YoudaoTranslater.java
com.dylan.orzeye.image.ImageProcessTool.java
com.dylan.orzeye.ocr.OCRTool.java