public virtual bool onLongClick(android.view.View v) { if (hasText()) { // Don't show the cheat sheet for items that already show text. return(false); } int[] screenPos = new int[2]; android.graphics.Rect displayFrame = new android.graphics.Rect(); getLocationOnScreen(screenPos); getWindowVisibleDisplayFrame(displayFrame); android.content.Context context = getContext(); int width = getWidth(); int height = getHeight(); int midy = screenPos[1] + height / 2; int screenWidth = context.getResources().getDisplayMetrics().widthPixels; android.widget.Toast cheatSheet = android.widget.Toast.makeText(context, mItemData .getTitle(), android.widget.Toast.LENGTH_SHORT); if (midy < displayFrame.height()) { // Show along the top; follow action buttons cheatSheet.setGravity(android.view.Gravity.TOP | android.view.Gravity.RIGHT, screenWidth - screenPos[0] - width / 2, height); } else { // Show along the bottom center cheatSheet.setGravity(android.view.Gravity.BOTTOM | android.view.Gravity.CENTER_HORIZONTAL , 0, height); } cheatSheet.show(); return(true); }
public virtual void onStartFailed(SinchError error) { Toast.makeText(this, error.ToString(), Toast.LENGTH_LONG).show(); if (mSpinner != null) { mSpinner.dismiss(); } }
public override void onReceive(Context context, Intent intent) { string data = intent.getStringExtra("extra_action_data"); if (data != null) { Toast.makeText(context, data, Toast.LENGTH_SHORT).show(); } }
public virtual void onItemSelected(View arg0, int arg1, object arg2) { if (arg1 < 0) { return; } Uri uri = (Uri)arg2; Toast.makeText(outerInstance, uri.ToString(), Toast.LENGTH_SHORT).show(); }
public virtual void onRequestPermissionsResult(int requestCode, string[] permissions, int[] grantResults) { if (grantResults.Length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { Toast.makeText(this, "You may now place a call", Toast.LENGTH_LONG).show(); } else { Toast.makeText(this, "This application needs permission to use your microphone to function properly.", Toast.LENGTH_LONG).show(); } }
public override void onPictureTaken(sbyte[] bytes) { Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.Length); if (bitmap != null) { outerInstance.showPicture(bitmap); } else { Toast.makeText(outerInstance, [email protected]_picture_failed, Toast.LENGTH_LONG).show(); } }
public override void apply(Camera.Parameters parameters) { if (parameters.FlashMode != null) { string flashMode = outerInstance.flashOn ? Camera.Parameters.FLASH_MODE_OFF : Camera.Parameters.FLASH_MODE_TORCH; parameters.FlashMode = flashMode; outerInstance.flashOn = !outerInstance.flashOn; } else { Toast.makeText(outerInstance, [email protected]_not_supported, Toast.LENGTH_LONG).show(); } }
protected internal override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); Intent intent = Intent; string data = intent.getStringExtra("extra_action_data"); if (data != null) { Toast.makeText(this, data, Toast.LENGTH_SHORT).show(); } }
public override void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_MEDIA_PROJECTION) { if (resultCode != AppCompatActivity.RESULT_OK) { Toast.makeText(this, [email protected]_capture_permission_not_granted, Toast.LENGTH_LONG).show(); return; } screenCapturer = new ScreenCapturer(this, resultCode, data, screenCapturerListener); startScreenCapture(); } }
// If you do not have an Applause application key, you must first create a // free account. Visit http://www.applause.com for more information about // how to create your account. // // If you already have an Applause account, login to the Applause control // panel at: https://sdk.applause.com // Create a new application (if you have not done so already). Your // application key can be retrieved at any time from the "Settings" tab // on the right menu. public override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_main; if (APP_KEY.Equals("Your-Applause-Application-Key-Goes-Here")) { Toast.makeText(this, "You have not provided Applause Application Key in MainActivity.APP_KEY", Toast.LENGTH_LONG).show(); return; } /// <summary> ///***************************** </summary> /* Creating session configuration */ /// <summary> ///***************************** </summary> // Here create a configuration Applause will use to start a session. // Configuration object uses builder pattern, so you can chain calls and // make the process of creation more compact. IBuilder builder = new Configuration.Builder(this); builder = builder.withAPIKey(APP_KEY); // specify app key // disable with uTest integration for demo purposes builder = builder.withUTestEnabled(false); Configuration configuration = builder.build(); /// <summary> ///***************************** </summary> /* Starting an Applause session */ /// <summary> ///***************************** </summary> // The following line of code actually starts an Applause session in QA // mode. Learn more by visiting // https://help.applause.com/hc/en-us/articles/201954883-Android-SDK-Pre-Production-Installation-Guide Applause.startNewSession(this, configuration); /// <summary> ///********************** </summary> /* Logging with Applause */ /// <summary> ///********************** </summary> // Applause can replace the default logging mechanism with its own // mechanism, assuming you import com.applause.android.Log. See above // for more details. Log.w("myTag", "This log message will be sent to Applause."); }
public virtual void onClick(View v) { Intent intent = new Intent(); intent.Component = new ComponentName("com.samsung.android.app.pinboard", "com.samsung.android.app.pinboard.ui.PinboardActivity"); try { startActivity(intent); } catch (ActivityNotFoundException) { Toast.makeText(outerInstance, "Pinboard application is not installed.", Toast.LENGTH_SHORT).show(); } }
public override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_apasimple_client; try { Sapa sapa = new Sapa(); sapa.initialize(this); mService = new SapaService(); mService.stop(true); mService.start(SapaService.START_PARAM_DEFAULT_LATENCY); mClient = new SapaProcessor(this, null, new StatusListenerAnonymousInnerClassHelper(this)); mService.register(mClient); } catch (SsdkUnsupportedException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); Toast.makeText(this, "not support professional audio", Toast.LENGTH_LONG).show(); finish(); return; } catch (InstantiationException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); Toast.makeText(this, "fail to instantiate", Toast.LENGTH_LONG).show(); finish(); return; } catch (AndroidRuntimeException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); Toast.makeText(this, "fail to start", Toast.LENGTH_LONG).show(); finish(); return; } mPlayButton = (Button)this.findViewById(R.id.play_button); mPlayButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); mActivateButton = (Button)this.findViewById(R.id.button_activate); mActivateButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper2(this); mDeactivateButton = (Button)this.findViewById(R.id.button_deactivate); mDeactivateButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper3(this); }
public virtual void onClick(View v) { // handle the click event on the chart SeriesSelection seriesSelection = outerInstance.mChartView.CurrentSeriesAndPoint; if (seriesSelection == null) { Toast.makeText(outerInstance, "No chart element", Toast.LENGTH_SHORT).show(); } else { // display information of the clicked point Toast.makeTextuniquetempvar.show(); } }
/// <summary>Make a standard toast that just contains a text view.</summary> /// <remarks>Make a standard toast that just contains a text view.</remarks> /// <param name="context"> /// The context to use. Usually your /// <see cref="android.app.Application">android.app.Application</see> /// or /// <see cref="android.app.Activity">android.app.Activity</see> /// object. /// </param> /// <param name="text">The text to show. Can be formatted text.</param> /// <param name="duration"> /// How long to display the message. Either /// <see cref="LENGTH_SHORT">LENGTH_SHORT</see> /// or /// <see cref="LENGTH_LONG">LENGTH_LONG</see> /// </param> public static android.widget.Toast makeText(android.content.Context context, java.lang.CharSequence text, int duration) { android.widget.Toast result = new android.widget.Toast(context); android.view.LayoutInflater inflate = (android.view.LayoutInflater)context.getSystemService (android.content.Context.LAYOUT_INFLATER_SERVICE); android.view.View v = inflate.inflate([email protected]_notification , null); android.widget.TextView tv = (android.widget.TextView)v.findViewById([email protected] .id.message); tv.setText(text); result.mNextView = v; result.mDuration = duration; return(result); }
public override void onClick(View v) { SeriesSelection seriesSelection = outerInstance.mChartView.CurrentSeriesAndPoint; if (seriesSelection == null) { Toast.makeText(outerInstance, "No chart element selected", Toast.LENGTH_SHORT).show(); } else { for (int i = 0; i < outerInstance.mSeries.ItemCount; i++) { outerInstance.mRenderer.getSeriesRendererAt(i).Highlighted = i == seriesSelection.PointIndex; } outerInstance.mChartView.repaint(); Toast.makeTextuniquetempvar.show(); } }
private void callButtonClicked() { string userName = mCallName.Text.ToString(); if (userName.Length == 0) { Toast.makeText(this, "Please enter a user to call", Toast.LENGTH_LONG).show(); return; } Call call = SinchServiceInterface.callUserVideo(userName); string callId = call.CallId; Intent callScreen = new Intent(this, typeof(CallScreenActivity)); callScreen.putExtra(SinchService.CALL_ID, callId); startActivity(callScreen); }
private void loginClicked() { string userName = mLoginName.Text.ToString(); if (userName.Length == 0) { Toast.makeText(this, "Please enter a name", Toast.LENGTH_LONG).show(); return; } if (!SinchServiceInterface.Started) { SinchServiceInterface.startClient(userName); showSpinner(); } else { openPlaceCallActivity(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) public override void onRequestPermissionsResult(int requestCode, string[] permissions, int[] grantResults) { if (requestCode == CAMERA_PERMISSION_REQUEST_CODE) { bool cameraPermissionGranted = true; foreach (int grantResult in grantResults) { cameraPermissionGranted &= grantResult == PackageManager.PERMISSION_GRANTED; } if (cameraPermissionGranted) { addVideo(); } else { Toast.makeText(this, [email protected]_needed, Toast.LENGTH_LONG).show(); } } }
private void callButtonClicked() { string userName = mCallName.Text.ToString(); if (userName.Length == 0) { Toast.makeText(this, "Please enter a user to call", Toast.LENGTH_LONG).show(); return; } try { Call call = SinchServiceInterface.callUser(userName); string callId = call.CallId; Intent callScreen = new Intent(this, typeof(CallScreenActivity)); callScreen.putExtra(SinchService.CALL_ID, callId); startActivity(callScreen); } catch (MissingPermissionException e) { ActivityCompat.requestPermissions(this, new string[] { e.RequiredPermission }, 0); } }
private void executeDirectIo() { string command = mCommandEdit.Text.ToString(); if (command.Length == 0) { Toast.makeText(ApplicationContext, "Please input command", Toast.LENGTH_SHORT).show(); return; } bool hasResponse = mCheckBox.Checked; string @string = mResponseLengthEdit.Text.ToString(); if (@string.Length == 0) { Toast.makeText(ApplicationContext, "Please input response length", Toast.LENGTH_SHORT).show(); return; } int responseLength = int.Parse(@string); MainActivity.mBixolonLabelPrinter.executeDirectIo(command, hasResponse, responseLength); }
protected internal override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_airbutton_default; Button btnRecipient = (Button)findViewById(R.id.btn_default_recipient); createRecipientListWidgetFromView(btnRecipient); Button btnImage = (Button)findViewById(R.id.btn_default_image); createImageListWidgetFromView(btnImage); Slook slook = new Slook(); if (!slook.isFeatureEnabled(Slook.AIRBUTTON)) { Toast.makeText(this, "This model doesn't support AirButton", Toast.LENGTH_LONG).show(); } else { Toast.makeText(this, "Please hover and push the Spen button on each button", Toast.LENGTH_SHORT).show(); } }
public override void onScreenCaptureError(string errorDescription) { Log.e(TAG, "Screen capturer error: " + errorDescription); outerInstance.stopScreenCapture(); Toast.makeText(outerInstance, [email protected]_capture_error, Toast.LENGTH_LONG).show(); }
private void printBitmap() { string pathName = mTextView.Text.ToString(); mAlignment = BixolonPrinter.ALIGNMENT_CENTER; RadioGroup radioGroup = (RadioGroup)findViewById(R.id.radioGroup1); switch (radioGroup.CheckedRadioButtonId) { case R.id.radio0: mAlignment = BixolonPrinter.ALIGNMENT_LEFT; break; case R.id.radio1: mAlignment = BixolonPrinter.ALIGNMENT_CENTER; break; case R.id.radio2: mAlignment = BixolonPrinter.ALIGNMENT_RIGHT; break; } int width = 0; radioGroup = (RadioGroup)findViewById(R.id.radioGroup2); switch (radioGroup.CheckedRadioButtonId) { case R.id.radio3: width = BixolonPrinter.BITMAP_WIDTH_NONE; break; case R.id.radio4: width = BixolonPrinter.BITMAP_WIDTH_FULL; break; case R.id.radio5: string @string = mWidthEdit.Text.ToString(); if (@string.Length == 0) { Toast.makeText(ApplicationContext, "Please enter the width", Toast.LENGTH_SHORT).show(); } else { width = int.Parse(@string); } break; } EditText editText = (EditText)findViewById(R.id.editText1); int level = int.Parse(editText.Text.ToString()); CheckBox checkBox = (CheckBox)findViewById(R.id.checkBox1); mFormFeed = checkBox.Checked; checkBox = (CheckBox)findViewById(R.id.checkBox2); bool dither = ((CheckBox)findViewById(R.id.checkBox3)).Checked; bool compress = ((CheckBox)findViewById(R.id.checkBox4)).Checked; if (checkBox.Checked) { if (pathName != null && pathName.Length > 0) { MainActivity.mBixolonPrinter.printDotMatrixBitmap(pathName, mAlignment, width, level, false); } else { BitmapDrawable drawable = (BitmapDrawable)Resources.getDrawable(R.drawable.bixolon); Bitmap bitmap = drawable.Bitmap; MainActivity.mBixolonPrinter.printDotMatrixBitmap(bitmap, mAlignment, width, level, false); } } else { if (pathName != null && pathName.Length > 0) { MainActivity.mBixolonPrinter.printBitmap(pathName, mAlignment, width, level, dither, compress, true); /* * You can choose the method. Please reference attached document. * MainActivity.mBixolonPrinter.getMonoPixels(pathName, width, level); */ } else { BitmapDrawable drawable = (BitmapDrawable)Resources.getDrawable(R.drawable.bixolon); Bitmap bitmap = drawable.Bitmap; MainActivity.mBixolonPrinter.printBitmap(bitmap, mAlignment, width, level, dither, compress, true); /* * You can choose the method. Please reference attached document. * MainActivity.mBixolonPrinter.getMonoPixels(bitmap, width, level); */ } } }
/// <summary>Make a standard toast that just contains a text view.</summary> /// <remarks>Make a standard toast that just contains a text view.</remarks> /// <param name="context"> /// The context to use. Usually your /// <see cref="android.app.Application">android.app.Application</see> /// or /// <see cref="android.app.Activity">android.app.Activity</see> /// object. /// </param> /// <param name="text">The text to show. Can be formatted text.</param> /// <param name="duration"> /// How long to display the message. Either /// <see cref="LENGTH_SHORT">LENGTH_SHORT</see> /// or /// <see cref="LENGTH_LONG">LENGTH_LONG</see> /// </param> public static android.widget.Toast makeText(android.content.Context context, java.lang.CharSequence text, int duration) { android.widget.Toast result = new android.widget.Toast(context); android.view.LayoutInflater inflate = (android.view.LayoutInflater)context.getSystemService (android.content.Context.LAYOUT_INFLATER_SERVICE); android.view.View v = inflate.inflate([email protected]_notification , null); android.widget.TextView tv = (android.widget.TextView)v.findViewById([email protected] .id.message); tv.setText(text); result.mNextView = v; result.mDuration = duration; return result; }
private void printBarCode() { int barCodeSystem = 0; RadioGroup radioGroup = (RadioGroup)findViewById(R.id.radioGroup1); switch (radioGroup.CheckedRadioButtonId) { case R.id.radio0: barCodeSystem = BixolonPrinter.BAR_CODE_UPC_A; break; case R.id.radio1: barCodeSystem = BixolonPrinter.BAR_CODE_UPC_E; break; case R.id.radio2: barCodeSystem = BixolonPrinter.BAR_CODE_EAN13; break; case R.id.radio3: barCodeSystem = BixolonPrinter.BAR_CODE_EAN8; break; case R.id.radio4: barCodeSystem = BixolonPrinter.BAR_CODE_CODE39; break; case R.id.radio5: barCodeSystem = BixolonPrinter.BAR_CODE_ITF; break; case R.id.radio6: barCodeSystem = BixolonPrinter.BAR_CODE_CODABAR; break; case R.id.radio7: barCodeSystem = BixolonPrinter.BAR_CODE_CODE93; break; case R.id.radio8: barCodeSystem = BixolonPrinter.BAR_CODE_CODE128; break; } string data = mDataEdit.Text.ToString(); if (data == null || data.Length == 0) { Toast.makeText(ApplicationContext, "Input bar code data", Toast.LENGTH_SHORT).show(); return; } int alignment = BixolonPrinter.ALIGNMENT_LEFT; radioGroup = (RadioGroup)findViewById(R.id.radioGroup2); switch (radioGroup.CheckedRadioButtonId) { case R.id.radio9: alignment = BixolonPrinter.ALIGNMENT_LEFT; break; case R.id.radio10: alignment = BixolonPrinter.ALIGNMENT_CENTER; break; case R.id.radio11: alignment = BixolonPrinter.ALIGNMENT_RIGHT; break; } EditText editText = (EditText)findViewById(R.id.editText2); string @string = editText.Text.ToString(); if (@string.Length == 0) { Toast.makeText(ApplicationContext, "Please enter the width again.", Toast.LENGTH_SHORT).show(); return; } int width = int.Parse(@string); editText = (EditText)findViewById(R.id.editText3); @string = editText.Text.ToString(); if (@string.Length == 0) { Toast.makeText(ApplicationContext, "Please enter the height again.", Toast.LENGTH_SHORT).show(); return; } int height = int.Parse(@string); int characterPosition = 0; radioGroup = (RadioGroup)findViewById(R.id.radioGroup3); switch (radioGroup.CheckedRadioButtonId) { case R.id.radio12: characterPosition = BixolonPrinter.HRI_CHARACTER_NOT_PRINTED; break; case R.id.radio13: characterPosition = BixolonPrinter.HRI_CHARACTERS_ABOVE_BAR_CODE; break; case R.id.radio14: characterPosition = BixolonPrinter.HRI_CHARACTERS_BELOW_BAR_CODE; break; case R.id.radio15: characterPosition = BixolonPrinter.HRI_CHARACTERS_ABOVE_AND_BELOW_BAR_CODE; break; } CheckBox checkBox = (CheckBox)findViewById(R.id.checkBox1); if (checkBox.Checked) { MainActivity.mBixolonPrinter.print1dBarcode(data, barCodeSystem, alignment, width, height, characterPosition, false); MainActivity.mBixolonPrinter.formFeed(true); } else { MainActivity.mBixolonPrinter.print1dBarcode(data, barCodeSystem, alignment, width, height, characterPosition, true); } }
private void setPageMode() { RadioGroup radioGroup = (RadioGroup)findViewById(R.id.radioGroup1); if (radioGroup.CheckedRadioButtonId == R.id.radio0) { MainActivity.mBixolonPrinter.setStandardMode(); } else { MainActivity.mBixolonPrinter.setPageMode(); radioGroup = (RadioGroup)findViewById(R.id.radioGroup2); switch (radioGroup.CheckedRadioButtonId) { case R.id.radio2: MainActivity.mBixolonPrinter.PrintDirection = BixolonPrinter.DIRECTION_0_DEGREE_ROTATION; break; case R.id.radio3: MainActivity.mBixolonPrinter.PrintDirection = BixolonPrinter.DIRECTION_90_DEGREE_ROTATION; break; case R.id.radio4: MainActivity.mBixolonPrinter.PrintDirection = BixolonPrinter.DIRECTION_180_DEGREE_ROTATION; break; case R.id.radio5: MainActivity.mBixolonPrinter.PrintDirection = BixolonPrinter.DIRECTION_270_DEGREE_ROTATION; break; } EditText editText = (EditText)findViewById(R.id.editText1); string @string = editText.Text.ToString(); if (@string.Length == 0) { Toast.makeText(ApplicationContext, "Please enter the horizontal start position again", Toast.LENGTH_SHORT).show(); return; } int x = int.Parse(@string); editText = (EditText)findViewById(R.id.editText2); @string = editText.Text.ToString(); if (@string.Length == 0) { Toast.makeText(ApplicationContext, "Please enter the vertical start position again", Toast.LENGTH_SHORT).show(); return; } int y = int.Parse(@string); editText = (EditText)findViewById(R.id.editText3); @string = editText.Text.ToString(); if (@string.Length == 0) { Toast.makeText(ApplicationContext, "Please enter the horizontal print area again", Toast.LENGTH_SHORT).show(); return; } int width = int.Parse(@string); editText = (EditText)findViewById(R.id.editText4); @string = editText.Text.ToString(); if (@string.Length == 0) { Toast.makeText(ApplicationContext, "Please enter the vertical print area again", Toast.LENGTH_SHORT).show(); return; } int height = int.Parse(@string); MainActivity.mBixolonPrinter.setPrintArea(x, y, width, height); } }