List of usage examples for android.content Intent putExtras
public @NonNull Intent putExtras(@NonNull Bundle extras)
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name :createinteractiveLayout * /*from w w w . j a va 2s .c o m*/ * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ // interactive public void createinteractiveLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutInteractive); int size = resincUrls.size(); Log.i("Size to check :", "" + size); List<String> resTempincGooruid = new ArrayList<String>(); resTempincGooruid = resincGooruid; int intial = 0; if (interactiveresGooruOid.size() > 4) { intial = interactiveresGooruOid.size() - 5; } else { interactiveRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.interactive_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + interactiveresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Interactive"; resourceGooruId = interactiveresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", interactiveresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }
From source file:com.entradahealth.entrada.android.app.personal.activities.job_list.JobListActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); activity = this; application = (EntradaApplication) EntradaApplication.getAppContext(); sp = getSharedPreferences("Entrada", Context.MODE_WORLD_READABLE); if (sp.getBoolean("SECURE_MSG", true)) getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); else// www. jav a 2 s. c o m getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE); final JobListActivity thisActivity = this; //Custom view as action bar LayoutInflater mInflater = LayoutInflater.from(this); View mCustomView = mInflater.inflate(R.layout.acbar_job_list, null); tvAcTitle = (TextView) mCustomView.findViewById(R.id.tvAcTitle); ivInbox = (ImageView) mCustomView.findViewById(R.id.ivInbox); ivAddJob = (ImageView) mCustomView.findViewById(R.id.ivAddJob); ivSync = (ImageView) mCustomView.findViewById(R.id.ivSync); ivSchedule = (ImageView) mCustomView.findViewById(R.id.ivSchedule); tvAcTitle.setText(BundleKeys.title); //Sample icon badger on Action bar item badge = new BadgeView(this, ivInbox); if (BundleKeys.fromSecureMessaging || !application.isJobListEnabled()) { startActivity(new Intent(JobListActivity.this, SecureMessaging.class)); finish(); } ivInbox.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub startActivity(new Intent(JobListActivity.this, SecureMessaging.class)); finish(); } }); ivAddJob.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent addJobIntent = new Intent(JobListActivity.this, AddJobActivity.class); addJobIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(addJobIntent); finish(); } }); ivSync.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub ns = new NetworkState(getApplicationContext()); isConnected = ns.isConnectingToInternet(); if (isConnected) { running = false; ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if ("com.entradahealth.entrada.android.app.personal.sync.SyncService" .equals(service.service.getClassName()) || "com.entradahealth.entrada.android.app.personal.sync.DictationUploadService" .equals(service.service.getClassName())) { running = true; } } if (!running) { etSearch.setText(null); if (!isFinishing()) { //retryUploads(); boolean canSync = true; try { List<Job> jobs = AndroidState.getInstance().getUserState() .getProvider(currentAccount).getJobs(); for (Job j : jobs) { if (j.isPending()) { canSync = false; UserState state = AndroidState.getInstance().getUserState(); Log.e("", "onOptionsItemSelected-syncMenuItem--" + j.id); DictationUploadService.startUpload(JobListActivity.this, state, currentAccount, j); } } } catch (Exception ex) { ACRA.getErrorReporter().handleSilentException(ex); canSync = false; } if (!canSync) { Toast.makeText(JobListActivity.this, "Please wait for all uploads to complete before syncing.", Toast.LENGTH_SHORT).show(); } else { rlSyncError.setVisibility(View.GONE); rlUpdated.setVisibility(View.INVISIBLE); tvUpdating.setVisibility(View.VISIBLE); Intent i = new Intent(JobListActivity.this, SyncService.class); startService(i); } isSyncing = true; BundleKeys.SYNC_FOR_ACC = currentAccount.getDisplayName(); //BundleKeys.SYNC_FOR_CLINIC = currentAccount.getClinicCode(); /*task1 = buildMinderTask(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { task1.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { task1.execute(); }*/ } } else { if (!isResumed) Toast.makeText(JobListActivity.this, "Please wait for all uploads to complete before syncing.", Toast.LENGTH_SHORT) .show(); } isResumed = false; } else { rlSyncError.setVisibility(View.VISIBLE); rlUpdated.setVisibility(View.GONE); tvUpdating.setVisibility(View.GONE); } } }); ivSchedule.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(JobListActivity.this, ScheduleActivity.class)); finish(); } }); getActionBar().setCustomView(mCustomView); getActionBar().setDisplayShowCustomEnabled(true); //ActionBar ab = getActionBar(); //ab.setTitle(BundleKeys.title); this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); registerReceiver(broadcastReceiver, new IntentFilter("CONNECTIVITY_CHANGED")); jobIds = new ArrayList<Long>(); BundleKeys.fromImageDisplay = false; BundleKeys.fromCaputreImages = false; BundleKeys.fromSecureMessaging = false; /*Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread paramThread, Throwable paramThrowable) { Log.e("Job-List-Activity","Uncaught-Exception"); System.exit(2); } });*/ setBehindContentView(R.layout.job_list_sliding_menu); tvListTitle = (TextView) findViewById(R.id.tvListTitle); tvListTitle.setText("Jobs"); lvSliding = (ListView) findViewById(R.id.lvSlidingMenu); lvSliding.setBackgroundColor(Color.parseColor("#262b38")); // Get screen width and set sliding width to 3/4 Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int req_width = width * 3 / 4; slidingMenu = getSlidingMenu(); slidingMenu.setFadeEnabled(true); slidingMenu.setFadeDegree(0.35f); slidingMenu.setBehindWidth(req_width); slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN); setContentView(R.layout.job_list); ivDrawer = (ImageView) findViewById(R.id.ivDrawer); ivDrawer.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub slidingMenu.toggle(); // JobCountTask(); } }); rlUpdated = (RelativeLayout) findViewById(R.id.rlDateTime); rlSyncError = (RelativeLayout) findViewById(R.id.rlSyncError); rlSyncError.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub AlertDialog.Builder builder = new AlertDialog.Builder(JobListActivity.this); builder.setTitle(R.string.title_sync_error); builder.setMessage(R.string.msg_sync_error); builder.setPositiveButton("OK", null); dgSyncError = builder.create(); dgSyncError.show(); } }); tvDate = (TextView) findViewById(R.id.tvDate); tvTime = (TextView) findViewById(R.id.tvTime); tvUpdating = (TextView) findViewById(R.id.lblUpdating); tvSyncFailed = (TextView) findViewById(R.id.lblSyncError); handler = new Handler(); handler.postDelayed(runnable, BundleKeys.mins_to_sync * 60 * 1000); handler.postDelayed(runnable_logs, 5 * 60 * 1000); jobListView = (ListView) findViewById(R.id.jobListView); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); jobListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { // TODO: evaluate whether to save search text in // UserState to repopulate on back press. itemClicked = true; if (searchTask != null) { searchTask.cancel(true); } Log.d("", "-- Job ItemClick --"); List<Long> jobList = thisActivity.getJobIdList(); Preconditions.checkNotNull(jobList, "null List<Job> when adapter view clicked."); Job job = AndroidState.getInstance().getUserState().getProvider(currentAccount) .getJob(jobList.get(position)); if (job != null) { Preconditions.checkNotNull(job, "null item in List<Job> when adapter view clicked."); if (job.isFlagSet(Job.Flags.UPLOAD_COMPLETED) || job.isFlagSet(Job.Flags.UPLOAD_IN_PROGRESS) || (job.isFlagSet(Job.Flags.UPLOAD_PENDING) && BundleKeys.which == 6)) { Toast.makeText(thisActivity, "Cannot open a completed dictation.", Toast.LENGTH_SHORT) .show(); return; } else if (job.isFlagSet(Job.Flags.LOCALLY_DELETED)) { return; } Intent intent = new Intent(thisActivity, JobDisplayActivity.class); Bundle b = new Bundle(); if (!job.isFlagSet(Flags.HOLD)) job = job.setFlag(Flags.IS_FIRST); else job = job.clearFlag(Flags.IS_FIRST); try { AndroidState.getInstance().getUserState().getProvider(currentAccount).updateJob(job); } catch (DomainObjectWriteException e) { // TODO Auto-generated catch block e.printStackTrace(); } b.putBoolean("isFirst", true); b.putBoolean("isFromList", true); b.putBoolean("isNew", false); b.putLong(BundleKeys.SELECTED_JOB, job.id); b.putString(BundleKeys.SELECTED_JOB_ACCOUNT, currentAccount.getName()); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtras(b); thisActivity.startActivity(intent); thisActivity.finish(); } } }); jobListView.setMultiChoiceModeListener(new JobListMultiChoiceModeListener(this)); slidingMenu.setOnOpenListener(new OnOpenListener() { @Override public void onOpen() { // TODO Auto-generated method stub openSlide(); } }); lvSliding.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) { // TODO Auto-generated method stub switch (pos) { case 1: //getActionBar().setTitle("Today's Jobs"); tvAcTitle.setText("Today's Jobs"); BundleKeys.title = "Today's Jobs"; BundleKeys.which = 1; //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(true); ivAddJob.setVisibility(View.VISIBLE); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); etSearch.setText(""); break; case 2: //getActionBar().setTitle("Tomorrow's Jobs"); tvAcTitle.setText("Tomorrow's Jobs"); BundleKeys.which = 2; BundleKeys.title = "Tomorrow's Jobs"; //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(true); ivAddJob.setVisibility(View.VISIBLE); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); etSearch.setText(""); break; case 3: //getActionBar().setTitle("Stat Jobs"); tvAcTitle.setText("Stat Jobs"); BundleKeys.which = 3; BundleKeys.title = "Stat Jobs"; //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(true); ivAddJob.setVisibility(View.VISIBLE); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); etSearch.setText(""); break; case 4: //getActionBar().setTitle("All Jobs"); tvAcTitle.setText("All Jobs"); BundleKeys.which = 4; BundleKeys.title = "All Jobs"; //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(true); ivAddJob.setVisibility(View.VISIBLE); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); etSearch.setText(""); break; case 6: //getActionBar().setTitle("Hold Jobs"); tvAcTitle.setText("Hold Jobs"); BundleKeys.which = 5; BundleKeys.title = "Hold Jobs"; //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(true); ivAddJob.setVisibility(View.VISIBLE); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); etSearch.setText(""); break; case 7: //getActionBar().setTitle("Deleted Jobs"); tvAcTitle.setText("Deleted Jobs"); BundleKeys.which = 7; BundleKeys.title = "Deleted Jobs"; // Hide "Add Job" menu item //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(false); ivAddJob.setVisibility(View.GONE); jobListView.setChoiceMode(ListView.CHOICE_MODE_NONE); etSearch.setText(""); break; case 8: //getActionBar().setTitle("Completed Jobs"); tvAcTitle.setText("Completed Jobs"); BundleKeys.which = 6; BundleKeys.title = "Completed Jobs"; // Hide "Add Job" menu item //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(false); ivAddJob.setVisibility(View.GONE); jobListView.setChoiceMode(ListView.CHOICE_MODE_NONE); etSearch.setText(""); break; case 10: isSetting = true; //getActionBar().setTitle("Settings"); tvAcTitle.setText("Settings Jobs"); startActivity(new Intent(JobListActivity.this, EntradaSettings.class) .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); finish(); break; case 11: // Check if there are any held jobs or any uploads in // progress boolean isHeld = true, isPending = true; try { List<Job> jobs = AndroidState.getInstance().getUserState().getProvider(currentAccount) .getJobs(); for (Job j : jobs) { if (j.isPending()) isPending = false; if (j.isFlagSet(Job.Flags.HOLD)) isHeld = false; } } catch (Exception ex) { ACRA.getErrorReporter().handleSilentException(ex); isPending = false; isHeld = false; } if (SyncService.isRunning()) { AlertDialog.Builder builder = new AlertDialog.Builder(JobListActivity.this); builder.setTitle(R.string.del_acc_err_title); builder.setMessage(R.string.manage_q_upload_error); builder.setPositiveButton("OK", null); builder.setCancelable(true); dgManageQ = builder.create(); dgManageQ.show(); } else if (isPending && isHeld) { Intent qIntent = new Intent(JobListActivity.this, ManageQueuesActivity.class); qIntent.putExtra("from_settings", false); qIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(qIntent); finish(); } else if (!isHeld) { AlertDialog.Builder builder = new AlertDialog.Builder(JobListActivity.this); builder.setTitle(R.string.del_acc_err_title); builder.setMessage(R.string.manage_q_hold_error); builder.setPositiveButton("OK", null); builder.setCancelable(true); dgManageQ = builder.create(); dgManageQ.show(); } else if (!isPending) { AlertDialog.Builder builder = new AlertDialog.Builder(JobListActivity.this); builder.setTitle(R.string.del_acc_err_title); builder.setMessage(R.string.manage_q_upload_error); builder.setPositiveButton("OK", null); builder.setCancelable(true); dgManageQ = builder.create(); dgManageQ.show(); } break; default: //getActionBar().setTitle("Today's Jobs"); tvAcTitle.setText("Today's Jobs"); BundleKeys.title = "Today's Jobs"; BundleKeys.which = 1; //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(true); ivAddJob.setVisibility(View.VISIBLE); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); } Log.e(LOG_NAME, Integer.toString(BundleKeys.which) + " - " + BundleKeys.title); isSync = false; slidingMenu.toggle(true); /* * Log.e("isSetting", Boolean.toString(isSetting)); * if(BundleKeys.which != 8 && BundleKeys.which != 9 && * !isSetting) etSearch.setText(""); */ } }); rlSearch = (RelativeLayout) findViewById(R.id.rlSearch); etSearch = (EditText) findViewById(R.id.etSearch); etSearch.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { //launchSearchTask(); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub try { Thread.sleep(200); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } launchSearchTask(); } }); GetResourcesTask task = new GetResourcesTask(); task.execute(); }
From source file:com.ichi2.anki2.DeckPicker.java
/** Called when the activity is first created. */ @Override// w w w . j a va 2 s .co m protected void onCreate(Bundle savedInstanceState) throws SQLException { Log.i(AnkiDroidApp.TAG, "DeckPicker - onCreate"); Intent intent = getIntent(); if (!isTaskRoot()) { Log.i(AnkiDroidApp.TAG, "DeckPicker - onCreate: Detected multiple instance of this activity, closing it and return to root activity"); Intent reloadIntent = new Intent(DeckPicker.this, DeckPicker.class); reloadIntent.setAction(Intent.ACTION_MAIN); if (intent != null && intent.getExtras() != null) { reloadIntent.putExtras(intent.getExtras()); } if (intent != null && intent.getData() != null) { reloadIntent.setData(intent.getData()); } reloadIntent.addCategory(Intent.CATEGORY_LAUNCHER); reloadIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); finish(); startActivityIfNeeded(reloadIntent, 0); } if (intent.getData() != null) { mImportPath = getIntent().getData().getEncodedPath(); } // need to start this here in order to avoid showing deckpicker before splashscreen if (AnkiDroidApp.colIsOpen()) { setTitle(getResources().getString(R.string.app_name)); } else { setTitle(""); mOpenCollectionHandler.onPreExecute(); } Themes.applyTheme(this); super.onCreate(savedInstanceState); // mStartedByBigWidget = intent.getIntExtra(EXTRA_START, EXTRA_START_NOTHING); SharedPreferences preferences = restorePreferences(); // activate broadcast messages if first start of a day if (mLastTimeOpened < UIUtils.getDayStart()) { preferences.edit().putBoolean("showBroadcastMessageToday", true).commit(); } preferences.edit().putLong("lastTimeOpened", System.currentTimeMillis()).commit(); // if (intent != null && intent.hasExtra(EXTRA_DECK_ID)) { // openStudyOptions(intent.getLongExtra(EXTRA_DECK_ID, 1)); // } BroadcastMessages.checkForNewMessages(this); View mainView = getLayoutInflater().inflate(R.layout.deck_picker, null); setContentView(mainView); // check, if tablet layout View studyoptionsFrame = findViewById(R.id.studyoptions_fragment); mFragmented = studyoptionsFrame != null && studyoptionsFrame.getVisibility() == View.VISIBLE; Themes.setContentStyle(mFragmented ? mainView : mainView.findViewById(R.id.deckpicker_view), Themes.CALLER_DECKPICKER); registerExternalStorageListener(); if (!mFragmented) { mAddButton = (ImageButton) findViewById(R.id.deckpicker_add); mAddButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { addNote(); } }); mCardsButton = (ImageButton) findViewById(R.id.deckpicker_card_browser); mCardsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { openCardBrowser(); } }); mStatsButton = (ImageButton) findViewById(R.id.statistics_all_button); mStatsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showDialog(DIALOG_SELECT_STATISTICS_TYPE); } }); mSyncButton = (ImageButton) findViewById(R.id.sync_all_button); mSyncButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { sync(); } }); } mInvalidateMenu = false; mDeckList = new ArrayList<HashMap<String, String>>(); mDeckListView = (ListView) findViewById(R.id.files); mDeckListAdapter = new SimpleAdapter(this, mDeckList, R.layout.deck_item, new String[] { "name", "new", "lrn", "rev", // "complMat", "complAll", "sep", "dyn" }, new int[] { R.id.DeckPickerName, R.id.deckpicker_new, R.id.deckpicker_lrn, R.id.deckpicker_rev, // R.id.deckpicker_bar_mat, R.id.deckpicker_bar_all, R.id.deckpicker_deck, R.id.DeckPickerName }); mDeckListAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { @Override public boolean setViewValue(View view, Object data, String text) { if (view.getId() == R.id.deckpicker_deck) { if (text.equals("top")) { view.setBackgroundResource(R.drawable.white_deckpicker_top); return true; } else if (text.equals("bot")) { view.setBackgroundResource(R.drawable.white_deckpicker_bottom); return true; } else if (text.equals("ful")) { view.setBackgroundResource(R.drawable.white_deckpicker_full); return true; } else if (text.equals("cen")) { view.setBackgroundResource(R.drawable.white_deckpicker_center); return true; } } else if (view.getId() == R.id.DeckPickerName) { if (text.equals("d0")) { ((TextView) view).setTextColor(getResources().getColor(R.color.non_dyn_deck)); return true; } else if (text.equals("d1")) { ((TextView) view).setTextColor(getResources().getColor(R.color.dyn_deck)); return true; } } // } else if (view.getId() == R.id.deckpicker_bar_mat || view.getId() == R.id.deckpicker_bar_all) { // if (text.length() > 0 && !text.equals("-1.0")) { // View parent = (View)view.getParent().getParent(); // if (text.equals("-2")) { // parent.setVisibility(View.GONE); // } else { // Utils.updateProgressBars(view, (int) UIUtils.getDensityAdjustedValue(DeckPicker.this, 3.4f), // (int) (Double.parseDouble(text) * ((View)view.getParent().getParent().getParent()).getHeight())); // if (parent.getVisibility() == View.INVISIBLE) { // parent.setVisibility(View.VISIBLE); // parent.setAnimation(ViewAnimation.fade(ViewAnimation.FADE_IN, 500, 0)); // } // } // } // return true; // } else if (view.getVisibility() == View.INVISIBLE) { // if (!text.equals("-1")) { // view.setVisibility(View.VISIBLE); // view.setAnimation(ViewAnimation.fade(ViewAnimation.FADE_IN, 500, 0)); // return false; // } // } else if (text.equals("-1")){ // view.setVisibility(View.INVISIBLE); // return false; return false; } }); mDeckListView.setOnItemClickListener(mDeckSelHandler); mDeckListView.setAdapter(mDeckListAdapter); if (mFragmented) { mDeckListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); } registerForContextMenu(mDeckListView); showStartupScreensAndDialogs(preferences, 0); if (mSwipeEnabled) { gestureDetector = new GestureDetector(new MyGestureDetector()); mDeckListView.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (gestureDetector.onTouchEvent(event)) { return true; } return false; } }); } }
From source file:com.nit.vicky.DeckPicker.java
/** Called when the activity is first created. */ @Override/*from w w w . j a v a 2s. co m*/ protected void onCreate(Bundle savedInstanceState) throws SQLException { // Log.i(AnkiDroidApp.TAG, "DeckPicker - onCreate"); Intent intent = getIntent(); if (!isTaskRoot()) { // Log.i(AnkiDroidApp.TAG, "DeckPicker - onCreate: Detected multiple instance of this activity, closing it and return to root activity"); Intent reloadIntent = new Intent(DeckPicker.this, DeckPicker.class); reloadIntent.setAction(Intent.ACTION_MAIN); if (intent != null && intent.getExtras() != null) { reloadIntent.putExtras(intent.getExtras()); } if (intent != null && intent.getData() != null) { reloadIntent.setData(intent.getData()); } reloadIntent.addCategory(Intent.CATEGORY_LAUNCHER); reloadIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); finish(); startActivityIfNeeded(reloadIntent, 0); } if (intent.getData() != null) { mImportPath = getIntent().getData().getEncodedPath(); } // need to start this here in order to avoid showing deckpicker before splashscreen if (AnkiDroidApp.colIsOpen()) { setTitle(getResources().getString(R.string.app_name)); } else { setTitle(""); mOpenCollectionHandler.onPreExecute(); } Themes.applyTheme(this); super.onCreate(savedInstanceState); // mStartedByBigWidget = intent.getIntExtra(EXTRA_START, EXTRA_START_NOTHING); SharedPreferences preferences = restorePreferences(); // activate broadcast messages if first start of a day if (mLastTimeOpened < UIUtils.getDayStart()) { preferences.edit().putBoolean("showBroadcastMessageToday", true).commit(); } preferences.edit().putLong("lastTimeOpened", System.currentTimeMillis()).commit(); // if (intent != null && intent.hasExtra(EXTRA_DECK_ID)) { // openStudyOptions(intent.getLongExtra(EXTRA_DECK_ID, 1)); // } //BroadcastMessages.checkForNewMessages(this); View mainView = getLayoutInflater().inflate(R.layout.deck_picker, null); setContentView(mainView); // check, if tablet layout View studyoptionsFrame = findViewById(R.id.studyoptions_fragment); mFragmented = studyoptionsFrame != null && studyoptionsFrame.getVisibility() == View.VISIBLE; Themes.setContentStyle(mFragmented ? mainView : mainView.findViewById(R.id.deckpicker_view), Themes.CALLER_DECKPICKER); registerExternalStorageListener(); if (!mFragmented) { mAddButton = (ImageButton) findViewById(R.id.deckpicker_add); mAddButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { addNote(); } }); mCardsButton = (ImageButton) findViewById(R.id.deckpicker_card_browser); mCardsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { openCardBrowser(); } }); mStatsButton = (ImageButton) findViewById(R.id.statistics_all_button); mStatsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showDialog(DIALOG_SELECT_STATISTICS_TYPE); } }); mSyncButton = (ImageButton) findViewById(R.id.sync_all_button); mSyncButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { sync(); } }); } mInvalidateMenu = false; mDeckList = new ArrayList<HashMap<String, String>>(); mDeckListView = (ListView) findViewById(R.id.files); mDeckListAdapter = new SimpleAdapter(this, mDeckList, R.layout.deck_item, new String[] { "name", "new", "lrn", "rev", // "complMat", "complAll", "sep", "dyn" }, new int[] { R.id.DeckPickerName, R.id.deckpicker_new, R.id.deckpicker_lrn, R.id.deckpicker_rev, // R.id.deckpicker_bar_mat, R.id.deckpicker_bar_all, R.id.deckpicker_deck, R.id.DeckPickerName }); mDeckListAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { @Override public boolean setViewValue(View view, Object data, String text) { if (view.getId() == R.id.deckpicker_deck) { if (text.equals("top")) { view.setBackgroundResource(R.drawable.white_deckpicker_top); return true; } else if (text.equals("bot")) { view.setBackgroundResource(R.drawable.white_deckpicker_bottom); return true; } else if (text.equals("ful")) { view.setBackgroundResource(R.drawable.white_deckpicker_full); return true; } else if (text.equals("cen")) { view.setBackgroundResource(R.drawable.white_deckpicker_center); return true; } } else if (view.getId() == R.id.DeckPickerName) { if (text.equals("d0")) { ((TextView) view).setTextColor(getResources().getColor(R.color.non_dyn_deck)); return true; } else if (text.equals("d1")) { ((TextView) view).setTextColor(getResources().getColor(R.color.dyn_deck)); return true; } } // } else if (view.getId() == R.id.deckpicker_bar_mat || view.getId() == R.id.deckpicker_bar_all) { // if (text.length() > 0 && !text.equals("-1.0")) { // View parent = (View)view.getParent().getParent(); // if (text.equals("-2")) { // parent.setVisibility(View.GONE); // } else { // Utils.updateProgressBars(view, (int) UIUtils.getDensityAdjustedValue(DeckPicker.this, 3.4f), // (int) (Double.parseDouble(text) * ((View)view.getParent().getParent().getParent()).getHeight())); // if (parent.getVisibility() == View.INVISIBLE) { // parent.setVisibility(View.VISIBLE); // parent.setAnimation(ViewAnimation.fade(ViewAnimation.FADE_IN, 500, 0)); // } // } // } // return true; // } else if (view.getVisibility() == View.INVISIBLE) { // if (!text.equals("-1")) { // view.setVisibility(View.VISIBLE); // view.setAnimation(ViewAnimation.fade(ViewAnimation.FADE_IN, 500, 0)); // return false; // } // } else if (text.equals("-1")){ // view.setVisibility(View.INVISIBLE); // return false; return false; } }); mDeckListView.setOnItemClickListener(mDeckSelHandler); mDeckListView.setAdapter(mDeckListAdapter); if (mFragmented) { mDeckListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); } registerForContextMenu(mDeckListView); showStartupScreensAndDialogs(preferences, 0); if (mSwipeEnabled) { gestureDetector = new GestureDetector(new MyGestureDetector()); mDeckListView.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (gestureDetector.onTouchEvent(event)) { return true; } return false; } }); } }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search_results_resource); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); Bundle extra = getIntent().getExtras(); if (extra != null) { searchKeyword = extra.getString("keyWord").trim(); }//from w ww .j a v a 2 s .c o m prefsPrivate = getSharedPreferences(PREFS_PRIVATE, Context.MODE_PRIVATE); token = prefsPrivate.getString("token", ""); imageViewClose = (ImageView) findViewById(R.id.imageViewClose); imageViewSearch = (ImageView) findViewById(R.id.imageViewSearch); editTextSearchResults = (EditText) findViewById(R.id.textViewSearch); switchResColl = (Switch) findViewById(R.id.switchResColl); dialog1 = new Dialog(this); editTextSearchResults.setText(searchKeyword); imm = (InputMethodManager) this.getSystemService(Service.INPUT_METHOD_SERVICE); dialog = new ProgressDialog(this); dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); if (checkInternetConnection()) { new getResources().execute(); } else { showDialog("Please Check Internet connection"); new getResources().execute(); } // scroll views videoScroll = (HorizontalScrollView) findViewById(R.id.videoScroll); interactiveScroll = (HorizontalScrollView) findViewById(R.id.interactiveScroll); websiteScroll = (HorizontalScrollView) findViewById(R.id.websiteScroll); textbookScroll = (HorizontalScrollView) findViewById(R.id.textbookScroll); examScroll = (HorizontalScrollView) findViewById(R.id.examScroll); handoutScroll = (HorizontalScrollView) findViewById(R.id.handoutScroll); slideScroll = (HorizontalScrollView) findViewById(R.id.slideScroll); lessonScroll = (HorizontalScrollView) findViewById(R.id.lessonScroll); // category image load more resources videoRight = (ImageView) findViewById(R.id.videoRight); interactiveRight = (ImageView) findViewById(R.id.interactiveRight); websiteRight = (ImageView) findViewById(R.id.websiteRight); textbookRight = (ImageView) findViewById(R.id.textbookRight); examRight = (ImageView) findViewById(R.id.examRight); handoutRight = (ImageView) findViewById(R.id.handoutRight); slideRight = (ImageView) findViewById(R.id.slideRight); lessonRight = (ImageView) findViewById(R.id.lessonRight); videoRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { videoCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5Videos().execute(); } else { showDialog("Please Check Internet connection"); } } }); interactiveRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { interactiveCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5interactive().execute(); } else { showDialog("Please Check Internet connection"); } } }); imageViewSearch.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String searchKeyword = editTextSearchResults.getText().toString().trim(); if (searchKeyword.length() > 0) { Intent intentResResults = new Intent(getBaseContext(), SearchResults_resource.class); searchKeyword = editTextSearchResults.getText().toString().trim(); Log.i("Search :", searchKeyword); Bundle extras = new Bundle(); extras.putString("keyWord", searchKeyword); intentResResults.putExtras(extras); startActivity(intentResResults); finish(); } else { dialog1.setTitle("Please enter a Search keyword"); dialog1.show(); } } }); websiteRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { websiteCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5website().execute(); } else { showDialog("Please Check Internet connection"); } } }); textbookRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { textbookCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5textbook().execute(); } else { showDialog("Please Check Internet connection"); } } }); examRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { examCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5exam().execute(); } else { showDialog("Please Check Internet connection"); } } }); handoutRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { handoutCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5handout().execute(); } else { showDialog("Please Check Internet connection"); } } }); slideRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { slideCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5slide().execute(); } else { showDialog("Please Check Internet connection"); } } }); lessonRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { lessonCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5lesson().execute(); } else { showDialog("Please Check Internet connection"); } } }); editTextSearchResults.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: String searchKeyword = editTextSearchResults.getText().toString().trim(); if (searchKeyword.length() > 0) { Log.i("Resources", searchKeyword); Intent intentResResults = new Intent(getBaseContext(), SearchResults_resource.class); Bundle extras = new Bundle(); extras.putString("keyWord", searchKeyword); intentResResults.putExtras(extras); startActivity(intentResResults); finish(); } else { dialog1.setTitle("Please enter a Search keyword"); dialog1.show(); } return true; default: break; } } return false; } }); imageViewClose.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { finish(); } }); }
From source file:org.getlantern.firetweet.util.Utils.java
public static void openStatuses(final Activity activity, final List<ParcelableStatus> statuses) { if (activity == null || statuses == null) return;//from w w w . j ava 2 s. c o m final Bundle extras = new Bundle(); extras.putParcelableArrayList(EXTRA_STATUSES, new ArrayList<>(statuses)); final Uri.Builder builder = new Uri.Builder(); builder.scheme(SCHEME_FIRETWEET); builder.authority(AUTHORITY_STATUSES); final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build()); intent.putExtras(extras); activity.startActivity(intent); }
From source file:org.getlantern.firetweet.util.Utils.java
public static void openUsers(final Activity activity, final List<ParcelableUser> users) { if (activity == null || users == null) return;/*from www. j ava 2 s. c om*/ final Bundle extras = new Bundle(); extras.putParcelableArrayList(EXTRA_USERS, new ArrayList<>(users)); final Uri.Builder builder = new Uri.Builder(); builder.scheme(SCHEME_FIRETWEET); builder.authority(AUTHORITY_USERS); final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build()); intent.putExtras(extras); activity.startActivity(intent); }
From source file:com.df.app.procedures.CarRecogniseLayout.java
/** * ??//from w w w . j a v a 2 s. co m */ private void recogniseLicense() { // String selectPath = AppCommon.licensePhotoPath; boolean cutBoolean = cut; try { Intent intent = new Intent("wintone.idcard"); Bundle bundle = new Bundle(); int nSubID[] = null; bundle.putInt("nTypeInitIDCard", 0); //?0?? bundle.putString("lpFileName", selectPath);//? bundle.putInt("nTypeLoadImageToMemory", 0);//0???1??24 bundle.putInt("nMainID", nMainID); //?6?2????????ID????? bundle.putIntArray("nSubID", nSubID); //????ID????????nSubID[0]=nullnMainID? //sn File file = new File(AppCommon.licenseUtilPath); String snString = null; if (file.exists()) { String filePATH = AppCommon.licenseUtilPath + "/IdCard.sn"; File newFile = new File(filePATH); if (newFile.exists()) { BufferedReader bfReader = new BufferedReader(new FileReader(newFile)); snString = bfReader.readLine().toUpperCase(); bfReader.close(); } else { bundle.putString("sn", ""); } if (snString != null && !snString.equals("")) { bundle.putString("sn", snString); } else { bundle.putString("sn", ""); } } else { bundle.putString("sn", ""); } bundle.putString("authfile", ""); //? /mnt/sdcard/AndroidWT/357816040594713_zj.txt bundle.putString("logo", ""); //logologo?? bundle.putBoolean("isCut", cutBoolean); //?? bundle.putString("returntype", "withvalue");//?withvalue??? intent.putExtras(bundle); ((Activity) getContext()).startActivityForResult(intent, 8); } catch (Exception e) { Toast.makeText(getContext(), "?" + "wintone.idcard", Toast.LENGTH_SHORT).show(); } }
From source file:com.android.music.MediaPlaybackActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { badSymptoms.saveMenu("menu", item.toString()); Intent intent; try {/*w ww .j a va 2 s.co m*/ switch (item.getItemId()) { case GOTO_START: intent = new Intent(); intent.setClass(this, MusicBrowserActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); break; case USE_AS_RINGTONE: { // Set the system setting to make this the current ringtone if (mService != null) { MusicUtils.setRingtone(this, mService.getAudioId()); } return true; } case PARTY_SHUFFLE: MusicUtils.togglePartyShuffle(); setShuffleButtonImage(); break; case NEW_PLAYLIST: { intent = new Intent(); intent.setClass(this, CreatePlaylist.class); startActivityForResult(intent, NEW_PLAYLIST); return true; } case PLAYLIST_SELECTED: { long[] list = new long[1]; list[0] = MusicUtils.getCurrentAudioId(); long playlist = item.getIntent().getLongExtra("playlist", 0); MusicUtils.addToPlaylist(this, list, playlist); return true; } case DELETE_ITEM: { if (mService != null) { long[] list = new long[1]; list[0] = MusicUtils.getCurrentAudioId(); Bundle b = new Bundle(); String f; if (android.os.Environment.isExternalStorageRemovable()) { f = getString(R.string.delete_song_desc, mService.getTrackName()); } else { f = getString(R.string.delete_song_desc_nosdcard, mService.getTrackName()); } b.putString("description", f); b.putLongArray("items", list); intent = new Intent(); intent.setClass(this, DeleteItems.class); intent.putExtras(b); startActivityForResult(intent, -1); } return true; } case EFFECTS_PANEL: { Intent i = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL); i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, mService.getAudioSessionId()); startActivityForResult(i, EFFECTS_PANEL); return true; } } } catch (RemoteException ex) { } return super.onOptionsItemSelected(item); }
From source file:org.getlantern.firetweet.util.Utils.java
public static void openUserListDetails(final Activity activity, final ParcelableUserList userList) { if (activity == null || userList == null) return;/*w w w .j a v a2 s .c om*/ final long accountId = userList.account_id, userId = userList.user_id; final long listId = userList.id; final Bundle extras = new Bundle(); extras.putParcelable(EXTRA_USER_LIST, userList); final Uri.Builder builder = new Uri.Builder(); builder.scheme(SCHEME_FIRETWEET); builder.authority(AUTHORITY_USER_LIST); builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(accountId)); builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(userId)); builder.appendQueryParameter(QUERY_PARAM_LIST_ID, String.valueOf(listId)); final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build()); intent.setExtrasClassLoader(activity.getClassLoader()); intent.putExtras(extras); activity.startActivity(intent); }