private void showAlertMessage(string msg) { if (msg == null) { throw new System.NullReferenceException("AlertMessage is Null!!"); } AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.Title = "Error"; builder.Message = msg; builder.setNegativeButton("close", new OnClickListenerAnonymousInnerClassHelper(this)); builder.show(); }
/// <summary> /// Shows alert dialog. /// </summary> //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: private void showAlertDialog(String message, final boolean finishActivity) private void showAlertDialog(string message, bool finishActivity) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.app.AlertDialog.Builder dialog = new android.app.AlertDialog.Builder(this); AlertDialog.Builder dialog = new AlertDialog.Builder(this); dialog.setMessage(message).setIcon(android.R.drawable.ic_dialog_alert).setTitle("Alert").setPositiveButton([email protected], new OnClickListenerAnonymousInnerClassHelper(this, finishActivity, dialog)) .Cancelable = false; runOnUiThread(() => { dialog.show(); }); }
public override bool onOptionsItemSelected(MenuItem item) { int id = item.ItemId; switch (id) { case R.id.action_new_thing: renderNewThingPopup(); break; case R.id.change_floor: renderChangeCarpetPopup(); break; case R.id.action_rotate: if (mSelectedThing != null) { int rotation = mSelectedThing.Rotation; if (rotation >= 270) { mSelectedThing.Rotation = 0; } else { mSelectedThing.Rotation = rotation + 90; } updateOfficeThing(mSelectedThing.Key, mSelectedThing); } break; case R.id.action_delete: deleteOfficeThing(mSelectedThing.Key, mSelectedThing); break; case R.id.action_edit: AlertDialog.Builder builder = new AlertDialog.Builder(this); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.widget.EditText entry = new android.widget.EditText(this); EditText entry = new EditText(this); builder.setMessage(getString([email protected]_desk_name_description)).setTitle(getString([email protected]_desk_name_title)).setView(entry); builder.setPositiveButton(getString([email protected]_desk_name_save), new OnClickListenerAnonymousInnerClassHelper(this, id, entry)); builder.show(); break; } return(base.onOptionsItemSelected(item)); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: private void invokeInstallOption(final int msgID, String msg) private void invokeInstallOption(int msgID, string msg) { DialogInterface.OnClickListener msgClick = new OnClickListenerAnonymousInnerClassHelper(this, msgID); AlertDialog.Builder message = new AlertDialog.Builder(this, AlertDialog.THEME_HOLO_DARK); if (msgID != -1) { message.Message = msgID; } if (msg != null) { message.Message = msg; } message.setPositiveButton([email protected]_str, msgClick); message.Cancelable = false; message.show(); }
public override bool onOptionsItemSelected(MenuItem item) { int id = item.ItemId; switch (id) { case R.id.action_new_thing: renderNewThingPopup(); break; case R.id.change_floor: renderChangeCarpetPopup(); break; case R.id.action_rotate: if (mSelectedThing != null) { int rotation = mSelectedThing.Rotation; if (rotation >= 270) { mSelectedThing.Rotation = 0; } else { mSelectedThing.Rotation = rotation + 90; } updateOfficeThing(mSelectedThing.Key, mSelectedThing); } break; case R.id.action_delete: deleteOfficeThing(mSelectedThing.Key, mSelectedThing); break; case R.id.action_edit: AlertDialog.Builder builder = new AlertDialog.Builder(this); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.widget.EditText entry = new android.widget.EditText(this); EditText entry = new EditText(this); builder.setMessage(getString([email protected]_desk_name_description)).setTitle(getString([email protected]_desk_name_title)).setView(entry); builder.setPositiveButton(getString([email protected]_desk_name_save), new OnClickListenerAnonymousInnerClassHelper(this, id, entry)); builder.show(); break; } return base.onOptionsItemSelected(item); }
/// <summary> /// Shows depth of field result into dialog. /// </summary> private void showResultDialog(params object[] args) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.app.AlertDialog.Builder dialog = new android.app.AlertDialog.Builder(this); AlertDialog.Builder dialog = new AlertDialog.Builder(this); View dialogView = LayoutInflater.inflate(R.layout.result_dialog_dof, null); ImageView autoFocusImage = (ImageView)dialogView.findViewById(R.id.autoFocusImage); autoFocusImage.ImageBitmap = (Bitmap)args[0]; ImageView infinityFocusImage = (ImageView)dialogView.findViewById(R.id.infinityFocusImage); infinityFocusImage.ImageBitmap = (Bitmap)args[1]; ImageView resultImage = (ImageView) dialogView.findViewById(R.id.resultDOFImage); resultImage.ImageBitmap = (Bitmap)args[2]; dialog.setView(dialogView).setTitle("Capture result").setPositiveButton([email protected], new OnClickListenerAnonymousInnerClassHelper2(this, dialog)); runOnUiThread(() => { dialog.show(); }); }
protected override void onCreate(global::android.os.Bundle savedInstanceState) { // cmd /K c:\util\android-sdk-windows\platform-tools\adb.exe logcat // Camera PTP // http://developer.android.com/guide/topics/ui/notifiers/notifications.html base.onCreate(savedInstanceState); ScrollView sv = new ScrollView(this); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); Button b = new Button(this); b.setText("AlertDialog! " + new { id = Thread.currentThread().getId() }); int counter = 0; // ScriptCoreLib.Ultra ? b.AtClick( delegate { counter++; // http://www.tomswebdesign.net/Articles/Android/number-pad-input-class.html // https://android.googlesource.com/platform/frameworks/base/+/b896b9f/packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java // http://xmlstackoverflow.blogspot.com/2014/07/how-to-use-alertdialog-to-prompt-for-pin.html // http://incidencias-ctt.administracionelectronica.gob.es/websvn/filedetails.php?repname=clienteafirma&path=%2Fproject%2Fafirma-mobile%2Fafirma-android%2Ftrunk%2Fafirma-ui-android%2Fsrc%2Fes%2Fgob%2Fafirma%2Fandroid%2Fgui%2FPinDialog.java&peg=4040 // X:\jsc.svn\examples\java\android\forms\FormsMessageBox\FormsMessageBox\ApplicationActivity.cs // X:\jsc.svn\examples\java\android\Test\TestAlertDialog\TestAlertDialog\ApplicationActivity.cs AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Reset..."); alertDialog.setMessage("Are you sure?"); alertDialog.setButton("OK", new xOnClickListener { yield = delegate { b.setText("clicked! " + new { id = Thread.currentThread().getId() }); } } ); // skip icons? //alertDialog.setIcon(android.R.drawable.star_off); // can we do async yet? alertDialog.show(); } ); ll.addView(b); this.setContentView(sv); // X:\jsc.svn\examples\java\android\HelloOpenGLES20Activity\HelloOpenGLES20Activity\ScriptCoreLib.Android\Shader.cs // Error 1 'TestAlertDialog.Activities.ApplicationActivity' does not contain a definition for 'ShowLongToast' and no extension method 'ShowLongToast' accepting a first argument of type 'TestAlertDialog.Activities.ApplicationActivity' could be found (are you missing a using directive or an assembly reference?) X:\jsc.svn\examples\java\android\TestAlertDialog\TestAlertDialog\ApplicationActivity.cs 80 18 TestAlertDialog //this.ShowLongToast("http://jsc-solutions.net"); //this.ShowToast("http://jsc-solutions.net"); }
/// <summary> /// Shows the camera device information into dialog. /// </summary> private void showInformationDialog() { StringBuilder builder = new StringBuilder(); builder.Append("<html><body><pre>"); if (mCharacteristics != null) { builder.Append(string.Format("Camera Id: {0}\n", mCameraId)); // Check supported hardware level. SparseArray<string> level = new SparseArray<string>(); level.put(SCameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL, "Full"); level.put(SCameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED, "Limited"); level.put(SCameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY, "Legacy"); builder.Append(string.Format("Supported H/W Level: {0}\n", level.get(mCharacteristics.get(SCameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL)))); // Available characteristics tag. builder.Append("\nCharacteristics [\n"); //JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET: //ORIGINAL LINE: for(com.samsung.android.sdk.camera.SCameraCharacteristics.Key<?> key : mCharacteristics.getKeys()) foreach (SCameraCharacteristics.Key<?> key in mCharacteristics.Keys) { if (mCharacteristics.get(key) is int[]) { builder.Append(string.Format("\t{0} --> {1}\n", key.Name, Arrays.ToString((int[])mCharacteristics.get(key)))); } else if (mCharacteristics.get(key) is Range[]) { builder.Append(string.Format("\t{0} --> {1}\n", key.Name, Arrays.deepToString((Range[])mCharacteristics.get(key)))); } else if (mCharacteristics.get(key) is Size[]) { builder.Append(string.Format("\t{0} --> {1}\n", key.Name, Arrays.deepToString((Size[]) mCharacteristics.get(key)))); } else if (mCharacteristics.get(key) is float[]) { builder.Append(string.Format("\t{0} --> {1}\n", key.Name, Arrays.ToString((float[])mCharacteristics.get(key)))); } else if (mCharacteristics.get(key) is StreamConfigurationMap) { builder.Append(string.Format("\t{0} --> [\n", key.Name)); { StreamConfigurationMap streamConfigurationMap = mCharacteristics.get(SCameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); SparseArray<string> formatMap = new SparseArray<string>(); formatMap.put(ImageFormat.JPEG, "JPEG"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { formatMap.put(ImageFormat.PRIVATE, "PRIVATE"); formatMap.put(ImageFormat.DEPTH16, "DEPTH16"); formatMap.put(ImageFormat.DEPTH_POINT_CLOUD, "DEPTH_POINT_CLOUD"); } formatMap.put(ImageFormat.NV16, "NV16"); formatMap.put(ImageFormat.NV21, "NV21"); formatMap.put(ImageFormat.RAW10, "RAW10"); formatMap.put(ImageFormat.RAW_SENSOR, "RAW_SENSOR"); formatMap.put(ImageFormat.RGB_565, "RGB_565"); formatMap.put(ImageFormat.UNKNOWN, "UNKNOWN"); formatMap.put(ImageFormat.YUV_420_888, "420_888"); formatMap.put(ImageFormat.YUY2, "YUY2"); formatMap.put(ImageFormat.YV12, "YV12"); formatMap.put(PixelFormat.RGBA_8888, "RGBA_8888"); foreach (int format in streamConfigurationMap.OutputFormats) { builder.Append(string.Format("\t\t{0}(0x{1:x}) --> {2}\n", formatMap.get(format), format, Arrays.deepToString(streamConfigurationMap.getOutputSizes(format)))); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { builder.Append(string.Format("\t\tHigh Resolution {0}(0x{1:x}) --> {2}\n", formatMap.get(format), format, Arrays.deepToString(streamConfigurationMap.getHighResolutionOutputSizes(format)))); } } builder.Append(string.Format("\n\t\tHigh speed video fps --> {0}\n", Arrays.deepToString(streamConfigurationMap.HighSpeedVideoFpsRanges))); builder.Append(string.Format("\t\tHigh speed video size --> {0}\n", Arrays.deepToString(streamConfigurationMap.HighSpeedVideoSizes))); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { builder.Append(string.Format("\n\t\tInput formats [\n")); foreach (int format in streamConfigurationMap.InputFormats) { builder.Append(string.Format("\t\t\t{0}(0x{1:x}) --> {2}\n", formatMap.get(format), format, Arrays.deepToString(streamConfigurationMap.getInputSizes(format)))); } } builder.Append(string.Format("\t\t]\n")); } builder.Append("\t]\n"); } else if (mCharacteristics.get(key) is BlackLevelPattern) { BlackLevelPattern pattern = mCharacteristics.get(SCameraCharacteristics.SENSOR_BLACK_LEVEL_PATTERN); int[] patternArray = new int[BlackLevelPattern.COUNT]; pattern.copyTo(patternArray, 0); builder.Append(string.Format("\t{0} --> {1}\n", key.Name, Arrays.ToString(patternArray))); } else if (mCharacteristics.get(key) is bool[]) { builder.Append(string.Format("\t{0} --> {1}\n", key.Name, Arrays.ToString((bool[])mCharacteristics.get(key)))); } else { builder.Append(string.Format("\t{0} --> {1}\n", key.Name, mCharacteristics.get(key).ToString())); } } builder.Append("]\n"); // Available characteristics tag. builder.Append("\nAvailable characteristics keys [\n"); //JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET: //ORIGINAL LINE: for(com.samsung.android.sdk.camera.SCameraCharacteristics.Key<?> key : mCharacteristics.getKeys()) foreach (SCameraCharacteristics.Key<?> key in mCharacteristics.Keys) { builder.Append(string.Format("\t{0}\n", key.Name)); } builder.Append("]\n"); // Available request tag. builder.Append("\nAvailable request keys [\n"); //JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET: //ORIGINAL LINE: for(com.samsung.android.sdk.camera.SCaptureRequest.Key<?> key : mCharacteristics.getAvailableCaptureRequestKeys()) foreach (SCaptureRequest.Key<?> key in mCharacteristics.AvailableCaptureRequestKeys) { builder.Append(string.Format("\t{0}\n", key.Name)); } builder.Append("]\n"); // Available result tag. builder.Append("\nAvailable result keys [\n"); //JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET: //ORIGINAL LINE: for(com.samsung.android.sdk.camera.SCaptureResult.Key<?> key : mCharacteristics.getAvailableCaptureResultKeys()) foreach (SCaptureResult.Key<?> key in mCharacteristics.AvailableCaptureResultKeys) { builder.Append(string.Format("\t{0}\n", key.Name)); } builder.Append("]\n"); // Available capability. builder.Append("\nAvailable capabilities [\n"); SparseArray<string> capabilityName = new SparseArray<string>(); capabilityName.put(SCameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE, "BACKWARD_COMPATIBLE"); capabilityName.put(SCameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR, "MANUAL_SENSOR"); capabilityName.put(SCameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING, "MANUAL_POST_PROCESSING"); capabilityName.put(SCameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW, "RAW"); capabilityName.put(SCameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS, "READ_SENSOR_SETTINGS"); capabilityName.put(SCameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE, "BURST_CAPTURE"); capabilityName.put(SCameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT, "DEPTH_OUTPUT"); capabilityName.put(SCameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING, "PRIVATE_REPROCESSING"); capabilityName.put(SCameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING, "YUV_REPROCESSING"); capabilityName.put(SCameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO, "HIGH_SPEED_VIDEO"); foreach (int value in mCharacteristics.get(SCameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES)) { builder.Append(string.Format("\t{0}\n", capabilityName.get(value))); } builder.Append("]\n"); { builder.Append("\nSamsung extend tags\n"); // RT-HDR. if (mCharacteristics.Keys.contains(SCameraCharacteristics.LIVE_HDR_INFO_LEVEL_RANGE)) { builder.Append(string.Format("\tRT-HDR: {0}\n", mCharacteristics.get(SCameraCharacteristics.LIVE_HDR_INFO_LEVEL_RANGE).ToString())); } else { builder.Append("\tRT-HDR: not available\n"); } // Metering mode. builder.Append("\tAvailable Metering mode: [\n"); if (mCharacteristics.Keys.contains(SCameraCharacteristics.METERING_AVAILABLE_MODES)) { SparseArray<string> stringMap = new SparseArray<string>(); stringMap.put(SCameraCharacteristics.METERING_MODE_CENTER, "Center"); stringMap.put(SCameraCharacteristics.METERING_MODE_MATRIX, "Matrix"); stringMap.put(SCameraCharacteristics.METERING_MODE_SPOT, "Spot"); stringMap.put(SCameraCharacteristics.METERING_MODE_MANUAL, "Manual"); foreach (int mode in mCharacteristics.get(SCameraCharacteristics.METERING_AVAILABLE_MODES)) { builder.Append(string.Format("\t\t{0}\n", stringMap.get(mode))); } } else { builder.Append("\t\tnot available\n"); } builder.Append("\t]\n"); // PAF. builder.Append("\tPhase AF: "); if (mCharacteristics.Keys.contains(SCameraCharacteristics.PHASE_AF_INFO_AVAILABLE)) { builder.Append(mCharacteristics.get(SCameraCharacteristics.PHASE_AF_INFO_AVAILABLE)).Append("\n"); } else { builder.Append("not available\n"); } // Stabilization operation mode. builder.Append("\tStabilization modes: "); if (mCharacteristics.Keys.contains(SCameraCharacteristics.LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION_OPERATION_MODE)) { builder.Append(Arrays.ToString(mCharacteristics.get(SCameraCharacteristics.LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION_OPERATION_MODE))).Append("\n"); } else { builder.Append("not available\n"); } } } builder.Append("</pre></body></html>"); View dialogView = LayoutInflater.inflate(R.layout.information_dialog_single, null); ((WebView)dialogView.findViewById(R.id.information)).loadDataWithBaseURL(null, builder.ToString(), "text/html", "utf-8", null); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.app.AlertDialog.Builder dialog = new android.app.AlertDialog.Builder(this); AlertDialog.Builder dialog = new AlertDialog.Builder(this); dialog.setTitle("Information").setView(dialogView).setPositiveButton([email protected], new OnClickListenerAnonymousInnerClassHelper2(this, dialog)); runOnUiThread(() => { dialog.show(); }); }