2021-02-16 13:42:49 +01:00
|
|
|
package com.jens.automation2;
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View.OnClickListener;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.EditText;
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
import com.jens.automation2.Action.Action_Enum;
|
|
|
|
|
2021-03-29 16:36:21 +02:00
|
|
|
public class ActivityManageActionSpeakText extends Activity
|
2021-02-16 13:42:49 +01:00
|
|
|
{
|
|
|
|
private Button bSaveSpeakText;
|
|
|
|
private EditText etSpeakText;
|
|
|
|
|
|
|
|
public static boolean edit = false;
|
|
|
|
public static Action resultingAction = null;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState)
|
|
|
|
{
|
|
|
|
super.onCreate(savedInstanceState);
|
2021-05-30 20:03:30 +02:00
|
|
|
this.setContentView(R.layout.activity_manage_action_speak_text);
|
2021-02-16 13:42:49 +01:00
|
|
|
|
|
|
|
etSpeakText = (EditText)findViewById(R.id.etTextToSpeak);
|
2022-05-29 20:14:50 +02:00
|
|
|
bSaveSpeakText = (Button)findViewById(R.id.bSaveSpeakText);
|
2021-02-16 13:42:49 +01:00
|
|
|
bSaveSpeakText.setOnClickListener(new OnClickListener()
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public void onClick(View v)
|
|
|
|
{
|
|
|
|
if(etSpeakText.getText().toString().length()>0)
|
|
|
|
{
|
|
|
|
if(resultingAction == null)
|
|
|
|
{
|
|
|
|
resultingAction = new Action();
|
|
|
|
resultingAction.setAction(Action_Enum.speakText);
|
|
|
|
resultingAction.setParameter2(etSpeakText.getText().toString());
|
|
|
|
}
|
|
|
|
backToRuleManager();
|
|
|
|
}
|
|
|
|
else
|
2021-12-11 02:04:45 +01:00
|
|
|
Toast.makeText(getBaseContext(), getResources().getString(R.string.enterPhoneNumberAndText), Toast.LENGTH_LONG).show();
|
2021-02-16 13:42:49 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-03-29 16:36:21 +02:00
|
|
|
ActivityManageActionSpeakText.edit = getIntent().getBooleanExtra("edit", false);
|
2021-02-16 13:42:49 +01:00
|
|
|
if(edit)
|
2021-03-29 16:36:21 +02:00
|
|
|
etSpeakText.setText(ActivityManageActionSpeakText.resultingAction.getParameter2());
|
2021-02-16 13:42:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
// String url = getIntent().getStringExtra("urlToTrigger");
|
|
|
|
// if(url != null)
|
|
|
|
// existingUrl = url;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void backToRuleManager()
|
|
|
|
{
|
|
|
|
// Intent returnIntent = new Intent();
|
|
|
|
// returnIntent.putExtra("urlToTrigger", existingUrl);
|
|
|
|
|
|
|
|
// setResult(RESULT_OK, returnIntent);
|
|
|
|
|
|
|
|
if(edit && resultingAction != null)
|
2021-03-29 16:36:21 +02:00
|
|
|
ActivityManageActionSpeakText.resultingAction.setParameter2(etSpeakText.getText().toString());
|
2021-02-16 13:42:49 +01:00
|
|
|
|
|
|
|
setResult(RESULT_OK);
|
|
|
|
|
|
|
|
this.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|