Пример #1
0
  @Test
  public void getCurrentActivity_shouldReturnTheProvidedCurrentActivity() throws Exception {
    ActivityGroup activityGroup = new ActivityGroup();
    Activity activity = new Activity();
    shadowOf(activityGroup).setCurrentActivity(activity);

    assertThat(activityGroup.getCurrentActivity(), is(activity));
  }
Пример #2
0
  public static void startLocalActivity(
      final ActivityGroup activityGroup,
      final Intent intent,
      final String identifier,
      final int regionId,
      final int anim) {
    final LocalActivityManager activityManager = activityGroup.getLocalActivityManager();
    final View paneView = activityManager.startActivity(identifier, intent).getDecorView();

    final ViewParent parent = paneView.getParent();
    if ((parent != null) && (parent instanceof ViewGroup)) {
      throw new IllegalStateException("should not happen - currently we don't recycle activities");
    }

    final ViewGroup region = (ViewGroup) activityGroup.findViewById(regionId);
    if ((anim != ANIM_NONE) && (region instanceof ViewSwitcher)) {
      final ViewSwitcher animator = (ViewSwitcher) region;

      if (anim == ANIM_NEXT) {
        animator.setInAnimation(activityGroup, R.anim.sl_next_in);
        animator.setOutAnimation(activityGroup, R.anim.sl_next_out);
      } else {
        animator.setInAnimation(activityGroup, R.anim.sl_previous_in);
        animator.setOutAnimation(activityGroup, R.anim.sl_previous_out);
      }

      final int numChilds = animator.getChildCount();
      if (numChilds == 0) {
        animator.addView(
            paneView,
            0,
            new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
      } else if (numChilds == 1) {
        animator.addView(
            paneView,
            1,
            new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
        animator.showNext();
      } else {
        animator.removeViewAt(0);
        animator.addView(
            paneView,
            1,
            new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
        animator.showNext();
      }
    } else {
      region.removeAllViews();
      region.addView(
          paneView,
          new ViewGroup.LayoutParams(
              ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
    }
  }
Пример #3
0
  @Override
  protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();

    ConfigureDifficulty();
    ConfigureTopics();
    ConfigureTypeOfQuestion();

    try {

      if (cache.getScorableQuestions() > 0) {
        // if there is a result let the user know about it
        FinalResult.setText(
            "Your last result is "
                + Integer.toString(cache.getYourCorrectAnswerResult())
                + " out of "
                + Integer.toString(cache.getScorableQuestions()));
        FinalResult.setVisibility(View.VISIBLE);
      }

    } catch (NumberFormatException e) {

    }
  }
Пример #4
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   setContentView(R.layout.activity_frame);
   initView();
 }
Пример #5
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   unregisterReceiver(nmReceiver);
   unregisterReceiver(amReceiver);
   unregisterReceiver(niReceiver);
 }
Пример #6
0
  @Override
  public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    // changeContentView();

    // TODO wirft fehler?! TabHost tabHost = (TabHost) findViewById(R.id.main_tabhost);
    TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
    boolean tachoIsCurrent = (tabHost.getCurrentTab() == 0);
    if (tachoIsCurrent) {
      tabHost.setCurrentTab(1);
    }

    if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
        || newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
        || newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
      speedoTab.setContent(speedoLandscape);
    } else {
      speedoTab.setContent(speedoPortrait);
    }

    if (tachoIsCurrent) {
      tabHost.setCurrentTab(0);
      // TODO change current tab-workaround
      // (damit Intent nicht "einfriert")
    }
  }
Пример #7
0
 @Override
 protected void onResume() {
   cartBtn.setOnClickListener(this);
   backButton.setVisibility(View.GONE);
   cartBtn.setText("" + CartItemCount.getCartCount(this));
   super.onResume();
 }
Пример #8
0
 /* (non-Javadoc)
  * @see android.app.Activity#onResume()
  */
 @Override
 protected void onResume() {
   super.onResume();
   final Context context = getApplicationContext();
   mSession = Session.get(context);
   Collector.onResume(context);
 }
Пример #9
0
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   setContentView(R.layout.notice_main_group);
   /** add by pengcx 20130809 start */
   /** add by pengcx 20130809 end */
   context = this;
   mTabHost = (TabHost) findViewById(R.id.tab_host);
   tabWidget = mTabHost.getTabWidget();
   mTabHost.setup(getLocalActivityManager());
   mInflater = LayoutInflater.from(this);
   mTabHost.setOnTabChangedListener(
       new TabHost.OnTabChangeListener() {
         public void onTabChanged(String tabId) {
           for (int i = 0; i < titles.length; i++) {
             if (tabId.equals(titles[i])) {
               title.setText(topTitles[i]);
               if (tabId.equals("开奖走势") || tabId.equals("开奖分布")) {
                 imgIcon.setVisibility(View.VISIBLE);
               } else {
                 imgIcon.setVisibility(View.GONE);
               }
               return;
             }
           }
         }
       });
   initView();
   setScale();
   initView(LOTNO);
 }
Пример #10
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.home_page);

    manager = getLocalActivityManager();
    layout = (ViewGroup) findViewById(R.id.ll_main);
    actionBar = (ActionBar) findViewById(R.id.bottomBar1);
    InitView();

    intent1 = new Intent(HomePageActivity.this, MainActivity.class);
    intent2 = new Intent(HomePageActivity.this, MessageActivity.class);
    intent3 = new Intent(HomePageActivity.this, SettingActivity.class);
    // 初始第一项
    Window subActivity = getLocalActivityManager().startActivity("subActivity1", intent1);
    layout.addView(subActivity.getDecorView(), LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);

    haveMessageReceiver = new HaveMessageReceiver();
    IntentFilter filter = new IntentFilter();
    filter.addAction(TongGouService.TONGGOU_ACTION_NEW_MESSAGE);
    registerReceiver(haveMessageReceiver, filter);

    // 启动百度定位
    mLocClient = ((TongGouApplication) getApplication()).mLocationClient;
    ((TongGouApplication) getApplication()).starBaiduLBS();
    startRequestLocationTimer();

    timehandler = new Handler();
  }
Пример #11
0
 @Override
 protected void onResume() {
   super.onResume();
   cutscreen = (Button) findViewById(R.id.cutscreen);
   cutscreen.setSoundEffectsEnabled(false);
   MobclickAgent.onResume(this);
 }
Пример #12
0
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.viewswitcher2_main);
   mViewManager = MainViewManager.getInstance();
   mViewManager.setupViews(this);
 }
 @Override
 public void onConfigurationChanged(Configuration newConfig) {
   super.onConfigurationChanged(newConfig);
   if (null != mBrowser) {
     mBrowser.onConfigurationChanged(newConfig);
   }
 }
Пример #14
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.home_page);
   IfanService.addActivity(this);
   initData();
   initView();
 }
Пример #15
0
  /* (non-Javadoc)
   * @see android.app.Activity#onCreate(android.os.Bundle)
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    final Context context = getApplicationContext();
    mSession = Session.get(context);
    Collector.onError(context);
  }
Пример #16
0
 @Override
 protected void onRestoreInstanceState(Bundle savedInstanceState) {
   super.onRestoreInstanceState(savedInstanceState);
   String currentPage = savedInstanceState.getString(CURRENT_PAGE);
   if ((currentPage != null) && (currentPage.equals(HOME_MARK_ID))) {
     switchPages(R.id.home_bt_mark);
   }
 }
Пример #17
0
  protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.video_main);

    initView(); // 初始化控件
    initListen(); // 各个组件的点击事件
  }
  public void back() {
    hideKeyboard();
    try {
      // if we set history.size() > 0 and we press back key on home
      // activity
      // and then on another activity we wont get back!
      if (history.size() > 1) {
        history.remove(history.size() - 1);
        // call the super.setContent view! so set the real view
        super.setContentView(history.get(history.size() - 1));
      } else {

      }
    } catch (Exception e) {
      if (history.size() >= 0) super.setContentView(history.get(0));
    }
  }
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   super.onCreateOptionsMenu(menu);
   menu.add(0, MENU_SHOWCART, 0, R.string.Main_showCart);
   menu.add(0, MENU_SETSERVERIP, 0, R.string.Main_setServerIp);
   menu.add(0, MENU_REFRESH, 0, "刷新");
   return true;
 }
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   setContentView(R.layout.mainlayout);
   getViews();
   init();
   switchActivity(DISHCLASS_BREAKFAST);
 }
Пример #21
0
 @Override
 public void handleMessage(Message msg) {
   switch (msg.what) {
     case 2:
       cutscreen.performClick();
       break;
   }
   super.handleMessage(msg);
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (mIdList == null) {

      mIdList = new ArrayList<String>();
    }
  }
Пример #23
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.more_layout);
    prepareViewControls();
    getSaticPage();
    moreListView.setOnItemClickListener(MoreTabAct.this);
  }
Пример #24
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.pay_activity);
   mContent = (FrameLayout) findViewById(R.id.content);
   mButtonLike = (Button) findViewById(R.id.home_bt_like);
   mButtonMark = (Button) findViewById(R.id.home_bt_mark);
   mButtonLike.setOnClickListener(MyClickListener);
   mButtonMark.setOnClickListener(MyClickListener);
 }
 public final void startActivityForResult(EUExBase callack, Intent intent, int requestCode) {
   if (mCallbackRuning) {
     return;
   }
   if (null != callack) {
     mActivityCallback = callack;
     mCallbackRuning = true;
     super.startActivityForResult(intent, requestCode);
   }
 }
Пример #26
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (deviceProvider != null) {
     deviceProvider.unregisterReceiver();
     deviceProvider = null;
   }
   if (SettingsElements.LOGGING.getSummary() != null) {
     saveLogcatToFile(getApplicationContext());
   }
 }
Пример #27
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   firstGame_textview = null;
   weibokong_textview = null;
   gamevideo_textview = null;
   news_imageview = null;
   videos_imageview = null;
   collects_imageview = null;
   pictures_imageview = null;
   Video_data = null;
   System.gc();
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE); // 取消标题栏
    setContentView(R.layout.activity_main);

    tabHost = (AnimationTabHost) findViewById(R.id.tabhost);
    tabHost.setup(this.getLocalActivityManager());

    Intent intent;
    intent = new Intent(this, TrafficControl.class);
    tabHost.addTab(
        tabHost
            .newTabSpec("TrafficeControl")
            .setIndicator(
                null, getResources().getDrawable(R.drawable.main_toolbar_firewall_pressed))
            .setContent(intent));

    intent = new Intent(this, TrafficDisplay.class);
    tabHost.addTab(
        tabHost
            .newTabSpec("TrafficDisplay")
            .setIndicator(
                null, getResources().getDrawable(R.drawable.main_toolbar_networkassistant_pressed))
            .setContent(intent));

    intent = new Intent(this, TrafficStatistics.class);
    tabHost.addTab(
        tabHost
            .newTabSpec("TrafficStatistics")
            .setIndicator(
                null, getResources().getDrawable(R.drawable.main_toolbar_statistic_pressed))
            .setContent(intent));

    tabHost.setCurrentTab(1);
    updateTab(tabHost);
    tabHost.setOpenAnimation(true);

    gestureDetector = new GestureDetector(MainActivity.this, onGestureListener);

    tabHost.setOnTabChangedListener(
        new OnTabChangeListener() {

          @Override
          public void onTabChanged(String arg0) {
            // TODO Auto-generated method stub
            updateTab(tabHost);
          }
        });
  }
  /** 做初始化工作 */
  @Override
  protected void onResume() {
    SharedPreferences settings = getSharedPreferences("loginInfo", Activity.MODE_PRIVATE);
    loginName = settings.getString("LOGINNAME", "");
    activitys.add(this);
    ColumnEntry columnEntry = ((CeiApplication) getApplication()).columnEntry;
    ImageResourse imageResource = new ImageResourse();
    imageResource.setIconUrl(columnEntry.getLogo());
    imageResource.setIconId(columnEntry.getLogo());
    ((CeiApplication) (this.getApplication()))
        .asyncImageLoader.loadDrawable(
            imageResource,
            new AsyncImageLoader.ImageCallback() {

              @Override
              public void imageLoaded(Drawable drawable, String path) {
                ImageView imageView = (ImageView) findViewById(R.id.phone_study_icon);
                imageView.setImageBitmap(((BitmapDrawable) drawable).getBitmap());
                imageView.setOnClickListener(
                    new OnClickListener() {
                      @Override
                      public void onClick(View view) {
                        startActivity(
                            new Intent(FoundationActivity.this, PhoneStudyActivity.class));
                        for (int i = 0; i < activitys.size(); i++) {
                          activitys.get(i).finish();
                        }
                      }
                    });
              }
            });
    /*if (activitys.size() > 10) {
    	activitys.get(0).finish();
    	activitys.remove(0);
    }*/
    if (dataHelper == null) dataHelper = new DataHelper(this);
    if (coursewares.size() == 0 || CURRENT_KEY == RECORD_DATA_KEY) {
      initChangedElements();
      registCommonEvent();
      getDataForListView();
      /*
       * new Handler().postDelayed(new Runnable() {
       *
       * @Override public void run() { new Progresser().alertProgress(); }
       * }, 200);
       */

    }
    super.onResume();
  }
 @Override
 protected void onResume() {
   super.onResume();
   EUtil.loge("App onResume");
   mVisable = true;
   if (null != mBrowser) {
     mBrowser.onAppResume();
   }
   if (null != mBrowserAround) {
     mBrowserAround.onResume();
   }
   isForground = true;
   reflectionPluginMethod("onActivityResume");
 }