src/jpm/dg/ImageHideScreen.java
/**
	 * Displays a save dialog, allowing for filename input.
	 */
Displays a save dialog, allowing for filename input.
Displays a save dialog allowing for filename input .
public void displaySaveDialog() {
		AlertDialog.Builder builder = new AlertDialog.Builder(this);
		builder.setTitle(getString(R.string.filename));
		final EditText input = new EditText(this);
		input.setText(currentFileName);
		input.setInputType(InputType.TYPE_CLASS_TEXT);
		input.setSelection(input.getText().length());
		builder.setView(input);
		builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				currentFileName = input.getText().toString();
				String error = Util.isValidFileName(currentFileName);
				if (error.equals("")) {
					new HideImageTask(ImageHideScreen.this)
							.execute();
				} else {
					Toast.makeText(getApplicationContext(), error,
							Toast.LENGTH_LONG).show();
					displaySaveDialog();
				}
			}
		});
		builder.setNegativeButton("Cancel",
				new DialogInterface.OnClickListener() {
					@Override
					public void onClick(DialogInterface dialog, int which) {
						dialog.cancel();
						return;
					}
				});
		builder.setOnCancelListener(new OnCancelListener() {
			@Override
			public void onCancel(DialogInterface dialog) {
				currentFileName = input.getText().toString();
			}
		});
		builder.show();
	}
public void displaySaveDialog ( ) { AlertDialog . Builder builder = new AlertDialog . Builder ( this ) ; builder . setTitle ( getString ( R . string . filename ) ) ; final EditText input = new EditText ( this ) ; input . setText ( currentFileName ) ; input . setInputType ( InputType . TYPE_CLASS_TEXT ) ; input . setSelection ( input . getText ( ) . length ( ) ) ; builder . setView ( input ) ; builder . setPositiveButton ( "OK" , new DialogInterface . OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int which ) { currentFileName = input . getText ( ) . toString ( ) ; String error = Util . isValidFileName ( currentFileName ) ; if ( error . equals ( "" ) ) { new HideImageTask ( ImageHideScreen . this ) . execute ( ) ; } else { Toast . makeText ( getApplicationContext ( ) , error , Toast . LENGTH_LONG ) . show ( ) ; displaySaveDialog ( ) ; } } } ) ; builder . setNegativeButton ( "Cancel" , new DialogInterface . OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int which ) { dialog . cancel ( ) ; return ; } } ) ; builder . setOnCancelListener ( new OnCancelListener ( ) { @ Override public void onCancel ( DialogInterface dialog ) { currentFileName = input . getText ( ) . toString ( ) ; } } ) ; builder . show ( ) ; }
Displays a save dialog, allowing for filename input.
Displays a save dialog allowing for filename input .