protected void onResume() { File file1 = new File( Environment.getExternalStorageDirectory().getAbsolutePath() + Constants.APP_FOLDER_TEMP); DeleteRecursive(file1); dbHelper = new AnnounceDBAdapter(this); dbHelper.open(); displayListView(); dbHelper.close(); int temp = Integer.parseInt((getPreferences(MODE_PRIVATE).getString("listScroll", 0 + ""))); Log.v("temp on resume", temp + ""); listView.setSelection(temp); if (listView.getCount() < 1) { nomobcast.setVisibility(TextView.VISIBLE); } else { nomobcast.setVisibility(TextView.GONE); } IntentFilter filter = new IntentFilter(); filter.addAction("MyGCMMessageReceived"); registerReceiver(receiver, filter); super.onResume(); }
public void itemUnread(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.unreadrow(_id, "Training"); announce.close(); onPause(); onResume(); }
public void itemDelete(int position) { Cursor cursor = (Cursor) listView.getItemAtPosition(position); String _id = cursor.getString(cursor.getColumnIndexOrThrow("_id")); // Toast.makeText(this, "You have chosen the delete fot announceid = " + // _id, Toast.LENGTH_SHORT).show(); new DeleteFile(getApplicationContext(), AnnounceDBAdapter.SQLITE_TRAINING, _id).Delete(); AnnounceDBAdapter announce = new AnnounceDBAdapter(TrainingListView.this); announce.open(); // delete code announce.deleterow(_id, "Training"); announce.close(); onPause(); onResume(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.trainlist); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) { if (!BuildVars.debug) { getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE); } } NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.cancelAll(); search = (ImageButton) findViewById(R.id.sample_button); search.setOnTouchListener(myhandler2); nomobcast = (TextView) findViewById(R.id.noNew); sample_refresh = (ImageButton) findViewById(R.id.sample_refresh); getPreferences(MODE_PRIVATE).edit().putString("listScroll", "0").commit(); search.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent i = new Intent(TrainingListView.this, Search.class); i.putExtra("tablename", "Training"); startActivity(i); } }); sample_refresh.setOnTouchListener(myhandler2); sample_refresh.setOnClickListener(myhandler11); announce = new AnnounceDBAdapter(this); announce.open(); if (announce.fetchAllTraining().getCount() < 1) { ConnectionDetector cd = new ConnectionDetector(getApplicationContext()); Boolean isInternetPresent = cd.isConnectingToInternet(); // if (isInternetPresent) { myhandler11.onClick(sample_refresh); } } announce.close(); }
@Override public void onClick(View v) { // TODO Auto-generated method stub // Toast.makeText(getApplicationContext(), "refreshList", // Toast.LENGTH_SHORT).show(); RotateAnimation ranim = (RotateAnimation) AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotateanim); sample_refresh.startAnimation(ranim); // SA VIKALP try { refreshData(); } catch (Exception e) { e.printStackTrace(); } // EA VIKALP if (listView != null && listView.getCount() < 1) { dbHelper = new AnnounceDBAdapter(getApplicationContext()); dbHelper.open(); displayListView(); dbHelper.close(); } }
@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 }