@SuppressWarnings("unchecked") protected Object getModelValue(Object inValue, String columnName) { ModelContainerAdapter<? extends Model> modelContainerAdapter = FlowManager.getContainerAdapter(getTable()); Class<? extends Model> columnClass = (Class<? extends Model>) modelContainerAdapter.getClassForColumn(columnName); ModelContainerAdapter<? extends Model> columnAdapter = FlowManager.getContainerAdapter(columnClass); if (columnAdapter != null) { inValue = columnAdapter.toModel(getInstance(inValue, columnClass)); } else { throw new RuntimeException( "Column: " + columnName + "'s class needs to add the @ContainerAdapter annotation"); } return inValue; }
@Override public void onCreate() { super.onCreate(); mInstance = this; FlowManager.init(getApplicationContext()); Parse.initialize( this, getResources().getString(R.string.parse_application_id), getResources().getString(R.string.parse_client_key)); ParseObject.registerSubclass(CustomUser.class); ParseInstallation.getCurrentInstallation().saveInBackground(); Boolean isFirstRun = getSharedPreferences("PREFERENCE", MODE_PRIVATE).getBoolean("isFirstRun", true); if (isFirstRun) { Intent myIntent = new Intent(MyVolleySingleton.this, ConfiguracionActivity.class); myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); MyVolleySingleton.this.startActivity(myIntent); } getSharedPreferences("PREFERENCE", MODE_PRIVATE) .edit() .putBoolean("isFirstRun", false) .commit(); }
public BaseModelContainer(Class<ModelClass> table) { modelAdapter = FlowManager.getModelAdapter(table); modelContainerAdapter = FlowManager.getContainerAdapter(table); if (modelContainerAdapter == null) { throw new InvalidDBConfiguration( "The table " + FlowManager.getTableName(table) + " did not specify the " + com.raizlabs.android.dbflow.annotation.ModelContainer.class.getSimpleName() + " annotation." + " Please decorate " + table.getName() + " with annotation @" + com.raizlabs.android.dbflow.annotation.ModelContainer.class.getSimpleName() + "."); } }
@Override public void onCreate() { super.onCreate(); if (instance == null) { instance = this; } FlowManager.init(new FlowConfig.Builder(this).build()); Stetho.initializeWithDefaults(this); }
@Override public RemoteViews getViewAt(int position) { RemoteViews row = new RemoteViews(context.getPackageName(), R.layout.widget_list_item); cursor.moveToPosition(position); Build build = FlowManager.getModelAdapter(Build.class).loadFromCursor(cursor); row.setTextViewText(R.id.build_number, "Build #" + build.getNumber()); row.setTextViewText(R.id.build_state, ": " + build.getState()); row.setTextViewText(R.id.build_duration, String.valueOf(build.getDuration())); row.setTextViewText(R.id.build_finished, String.valueOf(build.getFinishedAt())); if (build.isPullRequest()) { row.setTextViewText(R.id.build_pull_request_title, build.getPullRequestTitle()); } else { row.setViewVisibility(R.id.build_pull_request_title, View.GONE); } GHCommit commit = build.getCommit(); if (commit != null) { row.setTextViewText(R.id.build_commit_message, commit.getMessage()); row.setTextViewText(R.id.build_commit_person, commit.getAuthorName()); row.setTextViewText(R.id.build_branch, commit.getBranch()); } return row; }
@Override public void onCreate() { super.onCreate(); Fabric.with(this, new Crashlytics()); FlowManager.init(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); // Disable HTTP keep-alive for our app, as some versions of Android will return an empty // response System.setProperty("http.keepAlive", "false"); // Allocate all the shared objects at launch conn = NetworkConnection.getInstance(); ColorFormatter.init(); if (prefs.contains("notify")) { SharedPreferences.Editor editor = prefs.edit(); editor.putString("notify_type", prefs.getBoolean("notify", true) ? "1" : "0"); editor.remove("notify"); editor.commit(); } if (prefs.contains("notify_sound")) { SharedPreferences.Editor editor = prefs.edit(); if (!prefs.getBoolean("notify_sound", true)) editor.putString("notify_ringtone", ""); editor.remove("notify_sound"); editor.commit(); } if (prefs.contains("notify_lights")) { SharedPreferences.Editor editor = prefs.edit(); if (!prefs.getBoolean("notify_lights", true)) editor.putString("notify_led_color", "0"); editor.remove("notify_lights"); editor.commit(); } if (prefs.getInt("ringtone_version", 0) < RINGTONE_VERSION) { File path = getFilesDir(); File file = new File(path, "IRCCloud.mp3"); try { path.mkdirs(); InputStream is = getResources().openRawResource(R.raw.digit); OutputStream os = new FileOutputStream(file); byte[] data = new byte[is.available()]; is.read(data); os.write(data); is.close(); os.close(); file.setReadable(true, false); MediaScannerConnection.scanFile( this, new String[] {file.toString()}, null, new MediaScannerConnection.OnScanCompletedListener() { @Override public void onScanCompleted(String path, Uri uri) { ContentValues values = new ContentValues(); values.put(MediaStore.Audio.Media.IS_NOTIFICATION, "1"); getContentResolver().update(uri, values, null, null); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); SharedPreferences.Editor editor = prefs.edit(); if (!prefs.contains("notify_ringtone")) { editor.putString("notify_ringtone", uri.toString()); } editor.putInt("ringtone_version", RINGTONE_VERSION); editor.commit(); } }); } catch (IOException e) { if (!prefs.contains("notify_ringtone")) { SharedPreferences.Editor editor = prefs.edit(); editor.putString("notify_ringtone", "content://settings/system/notification_sound"); editor.commit(); } } } if (prefs.contains("notify_pebble")) { try { int pebbleVersion = getPackageManager().getPackageInfo("com.getpebble.android", 0).versionCode; if (pebbleVersion >= 553 && Build.VERSION.SDK_INT >= 18) { SharedPreferences.Editor editor = prefs.edit(); editor.remove("notify_pebble"); editor.commit(); } } catch (Exception e) { } } if (prefs.contains("acra.enable")) { SharedPreferences.Editor editor = prefs.edit(); editor.remove("acra.enable"); editor.commit(); } if (prefs.contains("notifications_json")) { SharedPreferences.Editor editor = prefs.edit(); editor.remove("notifications_json"); editor.remove("networks_json"); editor.remove("lastseeneids_json"); editor.remove("dismissedeids_json"); editor.commit(); } prefs = getSharedPreferences("prefs", 0); if (prefs.getString("host", "www.irccloud.com").equals("www.irccloud.com") && !prefs.contains("path") && prefs.contains("session_key")) { Crashlytics.log(Log.INFO, "IRCCloud", "Migrating path from session key"); SharedPreferences.Editor editor = prefs.edit(); editor.putString("path", "/websocket/" + prefs.getString("session_key", "").charAt(0)); editor.commit(); } if (prefs.contains("host") && prefs.getString("host", "").equals("www.irccloud.com")) { Crashlytics.log(Log.INFO, "IRCCloud", "Migrating host"); SharedPreferences.Editor editor = prefs.edit(); editor.putString("host", "api.irccloud.com"); editor.commit(); } if (prefs.contains("gcm_app_version")) { SharedPreferences.Editor editor = prefs.edit(); editor.remove("gcm_app_version"); editor.remove("gcm_app_build"); editor.remove("gcm_registered"); editor.remove("gcm_reg_id"); editor.commit(); } NetworkConnection.IRCCLOUD_HOST = prefs.getString("host", BuildConfig.HOST); NetworkConnection.IRCCLOUD_PATH = prefs.getString("path", "/"); try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)) WebView.setWebContentsDebuggingEnabled(true); } } catch (Exception e) { } }