private double getSummaryAccountsInternal(Context context) { double curTotal = 0; Core core = new Core(context); // compose whereClause String where = ""; // check if show only open accounts if (core.getAccountsOpenVisible()) { where = "LOWER(STATUS)='open'"; } // check if show fav accounts if (core.getAccountFavoriteVisible()) { where = "LOWER(FAVORITEACCT)='true'"; } QueryAccountBills accountBills = new QueryAccountBills(context); Cursor cursor = context.getContentResolver().query(accountBills.getUri(), null, where, null, null); if (cursor == null) return 0; // calculate summary while (cursor.moveToNext()) { curTotal = curTotal + cursor.getDouble(cursor.getColumnIndex(QueryAccountBills.TOTALBASECONVRATE)); } cursor.close(); return curTotal; }
@Override public void onCreate() { super.onCreate(); Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this)); // save instance of application myInstance = this; if (BuildConfig.DEBUG) Log.d(LOGCAT, "Application created"); // create application folder Core core = new Core(getApplicationContext()); core.getExternalStorageDirectoryApplication(); // set default text size. setTextSize(new TextView(getApplicationContext()).getTextSize()); // preference if (appPreferences == null) { appPreferences = PreferenceManager.getDefaultSharedPreferences(this); RobotoView.setUserFont( Integer.parseInt( appPreferences.getString( getString(PreferenceConstants.PREF_APPLICATION_FONT), "-1"))); RobotoView.setUserFontSize( getApplicationContext(), appPreferences.getString( getString(PreferenceConstants.PREF_APPLICATION_FONT_SIZE), "default")); } // Initialize font icons. FontIconTypefaceHolder.init(getAssets(), "fonts/mmex.ttf"); }
/** * Returns only the directory name for the databases. This is where the new databases are created * by default. * * @return String containing the path to the default directory for storing databases. */ public static String getDatabaseDirectory(Context context) { Core core = new Core(context); File defaultFolder = core.getExternalStorageDirectoryApplication(); String databasePath; if (defaultFolder.getAbsoluteFile().exists()) { databasePath = defaultFolder.toString(); } else { String internalFolder; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { internalFolder = context.getApplicationInfo().dataDir; } else { internalFolder = "/data/data/" + context.getApplicationContext().getPackageName(); } // add databases internalFolder += "/databases"; // "/data.mmb"; databasePath = internalFolder; } return databasePath; }