List of usage examples for android.text.method LinkMovementMethod getInstance
public static MovementMethod getInstance()
From source file:truesculpt.ui.panels.WebFilePanel.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getManagers().getUtilsManager().updateFullscreenWindowStatus(getWindow()); setContentView(R.layout.webfile);/*from w w w . j av a2 s . c o m*/ getManagers().getUsageStatisticsManager().TrackEvent("OpenFromWeb", "", 1); mWebView = (WebView) findViewById(R.id.webview); mWebView.setWebViewClient(new MyWebViewClient()); WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); mWebView.addJavascriptInterface(new JavaScriptInterface(this, getManagers()), "Android"); int nVersionCode = getManagers().getUpdateManager().getCurrentVersionCode(); mWebView.loadUrl(mStrBaseWebSite + "?version=" + nVersionCode); mPublishToWebBtn = (Button) findViewById(R.id.publish_to_web); mPublishToWebBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String name = getManagers().getMeshManager().getName(); final File imagefile = new File(getManagers().getFileManager().GetImageFileName()); final File objectfile = new File(getManagers().getFileManager().GetObjectFileName()); getManagers().getUsageStatisticsManager().TrackEvent("PublishToWeb", name, 1); if (imagefile.exists() && objectfile.exists()) { try { final File zippedObject = File.createTempFile("object", "zip"); zippedObject.deleteOnExit(); BufferedReader in = new BufferedReader(new FileReader(objectfile)); BufferedOutputStream out = new BufferedOutputStream( new GZIPOutputStream(new FileOutputStream(zippedObject))); System.out.println("Compressing file"); int c; while ((c = in.read()) != -1) { out.write(c); } in.close(); out.close(); long size = 0; size = new FileInputStream(imagefile).getChannel().size(); size += new FileInputStream(zippedObject).getChannel().size(); size /= 1000; final SpannableString msg = new SpannableString( "You will upload your latest saved version of this scupture representing " + size + " ko of data\n\n" + "When clicking the yes button you accept to publish your sculpture under the terms of the creative commons share alike, non commercial license\n" + "http://creativecommons.org/licenses/by-nc-sa/3.0" + "\n\nDo you want to proceed ?"); Linkify.addLinks(msg, Linkify.ALL); AlertDialog.Builder builder = new AlertDialog.Builder(WebFilePanel.this); builder.setMessage(msg).setCancelable(false) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { PublishPicture(imagefile, zippedObject, name); } }).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { } }); AlertDialog dlg = builder.create(); dlg.show(); // Make the textview clickable. Must be called after // show() ((TextView) dlg.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); } catch (Exception e) { e.printStackTrace(); } } else { AlertDialog.Builder builder = new AlertDialog.Builder(WebFilePanel.this); builder.setMessage( "File has not been saved, you need to save it before publishing\nDo you want to proceed to save window ?") .setCancelable(false) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { ((FileSelectorPanel) getParent()).getTabHost().setCurrentTab(2); } }).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { } }); builder.show(); } } }); }
From source file:com.github.michalbednarski.intentslab.providerlab.ProviderInfoFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.activity_provider_info, container, false); mPackageName = getArguments().getString(ComponentInfoFragment.ARG_PACKAGE_NAME); mComponentName = getArguments().getString(ComponentInfoFragment.ARG_COMPONENT_NAME); // Fill mProviderInfo try {/*from www.j a v a2s . c o m*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { fillProviderInfo(); } else { fillProviderInfoLegacy(); } } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); Toast.makeText(getActivity(), R.string.component_not_found, Toast.LENGTH_SHORT).show(); //finish(); return null; } PackageManager packageManager = getActivity().getPackageManager(); // Header icon and text ((TextView) view.findViewById(R.id.title)).setText(mProviderInfo.loadLabel(packageManager)); ((TextView) view.findViewById(R.id.component)) .setText(new ComponentName(mPackageName, mComponentName).flattenToShortString()); ((ImageView) view.findViewById(R.id.icon)).setImageDrawable(mProviderInfo.loadIcon(packageManager)); // Start building description FormattedTextBuilder text = new FormattedTextBuilder(); // Authority if (mProviderInfo.authority != null) { text.appendValue("Authority", mProviderInfo.authority); } // Permission/exported if (!mProviderInfo.exported) { text.appendHeader(getString(R.string.component_not_exported)); } else { if (mProviderInfo.readPermission == null) { if (mProviderInfo.writePermission == null) { text.appendHeader(getString(R.string.provider_rw_world_accessible)); } else { text.appendValue(getString(R.string.provider_w_only_permission), mProviderInfo.writePermission, true, FormattedTextBuilder.ValueSemantic.PERMISSION); } } else if (mProviderInfo.readPermission.equals(mProviderInfo.writePermission)) { text.appendValue(getString(R.string.provider_rw_permission), mProviderInfo.readPermission, true, FormattedTextBuilder.ValueSemantic.PERMISSION); } else { text.appendValue(getString(R.string.provider_r_permission), mProviderInfo.readPermission, true, FormattedTextBuilder.ValueSemantic.PERMISSION); if (mProviderInfo.writePermission == null) { text.appendValuelessKeyContinuingGroup( getResources().getText(R.string.provider_no_w_permission)); } else { text.appendValue(getString(R.string.provider_w_permission), mProviderInfo.writePermission, false, FormattedTextBuilder.ValueSemantic.PERMISSION); } } } // Permission granting if (mProviderInfo.grantUriPermissions) { if (mProviderInfo.uriPermissionPatterns != null) { PatternMatcher[] uriPermissionPatterns = mProviderInfo.uriPermissionPatterns; String[] listItems = new String[uriPermissionPatterns.length]; for (int i = 0; i < uriPermissionPatterns.length; i++) { PatternMatcher pattern = uriPermissionPatterns[i]; listItems[i] = pattern.getPath() + (pattern.getType() == PatternMatcher.PATTERN_PREFIX ? "*" : ""); } text.appendList(getString(R.string.provider_grant_uri_permission_for), listItems); } else { text.appendHeader(getString(R.string.provider_grant_uri_permission_for_all_paths)); } } // <meta-data> text.appendFormattedText( ComponentInfoFragment.dumpMetaData(getActivity(), mPackageName, mProviderInfo.metaData)); // Put description in TextView TextView textView = (TextView) view.findViewById(R.id.description); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setText(text.getText()); // Set button action view.findViewById(R.id.go_to_provider_lab).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { goToProviderLab(); } }); // Return view return view; }
From source file:com.prof.rssparser.example.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { android.support.v7.app.AlertDialog alertDialog = new android.support.v7.app.AlertDialog.Builder( MainActivity.this).create(); alertDialog.setTitle(R.string.app_name); alertDialog.setMessage(Html.fromHtml(MainActivity.this.getString(R.string.info_text) + " <a href='http://github.com/prof18/RSS-Parser'>GitHub.</a>" + MainActivity.this.getString(R.string.author))); alertDialog.setButton(android.support.v7.app.AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); }// w ww . j av a 2 s .c o m }); alertDialog.show(); ((TextView) alertDialog.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); } return super.onOptionsItemSelected(item); }
From source file:org.creativecommons.thelist.activities.StartActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_start); mContext = this; mSharedPref = new SharedPreferencesMethods(mContext); mCurrentUser = new ListUser(StartActivity.this); am = AccountManager.get(getBaseContext()); //Google Analytics Tracker ((ListApplication) getApplication()).getTracker(ListApplication.TrackerName.GLOBAL_TRACKER); //Create App SharedPreferences SharedPreferences sharedPref = mContext.getSharedPreferences(SharedPreferencesMethods.APP_PREFERENCES_KEY, Context.MODE_PRIVATE); //TODO: add google analytics opt-in //Display Google Analytics Message if (!(mSharedPref.getGaMessageViewed())) { //The beta version of this app uses google analytics message MessageHelper mh = new MessageHelper(mContext); mh.showDialog(mContext, "The List Beta Uses Google Analytics", "Hey just a heads up that " + "were using Google Analytics to help us learn how to make the app better. " + "We dont collect personal info!"); mSharedPref.setMessageViewed();//from w ww .ja v a2 s. c o m } //UI Elements mFrameLayout = (FrameLayout) findViewById(R.id.fragment_container); mStartButton = (Button) findViewById(R.id.startButton); mAccountButton = (Button) findViewById(R.id.accountButton); mTermsLink = (TextView) findViewById(R.id.cc_logo_label); //Im new to the list? mStartButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Load explainerFragment getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, explainerFragment) .commit(); mFrameLayout.setClickable(true); } }); //StartButton ClickListener //I already have an account? mAccountButton.setOnClickListener(new View.OnClickListener() { //If you have accounts > show picker; if not, show login @Override public void onClick(View v) { Account availableAccounts[] = am.getAccountsByType(AccountGeneral.ACCOUNT_TYPE); //TODO: switch getAuthed: login to first account if there if only one, if there is more than more go to accountPicker if (availableAccounts.length > 1) { mCurrentUser.showAccountPicker(new ListUser.AuthCallback() { @Override public void onSuccess(String authtoken) { Log.d(TAG, "I have an account > Got an authtoken"); //TODO: is this actually needed? Intent intent = new Intent(StartActivity.this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); } }); } else { mCurrentUser.getAuthed(new ListUser.AuthCallback() { @Override public void onSuccess(String authtoken) { Log.d(TAG, "I have an account + I re-authenticated > Got an authtoken"); //TODO: is this actually needed? Intent intent = new Intent(StartActivity.this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); } }); } } }); //accountButton //Enable links if (mTermsLink != null) { mTermsLink.setMovementMethod(LinkMovementMethod.getInstance()); } }
From source file:com.gh4a.IssueActivity.java
private void fillData() { new LoadCommentsTask(this).execute(); Typeface boldCondensed = getApplicationContext().boldCondensed; ListView lvComments = (ListView) findViewById(R.id.list_view); // set details inside listview header LayoutInflater infalter = getLayoutInflater(); LinearLayout mHeader = (LinearLayout) infalter.inflate(R.layout.issue_header, lvComments, false); mHeader.setClickable(false);/*from ww w. j av a 2 s . c o m*/ lvComments.addHeaderView(mHeader, null, false); RelativeLayout rlComment = (RelativeLayout) findViewById(R.id.rl_comment); if (!isAuthorized()) { rlComment.setVisibility(View.GONE); } TextView tvCommentTitle = (TextView) mHeader.findViewById(R.id.comment_title); mCommentAdapter = new CommentAdapter(IssueActivity.this, new ArrayList<Comment>(), mIssue.getNumber(), mIssue.getState(), mRepoOwner, mRepoName); lvComments.setAdapter(mCommentAdapter); ImageView ivGravatar = (ImageView) mHeader.findViewById(R.id.iv_gravatar); aq.id(R.id.iv_gravatar).image(GravatarUtils.getGravatarUrl(mIssue.getUser().getGravatarId()), true, false, 0, 0, aq.getCachedImage(R.drawable.default_avatar), AQuery.FADE_IN); ivGravatar.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { getApplicationContext().openUserInfoActivity(IssueActivity.this, mIssue.getUser().getLogin(), null); } }); TextView tvExtra = (TextView) mHeader.findViewById(R.id.tv_extra); TextView tvState = (TextView) mHeader.findViewById(R.id.tv_state); TextView tvTitle = (TextView) mHeader.findViewById(R.id.tv_title); TextView tvDescTitle = (TextView) mHeader.findViewById(R.id.desc_title); tvDescTitle.setTypeface(getApplicationContext().boldCondensed); tvDescTitle.setTextColor(Color.parseColor("#0099cc")); tvCommentTitle.setTypeface(getApplicationContext().boldCondensed); tvCommentTitle.setTextColor(Color.parseColor("#0099cc")); tvCommentTitle .setText(getResources().getString(R.string.issue_comments) + " (" + mIssue.getComments() + ")"); TextView tvDesc = (TextView) mHeader.findViewById(R.id.tv_desc); tvDesc.setMovementMethod(LinkMovementMethod.getInstance()); TextView tvMilestone = (TextView) mHeader.findViewById(R.id.tv_milestone); ImageView ivComment = (ImageView) findViewById(R.id.iv_comment); if (Gh4Application.THEME == R.style.DefaultTheme) { ivComment.setImageResource(R.drawable.social_send_now_dark); } ivComment.setBackgroundResource(R.drawable.abs__list_selector_holo_dark); ivComment.setPadding(5, 2, 5, 2); ivComment.setOnClickListener(this); tvExtra.setText(mIssue.getUser().getLogin() + "\n" + pt.format(mIssue.getCreatedAt())); tvState.setTextColor(Color.WHITE); if ("closed".equals(mIssue.getState())) { tvState.setBackgroundResource(R.drawable.default_red_box); tvState.setText("C\nL\nO\nS\nE\nD"); } else { tvState.setBackgroundResource(R.drawable.default_green_box); tvState.setText("O\nP\nE\nN"); } tvTitle.setText(mIssue.getTitle()); tvTitle.setTypeface(boldCondensed); boolean showInfoBox = false; if (mIssue.getAssignee() != null) { showInfoBox = true; TextView tvAssignee = (TextView) mHeader.findViewById(R.id.tv_assignee); tvAssignee.setText(mIssue.getAssignee().getLogin() + " is assigned"); tvAssignee.setVisibility(View.VISIBLE); tvAssignee.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { getApplicationContext().openUserInfoActivity(IssueActivity.this, mIssue.getAssignee().getLogin(), null); } }); ImageView ivAssignee = (ImageView) mHeader.findViewById(R.id.iv_assignee); aq.id(R.id.iv_assignee).image(GravatarUtils.getGravatarUrl(mIssue.getAssignee().getGravatarId()), true, false, 0, 0, aq.getCachedImage(R.drawable.default_avatar), AQuery.FADE_IN); ivAssignee.setVisibility(View.VISIBLE); ivAssignee.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { getApplicationContext().openUserInfoActivity(IssueActivity.this, mIssue.getAssignee().getLogin(), null); } }); } if (mIssue.getMilestone() != null) { showInfoBox = true; tvMilestone.setText( getResources().getString(R.string.issue_milestone) + ": " + mIssue.getMilestone().getTitle()); } else { tvMilestone.setVisibility(View.GONE); } String body = mIssue.getBodyHtml(); if (!StringUtils.isBlank(body)) { HttpImageGetter imageGetter = new HttpImageGetter(this); body = HtmlUtils.format(body).toString(); imageGetter.bind(tvDesc, body, mIssue.getNumber()); } LinearLayout llLabels = (LinearLayout) findViewById(R.id.ll_labels); List<Label> labels = mIssue.getLabels(); if (labels != null && !labels.isEmpty()) { showInfoBox = true; for (Label label : labels) { TextView tvLabel = new TextView(this); tvLabel.setSingleLine(true); tvLabel.setText(label.getName()); tvLabel.setTextAppearance(this, R.style.default_text_small); tvLabel.setBackgroundColor(Color.parseColor("#" + label.getColor())); tvLabel.setPadding(5, 2, 5, 2); int r = Color.red(Color.parseColor("#" + label.getColor())); int g = Color.green(Color.parseColor("#" + label.getColor())); int b = Color.blue(Color.parseColor("#" + label.getColor())); if (r + g + b < 383) { tvLabel.setTextColor(getResources().getColor(android.R.color.primary_text_dark)); } else { tvLabel.setTextColor(getResources().getColor(android.R.color.primary_text_light)); } llLabels.addView(tvLabel); View v = new View(this); v.setLayoutParams(new LayoutParams(5, LayoutParams.WRAP_CONTENT)); llLabels.addView(v); } } else { llLabels.setVisibility(View.GONE); } TextView tvPull = (TextView) mHeader.findViewById(R.id.tv_pull); if (mIssue.getPullRequest() != null && mIssue.getPullRequest().getDiffUrl() != null) { showInfoBox = true; tvPull.setVisibility(View.VISIBLE); tvPull.setOnClickListener(this); } if (!showInfoBox) { RelativeLayout rl = (RelativeLayout) mHeader.findViewById(R.id.info_box); rl.setVisibility(View.GONE); } }
From source file:com.blueoxfords.peacecorpstinder.activities.MainActivity.java
public void getLegalInfo(View v) { String photoId = v.getTag() + ""; ImageRestClient.get().getInfoFromImageId(photoId, new Callback<ImageService.ImageInfoWrapper>() { @Override/*from w ww .j a v a 2s.c o m*/ public void success(ImageService.ImageInfoWrapper imageInfoWrapper, Response response) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.activity); ScrollView wrapper = new ScrollView(MainActivity.activity); LinearLayout infoLayout = new LinearLayout(MainActivity.activity); infoLayout.setOrientation(LinearLayout.VERTICAL); infoLayout.setPadding(35, 35, 35, 35); TextView imageOwner = new TextView(MainActivity.activity); imageOwner.setText(Html.fromHtml("<b>Image By: </b>" + imageInfoWrapper.photo.owner.username)); if (imageInfoWrapper.photo.owner.realname.length() > 0) { imageOwner.setText(imageOwner.getText() + " (" + imageInfoWrapper.photo.owner.realname + ")"); } infoLayout.addView(imageOwner); if (getLicenseUrl(Integer.parseInt(imageInfoWrapper.photo.license)).length() > 0) { TextView licenseLink = new TextView(MainActivity.activity); licenseLink.setText(Html .fromHtml("<a href=\"" + getLicenseUrl(Integer.parseInt(imageInfoWrapper.photo.license)) + "\"><b>Licensing</b></a>")); licenseLink.setMovementMethod(LinkMovementMethod.getInstance()); infoLayout.addView(licenseLink); } if (imageInfoWrapper.photo.urls.url.size() > 0) { TextView imageLink = new TextView(MainActivity.activity); imageLink.setText(Html.fromHtml("<a href=\"" + imageInfoWrapper.photo.urls.url.get(0)._content + "\"><b>Image Link</b></a>")); imageLink.setMovementMethod(LinkMovementMethod.getInstance()); infoLayout.addView(imageLink); } if (imageInfoWrapper.photo.title._content.length() > 0) { TextView photoTitle = new TextView(MainActivity.activity); photoTitle .setText(Html.fromHtml("<b>Image Title: </b>" + imageInfoWrapper.photo.title._content)); infoLayout.addView(photoTitle); } if (imageInfoWrapper.photo.description._content.length() > 0) { TextView description = new TextView(MainActivity.activity); description.setText(Html .fromHtml("<b>Image Description: </b>" + imageInfoWrapper.photo.description._content)); infoLayout.addView(description); } TextView contact = new TextView(MainActivity.activity); contact.setText( Html.fromHtml("<br><i>To remove this photo, please email pcorpsconnect@gmail.com</i>")); infoLayout.addView(contact); wrapper.addView(infoLayout); builder.setTitle("Photo Information"); builder.setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); builder.setView(wrapper); builder.create().show(); } @Override public void failure(RetrofitError error) { Log.i("testing", "could not retrieve legal/attribution info"); } }); }
From source file:com.concentricsky.android.khanacademy.app.HomeActivity.java
private void showTOSAcknowledgement() { View contentView = LayoutInflater.from(this).inflate(R.layout.dialog_tos, null, false); // Use this LinkMovementMethod (as opposed to just the xml setting android:autoLink="web") to allow for named links. TextView mustAccept = (TextView) contentView.findViewById(R.id.dialog_tos_must_accept); TextView notEndorsed = (TextView) contentView.findViewById(R.id.dialog_tos_not_endorsed); mustAccept.setMovementMethod(LinkMovementMethod.getInstance()); notEndorsed.setMovementMethod(LinkMovementMethod.getInstance()); new AlertDialog.Builder(this).setCancelable(false).setView(contentView) .setPositiveButton(getString(R.string.button_i_accept), new DialogInterface.OnClickListener() { @Override//from w ww .ja v a 2 s . co m public void onClick(DialogInterface dialog, int which) { // Store the fact that the user has accepted. getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE).edit() .putBoolean(Constants.SETTING_ACKNOWLEDGEMENT, true).apply(); } }).setNegativeButton(getString(R.string.button_quit), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }).show(); }
From source file:de.bahnhoefe.deutschlands.bahnhofsfotos.DetailsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_details); baseApplication = (BaseApplication) getApplication(); rsapi = baseApplication.getRSAPI();//from w w w . ja v a2 s . c o m BahnhofsDbAdapter dbAdapter = baseApplication.getDbAdapter(); countryCode = baseApplication.getCountryCode(); country = dbAdapter.fetchCountryByCountryCode(countryCode); getSupportActionBar().setDisplayHomeAsUpEnabled(true); detailsLayout = findViewById(R.id.content_details); header = findViewById(R.id.header); tvBahnhofName = findViewById(R.id.tvbahnhofname); coordinates = findViewById(R.id.coordinates); imageView = findViewById(R.id.imageview); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onPictureClicked(); } }); takePictureButton = findViewById(R.id.button_take_picture); takePictureButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { takePictureWithPermissionCheck(); } }); selectPictureButton = findViewById(R.id.button_select_picture); selectPictureButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { selectPictureWithPermissionCheck(); } }); reportGhostStationButton = findViewById(R.id.button_remove_station); reportGhostStationButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { reportGhostStationWithPermissionCheck(); } }); licenseTagView = findViewById(R.id.license_tag); licenseTagView.setMovementMethod(LinkMovementMethod.getInstance()); // switch off image and license view until we actually have a foto imageView.setVisibility(View.INVISIBLE); licenseTagView.setVisibility(View.INVISIBLE); setPictureButtonsVisibility(View.INVISIBLE); fullscreen = false; readPreferences(); Intent intent = getIntent(); boolean directPicture = false; if (intent != null) { bahnhof = (Bahnhof) intent.getSerializableExtra(EXTRA_BAHNHOF); if (bahnhof == null) { Log.w(TAG, "EXTRA_BAHNHOF in intent data missing"); Toast.makeText(this, R.string.station_not_found, Toast.LENGTH_LONG).show(); finish(); return; } directPicture = intent.getBooleanExtra(EXTRA_TAKE_FOTO, false); tvBahnhofName.setText(bahnhof.getTitle() + " (" + bahnhof.getId() + ")"); coordinates.setText(bahnhof.getLat() + ", " + bahnhof.getLon()); if (bahnhof.hasPhoto()) { if (ConnectionUtil.checkInternetConnection(this)) { BitmapCache.getInstance().getFoto(this, bahnhof.getPhotoUrl()); } setPictureButtonsVisibility( TextUtils.equals(nickname, bahnhof.getPhotographer()) ? View.VISIBLE : View.INVISIBLE); } else { setLocalBitmap(); } } if (directPicture) { takePictureWithPermissionCheck(); } }
From source file:cn.count.easydrive366.SettingsActivity.java
private void init_view() { findViewById(R.id.row_resetpassword).setOnClickListener(new OnClickListener() { @Override//from w w w . j a v a 2 s. com public void onClick(View v) { changePassword(); } }); findViewById(R.id.row_maintain).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // setup_maintain(); get(AppSettings.url_for_get_maintain_record(), 2); } }); findViewById(R.id.row_setup).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { register_step(); } }); findViewById(R.id.row_driver).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // setup_driver(); get(AppSettings.url_get_driver_license(), 3); } }); findViewById(R.id.row_car).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // setup_car_registration(); get(AppSettings.url_get_car_registration(), 4); } }); findViewById(R.id.row_choose_cellphone).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //start activity bindcellphone Intent intent = new Intent(SettingsActivity.this, BindCellphoneActivity.class); intent.putExtra("phone", _cellphone); intent.putExtra("isbind", _isbind); startActivityForResult(intent, BINDCELLPHONE); } }); findViewById(R.id.row_choose_check_version).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new CheckUpdate(SettingsActivity.this, true); } }); findViewById(R.id.row_choose_findpassword).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { reset_password(); } }); findViewById(R.id.row_choose_user_feedback).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { user_feedback(); } }); findViewById(R.id.row_card).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { check_activate_code(); } }); findViewById(R.id.txt_bound).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { open_bound(); } }); findViewById(R.id.btn_pay).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { open_pay(); } }); findViewById(R.id.btn_insurance).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { open_insurance(); } }); findViewById(R.id.btn_task).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { open_task(); } }); findViewById(R.id.btn_friend).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { open_friend(); } }); /* findViewById(R.id.row_cardview).setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { cardView(); }}); findViewById(R.id.row_cardadd).setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { cardAdd(); }}); */ txtNickname = (TextView) findViewById(R.id.txt_nickname); txtSignature = (TextView) findViewById(R.id.txt_signature); txtBound = (TextView) findViewById(R.id.txt_bound); txtBound.setMovementMethod(LinkMovementMethod.getInstance()); txtExp = (TextView) findViewById(R.id.txt_exp); imgAvater = (ImageView) findViewById(R.id.img_picture); pbExp = (ProgressBar) findViewById(R.id.pb_exp); txtBind = (TextView) findViewById(R.id.txt_bindCellphone); txtVersion = (TextView) findViewById(R.id.txt_version); txtCellphone = (TextView) findViewById(R.id.img_choose_cellphone); //txtActivate_code = (TextView)findViewById(R.id.txt_activate_code); txtVersion.setText(String.format("V%s >", AppSettings.version)); this.logoutButton = (Button) findViewById(R.id.btn_logout); logoutButton.setText(String.format("-%s", AppSettings.username)); findViewById(R.id.btn_logout).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { logout(); } }); //this.get(AppSettings.url_get_user_phone(), 1); //this.get(AppSettings.url_get_activate_code(), 11,""); load_user_profile(); }
From source file:com.zd.vpn.fragments.AboutFragment.java
private void createPlayBuyOptions(ArrayList<String> ownedSkus, ArrayList<String> responseList) { try {/* ww w . j av a 2 s . c om*/ Vector<Pair<String, String>> gdonation = new Vector<Pair<String, String>>(); gdonation.add(new Pair<String, String>(getString(R.string.donatePlayStore), null)); HashMap<String, SkuResponse> responseMap = new HashMap<String, SkuResponse>(); for (String thisResponse : responseList) { JSONObject object = new JSONObject(thisResponse); responseMap.put(object.getString("productId"), new SkuResponse(object.getString("price"), object.getString("title"))); } for (String sku : donationSkus) if (responseMap.containsKey(sku)) gdonation.add( getSkuTitle(sku, responseMap.get(sku).title, responseMap.get(sku).price, ownedSkus)); String gmsTextString = ""; for (int i = 0; i < gdonation.size(); i++) { if (i == 1) gmsTextString += " "; else if (i > 1) gmsTextString += ", "; gmsTextString += gdonation.elementAt(i).first; } SpannableString gmsText = new SpannableString(gmsTextString); int lStart = 0; int lEnd = 0; for (Pair<String, String> item : gdonation) { lEnd = lStart + item.first.length(); if (item.second != null) { final String mSku = item.second; ClickableSpan cspan = new ClickableSpan() { @Override public void onClick(View widget) { triggerBuy(mSku); } }; gmsText.setSpan(cspan, lStart, lEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } lStart = lEnd + 2; // Account for ", " between items } if (gmsTextView != null) { gmsTextView.setText(gmsText); gmsTextView.setMovementMethod(LinkMovementMethod.getInstance()); gmsTextView.setVisibility(View.VISIBLE); } } catch (JSONException e) { VpnStatus.logException("Parsing Play Store IAP", e); } }