박정현

코드 수정

Showing 27 changed files with 67 additions and 23 deletions
No preview for this file type
No preview for this file type
No preview for this file type
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release","dirName":""},"path":"app-release.apk","properties":{}}]
\ No newline at end of file
......@@ -42,6 +42,8 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
ArrayAdapter<String> arrayAdapter;
public AudioManager audioManager;
private BluetoothAdapter bluetoothAdapter;
// 연결된 블루투스 장치 표시
BroadcastReceiver bluetoothReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
......@@ -66,13 +68,17 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
ArrayList<String> engineList;
ArrayList<String> engineSpinnerList;
private SmsReceiver smsReceiver;
private int isTTSReady = -2;
private BroadcastReceiver kakaoReceiver;
long now = System.currentTimeMillis();
public double speed = 1.0d;
public double tone = 1.0f;
private Spinner spinner;
private Spinner spinner2;
private Spinner spinner3;
public TextToSpeech tts;
public String ttsengine;
private SeekBar volumebar;
......@@ -96,7 +102,8 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
setContentView((int) R.layout.activity_main);
this.tts = new TextToSpeech(this, this, this.ttsengine);
// this.editText = (TextView) findViewById(R.id.SMSText);
this.smsReceiver = new SmsReceiver();
this.deviceview = (TextView) findViewById(R.id.textView32);
this.button1 = (Button) findViewById(R.id.button1);
this.button2 = (Button) findViewById(R.id.button2);
......@@ -104,7 +111,10 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
this.button4 = (Button) findViewById(R.id.button4);
this.button5 = (Button) findViewById(R.id.button5);
this.spinner = (Spinner) findViewById(R.id.spinner);
spinner.setSelection(2);
this.spinner2 = (Spinner) findViewById(R.id.spinner2);
this.spinner3 = (Spinner) findViewById(R.id.spinner3);
spinner3.setSelection(2);
this.volumebar = (SeekBar) findViewById(R.id.volumeBar);
this.audioManager = (AudioManager) getSystemService("audio");
this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
......@@ -194,6 +204,28 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
}
});
this.spinner3.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
int selectedItemPosition = parent.getSelectedItemPosition();
if (selectedItemPosition == 0) {
double unused = MainActivity.this.tone = 0.7f;
} else if (selectedItemPosition == 1) {
double unused2 = MainActivity.this.tone = 0.85f;
} else if (selectedItemPosition == 2) {
double unused2 = MainActivity.this.tone = 1.0f;
} else if (selectedItemPosition == 3) {
double unused3 = MainActivity.this.tone = 1.15f;
} else if (selectedItemPosition == 4) {
double unused4 = MainActivity.this.tone = 1.3f;
}
Log.d("spinner3", "tone : " + MainActivity.this.tone);
}
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothAdapter bluetoothAdapter2 = this.bluetoothAdapter;
if (bluetoothAdapter2 != null) {
......@@ -220,20 +252,12 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
String sender = intent.getStringExtra("sender");
String contents = intent.getStringExtra("contents");
if (sender == null || contents == null) {
// this.editText.setText((CharSequence) null);
}
else {
// TextView textView = this.editText;
// textView.setText(sender + 10 + contents);
moveTaskToBack(true);
}
if (!this.button1.getBackground().getConstantState().equals(getResources().getDrawable(R.drawable.stop).getConstantState())) {
return;
}
TextToSpeech(sender + contents);
else {
TextToSpeech(sender + " " + contents);
}
}
......@@ -355,10 +379,10 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
setSeekBar();
}
//음성출력
public void TextToSpeech(String str) {
if (this.isTTSReady == 0) {
this.tts.setPitch(1.0f);
this.tts.setPitch((float) this.tone);
this.tts.setSpeechRate((float) this.speed);
if (Build.VERSION.SDK_INT >= 21) {
this.tts.addEarcon("[alarm]", BuildConfig.APPLICATION_ID, R.raw.alram);
......@@ -372,7 +396,9 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
}
HashMap<String, String> map = new HashMap<>();
map.put("utteranceId", "UniqueID");
this.tts.speak(str, 1, map);
}
}
......
......@@ -45,6 +45,7 @@ public class SmsReceiver extends BroadcastReceiver {
intent.putExtra("class", "SMS");
Log.d("SMSToSpeech", "Sender :" + sender);
Log.d("SMSToSpeech", "contents : " + contents);
Log.d("SMSToSpeech", "receivedDate : " + receivedDate);
context.startActivity(intent);
}
......
......@@ -116,10 +116,15 @@
<TextView android:textSize="20sp" android:textStyle="bold" android:textColor="@android:color/black" android:gravity="left|center_vertical|center_horizontal|center" android:id="@+id/textView40" android:background="#FFFFFF" android:paddingLeft="10dp" android:layout_width="match_parent" android:layout_height="60dp" android:text="볼륨"/>
<SeekBar android:layout_gravity="right|center_vertical|center_horizontal|center" android:id="@+id/volumeBar" android:layout_width="300dp" android:layout_height="60dp"/>
</FrameLayout>
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent">
<TextView android:textSize="20sp" android:textStyle="bold" android:textColor="@android:color/black" android:gravity="left|center_vertical|center_horizontal|center" android:id="@+id/textView41" android:background="#FFFFFF" android:paddingLeft="10dp" android:layout_width="match_parent" android:layout_height="60dp" android:text="읽기 속도"/>
<Spinner android:entries="@array/읽기속도" android:layout_gravity="right|center_vertical|center_horizontal|center" android:id="@+id/spinner" android:layout_width="200dp" android:layout_height="match_parent"/>
</FrameLayout>
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent">
<TextView android:textSize="20sp" android:textStyle="bold" android:textColor="@android:color/black" android:gravity="left|center_vertical|center_horizontal|center" android:id="@+id/textView42" android:background="#FFFFFF" android:paddingLeft="10dp" android:layout_width="match_parent" android:layout_height="60dp" android:text="톤 설정"/>
<Spinner android:entries="@array/톤" android:layout_gravity="right|center_vertical|center_horizontal|center" android:id="@+id/spinner3" android:layout_width="200dp" android:layout_height="match_parent"/>
</FrameLayout>
<TextView
android:id="@+id/textView5"
......
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
\ No newline at end of file
......
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
\ No newline at end of file
......

4.65 KB | W: | H:

4.29 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

2.5 KB | W: | H:

2.76 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

6.16 KB | W: | H:

6.21 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

15.9 KB | W: | H:

16.9 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="읽기속도">
<item>느림(0.7배속)</item>
<item>보통(1배속)</item>
<item>약간빠름(1.2배속)</item>
<item>좀더빠름(1.5배속)</item>
<item>매우빠름(2배속)</item>
<item>느림(0.7배속)</item>
<item>보통(1배속)</item>
<item>약간빠름(1.2배속)</item>
<item>좀더빠름(1.5배속)</item>
<item>매우빠름(2배속)</item>
</array>
<array name="톤">
<item>매우낮음(0.7)</item>
<item>낮음(0.85)</item>
<item>보통(1)</item>
<item>약간높음(1.15)</item>
<item>좀더높음(1.3)</item>
</array>
</resources>
\ No newline at end of file
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>
\ No newline at end of file