예제 #1
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   for (CameraInfo info : mCameraInfos) {
     removeStreamer(info.getCid());
   }
   mMyViewerHelper.removeCameraStateListener(this);
   mMyViewerHelper.logout();
   android.os.Process.killProcess(android.os.Process.myPid());
 }
예제 #2
0
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   CameraInfo cameraInfo = mCameraInfos.get(position);
   if (cameraInfo.getIsOnline()) {
     Intent intent = new Intent(this, WatchActivity.class);
     intent.putExtra(Constants.INTENT_CID, cameraInfo.getCid());
     intent.putExtra(Constants.INTENT_CAMERA_NAME, cameraInfo.getCameraName());
     startActivity(intent);
   } else {
     Toast.makeText(this, R.string.camera_offline, Toast.LENGTH_LONG).show();
   }
 }
예제 #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.camera_list);
    mLayoutInflater = LayoutInflater.from(this);
    mCameraListView = (ListView) findViewById(R.id.cameraList);
    TextView titleView = (TextView) findViewById(R.id.title);
    titleView.setText(R.string.app_name);
    mMenuView = (ImageView) findViewById(R.id.menu);
    mMenuView.setVisibility(View.VISIBLE);
    mMenuView.setOnClickListener(this);
    mMenu = new PopupMenu(this, mMenuView);
    MenuInflater inflater = mMenu.getMenuInflater();
    inflater.inflate(R.menu.popup_menu, mMenu.getMenu());
    mMenu.setOnMenuItemClickListener(this);

    mViewer = Viewer.getViewer();
    mMyViewerHelper = MyViewerHelper.getInstance(getApplicationContext());
    mMyViewerHelper.addCameraStateListener(this);
    mCameraDefaulThumb = BitmapFactory.decodeResource(getResources(), R.drawable.avs_type_android);

    mCameraInfoManager = new CameraInfoManager(this);
    mCameraInfos = mMyViewerHelper.getAllCameraInfos();
    for (CameraInfo info : mCameraInfos) {
      addStreamer(info.getCid(), info.getCameraUser(), info.getCameraPwd());
    }
    mCameraListAdapter = new CameraListAdapter(this, mCameraInfos);
    mCameraListView.setAdapter(mCameraListAdapter);
    mCameraListView.setOnItemClickListener(this);

    mShowChinese = "zh".equals(Locale.getDefault().getLanguage().toLowerCase());

    // update
    UmengUpdateAgent.setUpdateOnlyWifi(false);
    UmengUpdateAgent.update(this);

    // admob ad
    RelativeLayout adContainer = (RelativeLayout) findViewById(R.id.adLayout);
    AdView ad = new AdView(this, AdSize.BANNER, AD_UNIT_ID);
    // .addTestDevice("703C305FC29B7ED91BD7625874CFDEBC")
    ad.loadAd(new AdRequest());
    adContainer.addView(ad);
  }