박정현

코드 수정

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
1 +[{"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 ...\ No newline at end of file
...@@ -42,6 +42,8 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn ...@@ -42,6 +42,8 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
42 ArrayAdapter<String> arrayAdapter; 42 ArrayAdapter<String> arrayAdapter;
43 public AudioManager audioManager; 43 public AudioManager audioManager;
44 private BluetoothAdapter bluetoothAdapter; 44 private BluetoothAdapter bluetoothAdapter;
45 +
46 + // 연결된 블루투스 장치 표시
45 BroadcastReceiver bluetoothReceiver = new BroadcastReceiver() { 47 BroadcastReceiver bluetoothReceiver = new BroadcastReceiver() {
46 public void onReceive(Context context, Intent intent) { 48 public void onReceive(Context context, Intent intent) {
47 String action = intent.getAction(); 49 String action = intent.getAction();
...@@ -66,13 +68,17 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn ...@@ -66,13 +68,17 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
66 ArrayList<String> engineList; 68 ArrayList<String> engineList;
67 ArrayList<String> engineSpinnerList; 69 ArrayList<String> engineSpinnerList;
68 70
71 + private SmsReceiver smsReceiver;
72 +
69 73
70 private int isTTSReady = -2; 74 private int isTTSReady = -2;
71 private BroadcastReceiver kakaoReceiver; 75 private BroadcastReceiver kakaoReceiver;
72 long now = System.currentTimeMillis(); 76 long now = System.currentTimeMillis();
73 public double speed = 1.0d; 77 public double speed = 1.0d;
78 + public double tone = 1.0f;
74 private Spinner spinner; 79 private Spinner spinner;
75 private Spinner spinner2; 80 private Spinner spinner2;
81 + private Spinner spinner3;
76 public TextToSpeech tts; 82 public TextToSpeech tts;
77 public String ttsengine; 83 public String ttsengine;
78 private SeekBar volumebar; 84 private SeekBar volumebar;
...@@ -96,7 +102,8 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn ...@@ -96,7 +102,8 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
96 setContentView((int) R.layout.activity_main); 102 setContentView((int) R.layout.activity_main);
97 this.tts = new TextToSpeech(this, this, this.ttsengine); 103 this.tts = new TextToSpeech(this, this, this.ttsengine);
98 104
99 - // this.editText = (TextView) findViewById(R.id.SMSText); 105 + this.smsReceiver = new SmsReceiver();
106 +
100 this.deviceview = (TextView) findViewById(R.id.textView32); 107 this.deviceview = (TextView) findViewById(R.id.textView32);
101 this.button1 = (Button) findViewById(R.id.button1); 108 this.button1 = (Button) findViewById(R.id.button1);
102 this.button2 = (Button) findViewById(R.id.button2); 109 this.button2 = (Button) findViewById(R.id.button2);
...@@ -104,7 +111,10 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn ...@@ -104,7 +111,10 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
104 this.button4 = (Button) findViewById(R.id.button4); 111 this.button4 = (Button) findViewById(R.id.button4);
105 this.button5 = (Button) findViewById(R.id.button5); 112 this.button5 = (Button) findViewById(R.id.button5);
106 this.spinner = (Spinner) findViewById(R.id.spinner); 113 this.spinner = (Spinner) findViewById(R.id.spinner);
114 + spinner.setSelection(2);
107 this.spinner2 = (Spinner) findViewById(R.id.spinner2); 115 this.spinner2 = (Spinner) findViewById(R.id.spinner2);
116 + this.spinner3 = (Spinner) findViewById(R.id.spinner3);
117 + spinner3.setSelection(2);
108 this.volumebar = (SeekBar) findViewById(R.id.volumeBar); 118 this.volumebar = (SeekBar) findViewById(R.id.volumeBar);
109 this.audioManager = (AudioManager) getSystemService("audio"); 119 this.audioManager = (AudioManager) getSystemService("audio");
110 this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); 120 this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
...@@ -194,6 +204,28 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn ...@@ -194,6 +204,28 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
194 } 204 }
195 }); 205 });
196 206
207 + this.spinner3.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
208 + public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
209 + int selectedItemPosition = parent.getSelectedItemPosition();
210 + if (selectedItemPosition == 0) {
211 + double unused = MainActivity.this.tone = 0.7f;
212 + } else if (selectedItemPosition == 1) {
213 + double unused2 = MainActivity.this.tone = 0.85f;
214 + } else if (selectedItemPosition == 2) {
215 + double unused2 = MainActivity.this.tone = 1.0f;
216 + } else if (selectedItemPosition == 3) {
217 + double unused3 = MainActivity.this.tone = 1.15f;
218 + } else if (selectedItemPosition == 4) {
219 + double unused4 = MainActivity.this.tone = 1.3f;
220 + }
221 +
222 + Log.d("spinner3", "tone : " + MainActivity.this.tone);
223 + }
224 +
225 + public void onNothingSelected(AdapterView<?> adapterView) {
226 + }
227 + });
228 +
197 this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); 229 this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
198 BluetoothAdapter bluetoothAdapter2 = this.bluetoothAdapter; 230 BluetoothAdapter bluetoothAdapter2 = this.bluetoothAdapter;
199 if (bluetoothAdapter2 != null) { 231 if (bluetoothAdapter2 != null) {
...@@ -220,20 +252,12 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn ...@@ -220,20 +252,12 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
220 String sender = intent.getStringExtra("sender"); 252 String sender = intent.getStringExtra("sender");
221 String contents = intent.getStringExtra("contents"); 253 String contents = intent.getStringExtra("contents");
222 254
223 -
224 - if (sender == null || contents == null) {
225 - // this.editText.setText((CharSequence) null);
226 - }
227 - else {
228 - // TextView textView = this.editText;
229 - // textView.setText(sender + 10 + contents);
230 - moveTaskToBack(true);
231 - }
232 -
233 if (!this.button1.getBackground().getConstantState().equals(getResources().getDrawable(R.drawable.stop).getConstantState())) { 255 if (!this.button1.getBackground().getConstantState().equals(getResources().getDrawable(R.drawable.stop).getConstantState())) {
234 return; 256 return;
235 } 257 }
236 - TextToSpeech(sender + contents); 258 + else {
259 + TextToSpeech(sender + " " + contents);
260 + }
237 } 261 }
238 262
239 263
...@@ -355,10 +379,10 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn ...@@ -355,10 +379,10 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
355 setSeekBar(); 379 setSeekBar();
356 } 380 }
357 381
358 - 382 + //음성출력
359 public void TextToSpeech(String str) { 383 public void TextToSpeech(String str) {
360 if (this.isTTSReady == 0) { 384 if (this.isTTSReady == 0) {
361 - this.tts.setPitch(1.0f); 385 + this.tts.setPitch((float) this.tone);
362 this.tts.setSpeechRate((float) this.speed); 386 this.tts.setSpeechRate((float) this.speed);
363 if (Build.VERSION.SDK_INT >= 21) { 387 if (Build.VERSION.SDK_INT >= 21) {
364 this.tts.addEarcon("[alarm]", BuildConfig.APPLICATION_ID, R.raw.alram); 388 this.tts.addEarcon("[alarm]", BuildConfig.APPLICATION_ID, R.raw.alram);
...@@ -372,7 +396,9 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn ...@@ -372,7 +396,9 @@ public class MainActivity extends AppCompatActivity implements TextToSpeech.OnIn
372 } 396 }
373 HashMap<String, String> map = new HashMap<>(); 397 HashMap<String, String> map = new HashMap<>();
374 map.put("utteranceId", "UniqueID"); 398 map.put("utteranceId", "UniqueID");
399 +
375 this.tts.speak(str, 1, map); 400 this.tts.speak(str, 1, map);
401 +
376 } 402 }
377 } 403 }
378 404
......
...@@ -45,6 +45,7 @@ public class SmsReceiver extends BroadcastReceiver { ...@@ -45,6 +45,7 @@ public class SmsReceiver extends BroadcastReceiver {
45 intent.putExtra("class", "SMS"); 45 intent.putExtra("class", "SMS");
46 Log.d("SMSToSpeech", "Sender :" + sender); 46 Log.d("SMSToSpeech", "Sender :" + sender);
47 Log.d("SMSToSpeech", "contents : " + contents); 47 Log.d("SMSToSpeech", "contents : " + contents);
48 + Log.d("SMSToSpeech", "receivedDate : " + receivedDate);
48 context.startActivity(intent); 49 context.startActivity(intent);
49 } 50 }
50 51
......
...@@ -116,10 +116,15 @@ ...@@ -116,10 +116,15 @@
116 <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="볼륨"/> 116 <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="볼륨"/>
117 <SeekBar android:layout_gravity="right|center_vertical|center_horizontal|center" android:id="@+id/volumeBar" android:layout_width="300dp" android:layout_height="60dp"/> 117 <SeekBar android:layout_gravity="right|center_vertical|center_horizontal|center" android:id="@+id/volumeBar" android:layout_width="300dp" android:layout_height="60dp"/>
118 </FrameLayout> 118 </FrameLayout>
119 +
119 <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"> 120 <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent">
120 <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="읽기 속도"/> 121 <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="읽기 속도"/>
121 <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"/> 122 <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"/>
122 </FrameLayout> 123 </FrameLayout>
124 + <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent">
125 + <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="톤 설정"/>
126 + <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"/>
127 + </FrameLayout>
123 128
124 <TextView 129 <TextView
125 android:id="@+id/textView5" 130 android:id="@+id/textView5"
......
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> 2 <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3 - <background android:drawable="@drawable/ic_launcher_background" /> 3 + <background android:drawable="@color/ic_launcher_background"/>
4 - <foreground android:drawable="@drawable/ic_launcher_foreground" /> 4 + <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
5 </adaptive-icon> 5 </adaptive-icon>
...\ No newline at end of file ...\ No newline at end of file
......
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> 2 <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3 - <background android:drawable="@drawable/ic_launcher_background" /> 3 + <background android:drawable="@color/ic_launcher_background"/>
4 - <foreground android:drawable="@drawable/ic_launcher_foreground" /> 4 + <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
5 </adaptive-icon> 5 </adaptive-icon>
...\ No newline at end of file ...\ 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
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <resources> 2 <resources>
3 <array name="읽기속도"> 3 <array name="읽기속도">
4 - <item>느림(0.7배속)</item> 4 + <item>느림(0.7배속)</item>
5 - <item>보통(1배속)</item> 5 + <item>보통(1배속)</item>
6 - <item>약간빠름(1.2배속)</item> 6 + <item>약간빠름(1.2배속)</item>
7 - <item>좀더빠름(1.5배속)</item> 7 + <item>좀더빠름(1.5배속)</item>
8 - <item>매우빠름(2배속)</item> 8 + <item>매우빠름(2배속)</item>
9 +</array>
10 + <array name="톤">
11 + <item>매우낮음(0.7)</item>
12 + <item>낮음(0.85)</item>
13 + <item>보통(1)</item>
14 + <item>약간높음(1.15)</item>
15 + <item>좀더높음(1.3)</item>
9 </array> 16 </array>
10 </resources> 17 </resources>
...\ No newline at end of file ...\ No newline at end of file
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<resources>
3 + <color name="ic_launcher_background">#FFFFFF</color>
4 +</resources>
...\ No newline at end of file ...\ No newline at end of file