예제 #1
0
  public void itemRead(int position) {
    Cursor cursor = (Cursor) listView.getItemAtPosition(position);
    String _id = cursor.getString(cursor.getColumnIndexOrThrow("_id"));
    // Toast.makeText(this, "You have chosen the delete for announceid = " +
    // _id, Toast.LENGTH_SHORT).show();

    AnnounceDBAdapter announce = new AnnounceDBAdapter(TrainingListView.this);
    announce.open();
    // set row read code for announcement row
    announce.readrow(_id, "Training");

    announce.close();
    onPause();
    onResume();
  }
예제 #2
0
  @Override
  public void onNewIntent(Intent intent) {

    Dtitle = intent.getStringExtra("title");
    Ddetail = intent.getStringExtra("detail");
    Dfrom = intent.getStringExtra("from");
    _id = intent.getStringExtra("_id");
    Dsummary = intent.getStringExtra("summary");
    String sharekey = intent.getStringExtra("shareKey");
    if (sharekey.contains("off")) share.setVisibility(Button.GONE);
    name = intent.getStringExtra("name");
    aid = intent.getStringExtra("id");
    // String shareflag = intent.getStringExtra("shareKey");
    // if(shareflag.trim().contentEquals("off"))
    // share.setVisibility(Button.INVISIBLE);

    // url = intent.getStringExtra("");
    title.setText(Dtitle);
    detail.setText(Ddetail);
    from.setText(Dfrom);
    summary.setText(Dsummary);

    String root = Environment.getExternalStorageDirectory().toString();
    File myDir = new File(root + Constants.APP_FOLDER_VIDEO);
    // myDir.mkdirs();
    String fname = name;
    file = new File(myDir, fname);
    if (file.exists()) {

      String roo1t =
          Environment.getExternalStorageDirectory().toString() + Constants.APP_FOLDER_VIDEO + name;
      vid.setVideoPath(roo1t);
      vid.setZOrderOnTop(false);
      vid.setMediaController(new MediaController(this) {});
      vid.requestFocus();
    } else {
      if (Utilities.isInternetConnected()) {
        Download d = new Download(TrainingVideo.this, AnnounceDBAdapter.SQLITE_TRAINING, _id + "");
        d.execute("");
        d.setOnPostExecuteListener(
            new OnPostExecuteListener() {

              public void onPostExecute(String result) {
                String roo1t =
                    Environment.getExternalStorageDirectory().toString()
                        + Constants.APP_FOLDER_VIDEO
                        + name;
                detail.setText(DateUtils.formatDate(Ddetail));
                Bitmap thumbnail =
                    ThumbnailUtils.createVideoThumbnail(
                        roo1t, MediaStore.Images.Thumbnails.MINI_KIND);
                BitmapDrawable bitmapDrawable = new BitmapDrawable(thumbnail);
                // vid.setBackgroundDrawable(bitmapDrawable);
                btn.setImageDrawable(bitmapDrawable);
                vid.setVideoPath(roo1t);

                vid.setVideoPath(roo1t);
                vid.setZOrderOnTop(false);
                vid.setMediaController(new MediaController(TrainingVideo.this) {});
                vid.requestFocus();
              }
            });
      } else {
        Toast.makeText(
                TrainingVideo.this, "Please check your internet connection", Toast.LENGTH_SHORT)
            .show();
      }
    }

    // vid.start();
    AnnounceDBAdapter announce = new AnnounceDBAdapter(getApplicationContext());
    announce.open();
    announce.readrow(_id + "", "Training");
    announce.close();
    reports.updateRead(aid);

    //		SA VIKALP ADDED CANCEL LOLLIPOP NOTIFICATION
    try {
      Utilities.cancelLolliPopNotification(ApplicationLoader.getApplication());
    } catch (Exception e) {
      Log.i(TAG, e.toString());
    }
    //		EA VIKALP ADDED CANCEL LOLLIPOP NOTIFICATION
  }