@Override
 public void setContentView(View view) {
   if (mFrom == DLConstants.FROM_INTERNAL) {
     super.setContentView(view);
   } else {
     mProxyActivity.setContentView(view);
   }
 }
 @Override
 public void setContentView(int layoutResID) {
   if (mFrom == DLConstants.FROM_INTERNAL) {
     super.setContentView(layoutResID);
   } else {
     mProxyActivity.setContentView(layoutResID);
   }
 }
Ejemplo n.º 3
1
  @Test
  public void setContentView_shouldReplaceOldContentView() throws Exception {
    View view1 = new View(application);
    view1.setId(R.id.burritos);
    View view2 = new View(application);
    view2.setId(R.id.button);

    Activity activity = new Activity();
    activity.setContentView(view1);
    assertSame(view1, activity.findViewById(R.id.burritos));

    activity.setContentView(view2);
    assertNull(activity.findViewById(R.id.burritos));
    assertSame(view2, activity.findViewById(R.id.button));
  }
  @Override
  protected void onPostExecute(SearchMovieContainer searchMovieContainer) {
    this.progressDialog.hide();

    if (searchMovieContainer.getSearchMovieElementArrayList().isEmpty()) {
      activity.setContentView(R.layout.activity_no_movies);
      return;
    }

    for (int i = 0; i < searchMovieContainer.getSearchMovieElementArrayList().size(); i++) {
      SearchResultsItem searchResultsItem = new SearchResultsItem();
      searchResultsItem.setTitle(
          searchMovieContainer.getSearchMovieElementArrayList().get(i).getTitle());
      searchResultsItem.setReleaseDate(
          searchMovieContainer.getSearchMovieElementArrayList().get(i).getRelease_date());
      searchResultsItem.setRating(
          searchMovieContainer.getSearchMovieElementArrayList().get(i).getVote_average());
      searchResultsItem.setPosterLink(
          searchMovieContainer.getSearchMovieElementArrayList().get(i).getPoster_path());
      searchResultsItem.setVotes(
          searchMovieContainer.getSearchMovieElementArrayList().get(i).getVote_count());
      searchResultsItem.setMovieId(
          searchMovieContainer.getSearchMovieElementArrayList().get(i).getId());
      searchResultsContainer.getSearchResultsItemArrayList().add(searchResultsItem);

      searchResultsItemAdapter.notifyDataSetChanged(); // this line try to put to loop
    }
  }
Ejemplo n.º 5
1
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   super.setContentView(R.layout.activity_auth);
   sp = this.getSharedPreferences("config", MODE_PRIVATE);
   hu = new HttpUtils();
   pd = new ProgressDialog(this);
   pd.setCancelable(false);
   imei = (TextView) super.findViewById(R.id.imei);
   authcode = (EditText) super.findViewById(R.id.authcode);
   authcode.setText(sp.getString("authcode", ""));
   gcode = (Button) super.findViewById(R.id.gcode);
   queding = (Button) super.findViewById(R.id.queding);
   test = (Button) super.findViewById(R.id.test);
   tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
   imei.setText(tm.getDeviceId());
   gcode.setOnClickListener(new OnClickListenerImpl());
   queding.setOnClickListener(new OnClickListenerImpl());
   test.setOnClickListener(new OnClickListenerImpl());
   if (!"".equals(authcode.getText().toString())) {
     pd.setMessage("正在验证...");
     pd.show();
     PostDataThread pdt = new PostDataThread(2);
     pdt.start();
   }
 }
Ejemplo n.º 6
1
 public static void load(Activity a, int R_layout_yourXML) {
   a.setContentView(R_layout_yourXML);
   Views.inject(a); // butterknife injection
   String className = a.getClass().getCanonicalName() + "$$ViewInjector";
   try {
     Log.i(LOG_TAG, "Checking if butterknife injections exist" + ", className=" + className);
     Class.forName(className);
   } catch (ClassNotFoundException e) {
     // injection did not work show instructions:
     Log.e(
         LOG_TAG,
         "! Butterknife could not find injection classes "
             + "(see http://jakewharton.github.io/"
             + "butterknife/ide-eclipse.html )");
     Log.e(
         LOG_TAG,
         "! Right click on project -> "
             + "Head to Java Compiler -> Annotation "
             + "Processing -> CHECK 'Enable project "
             + "specific settings'");
     Log.e(
         LOG_TAG,
         "! Select 'Factory Path' -> "
             + "Check \"Enable project specific settings\" "
             + "-> click \"Add JARs\" -> Navigate to the "
             + "project's libs/ folder and select "
             + "the Butter Knife jar -> Click Ok");
     throw new RuntimeException(
         "Butterknife could not " + "find injection class '" + className + "'");
   }
 }
Ejemplo n.º 7
0
  @Override
  public ViewGroup bind(final Activity activity) {
    activity.setContentView(R.layout.internal_activity_frame);
    ButterKnife.bind(this, activity);

    TelescopeLayout.cleanUp(activity); // Clean up any old screenshots.
    telescopeLayout.setLens(new BugReportLens(activity, lumberYard));

    // If you have not seen the telescope dialog before, show it.
    if (!seenTelescopeDialog.get()) {
      telescopeLayout.postDelayed(
          new Runnable() {
            @Override
            public void run() {
              if (activity.isFinishing()) {
                return;
              }

              seenTelescopeDialog.set(true);
              showTelescopeDialog(activity);
            }
          },
          1000);
    }

    return telescopeLayout;
  }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   super.setContentView(R.layout.main);
   this.mybut = (Button) super.findViewById(R.id.mybut); // 取得组件
   this.mybut.setOnClickListener(new OnClickListenerImpl());
 }
Ejemplo n.º 9
0
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setContentView(R.layout.a_handbook);

    init();
    setText();
    setListener();
  }
Ejemplo n.º 10
0
  @Test // unclear what the correct behavior should be here...
  public void shouldPopulateWindowDecorViewWithMergeLayoutContents() throws Exception {
    Activity activity = new Activity();
    activity.setContentView(R.layout.toplevel_merge);

    View contentView = activity.findViewById(android.R.id.content);
    assertThat(((ViewGroup) contentView).getChildCount()).isEqualTo(2);
  }
Ejemplo n.º 11
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setContentView(R.layout.base_layout);

    llBase = (LinearLayout) findViewById(R.id.llBase);

    initializeTopNav();
  }
Ejemplo n.º 12
0
  @Test
  public void shouldFindContentViewContainerWithChild() throws Exception {
    Activity activity = new Activity();
    View contentView = new View(activity);
    activity.setContentView(contentView);

    FrameLayout contentViewContainer = (FrameLayout) activity.findViewById(android.R.id.content);
    assertThat(contentViewContainer.getChildAt(0)).isSameAs(contentView);
  }
Ejemplo n.º 13
0
 /**
  * Subclasses must call this at the end of their onCreate() call.
  *
  * @param near The near clipping distance.
  * @param far The far clipping distance.
  */
 protected void start(float near, float far) {
   if (!created) {
     throw new IllegalStateException("GameActivity subclass must call super.onCreate() first!");
   }
   Log.d(TAG, "GameActivity Start!");
   engine.start();
   gameView.setRenderer(new GameRenderer(pipe, near, far));
   super.setContentView(gameView); // TODO change to super.setContentView(content);
 }
Ejemplo n.º 14
0
 /**
  * Sets the content to be displayed. The layout given is superimposed over the game.
  *
  * @param v The view to display over the game.
  * @param params The ViewGroup params to use.
  * @see android.app.Activity#setContentView(int)
  */
 @Override
 public void setContentView(View v, ViewGroup.LayoutParams params) {
   if (content == null) {
     content = new GameLayout(this, gameView);
   } else {
     content.removeAllViews();
   }
   content.addView(v, params);
   super.setContentView(content);
 }
Ejemplo n.º 15
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   list_4view = new ListView(this);
   list_4view.setBackgroundColor(OtherUtils.getColor(255, 204, 255));
   list_4view.setAdapter(
       new ArrayAdapter<String>(
           this, android.R.layout.simple_expandable_list_item_1, SysConts.datao));
   super.setContentView(list_4view);
 }
  @Override()
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setContentView(R.layout.activity_hangman_board_resume);

    // this.createComponents();
    this.extractGameResume(super.getIntent());
    this.createViewComponents();
    this.fillResumeComponents();
  }
Ejemplo n.º 17
0
  @Override
  public void setContentView(View view) {
    if (false) { // set to true to test Picture
      ViewGroup vg = new PictureLayout(this);
      vg.addView(view);
      view = vg;
    }

    super.setContentView(view);
  }
    public void onCreate(Activity activity, Bundle savedInstanceState) {
      this.activity = activity;

      LinearLayout layout = new LinearLayout(activity);

      layout.setOrientation(LinearLayout.VERTICAL);

      activity.setContentView(layout);

      executeFacebookCall();
    }
Ejemplo n.º 19
0
  // not supported yet...
  public static final void CC_DIRECTOR_INIT(Activity app) {
    CCDirector director = CCDirector.sharedDirector();
    director.setDeviceOrientation(CCDirector.kCCDeviceOrientationPortrait);
    director.setDisplayFPS(false);
    director.setAnimationInterval(1.0 / 60);

    CCGLSurfaceView sv = new CCGLSurfaceView(app);

    director.attachInView(sv);
    app.setContentView(sv);
  }
  @Before
  public void setUp() {
    final ActivityController<Activity> activityController = buildActivity(Activity.class);
    final Activity activity = activityController.create().get();
    activityController.start().resume().visible();

    TextInputLayout textInputLayout;
    activity.setContentView(textInputLayout = new TextInputLayout(activity));
    textInputLayout.addView(editText = new EditText(activity));
    editText.setText("0,00");
  }
  /**
   * Set the content to an explicit view.
   *
   * @param view The desired content to display.
   * @param params Layout parameters for the view.
   */
  public void setContentView(View view, LayoutParams params) {
    switch (mDragMode) {
      case MenuDrawer.MENU_DRAG_CONTENT:
        mContentContainer.removeAllViews();
        mContentContainer.addView(view, params);
        break;

      case MenuDrawer.MENU_DRAG_WINDOW:
        mActivity.setContentView(view, params);
        break;
    }
  }
Ejemplo n.º 22
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   super.setContentView(R.layout.main); // 调用布局管理器
   Dialog dialog =
       new AlertDialog.Builder(this)
           .setTitle("对话框") // 创建标题
           .setMessage("显示提示信息") // 表示对话框中的内容
           .setIcon(R.drawable.pic_m) // 设置LOGO
           .create(); // 创建了一个对话框
   dialog.show(); // 显示对话框
 }
  /**
   * Set the content from a layout resource.
   *
   * @param layoutResId Resource ID to be inflated.
   */
  public void setContentView(int layoutResId) {
    switch (mDragMode) {
      case MenuDrawer.MENU_DRAG_CONTENT:
        mContentContainer.removeAllViews();
        LayoutInflater inflater = mActivity.getLayoutInflater();
        inflater.inflate(layoutResId, mContentContainer, true);
        break;

      case MenuDrawer.MENU_DRAG_WINDOW:
        mActivity.setContentView(layoutResId);
        break;
    }
  }
  @Override
  public WebViewBridge loadWebViewBridge(Activity activity) {
    Class<?> clazz = activity.getClass();
    LayoutConfig config = createLayoutConfig(clazz);

    activity.setContentView(config.getLayoutId());
    WebViewBridge webViewBridge =
        (WebViewBridge) activity.findViewById(config.getWebViewBridgeId());
    webViewBridge.setDomainConfig(createDomainConfig(clazz));
    webViewBridge.setNoPause(hasNoPause(clazz));

    return webViewBridge;
  }
Ejemplo n.º 25
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   super.requestWindowFeature(Window.FEATURE_NO_TITLE);
   super.getWindow()
       .setFlags(
           WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
   super.setContentView(R.layout.sys_chgbg);
   chgbg_bg = (TextView) super.findViewById(R.id.chgbg_bg);
   chgbg_img = (ImageView) super.findViewById(R.id.chgbg_img);
   chgbg_img.setOnLongClickListener(this);
   Toast.makeText(this, "全屏设置", Toast.LENGTH_SHORT).show();
 }
Ejemplo n.º 26
0
 /**
  * setContentView for Activity
  *
  * @param context
  * @param bean contains layout
  * @return
  */
 private View setContentView(Context context, Object bean) {
   if (bean.getClass().isAnnotationPresent(ActivityInj.class)) {
     Annotation annotation = bean.getClass().getAnnotation(ActivityInj.class);
     if (annotation != null) {
       ActivityInj contentInj = (ActivityInj) annotation;
       int resId = contentInj.value();
       if (context instanceof Activity) {
         ((Activity) context).setContentView(resId);
         return ((Activity) context).findViewById(android.R.id.content);
       }
     }
   }
   return null;
 }
Ejemplo n.º 27
0
  public void initView(Activity activity) {
    activity.setContentView(R.layout.pg_sdk_edit_main);
    mCompareGLSurfaceView = (IPGEditCompareGLSurfaceView) activity.findViewById(R.id.compare_view);
    mCompareGLSurfaceView.getPGGLSurfaceView().setListener(mPGGLListener);

    mBannerView = activity.findViewById(R.id.pg_sdk_edit_banner);
    mBannerView.setOnClickListener(mOnClickListener);

    mFirstHorizontalLayout = (LinearHoriScrollView) activity.findViewById(R.id.first_menus);
    mSecondHorizontalLayout = (LinearHoriScrollView) activity.findViewById(R.id.second_menus);
    mSecondMenusLayout = activity.findViewById(R.id.second_menus_layout);

    mThirdHorizontalLayout = (LinearHoriScrollView) activity.findViewById(R.id.third_menus);

    mFirstTopView = activity.findViewById(R.id.first_top);
    mStepLayout = activity.findViewById(R.id.step_layout);
    mSaveEffectView = activity.findViewById(R.id.save_effect);
    mSaveEffectView.setOnClickListener(mOnClickListener);

    mBackMainView = activity.findViewById(R.id.back_main);
    mBackMainView.setOnClickListener(mOnClickListener);

    mQuitView = activity.findViewById(R.id.quit);
    mQuitView.setOnClickListener(mOnClickListener);

    mSavePhotoView = activity.findViewById(R.id.save_photo);
    mSavePhotoView.setOnClickListener(mOnClickListener);

    mCenterLayout = (ViewGroup) activity.findViewById(R.id.center_layout);
    mCenterLayoutParent = activity.findViewById(R.id.center_layout_parent);

    mProgressDialogView = activity.findViewById(R.id.progress_dialog);

    mLastStepView = activity.findViewById(R.id.last_step);
    mLastStepView.setOnClickListener(mOnClickListener);
    mLastStepView.setEnabled(false);

    mNextStepView = activity.findViewById(R.id.next_step);
    mNextStepView.setOnClickListener(mOnClickListener);
    mNextStepView.setEnabled(false);

    mNameAutoHideTextView =
        (PGEditAutoHideTextView) activity.findViewById(R.id.name_auto_hide_textview);
    mValueAutoHideTextView =
        (PGEditAutoHideTextView) activity.findViewById(R.id.value_auto_hide_textview);
    mSecondBottomName = (TextView) activity.findViewById(R.id.second_bottom_name);

    mEffectBackView = activity.findViewById(R.id.effect_back);
    mActivity = activity;
  }
Ejemplo n.º 28
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   LinearLayout lay = (LinearLayout) super.getLayoutInflater().inflate(R.layout.base_box, null);
   for (int i = 0; i < SysConts.datao.length; i++) {
     CheckBox cb = (CheckBox) super.getLayoutInflater().inflate(R.layout.base_box1view, null);
     cb.setText(SysConts.datao[i]);
     cbs.add(cb);
     lay.addView(cb, i);
   }
   super.setContentView(lay);
   box_con = (Button) super.findViewById(R.id.box_con);
   box_next = (ImageButton) super.findViewById(R.id.box_next);
   box_con.setOnClickListener(this);
   box_next.setOnClickListener(this);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    searchMenuItem = (ListObject) getIntent().getSerializableExtra(EXTRA_LIST_OBJECT_IDENTIFIER);
    layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View view = layoutInflater.inflate(R.layout.imageviewer, null, false);
    ImageView imageView = (ImageView) view.findViewById(R.id.item_img);

    if (ImageUtils.imageExists(searchMenuItem.getId(), true)) {
      imageView.setImageDrawable(ImageUtils.getImageAsDrawable(this, searchMenuItem.getId(), true));
      imageView.setOnTouchListener(this);
    }

    super.setContentView(view);
  }
Ejemplo n.º 30
0
 @Test
 public void onContentChangedShouldBeCalledAfterContentViewIsSet() throws RuntimeException {
   final Transcript transcript = new Transcript();
   Activity customActivity =
       new Activity() {
         @Override
         public void onContentChanged() {
           transcript.add(
               "onContentChanged was called; title is \""
                   + shadowOf(findViewById(R.id.title)).innerText()
                   + "\"");
         }
       };
   customActivity.setContentView(R.layout.main);
   transcript.assertEventsSoFar("onContentChanged was called; title is \"Main Layout\"");
 }