Crazy English 900 Expressions (Android App)

简介

究竟需要掌握多少英语句子才能用英语自由交际?怎样才算是学好了英语?一直以来,中国英语学习者都在为这些问题所困扰。尤其是当学习者具备了一定的英语基础,但对自己的学习进展感到怀疑和彷徨之时。 

用疯狂的信念和超强的毅力去攻克英语! 
  900句不是你的终极目标! 
  用英语自由表达,你可以做得到! 
  学习,就从现在开始! 
  三十类基础功能表达;六十八人自由话题演练;最疯狂的口语学习套餐;最潮流的实用英语表达;900次疯狂铸就一口流利英语真正一本在手,沟通无忧! 
1.寒暄与介绍 
2. 观点与想法 
  3.喜欢与讨厌 
  4.寻求帮助与提供帮助 
  5.感激与致歉 
  6.聚会与离别 
  7.抱怨与恭维 
  8.同意与分歧 
  9.许可与拒绝 
  10.建议与忠告 

你可以安装在平板电脑(三星平板,摩托罗拉Xoom),同样的程序,不同的体验。 
程序签名后优化,运行更加流畅。 

2011-12-07更新说明: 
1. 针对Android 4.0优化。 
2. 添加Welcome页面

下载地址: https://files.cnblogs.com/kangyi/CrazyEnglishUmeng_4.2.0.apk

程序截图 

 

安装程序附件

/Files/kangyi/android app/CrazyEnglish900.zip

核心code: 

 package android.kaden.crazyenglish;


import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import android.view.animation.AccelerateInterpolator;
import android.widget.RelativeLayout;
import android.widget.Toast;

public class CommonHelper {

    private static final String TAG = "CommonHelper.java";
    private static final String DATABASE_PATH = "/data/data/android.kaden.crazyenglish/databases/";
    // android.os.Environment.getExternalStorageDirectory().getAbsolutePath() +
    
// "/crazy_enlish_db";
    private static final String DATABASE_FILENAME = "sentencedb.db";

    /*
     * Open the exits database In this method we will copy the database file
     * from raw folder to /sdcard/crazy_enlish_db/ folder, and then open the
     * database which under /sdcard/crazy_enlish_db/ folder.
     
*/
    public static SQLiteDatabase openDatabase(Context context) {
        try {
            String databaseFilename = DATABASE_PATH + "/" + DATABASE_FILENAME;
            File dir = new File(DATABASE_PATH);

            if (!dir.exists())
                dir.mkdir();
            if (!(new File(databaseFilename)).exists()) {
                InputStream is = context.getResources().openRawResource(
                        R.raw.sentencedb);
                FileOutputStream fos = new FileOutputStream(databaseFilename);
                byte[] buffer = new byte[8192];
                int count = 0;
                while ((count = is.read(buffer)) > 0) {
                    fos.write(buffer, 0, count);
                }

                fos.close();
                is.close();
            }
            // Open the database form the following address:
            
// /sdcard/crazy_enlish_db/sentencedb.db
            SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(
                    databaseFilename, null);
            return database;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public static List<Sentence> getCategoryList(Context context) {
        List<Sentence> list = new ArrayList<Sentence>();
        Cursor cursor = null;
        SQLiteDatabase database = openDatabase(context);
        try {
            String[] column = { "ID", "Chinese", "English", "Pages" };
            cursor = database.query("Category", column, nullnullnullnull,
                    null);

            cursor.moveToFirst();
            int i = 1;
            String Id = null;
            while (cursor.getPosition() != cursor.getCount()) {
                if (i < 10) {
                    Id = " " + cursor.getString(0);
                    i++;
                } else {
                    Id = cursor.getString(0);
                }
                list.add(new Sentence(Id, cursor.getString(1), cursor
                        .getString(2), cursor.getString(3)));

                cursor.moveToNext();
            }
        } catch (SQLException ex) {
            Toast.makeText(context, "Read record error:" + ex.toString(),
                    Toast.LENGTH_LONG).show();
        } finally {
            if (cursor != null) {
                cursor.close();
            }
            if (database.isOpen()) {
                database.close();
            }
        }

        return list;
    }

    public static List<Sentence> getCategoryedSentenceList(Context context,
            String startId, String endId) {
        List<Sentence> list = new ArrayList<Sentence>();
        Cursor cursor = null;
        SQLiteDatabase database = openDatabase(context);
        try {
            String[] column = { "Chinese", "English" };
            cursor = database.query("sentenceTable", column, "ID>=? and ID<=?",
                    new String[] { startId, endId }, nullnullnull);

            cursor.moveToFirst();

            while (cursor.getPosition() != cursor.getCount()) {

                list
                        .add(new Sentence(cursor.getString(0), cursor
                                .getString(1)));

                cursor.moveToNext();
            }
        } catch (SQLException ex) {
            Toast.makeText(context, "Read record error:" + ex.toString(),
                    Toast.LENGTH_LONG).show();
        } finally {
            if (cursor != null) {
                cursor.close();
            }
            if (database.isOpen()) {
                database.close();
            }
        }

        return list;
    }

    public static List<Sentence> getAllSentence(Context context) {
        List<Sentence> list = new ArrayList<Sentence>();
        Cursor cursor = null;
        SQLiteDatabase database = openDatabase(context);
        try {
            String[] column = { "Chinese", "English" };
            cursor = database.query("sentenceTable", column, nullnullnull,
                    nullnull);

            cursor.moveToFirst();

            while (cursor.getPosition() != cursor.getCount()) {

                list.add(new Sentence(cursor.getString(0), cursor
                                .getString(1)));

                cursor.moveToNext();
            }
        } catch (SQLException ex) {
            Toast.makeText(context, "Read record error:" + ex.toString(),
                    Toast.LENGTH_LONG).show();
        } finally {
            if (cursor != null) {
                cursor.close();
            }
            if (database.isOpen()) {
                database.close();
            }
        }
        return list;
    }

    /**
     * 
     * 
@param context
     * 
@return
     
*/
    public static String getAppVersionName(Context context) {

        String versionName = "";
        try {
            // ---get the package info---
            PackageManager pm = context.getPackageManager();
            PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0);
            versionName = pi.versionName;
            if (versionName == null || versionName.length() <= 0) {
                return "";
            }
        } catch (Exception e) {
            Log.e(TAG, "Exception", e);
        }
        return versionName;
    }

    public static void startMyAnimation(RelativeLayout rl, int screenWidth,
            int screenHeight) {
        /*
         * //DisplayMetrics dm = new DisplayMetrics();
         * getWindowManager().getDefaultDisplay().getMetrics(dm); int
         * screenWidth = dm.widthPixels; int screenHeight = dm.heightPixels;
         
*/
        final float centerX = screenWidth;
        final float centerY = screenHeight / 2.0f;
        Rotate3dAnimation rotation = new Rotate3dAnimation(90, 0, centerX,
                centerY, 300.0f, false);
        rotation.setDuration(800);

        rotation.setFillAfter(true);
        rotation.setInterpolator(new AccelerateInterpolator());

        rl.startAnimation(rotation);
    }

    public static void finishAnimation(RelativeLayout rl, int screenWidth,
            int screenHeight) {
        /*
         * //DisplayMetrics dm = new DisplayMetrics();
         * getWindowManager().getDefaultDisplay().getMetrics(dm); int
         * screenWidth = dm.widthPixels; int screenHeight = dm.heightPixels;
         
*/
        final float centerX = 0;
        final float centerY = screenHeight / 2f;
        Rotate3dAnimation rotation = new Rotate3dAnimation(0, 270, centerX,
                centerY, 360.0f, true);
        rotation.setDuration(2800);

        rotation.setFillAfter(true);
        rotation.setInterpolator(new AccelerateInterpolator());

        rl.startAnimation(rotation);
    }
}
原文地址:https://www.cnblogs.com/kangyi/p/1839755.html