Ejemplo n.º 1
0
 @Override
 public void onReceive(Context mContext, Intent intent) {
   try {
     if (!isFirstRegister) {
       NetworkInfo networkInfo = null;
       ConnectivityManager cm =
           (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
       networkInfo = cm.getActiveNetworkInfo();
       alog.debug("接收网络监听广播");
       if (null != networkInfo) {
         boolean isConnect = networkInfo.isConnectedOrConnecting();
         alog.debug("netBroadcastReceiver isConnect = " + isConnect);
         if (isConnect) {
           if (!isConnteced) {
             isConnteced = true;
             getData(mGameId);
           }
         }
       } else {
         // 网络断开了
         alog.debug("当前网络断开了");
         isConnteced = false;
         // loadingView.showContentNetExceptionOrNullData(true);
         loadingView.getmHandler().sendEmptyMessage(Constant.EXCEPTION);
       }
     } else {
       isFirstRegister = false;
     }
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Ejemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN
                | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
            WindowManager.LayoutParams.FLAG_FULLSCREEN
                | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

    setContentView(R.layout.activity_third_game_detail);
    ScaleViewUtils.init(this);
    ScaleViewUtils.scaleView(getWindow().getDecorView());

    setBlackTitle(false);

    icon = (ImageView) findViewById(R.id.iv_icon);
    gameSize = (TextView) findViewById(R.id.tv_game_size);
    handleType = (TextView) findViewById(R.id.tv_game_handle);
    gameName = (TextView) findViewById(R.id.tv_game_name);

    gameDesc = (TextView) findViewById(R.id.tv_game_desc);

    gameDesc.setMovementMethod(ScrollingMovementMethod.getInstance());
    gameDesc.setOnFocusChangeListener(onFocusChangeListener);

    mRecyclerView = (RecyclerView) findViewById(R.id.rv_game_source);

    LayoutManager layoutManager =
        new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
    mRecyclerView.setLayoutManager(layoutManager);

    mAdapter = new GameSourceAdapter(this, mRecyclerView, mImageFetcher);
    mRecyclerView.setAdapter(mAdapter);

    // gameSourceLayout = (LinearLayout)findViewById(R.id.ll_game_source);

    contentView = (RelativeLayout) findViewById(R.id.rl_desc);
    loadingView = (LoadingView) findViewById(R.id.contentLoading);
    loadingView.setDataView(contentView);

    if (getIntent() != null) {
      mGameId = getIntent().getStringExtra(GAMEID);
    }
    if (mGameId != null && mGameId != "") {
      Log.i("life", "mGameId:" + mGameId);
      getData(mGameId);
    }
    registReceiver();
  }