mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 12:03:28 +08:00
Fix spacing, convert all tabs to spaces
This commit is contained in:
parent
4b38ccef80
commit
21614ea891
@ -33,7 +33,6 @@ import android.media.Ringtone;
|
|||||||
import android.media.RingtoneManager;
|
import android.media.RingtoneManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.util.Log;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -209,41 +208,40 @@ public class Notification extends CordovaPlugin {
|
|||||||
// First button
|
// First button
|
||||||
if (buttonLabels.length() > 0) {
|
if (buttonLabels.length() > 0) {
|
||||||
try {
|
try {
|
||||||
dlg.setNegativeButton(buttonLabels.getString(0),
|
dlg.setNegativeButton(buttonLabels.getString(0),
|
||||||
new AlertDialog.OnClickListener() {
|
new AlertDialog.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 1));
|
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 1));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (JSONException e) { }
|
} catch (JSONException e) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second button
|
// Second button
|
||||||
if (buttonLabels.length() > 1) {
|
if (buttonLabels.length() > 1) {
|
||||||
try {
|
try {
|
||||||
dlg.setNeutralButton(buttonLabels.getString(1),
|
dlg.setNeutralButton(buttonLabels.getString(1),
|
||||||
new AlertDialog.OnClickListener() {
|
new AlertDialog.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 2));
|
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 2));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (JSONException e) { }
|
} catch (JSONException e) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Third button
|
// Third button
|
||||||
if (buttonLabels.length() > 2) {
|
if (buttonLabels.length() > 2) {
|
||||||
try {
|
try {
|
||||||
dlg.setPositiveButton(buttonLabels.getString(2),
|
dlg.setPositiveButton(buttonLabels.getString(2),
|
||||||
new AlertDialog.OnClickListener() {
|
new AlertDialog.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 3));
|
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 3));
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
} catch (JSONException e) { }
|
||||||
} catch (JSONException e) { }
|
|
||||||
}
|
}
|
||||||
dlg.setOnCancelListener(new AlertDialog.OnCancelListener() {
|
dlg.setOnCancelListener(new AlertDialog.OnCancelListener() {
|
||||||
public void onCancel(DialogInterface dialog)
|
public void onCancel(DialogInterface dialog)
|
||||||
@ -292,74 +290,72 @@ public class Notification extends CordovaPlugin {
|
|||||||
// First button
|
// First button
|
||||||
if (buttonLabels.length() > 0) {
|
if (buttonLabels.length() > 0) {
|
||||||
try {
|
try {
|
||||||
dlg.setNegativeButton(buttonLabels.getString(0),
|
dlg.setNegativeButton(buttonLabels.getString(0),
|
||||||
new AlertDialog.OnClickListener() {
|
new AlertDialog.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
try {
|
try {
|
||||||
result.put("buttonIndex",1);
|
result.put("buttonIndex",1);
|
||||||
result.put("input1", promptInput.getText().toString().trim().length()==0 ? defaultText : promptInput.getText());
|
result.put("input1", promptInput.getText().toString().trim().length()==0 ? defaultText : promptInput.getText());
|
||||||
} catch (JSONException e) { e.printStackTrace(); }
|
} catch (JSONException e) { e.printStackTrace(); }
|
||||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
|
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (JSONException e) { }
|
} catch (JSONException e) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second button
|
// Second button
|
||||||
if (buttonLabels.length() > 1) {
|
if (buttonLabels.length() > 1) {
|
||||||
try {
|
try {
|
||||||
dlg.setNeutralButton(buttonLabels.getString(1),
|
dlg.setNeutralButton(buttonLabels.getString(1),
|
||||||
new AlertDialog.OnClickListener() {
|
new AlertDialog.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
try {
|
try {
|
||||||
result.put("buttonIndex",2);
|
result.put("buttonIndex",2);
|
||||||
result.put("input1", promptInput.getText().toString().trim().length()==0 ? defaultText : promptInput.getText());
|
result.put("input1", promptInput.getText().toString().trim().length()==0 ? defaultText : promptInput.getText());
|
||||||
} catch (JSONException e) { e.printStackTrace(); }
|
} catch (JSONException e) { e.printStackTrace(); }
|
||||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
|
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (JSONException e) { }
|
} catch (JSONException e) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Third button
|
// Third button
|
||||||
if (buttonLabels.length() > 2) {
|
if (buttonLabels.length() > 2) {
|
||||||
try {
|
try {
|
||||||
dlg.setPositiveButton(buttonLabels.getString(2),
|
dlg.setPositiveButton(buttonLabels.getString(2),
|
||||||
new AlertDialog.OnClickListener() {
|
new AlertDialog.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
try {
|
try {
|
||||||
result.put("buttonIndex",3);
|
result.put("buttonIndex",3);
|
||||||
result.put("input1", promptInput.getText().toString().trim().length()==0 ? defaultText : promptInput.getText());
|
result.put("input1", promptInput.getText().toString().trim().length()==0 ? defaultText : promptInput.getText());
|
||||||
} catch (JSONException e) { e.printStackTrace(); }
|
} catch (JSONException e) { e.printStackTrace(); }
|
||||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
|
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
} catch (JSONException e) { }
|
||||||
} catch (JSONException e) { }
|
|
||||||
}
|
}
|
||||||
dlg.setOnCancelListener(new AlertDialog.OnCancelListener() {
|
dlg.setOnCancelListener(new AlertDialog.OnCancelListener() {
|
||||||
public void onCancel(DialogInterface dialog)
|
public void onCancel(DialogInterface dialog){
|
||||||
{
|
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
try {
|
try {
|
||||||
result.put("buttonIndex",0);
|
result.put("buttonIndex",0);
|
||||||
result.put("input1", promptInput.getText().toString().trim().length()==0 ? defaultText : promptInput.getText());
|
result.put("input1", promptInput.getText().toString().trim().length()==0 ? defaultText : promptInput.getText());
|
||||||
} catch (JSONException e) { e.printStackTrace(); }
|
} catch (JSONException e) { e.printStackTrace(); }
|
||||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
|
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dlg.create();
|
dlg.create();
|
||||||
dlg.show();
|
dlg.show();
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
this.cordova.getActivity().runOnUiThread(runnable);
|
this.cordova.getActivity().runOnUiThread(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the spinner.
|
* Show the spinner.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user