|
|
@ -31,6 +31,7 @@ import android.os.Build;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.provider.ContactsContract;
|
|
|
|
import android.provider.ContactsContract;
|
|
|
|
|
|
|
|
import android.speech.tts.TextToSpeech;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.format.DateFormat;
|
|
|
|
import android.text.format.DateFormat;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
@ -133,6 +134,8 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
private Spinner spAnswer;
|
|
|
|
private Spinner spAnswer;
|
|
|
|
private CheckBox cbCc;
|
|
|
|
private CheckBox cbCc;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Button btnTts;
|
|
|
|
|
|
|
|
|
|
|
|
private TextView tvAutomation;
|
|
|
|
private TextView tvAutomation;
|
|
|
|
|
|
|
|
|
|
|
|
private BottomNavigationView bottom_navigation;
|
|
|
|
private BottomNavigationView bottom_navigation;
|
|
|
@ -146,6 +149,7 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
private Group grpMove;
|
|
|
|
private Group grpMove;
|
|
|
|
private Group grpMoveProp;
|
|
|
|
private Group grpMoveProp;
|
|
|
|
private Group grpAnswer;
|
|
|
|
private Group grpAnswer;
|
|
|
|
|
|
|
|
private Group grpTts;
|
|
|
|
private Group grpAutomation;
|
|
|
|
private Group grpAutomation;
|
|
|
|
|
|
|
|
|
|
|
|
private ArrayAdapter<String> adapterDay;
|
|
|
|
private ArrayAdapter<String> adapterDay;
|
|
|
@ -168,6 +172,7 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
private final static int REQUEST_DELETE = 4;
|
|
|
|
private final static int REQUEST_DELETE = 4;
|
|
|
|
private final static int REQUEST_SCHEDULE_START = 5;
|
|
|
|
private final static int REQUEST_SCHEDULE_START = 5;
|
|
|
|
private final static int REQUEST_SCHEDULE_END = 6;
|
|
|
|
private final static int REQUEST_SCHEDULE_END = 6;
|
|
|
|
|
|
|
|
private final static int REQUEST_TTS = 7;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
@ -247,6 +252,7 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
spAnswer = view.findViewById(R.id.spAnswer);
|
|
|
|
spAnswer = view.findViewById(R.id.spAnswer);
|
|
|
|
cbCc = view.findViewById(R.id.cbCc);
|
|
|
|
cbCc = view.findViewById(R.id.cbCc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btnTts = view.findViewById(R.id.btnTts);
|
|
|
|
tvAutomation = view.findViewById(R.id.tvAutomation);
|
|
|
|
tvAutomation = view.findViewById(R.id.tvAutomation);
|
|
|
|
|
|
|
|
|
|
|
|
bottom_navigation = view.findViewById(R.id.bottom_navigation);
|
|
|
|
bottom_navigation = view.findViewById(R.id.bottom_navigation);
|
|
|
@ -261,6 +267,7 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
grpMove = view.findViewById(R.id.grpMove);
|
|
|
|
grpMove = view.findViewById(R.id.grpMove);
|
|
|
|
grpMoveProp = view.findViewById(R.id.grpMoveProp);
|
|
|
|
grpMoveProp = view.findViewById(R.id.grpMoveProp);
|
|
|
|
grpAnswer = view.findViewById(R.id.grpAnswer);
|
|
|
|
grpAnswer = view.findViewById(R.id.grpAnswer);
|
|
|
|
|
|
|
|
grpTts = view.findViewById(R.id.grpTts);
|
|
|
|
grpAutomation = view.findViewById(R.id.grpAutomation);
|
|
|
|
grpAutomation = view.findViewById(R.id.grpAutomation);
|
|
|
|
|
|
|
|
|
|
|
|
ibSender.setOnClickListener(new View.OnClickListener() {
|
|
|
|
ibSender.setOnClickListener(new View.OnClickListener() {
|
|
|
@ -391,6 +398,7 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
actions.add(new Action(EntityRule.TYPE_COPY, getString(R.string.title_rule_copy)));
|
|
|
|
actions.add(new Action(EntityRule.TYPE_COPY, getString(R.string.title_rule_copy)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
actions.add(new Action(EntityRule.TYPE_ANSWER, getString(R.string.title_rule_answer)));
|
|
|
|
actions.add(new Action(EntityRule.TYPE_ANSWER, getString(R.string.title_rule_answer)));
|
|
|
|
|
|
|
|
actions.add(new Action(EntityRule.TYPE_TTS, getString(R.string.title_rule_tts)));
|
|
|
|
actions.add(new Action(EntityRule.TYPE_AUTOMATION, getString(R.string.title_rule_automation)));
|
|
|
|
actions.add(new Action(EntityRule.TYPE_AUTOMATION, getString(R.string.title_rule_automation)));
|
|
|
|
adapterAction.addAll(actions);
|
|
|
|
adapterAction.addAll(actions);
|
|
|
|
|
|
|
|
|
|
|
@ -454,6 +462,15 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
spIdent.setOnItemSelectedListener(onItemSelectedListener);
|
|
|
|
spIdent.setOnItemSelectedListener(onItemSelectedListener);
|
|
|
|
spAnswer.setOnItemSelectedListener(onItemSelectedListener);
|
|
|
|
spAnswer.setOnItemSelectedListener(onItemSelectedListener);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btnTts.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
|
|
|
Intent tts = new Intent();
|
|
|
|
|
|
|
|
tts.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
|
|
|
|
|
|
|
|
startActivityForResult(tts, REQUEST_TTS);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
tvAutomation.setText(getString(R.string.title_rule_automation_hint,
|
|
|
|
tvAutomation.setText(getString(R.string.title_rule_automation_hint,
|
|
|
|
EntityRule.ACTION_AUTOMATION,
|
|
|
|
EntityRule.ACTION_AUTOMATION,
|
|
|
|
TextUtils.join(",", new String[]{
|
|
|
|
TextUtils.join(",", new String[]{
|
|
|
@ -491,6 +508,7 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
grpMove.setVisibility(View.GONE);
|
|
|
|
grpMove.setVisibility(View.GONE);
|
|
|
|
grpMoveProp.setVisibility(View.GONE);
|
|
|
|
grpMoveProp.setVisibility(View.GONE);
|
|
|
|
grpAnswer.setVisibility(View.GONE);
|
|
|
|
grpAnswer.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
grpTts.setVisibility(View.GONE);
|
|
|
|
grpAutomation.setVisibility(View.GONE);
|
|
|
|
grpAutomation.setVisibility(View.GONE);
|
|
|
|
pbWait.setVisibility(View.VISIBLE);
|
|
|
|
pbWait.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
|
@ -634,6 +652,15 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
if (resultCode == RESULT_OK)
|
|
|
|
if (resultCode == RESULT_OK)
|
|
|
|
onScheduleEnd(data.getBundleExtra("args"));
|
|
|
|
onScheduleEnd(data.getBundleExtra("args"));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REQUEST_TTS:
|
|
|
|
|
|
|
|
if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS)
|
|
|
|
|
|
|
|
ToastEx.makeText(getContext(), android.R.string.ok, Toast.LENGTH_LONG).show();
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
Intent tts = new Intent();
|
|
|
|
|
|
|
|
tts.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
|
|
|
|
|
|
|
|
startActivity(tts);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.e(ex);
|
|
|
|
Log.e(ex);
|
|
|
@ -881,6 +908,7 @@ public class FragmentRule extends FragmentBase {
|
|
|
|
grpMove.setVisibility(type == EntityRule.TYPE_MOVE || type == EntityRule.TYPE_COPY ? View.VISIBLE : View.GONE);
|
|
|
|
grpMove.setVisibility(type == EntityRule.TYPE_MOVE || type == EntityRule.TYPE_COPY ? View.VISIBLE : View.GONE);
|
|
|
|
grpMoveProp.setVisibility(type == EntityRule.TYPE_MOVE ? View.VISIBLE : View.GONE);
|
|
|
|
grpMoveProp.setVisibility(type == EntityRule.TYPE_MOVE ? View.VISIBLE : View.GONE);
|
|
|
|
grpAnswer.setVisibility(type == EntityRule.TYPE_ANSWER ? View.VISIBLE : View.GONE);
|
|
|
|
grpAnswer.setVisibility(type == EntityRule.TYPE_ANSWER ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
grpTts.setVisibility(type == EntityRule.TYPE_TTS ? View.VISIBLE : View.GONE);
|
|
|
|
grpAutomation.setVisibility(type == EntityRule.TYPE_AUTOMATION ? View.VISIBLE : View.GONE);
|
|
|
|
grpAutomation.setVisibility(type == EntityRule.TYPE_AUTOMATION ? View.VISIBLE : View.GONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|