List of usage examples for android.content Intent setClass
public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls)
From source file:com.lepin.activity.MyLoveCarActivity.java
/** * ?/*ww w . j a v a2 s .com*/ */ @Override public void onClick(View v) { if (v == mlTitleBack) { if (from_info.equals("from_perinfo")) { this.finish(); } else { if (isEidting && !isPublishAddCar) { isEidting = false; setEnable(isEidting); setVisible(isEidting); loadCarInfo(); } else { this.finish(); } } } else if (v == mlTitleEdit) { if (null != car.getState() && (car.getState().equals(Car.STATE_AUDITING) || car.getState().endsWith(Car.STATE_AUDITED))) { Util.showToast(MyLoveCarActivity.this, getResources().getString(R.string.car_verifying_tip)); } else { from_info = ""; isEidting = true; setEnable(isEidting); setVisible(isEidting); } } else if (v == mlPeoNum) { if (isEidting) { choicePeoPleNumber(); } } else if (v == mlDrivYear) { if (isEidting) { choiceDriveYear(); } } else if (v == mlSave) { boolean dataOk = checkData(); if (dataOk) { updateCarInfo(); } } else if (v == mlSafeLayout) { if (userCarIsExits()) { // ??TOAST?? // if (null != car.getState() // && (car.getState().equals(Car.STATE_AUDITING) || // car.getState().equals( // Car.STATE_AUDITED))) { // Util.getInstance().showToast(MyLoveCarActivity.this, // getResources().getString(R.string.car_verifying_tip)); // } else { // ?? Intent intent = new Intent(); intent.setClass(MyLoveCarActivity.this, CarDriverVerify.class); intent.putExtra("CarId", car.getCarId()); intent.putExtra("state", car.getState()); startActivityForResult(intent, 10); // } } else { Util.showToast(this, getString(R.string.my_car_not_add)); } } else if (v == mlLayout) { Intent intent = new Intent(); intent.setClass(MyLoveCarActivity.this, SelectCarBrandActivity.class); startActivityForResult(intent, 5); } }
From source file:com.hannesdorfmann.FeedAdapter.java
private void bindDribbbleShotView(final Shot shot, final DribbbleShotHolder holder, final int position) { final BadgedFourThreeImageView iv = (BadgedFourThreeImageView) holder.itemView; Glide.with(host).load(shot.images.best()).listener(new RequestListener<String, GlideDrawable>() { @Override/* w w w . j a va 2 s.c om*/ public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { if (!shot.hasFadedIn) { iv.setHasTransientState(true); final ObservableColorMatrix cm = new ObservableColorMatrix(); ObjectAnimator saturation = ObjectAnimator.ofFloat(cm, ObservableColorMatrix.SATURATION, 0f, 1f); saturation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { // just animating the color matrix does not invalidate the // drawable so need this update listener. Also have to create a // new CMCF as the matrix is immutable :( if (iv.getDrawable() != null) { iv.getDrawable().setColorFilter(new ColorMatrixColorFilter(cm)); } } }); saturation.setDuration(2000); saturation.setInterpolator( AnimationUtils.loadInterpolator(host, android.R.interpolator.fast_out_slow_in)); saturation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { iv.setHasTransientState(false); } }); saturation.start(); shot.hasFadedIn = true; } return false; } @Override public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { return false; } }).placeholder(shotLoadingPlaceholders[position % shotLoadingPlaceholders.length]) .diskCacheStrategy(DiskCacheStrategy.ALL).into(new DribbbleTarget(iv, false)); iv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { iv.setTransitionName(iv.getResources().getString(R.string.transition_shot)); iv.setBackgroundColor(ContextCompat.getColor(host, R.color.background_light)); Intent intent = new Intent(); intent.setClass(host, DribbbleShot.class); intent.putExtra(DribbbleShot.EXTRA_SHOT, shot); ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(host, Pair.create(view, host.getString(R.string.transition_shot)), Pair.create(view, host.getString(R.string.transition_shot_background))); host.startActivity(intent, options.toBundle()); } }); }
From source file:com.mgfypy.imagelibrary.ui.ImagesGridFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { //super.onActivityResult(requestCode, resultCode, data); if (requestCode == AndroidImagePicker.REQ_CAMERA && resultCode == Activity.RESULT_OK) { if (!TextUtils.isEmpty(androidImagePicker.getCurrentPhotoPath())) { AndroidImagePicker.galleryAddPic(mContext, androidImagePicker.getCurrentPhotoPath()); getActivity().finish();/* ww w . j av a 2s . c om*/ //androidImagePicker.notifyPictureTaken(); if (androidImagePicker.cropMode) {//?? Intent intent = new Intent(); intent.setClass(mContext, ImageCropActivity.class); intent.putExtra(AndroidImagePicker.KEY_PIC_PATH, androidImagePicker.getCurrentPhotoPath()); startActivityForResult(intent, AndroidImagePicker.REQ_CAMERA); } else { ImageItem item = new ImageItem(androidImagePicker.getCurrentPhotoPath(), "", -1); androidImagePicker.clearSelectedImages(); androidImagePicker.addSelectedImageItem(-1, item); androidImagePicker.notifyOnImagePickComplete(); } } else { Log.i(TAG, "didn't save to your path"); } } }
From source file:com.lykj.weixun.ui.chat.ui.ContactListFragment.java
@SuppressWarnings("unchecked") @Override//from w ww.j a va2s .c o m protected void setUpView() { //?? Map<String, EaseUser> m = DemoHelper.getInstance().getContactList(); if (m instanceof Hashtable<?, ?>) { m = (Map<String, EaseUser>) ((Hashtable<String, EaseUser>) m).clone(); } setContactsMap(m); super.setUpView(); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { EaseUser user = (EaseUser) listView.getItemAtPosition(position); if (user != null) { String username = user.getUsername(); ComantUtils.ACTION_CONTACT_INDEXT = 1; // demo?? Intent intent = new Intent(); intent.putExtra("userId", username); intent.putExtra("title", "newPager"); intent.setClass(getActivity(), UserDetailsActivity.class); startActivity(intent); // startActivity(new Intent(getActivity(), ChatActivity.class).putExtra("userId", username)); } } }); contactSyncListener = new ContactSyncListener(); DemoHelper.getInstance().addSyncContactListener(contactSyncListener); blackListSyncListener = new BlackListSyncListener(); DemoHelper.getInstance().addSyncBlackListListener(blackListSyncListener); contactInfoSyncListener = new ContactInfoSyncListener(); DemoHelper.getInstance().getUserProfileManager().addSyncContactInfoListener(contactInfoSyncListener); if (DemoHelper.getInstance().isContactsSyncedWithServer()) { loadingView.setVisibility(View.GONE); } else if (DemoHelper.getInstance().isSyncingContactsWithServer()) { loadingView.setVisibility(View.VISIBLE); } }
From source file:com.mumu.joshautomation.HeadService.java
private void configSettings(boolean isLongPress) { if (isLongPress) { String filename = mDumpFilePath + mDumpCount; try {/*from w ww. j a va 2 s. c om*/ mGL.getCaptureService().dumpScreen(filename); } catch (InterruptedException e) { e.printStackTrace(); } mMessageText = "Dump count = " + mDumpCount; mDumpCount++; } else { mMessageText = ""; Intent intent = new Intent(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setClass(HeadService.this, AppPreferenceActivity.class); startActivity(intent); } }
From source file:com.lykj.weixun.ui.chat.ui.ContactListFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); /**/*from w w w . j a v a 2s. c o m*/ * ???? */ if (requestCode == ConversationListFragment.REQUEST_CODE) { //???? if (null != data) { Bundle bundle = data.getExtras(); if (bundle != null) { String result = bundle.getString("result"); if (result.contains("sid")) { PCLoginDialog login = new PCLoginDialog(getContext(), result.replace("sid=", "")); login.show(); } else { if (isInteger(result)) { Intent intent = new Intent(); intent.putExtra("userId", result); intent.putExtra("title", "Conversation"); intent.setClass(getActivity(), UserDetailsActivity.class); startActivity(intent); } } } } } }
From source file:com.mindprotectionkit.freephone.RedPhoneService.java
private void startCallCardActivity() { Intent activityIntent = new Intent(); activityIntent.setClass(this, RedPhone.class); activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(activityIntent);/* ww w . ja va 2s .c om*/ }
From source file:com.miz.mizuu.fragments.TvShowLibraryFragment.java
private void viewTvShowDetails(int position, View view) { Intent intent = new Intent(); intent.putExtra("showId", mAdapter.getItem(position).getId()); intent.setClass(mContext, TvShowDetails.class); if (view != null) { Pair<View, String> pair = new Pair<>(view.findViewById(R.id.cover), "cover"); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), pair); ActivityCompat.startActivityForResult(getActivity(), intent, 0, options.toBundle()); } else {/* w w w. j av a 2 s .c om*/ startActivityForResult(intent, 0); } }
From source file:com.HumanDecisionSupportSystemsLaboratory.DD_P2P.SafeProfileFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.safe_profile, container); // retrieve text and image from main activity imgbut = (ImageView) v.findViewById(R.id.profImg); // profile img whoText = (TextView) v.findViewById(R.id.profName); // profile name email = (TextView) v.findViewById(R.id.safe_profile_email); slogan = (TextView) v.findViewById(R.id.safe_profile_slogan); device = (TextView) v.findViewById(R.id.safe_profile_device); Intent i = getActivity().getIntent(); Bundle b = i.getExtras();//from www. j a v a 2s .c o m whoStr = b.getString("who"); safe_gidh = b.getString(Safe.P_SAFE_GIDH); safe_lid = b.getString(Safe.P_SAFE_LID); // safe_id = b.getInt(Safe.P_SAFE_ID) + 1; whoText.setText(whoStr); peer = D_Peer.getPeerByLID(safe_lid, true, false); boolean gotIcon = false; try { byte[] icon = peer.getIcon(); if (icon != null) { Bitmap bmp = BitmapFactory.decodeByteArray(icon, 0, icon.length - 1); imgbut.setImageBitmap(bmp); gotIcon = true; } } catch (Exception e) { e.printStackTrace(); } if (!gotIcon) { int imgPath = Integer.parseInt(b.getString("profImg")); Bitmap bmp = BitmapFactory.decodeResource(getResources(), imgPath); imgbut.setImageBitmap(bmp); } imgbut.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { byte[] icon = peer.getIcon(); if (icon != null) { ImageFragment fragment = ImageFragment.newInstance(icon); FragmentManager fm = getActivity().getSupportFragmentManager(); fragment.show(fm, "icon"); } if (icon == null) { int imgPath = R.drawable.placeholder; Bitmap bmp = BitmapFactory.decodeResource(getResources(), imgPath); icon = PhotoUtil.BitmapToByteArray(bmp, 100); ImageFragment fragment = ImageFragment.newInstance(icon); FragmentManager fm = getActivity().getSupportFragmentManager(); fragment.show(fm, "icon"); } } }); email.setText(peer.getEmail()); slogan.setText(peer.getSlogan()); String instances = null; String contacts_Date = null; String sync_Date = null; for (String _inst : peer._instances.keySet()) { String contact = Encoder.getGeneralizedTime(peer._instances.get(_inst).get_last_contact_date()); String sync = peer._instances.get(_inst).get_last_sync_date_str(); if (contact == null) contact = Util.__("NEVER"); if (sync == null) sync = Util.__("NEVER"); if (instances == null) { instances = _inst; contacts_Date = contact; sync_Date = sync; } else { instances += ", " + _inst; contacts_Date += ", " + contact; sync_Date += ", " + sync; } } device.setText(Util.getStringNonNullUnique(peer.getInstance()) + " / {" + instances + "}"); if (peer.getSK() != null) { ipAddress = (TextView) v.findViewById(R.id.safe_profile_ip); ipAddress.setText("Known Secret Key"); setProfilePhoto = (Button) v.findViewById(R.id.safe_profile_set_profile_photo); setProfilePhoto.setVisibility(View.VISIBLE); setProfilePhoto.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (Build.VERSION.SDK_INT < 19) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(intent, SELECT_PROFILE_PHOTO); } else { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.setType("image/*"); startActivityForResult(intent, SELECT_PPROFILE_PHOTO_KITKAT); } } }); } else { lastContact = (TextView) v.findViewById(R.id.safe_profile_last_contact); lastContact.setText(contacts_Date);//peer.getLastSyncDate(safe_lid)); ipAddress = (TextView) v.findViewById(R.id.safe_profile_ip); ipAddress.setText(sync_Date); /* * hideThisSafe = (Switch) * v.findViewById(R.id.switch_hide_this_safe); * hideThisSafe.setVisibility(View.VISIBLE); * * if (peer.getHidden() == false) hideThisSafe.setChecked(false); * else hideThisSafe.setChecked(true); * * hideThisSafe .setOnCheckedChangeListener(new * OnCheckedChangeListener() { * * @Override public void onCheckedChanged(CompoundButton buttonView, * boolean isChecked) { if (isChecked) { D_Peer.setHidden(peer, * true); peer.storeRequest(); peer.releaseReference(); } else { * D_Peer.setHidden(peer, false); peer.storeRequest(); * peer.releaseReference(); } * * } }); * * resetLastSyncDate = (Button) v * .findViewById(R.id.button_reset_LastSyncDate); * resetLastSyncDate.setVisibility(View.VISIBLE); * resetLastSyncDate.setOnClickListener(new OnClickListener() { * * @Override public void onClick(View v) { peer = * D_Peer.getPeerByPeer_Keep(peer); peer.setLastSyncDate(null); * peer.storeRequest(); peer.releaseReference(); * * for (D_PeerInstance i : peer._instances.values()) { Calendar date * = i.get_last_sync_date(); Log.i("last_sync_date", * "last sync date: " + date); } } }); */ sendMsg = (Button) v.findViewById(R.id.button_send_msg); sendMsg.setVisibility(View.VISIBLE); sendMsg.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent myIntent = new Intent(); myIntent.setClass(getActivity(), Chat.class); // pass data to chat myIntent.putExtra("who", whoStr); // myIntent.putExtra(Safe.P_SAFE_ID, safe_id); myIntent.putExtra(Safe.P_SAFE_LID, safe_lid); myIntent.putExtra(Safe.P_SAFE_GIDH, safe_gidh); myIntent.putExtra("profImg", String.valueOf(R.drawable.placeholder)); startActivity(myIntent); } }); /* * // set up switch access accessIt = (Switch) * v.findViewById(R.id.switch_access); * accessIt.setVisibility(View.VISIBLE); if (peer.getUsed() == true) * accessIt.setChecked(true); if (peer.getUsed() == false) * accessIt.setChecked(false); * * accessIt.setOnCheckedChangeListener(new OnCheckedChangeListener() * { * * @Override public void onCheckedChanged(CompoundButton buttonView, * boolean isChecked) { if (isChecked) { D_Peer.setUsed(peer, true); * } else { D_Peer.setUsed(peer, false); } } }); * * // set up switch block blockIt = (Switch) * v.findViewById(R.id.switch_block); * blockIt.setVisibility(View.VISIBLE); if (peer.getBlocked() == * true) blockIt.setChecked(true); if (peer.getBlocked() == false) * blockIt.setChecked(false); * * blockIt.setOnCheckedChangeListener(new OnCheckedChangeListener() * { * * @Override public void onCheckedChanged(CompoundButton buttonView, * boolean isChecked) { if (isChecked) { D_Peer.setBlocked(peer, * true); } else { D_Peer.setBlocked(peer, false); } } }); * * // set up switch serve serveIt = (Switch) * v.findViewById(R.id.switch_serve); * serveIt.setVisibility(View.VISIBLE); * * if (peer.getUsed() == true) serveIt.setChecked(true); if * (peer.getUsed() == false) serveIt.setChecked(false); * * serveIt.setOnCheckedChangeListener(new OnCheckedChangeListener() * { * * @Override public void onCheckedChanged(CompoundButton buttonView, * boolean isChecked) { if (isChecked) { D_Peer.setUsed(peer, true); * peer.storeRequest(); peer.releaseReference(); } else { * D_Peer.setUsed(peer, false); peer.storeRequest(); * peer.releaseReference(); } } }); */ } return super.onCreateView(inflater, container, savedInstanceState); }
From source file:com.hannesdorfmann.FeedAdapter.java
private void bindDesignerNewsStory(final Story story, final DesignerNewsStoryHolder holder) { holder.title.setText(story.title);// w w w. j a va 2 s . c om holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { CustomTabActivityHelper.openCustomTab(host, DesignerNewsStory.getCustomTabIntent(host, story, null).build(), Uri.parse(story.url)); } }); holder.comments.setText(String.valueOf(story.comment_count)); holder.comments.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View commentsView) { final Intent intent = new Intent(); intent.setClass(host, DesignerNewsStory.class); intent.putExtra(DesignerNewsStory.EXTRA_STORY, story); final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(host, Pair.create(holder.itemView, host.getString(R.string.transition_story_title_background)), Pair.create(holder.itemView, host.getString(R.string.transition_story_background))); host.startActivity(intent, options.toBundle()); } }); if (pocketIsInstalled) { holder.pocket.setImageAlpha(178); // grumble... no xml setter, grumble... holder.pocket.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { final ImageButton pocketButton = (ImageButton) view; // actually add to pocket PocketUtils.addToPocket(host, story.url); // setup for anim holder.itemView.setHasTransientState(true); ((ViewGroup) pocketButton.getParent().getParent()).setClipChildren(false); final int initialLeft = pocketButton.getLeft(); final int initialTop = pocketButton.getTop(); final int translatedLeft = (holder.itemView.getWidth() - pocketButton.getWidth()) / 2; final int translatedTop = initialTop - ((holder.itemView.getHeight() - pocketButton.getHeight()) / 2); final ArcMotion arc = new ArcMotion(); // animate the title & pocket icon up, scale the pocket icon up PropertyValuesHolder pvhTitleUp = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, -(holder.itemView.getHeight() / 5)); PropertyValuesHolder pvhTitleFade = PropertyValuesHolder.ofFloat(View.ALPHA, 0.54f); Animator titleMoveFadeOut = ObjectAnimator.ofPropertyValuesHolder(holder.title, pvhTitleUp, pvhTitleFade); Animator pocketMoveUp = ObjectAnimator.ofFloat(pocketButton, View.TRANSLATION_X, View.TRANSLATION_Y, arc.getPath(initialLeft, initialTop, translatedLeft, translatedTop)); PropertyValuesHolder pvhPocketScaleUpX = PropertyValuesHolder.ofFloat(View.SCALE_X, 3f); PropertyValuesHolder pvhPocketScaleUpY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 3f); Animator pocketScaleUp = ObjectAnimator.ofPropertyValuesHolder(pocketButton, pvhPocketScaleUpX, pvhPocketScaleUpY); ObjectAnimator pocketFadeUp = ObjectAnimator.ofInt(pocketButton, ViewUtils.IMAGE_ALPHA, 255); AnimatorSet up = new AnimatorSet(); up.playTogether(titleMoveFadeOut, pocketMoveUp, pocketScaleUp, pocketFadeUp); up.setDuration(300); up.setInterpolator( AnimationUtils.loadInterpolator(host, android.R.interpolator.fast_out_slow_in)); // animate everything back into place PropertyValuesHolder pvhTitleMoveUp = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, 0f); PropertyValuesHolder pvhTitleFadeUp = PropertyValuesHolder.ofFloat(View.ALPHA, 1f); Animator titleMoveFadeIn = ObjectAnimator.ofPropertyValuesHolder(holder.title, pvhTitleMoveUp, pvhTitleFadeUp); Animator pocketMoveDown = ObjectAnimator.ofFloat(pocketButton, View.TRANSLATION_X, View.TRANSLATION_Y, arc.getPath(translatedLeft, translatedTop, 0, 0)); PropertyValuesHolder pvhPocketScaleDownX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1f); PropertyValuesHolder pvhPocketScaleDownY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f); Animator pvhPocketScaleDown = ObjectAnimator.ofPropertyValuesHolder(pocketButton, pvhPocketScaleDownX, pvhPocketScaleDownY); ObjectAnimator pocketFadeDown = ObjectAnimator.ofInt(pocketButton, ViewUtils.IMAGE_ALPHA, 138); AnimatorSet down = new AnimatorSet(); down.playTogether(titleMoveFadeIn, pocketMoveDown, pvhPocketScaleDown, pocketFadeDown); down.setDuration(300); down.setInterpolator( AnimationUtils.loadInterpolator(host, android.R.interpolator.fast_out_slow_in)); down.setStartDelay(500); // play it AnimatorSet upDown = new AnimatorSet(); upDown.playSequentially(up, down); // clean up upDown.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { ((ViewGroup) pocketButton.getParent().getParent()).setClipChildren(true); holder.itemView.setHasTransientState(false); } }); upDown.start(); } }); } }