Пример #1
0
 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()
             + ".");
   }
 }
Пример #2
0
 @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;
 }