@Override protected void setUp() throws Exception { super.setUp(); // final RenamingMockContext mockContext = new RenamingMockContext( // getContext()); // setContext(mockContext); createApplication(); mApplication = getApplication(); rtt = mApplication.getString(R.string.mock_dt); }
@Provides @Singleton Tracker provideTracker(Application app) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(app); if (BuildConfig.DEBUG) { analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); analytics.setDryRun(true); } return analytics.newTracker(app.getString(R.string.tracking_id)); }
private static String getStringByKey(Application app, String key) { int resourceId = app.getResources().getIdentifier(key, "string", app.getPackageName()); return app.getString(resourceId); }
/** * 処理種別を取得します * * <pre>http:// sourceforge.jp/projects/felicalib/wiki/suicaを参考にしています</pre> * * @param proc 処理タイプをセット * @return String 処理タイプが文字列で戻ります */ static String getProcessTypeName(int proc) { Application app = MetrodroidApplication.getInstance(); switch (proc & 0xff) { case 0x01: return app.getString(R.string.felica_process_fare_exit_gate); case 0x02: return app.getString(R.string.felica_process_charge); case 0x03: return app.getString(R.string.felica_process_purchase_magnetic); case 0x04: return app.getString(R.string.felica_process_fare_adjustment); case 0x05: return app.getString(R.string.felica_process_admission_payment); case 0x06: return app.getString(R.string.felica_process_booth_exit); case 0x07: return app.getString(R.string.felica_process_issue_new); case 0x08: return app.getString(R.string.felica_process_booth_deduction); case 0x0d: return app.getString(R.string.felica_process_bus_pitapa); // Bus case 0x0f: return app.getString(R.string.felica_process_bus_iruca); // Bus case 0x11: return app.getString(R.string.felica_process_reissue); case 0x13: return app.getString(R.string.felica_process_payment_shinkansen); case 0x14: return app.getString(R.string.felica_process_entry_a_autocharge); case 0x15: return app.getString(R.string.felica_process_exit_a_autocharge); case 0x1f: return app.getString(R.string.felica_process_deposit_bus); // Bus case 0x23: return app.getString(R.string.felica_process_purchase_special_ticket); // Bus case 0x46: return app.getString(R.string.felica_process_merchandise_purchase); // Sales case 0x48: return app.getString(R.string.felica_process_bonus_charge); case 0x49: return app.getString(R.string.felica_process_register_deposit); // Sales case 0x4a: return app.getString(R.string.felica_process_merchandise_cancel); // Sales case 0x4b: return app.getString(R.string.felica_process_merchandise_admission); // Sales case 0xc6: return app.getString(R.string.felica_process_merchandise_purchase_cash); // Sales case 0xcb: return app.getString(R.string.felica_process_merchandise_admission_cash); // Sales case 0x84: return app.getString(R.string.felica_process_payment_thirdparty); case 0x85: return app.getString(R.string.felica_process_admission_thirdparty); default: return String.format("Process0x%s", Integer.toHexString(proc)); } }
/** * 機器種別を取得します * * <pre>http:// sourceforge.jp/projects/felicalib/wiki/suicaを参考にしています</pre> * * @param cType コンソールタイプをセット * @return String 機器タイプが文字列で戻ります */ static String getConsoleTypeName(int cType) { Application app = MetrodroidApplication.getInstance(); switch (cType & 0xff) { case 0x03: return app.getString(R.string.felica_terminal_fare_adjustment); case 0x04: return app.getString(R.string.felica_terminal_portable); case 0x05: return app.getString(R.string.felica_terminal_vehicle); // bus case 0x07: return app.getString(R.string.felica_terminal_ticket); case 0x08: return app.getString(R.string.felica_terminal_ticket); case 0x09: return app.getString(R.string.felica_terminal_deposit_quick_charge); case 0x12: return app.getString(R.string.felica_terminal_tvm_tokyo_monorail); case 0x13: return app.getString(R.string.felica_terminal_tvm_etc); case 0x14: return app.getString(R.string.felica_terminal_tvm_etc); case 0x15: return app.getString(R.string.felica_terminal_tvm_etc); case 0x16: return app.getString(R.string.felica_terminal_ticket_gate); case 0x17: return app.getString(R.string.felica_terminal_simple_ticket_gate); case 0x18: return app.getString(R.string.felica_terminal_booth); case 0x19: return app.getString(R.string.felica_terminal_booth_green); case 0x1a: return app.getString(R.string.felica_terminal_ticket_gate_terminal); case 0x1b: return app.getString(R.string.felica_terminal_mobile_phone); case 0x1c: return app.getString(R.string.felica_terminal_connection_adjustment); case 0x1d: return app.getString(R.string.felica_terminal_transfer_adjustment); case 0x1f: return app.getString(R.string.felica_terminal_simple_deposit); case 0x46: return "VIEW ALTTE"; case 0x48: return "VIEW ALTTE"; case 0xc7: return app.getString(R.string.felica_terminal_pos); // sales case 0xc8: return app.getString(R.string.felica_terminal_vending); // sales default: return String.format("Console 0x%s", Integer.toHexString(cType)); } }