summaryrefslogtreecommitdiff
path: root/plugins/hu.dpal.phonegap.plugins.PinDialog/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/hu.dpal.phonegap.plugins.PinDialog/src')
-rw-r--r--plugins/hu.dpal.phonegap.plugins.PinDialog/src/android/PinDialog.java124
-rw-r--r--plugins/hu.dpal.phonegap.plugins.PinDialog/src/ios/CDVPinDialog.h19
-rw-r--r--plugins/hu.dpal.phonegap.plugins.PinDialog/src/ios/CDVPinDialog.m61
3 files changed, 0 insertions, 204 deletions
diff --git a/plugins/hu.dpal.phonegap.plugins.PinDialog/src/android/PinDialog.java b/plugins/hu.dpal.phonegap.plugins.PinDialog/src/android/PinDialog.java
deleted file mode 100644
index 6be1d6e3..00000000
--- a/plugins/hu.dpal.phonegap.plugins.PinDialog/src/android/PinDialog.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package hu.dpal.phonegap.plugins;
-
-import org.apache.cordova.CallbackContext;
-import org.apache.cordova.CordovaInterface;
-import org.apache.cordova.CordovaPlugin;
-import org.apache.cordova.PluginResult;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.app.AlertDialog;
-import android.app.ProgressDialog;
-import android.content.DialogInterface;
-import android.text.InputType;
-import android.text.method.PasswordTransformationMethod;
-import android.widget.EditText;
-
-
-public class PinDialog extends CordovaPlugin {
-
- public ProgressDialog spinnerDialog = null;
-
- public PinDialog() {
- }
-
- public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {
- if (action.equals("prompt")) {
-
- final String message = args.getString(0);
- final String title = args.getString(1);
- final JSONArray buttonLabels = args.getJSONArray(2);
-
- final CordovaInterface cordova = this.cordova;
- final EditText promptInput = new EditText(cordova.getActivity());
- promptInput.setInputType(InputType.TYPE_CLASS_NUMBER);
- promptInput.setTransformationMethod(PasswordTransformationMethod.getInstance());
-
- Runnable runnable = new Runnable() {
- public void run() {
- AlertDialog.Builder dlg = new AlertDialog.Builder(cordova.getActivity());
- dlg.setMessage(message);
- dlg.setTitle(title);
- dlg.setCancelable(true);
-
- dlg.setView(promptInput);
-
- final JSONObject result = new JSONObject();
-
- // First button
- if (buttonLabels.length() > 0) {
- try {
- dlg.setNegativeButton(buttonLabels.getString(0),
- new AlertDialog.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- try {
- result.put("buttonIndex",1);
- result.put("input1", promptInput.getText().toString().trim().length()==0 ? "" : promptInput.getText());
- } catch (JSONException e) { e.printStackTrace(); }
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
- }
- });
- } catch (JSONException e) { }
- }
-
- // Second button
- if (buttonLabels.length() > 1) {
- try {
- dlg.setNeutralButton(buttonLabels.getString(1),
- new AlertDialog.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- try {
- result.put("buttonIndex",2);
- result.put("input1", promptInput.getText().toString().trim().length()==0 ? "" : promptInput.getText());
- } catch (JSONException e) { e.printStackTrace(); }
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
- }
- });
- } catch (JSONException e) { }
- }
-
- // Third button
- if (buttonLabels.length() > 2) {
- try {
- dlg.setPositiveButton(buttonLabels.getString(2),
- new AlertDialog.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- try {
- result.put("buttonIndex",3);
- result.put("input1", promptInput.getText().toString().trim().length()==0 ? "" : promptInput.getText());
- } catch (JSONException e) { e.printStackTrace(); }
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
- }
- });
- } catch (JSONException e) { }
- }
-
- dlg.setOnCancelListener(new AlertDialog.OnCancelListener() {
- public void onCancel(DialogInterface dialog){
- dialog.dismiss();
- try {
- result.put("buttonIndex",0);
- result.put("input1", promptInput.getText().toString().trim().length()==0 ? "" : promptInput.getText());
- } catch (JSONException e) { e.printStackTrace(); }
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
- }
- });
-
- dlg.create();
- dlg.show();
-
- };
- };
- this.cordova.getActivity().runOnUiThread(runnable);
-
-
- }
-
- return true;
- }
-
-} \ No newline at end of file
diff --git a/plugins/hu.dpal.phonegap.plugins.PinDialog/src/ios/CDVPinDialog.h b/plugins/hu.dpal.phonegap.plugins.PinDialog/src/ios/CDVPinDialog.h
deleted file mode 100644
index 415195d5..00000000
--- a/plugins/hu.dpal.phonegap.plugins.PinDialog/src/ios/CDVPinDialog.h
+++ /dev/null
@@ -1,19 +0,0 @@
-//
-// CDVPinDialog.h
-// HelloWorld
-//
-//
-//
-
-#import <Foundation/Foundation.h>
-#import <UIKit/UIKit.h>
-#import <Cordova/CDVPlugin.h>
-
-
-@interface CDVPinDialog : CDVPlugin <UIAlertViewDelegate>{}
-@property (nonatomic, copy) NSString* callbackId;
-
-- (void)prompt:(CDVInvokedUrlCommand*)command;
-
-@end
-
diff --git a/plugins/hu.dpal.phonegap.plugins.PinDialog/src/ios/CDVPinDialog.m b/plugins/hu.dpal.phonegap.plugins.PinDialog/src/ios/CDVPinDialog.m
deleted file mode 100644
index bd33a205..00000000
--- a/plugins/hu.dpal.phonegap.plugins.PinDialog/src/ios/CDVPinDialog.m
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// CDVPinDialog.m
-// HelloWorld
-//
-//
-//
-
-#import "CDVPinDialog.h"
-
-@implementation CDVPinDialog
-
-- (void)prompt:(CDVInvokedUrlCommand*)command
-{
- self.callbackId = command.callbackId;
- NSString* message = [command argumentAtIndex:0];
- NSString* title = [command argumentAtIndex:1];
- NSArray* buttons = [command argumentAtIndex:2];
-
- UIAlertView* alertView = [[UIAlertView alloc]
- initWithTitle:title
- message:message
- delegate:self
- cancelButtonTitle:nil
- otherButtonTitles:nil];
-
- //alertView.callbackId = callbackId;
-
- int count = [buttons count];
-
- for (int n = 0; n < count; n++) {
- [alertView addButtonWithTitle:[buttons objectAtIndex:n]];
- }
-
- alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
- UITextField* textField = [alertView textFieldAtIndex:0];
-
- [alertView show];
-
- [textField resignFirstResponder];
- [textField setKeyboardType:UIKeyboardTypeNumberPad];
- [textField becomeFirstResponder];
-
-}
-
-
-- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-{
- CDVPluginResult* result;
-
- NSString* value0 = [[alertView textFieldAtIndex:0] text];
- NSDictionary* info = @{
- @"buttonIndex":@(buttonIndex + 1),
- @"input1":(value0 ? value0 : [NSNull null])
- };
- result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:info];
-
- [self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
-}
-
-
-@end