close notification with button
This commit is contained in:
parent
937c6ffe1d
commit
f97bfbb732
@ -21,6 +21,7 @@ import android.widget.EditText;
|
|||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@ -49,6 +50,8 @@ public class ActivityManageActionCloseNotification extends Activity
|
|||||||
|
|
||||||
private static List<PackageInfo> pInfos = null;
|
private static List<PackageInfo> pInfos = null;
|
||||||
|
|
||||||
|
final static String dismissRegularString = "p0815DismissString";
|
||||||
|
|
||||||
private static String[] directions;
|
private static String[] directions;
|
||||||
|
|
||||||
ArrayAdapter<String> directionSpinnerAdapter;
|
ArrayAdapter<String> directionSpinnerAdapter;
|
||||||
@ -269,7 +272,6 @@ public class ActivityManageActionCloseNotification extends Activity
|
|||||||
rbNotificationDismissSimple = (RadioButton)findViewById(R.id.rbNotificationDismissSimple);
|
rbNotificationDismissSimple = (RadioButton)findViewById(R.id.rbNotificationDismissSimple);
|
||||||
rbNotificationDismissButton = (RadioButton)findViewById(R.id.rbNotificationDismissButton);
|
rbNotificationDismissButton = (RadioButton)findViewById(R.id.rbNotificationDismissButton);
|
||||||
|
|
||||||
|
|
||||||
directions = new String[] {
|
directions = new String[] {
|
||||||
getResources().getString(R.string.directionStringEquals),
|
getResources().getString(R.string.directionStringEquals),
|
||||||
getResources().getString(R.string.directionStringContains),
|
getResources().getString(R.string.directionStringContains),
|
||||||
@ -301,7 +303,7 @@ public class ActivityManageActionCloseNotification extends Activity
|
|||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
String app;
|
String app;
|
||||||
if(tvSelectedApplication.getText().toString().equalsIgnoreCase(getResources().getString(R.string.anyApp)))
|
if (tvSelectedApplication.getText().toString().equalsIgnoreCase(getResources().getString(R.string.anyApp)))
|
||||||
app = Trigger.anyAppString;
|
app = Trigger.anyAppString;
|
||||||
else
|
else
|
||||||
app = tvSelectedApplication.getText().toString();
|
app = tvSelectedApplication.getText().toString();
|
||||||
@ -312,29 +314,38 @@ public class ActivityManageActionCloseNotification extends Activity
|
|||||||
String text = etNotificationText.getText().toString();
|
String text = etNotificationText.getText().toString();
|
||||||
|
|
||||||
Intent responseData = new Intent();
|
Intent responseData = new Intent();
|
||||||
if(edit)
|
// if(edit)
|
||||||
{
|
// {
|
||||||
// editedNotificationAction.setTriggerParameter(chkNotificationDirection.isChecked());
|
// responseData.putExtra(ActivityManageRule.intentNameActionParameter2, app + Action.actionParameter2Split + titleDir + Action.actionParameter2Split + title + Action.actionParameter2Split + textDir + Action.actionParameter2Split + text);
|
||||||
responseData.putExtra(ActivityManageRule.intentNameActionParameter2, app + Action.actionParameter2Split + titleDir + Action.actionParameter2Split + title + Action.actionParameter2Split + textDir + Action.actionParameter2Split + text);
|
// ActivityManageActionCloseNotification.this.setResult(RESULT_OK, responseData);
|
||||||
ActivityManageActionCloseNotification.this.setResult(RESULT_OK, responseData);
|
// }
|
||||||
}
|
// else
|
||||||
|
// {
|
||||||
|
|
||||||
|
String dismissMethod;
|
||||||
|
if (rbNotificationDismissSimple.isChecked())
|
||||||
|
dismissMethod = dismissRegularString;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// data.putExtra(intentNameNotificationDirection, chkNotificationDirection.isChecked());
|
if(StringUtils.isEmpty(etNotificationDismissalButtonText.getText().toString()))
|
||||||
|
{
|
||||||
|
Toast.makeText(ActivityManageActionCloseNotification.this, getResources().getString(R.string.enterText), Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dismissMethod = etNotificationDismissalButtonText.getText().toString();
|
||||||
|
}
|
||||||
|
|
||||||
responseData.putExtra(ActivityManageRule.intentNameActionParameter2,
|
responseData.putExtra(ActivityManageRule.intentNameActionParameter2,
|
||||||
app + Action.actionParameter2Split +
|
app + Action.actionParameter2Split +
|
||||||
titleDir + Action.actionParameter2Split +
|
titleDir + Action.actionParameter2Split +
|
||||||
title + Action.actionParameter2Split +
|
title + Action.actionParameter2Split +
|
||||||
textDir + Action.actionParameter2Split +
|
textDir + Action.actionParameter2Split +
|
||||||
text
|
text + Action.actionParameter2Split +
|
||||||
|
dismissMethod
|
||||||
);
|
);
|
||||||
// data.putExtra(intentNameNotificationApp, app);
|
|
||||||
// data.putExtra(intentNameNotificationTitleDir, titleDir);
|
|
||||||
// data.putExtra(intentNameNotificationTitle, title);
|
|
||||||
// data.putExtra(intentNameNotificationTextDir, textDir);
|
|
||||||
// data.putExtra(intentNameNotificationText, text);
|
|
||||||
ActivityManageActionCloseNotification.this.setResult(RESULT_OK, responseData);
|
ActivityManageActionCloseNotification.this.setResult(RESULT_OK, responseData);
|
||||||
}
|
// }
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
@ -371,6 +382,21 @@ public class ActivityManageActionCloseNotification extends Activity
|
|||||||
else
|
else
|
||||||
text = "";
|
text = "";
|
||||||
|
|
||||||
|
/*
|
||||||
|
That's not reliable, yet. Last parameter may be empty, hence the method might
|
||||||
|
be incorrectly interpreted as a text notification text.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (params.length >= 6)
|
||||||
|
{
|
||||||
|
rbNotificationDismissButton.setChecked(true);
|
||||||
|
etNotificationDismissalButtonText.setText(params[5]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rbNotificationDismissSimple.setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
if(!app.equals(Trigger.anyAppString))
|
if(!app.equals(Trigger.anyAppString))
|
||||||
tvSelectedApplication.setText(app);
|
tvSelectedApplication.setText(app);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user