Пример #1
0
  /**
   * inject a mutable entity for view
   *
   * @param context
   * @param view
   * @param m
   * @return
   */
  public boolean inject(Context context, View view, MutableEntity m) {
    checkInit();
    if (m == null || m.getEntity() == null) {
      return false;
    }

    Object bean = m.getEntity();
    if (bean instanceof Postable) {
      setDataPost(context, view, (Postable) m.getEntity());
    }
    //        else if (bean instanceof Getable){
    //            setDataPost(context, view, (Getable) m.getEntity());
    //        }

    /** if the state is stored */
    if (m.isStateStored()) {
      setContent(context, view, bean);
      return true;
    }
    if (bean instanceof Downloadable) {
      loadEntity(context, view, (MutableEntity) m);
      return true;
    }

    setContent(context, view, bean);
    return false;
  }
Пример #2
0
  /** inject a mutable entity used for Activity */
  public void inject(Context context, MutableEntity m) {
    if (m == null || m.getEntity() == null) {
      return;
    }

    View view = setContentView(context, m.getEntity());
    inject(context, view, m);
  }
Пример #3
0
  private void loadEntity(final Context context, final View view, final MutableEntity m) {
    final Downloadable downloadable = (Downloadable) m.getEntity();
    Object downloadParams = downloadable.onDownloadParams();

    Map<String, String> params = objToMap(downloadParams);

    String uri = downloadable.onDownLoadUrl(context);

    AbsDataProvider dataProvider = configurations.dataProvider;
    handleData(dataProvider, context, view, m, uri, downloadable, params);
  }