박정현

코드 업로드

Showing 48 changed files with 1492 additions and 0 deletions
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
talktalkspeak
\ No newline at end of file
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.talktalkspeak"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.talktalkspeak">
<uses-permission android:name="android.permission.BLUETOOTH" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.example.talktalkspeak;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.ContextCompat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class MainActivity extends AppCompatActivity implements TextToSpeech.OnInitListener {
private static final String ACTION_NOTIFICATION_LISTENER_SETTINGS = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS";
private static final int REQUEST_ENABLE_BT = 10;
ArrayAdapter<String> arrayAdapter;
public AudioManager audioManager;
private BluetoothAdapter bluetoothAdapter;
BroadcastReceiver bluetoothReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
BluetoothDevice device = (BluetoothDevice) intent.getParcelableExtra("android.bluetooth.device.extra.DEVICE");
if ("android.bluetooth.device.action.ACL_CONNECTED".equals(action)) {
MainActivity.this.deviceview.setText(device.getName().toString());
} else if ("android.bluetooth.device.action.ACL_DISCONNECTED".equals(action)) {
MainActivity.this.deviceview.setText("없음");
}
}
};
/* access modifiers changed from: private */
public Button button1;
private Button button2;
private Button button3;
private Button button4;
private Button button5;
public TextView deviceview;
private TextView editText;
ArrayList<String> engineList;
ArrayList<String> engineSpinnerList;
private int isTTSReady = -2;
private BroadcastReceiver kakaoReceiver;
long now = System.currentTimeMillis();
/* access modifiers changed from: private */
public double speed = 1.0d;
private Spinner spinner;
private Spinner spinner2;
/* access modifiers changed from: private */
public TextToSpeech tts;
/* access modifiers changed from: private */
public String ttsengine;
private SeekBar volumebar;
/* access modifiers changed from: protected */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView((int) R.layout.activity_main);
this.tts = new TextToSpeech(this, this, this.ttsengine);
//this.editText = (TextView) findViewById(R.id.SMSText);
this.deviceview = (TextView) findViewById(R.id.textView32);
this.button1 = (Button) findViewById(R.id.button1);
this.button2 = (Button) findViewById(R.id.button2);
this.button3 = (Button) findViewById(R.id.button3);
this.button4 = (Button) findViewById(R.id.button4);
this.button5 = (Button) findViewById(R.id.button5);
this.spinner = (Spinner) findViewById(R.id.spinner);
this.spinner2 = (Spinner) findViewById(R.id.spinner2);
this.volumebar = (SeekBar) findViewById(R.id.volumeBar);
this.audioManager = (AudioManager) getSystemService("audio");
this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
processIntent(getIntent());
initializeKakaoReceiver();
Regex(this.tts.getEngines().toString());
int permission = ContextCompat.checkSelfPermission(this, "android.permission.RECEIVE_SMS");
if (permission == 0) {
Toast.makeText(this, "메시지 수신 권한 있음.", 1).show();
this.button3.setBackgroundResource(R.drawable.on);
} else {
Toast.makeText(this, "메시지 수신 권한 없음.", 1).show();
ActivityCompat.requestPermissions(this, new String[]{"android.permission.RECEIVE_SMS"}, 1);
if (ActivityCompat.shouldShowRequestPermissionRationale(this, "android.permission.RECEIVE_SMS")) {
Toast.makeText(this, "메시지 권한 설명 필요함.", 1).show();
} else {
ActivityCompat.requestPermissions(this, new String[]{"android.permission.RECEIVE_SMS"}, 1);
}
}
this.button1.setTag(Integer.valueOf(permission));
this.button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
if (MainActivity.this.button1.getBackground().getConstantState().equals(MainActivity.this.getResources().getDrawable(R.drawable.stop).getConstantState())) {
MainActivity.this.button1.setBackgroundResource(R.drawable.start);
} else if (((Integer) view.getTag()).intValue() == 0) {
MainActivity.this.button1.setBackgroundResource(R.drawable.stop);
}
}
});
//권한 허가창 열기
this.button2.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS", Uri.fromParts("package", MainActivity.this.getPackageName(), (String) null));
intent.addFlags(268435456);
MainActivity.this.startActivity(intent);
}
});
//블루투스 연결창 열기
this.button4.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
MainActivity.this.startActivity(new Intent("android.settings.BLUETOOTH_SETTINGS"));
}
});
//TTS 속도조정
this.spinner.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.speed = 0.5d;
} else if (selectedItemPosition == 1) {
double unused2 = MainActivity.this.speed = 1.0d;
} else if (selectedItemPosition == 2) {
double unused3 = MainActivity.this.speed = 1.5d;
} else if (selectedItemPosition == 3) {
double unused4 = MainActivity.this.speed = 2.0d;
}
Log.d("spinner", "speed : " + MainActivity.this.speed);
}
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
this.spinner2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
MainActivity mainActivity = MainActivity.this;
String unused = mainActivity.ttsengine = mainActivity.engineList.get(i);
MainActivity.this.tts.stop();
MainActivity mainActivity2 = MainActivity.this;
TextToSpeech unused2 = mainActivity2.tts = new TextToSpeech(mainActivity2, mainActivity2, mainActivity2.ttsengine);
}
public void onNothingSelected(AdapterView<?> adapterView) {
MainActivity mainActivity = MainActivity.this;
TextToSpeech unused = mainActivity.tts = new TextToSpeech(mainActivity, mainActivity, mainActivity.tts.getDefaultEngine());
}
});
this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothAdapter bluetoothAdapter2 = this.bluetoothAdapter;
if (bluetoothAdapter2 != null) {
if (bluetoothAdapter2.isEnabled()) {
this.button5.setBackgroundResource(R.drawable.on);
} else {
this.button5.setBackgroundResource(R.drawable.off);
startActivityForResult(new Intent("android.bluetooth.adapter.action.REQUEST_ENABLE"), 10);
}
}
registerReceiver(this.bluetoothReceiver, new IntentFilter("android.bluetooth.device.action.ACL_CONNECTED"));
registerReceiver(this.bluetoothReceiver, new IntentFilter("android.bluetooth.device.action.ACL_DISCONNECTED"));
registerReceiver(this.kakaoReceiver, new IntentFilter("android.service.notification.NotificationListenerService"));
setSeekBar();
if (!permissionGrantred()) {
startActivity(new Intent(ACTION_NOTIFICATION_LISTENER_SETTINGS));
}
}
public void processIntent(Intent intent) {
if (intent != null) {
String sender = intent.getStringExtra("sender");
String contents = intent.getStringExtra("contents");
String date2 = intent.getStringExtra("receivedDate");
if (sender == null || contents == null) {
this.editText.setText((CharSequence) null);
} else {
TextView textView = this.editText;
textView.setText(sender + 10 + contents + 10);
moveTaskToBack(true);
}
if (!this.button1.getBackground().getConstantState().equals(getResources().getDrawable(R.drawable.stop).getConstantState())) {
return;
}
}
}
public void onInit(int status) {
if (status == 0) {
int language = this.tts.setLanguage(Locale.KOREAN);
if (language == -1 || language == -2) {
this.editText.setText("지원하지 않는 언어입니다.");
} else {
this.isTTSReady = status;
}
} else {
this.editText.setText("TTS 작업이 실패하였습니다.");
}
}
private void initializeKakaoReceiver() {
this.kakaoReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("android.service.notification.NotificationListenerService")) {
String kTitle = intent.getExtras().getString("realTitle");
CharSequence tempKBody = intent.getExtras().getCharSequence("realBody");
String KBody = tempKBody.toString();
if (kTitle != null || KBody != null) {
Intent intent1 = new Intent();
intent1.putExtra("sender", kTitle);
intent1.putExtra("contents", tempKBody);
intent1.putExtra("class", "KAKAO");
MainActivity.this.processIntent(intent1);
}
}
}
};
}
public void Regex(String str) {
Matcher m = Pattern.compile("name=[A-za-z.]+").matcher(str);
this.engineList = new ArrayList<>();
this.engineSpinnerList = new ArrayList<>();
int i = 0;
while (m.find()) {
this.engineList.add(m.group().substring(5));
if (m.group().substring(5).equals("com.google.android.tts")) {
this.engineSpinnerList.add("구글TTS");
} else if (m.group().substring(5).equals("com.samsung.SMT")) {
this.engineSpinnerList.add("삼성TTS");
} else {
this.engineSpinnerList.add(this.engineList.get(i));
}
i++;
}
this.arrayAdapter = new ArrayAdapter<>(getApplicationContext(), 17367049, this.engineSpinnerList);
this.spinner2.setAdapter(this.arrayAdapter);
}
public void setSeekBar() {
int nMax = this.audioManager.getStreamMaxVolume(3);
int nCurrentVolume = this.audioManager.getStreamVolume(3);
this.volumebar.setMax(nMax);
this.volumebar.setProgress(nCurrentVolume);
this.volumebar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
MainActivity.this.audioManager.setStreamVolume(3, progress, 0);
}
public void onStartTrackingTouch(SeekBar seekBar) {
}
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
public void onNewIntent(Intent intent) {
processIntent(intent);
initializeKakaoReceiver();
super.onNewIntent(intent);
}
private boolean permissionGrantred() {
Set<String> sets = NotificationManagerCompat.getEnabledListenerPackages(this);
if (sets == null || !sets.contains(getPackageName())) {
return false;
}
return true;
}
public void onRestart() {
super.onRestart();
if (!permissionGrantred()) {
startActivity(new Intent(ACTION_NOTIFICATION_LISTENER_SETTINGS));
}
int permission = ContextCompat.checkSelfPermission(this, "android.permission.RECEIVE_SMS");
if (permission == 0) {
Toast.makeText(this, "메시지 수신 권한 주어져 있음.", 1).show();
this.button3.setBackgroundResource(R.drawable.on);
} else {
Toast.makeText(this, "메시지 수신 권한 없음.", 1).show();
ActivityCompat.requestPermissions(this, new String[]{"android.permission.RECEIVE_SMS"}, 1);
if (ActivityCompat.shouldShowRequestPermissionRationale(this, "android.permission.RECEIVE_SMS")) {
Toast.makeText(this, "메시지 권한 설명 필요함.", 1).show();
} else {
ActivityCompat.requestPermissions(this, new String[]{"android.permission.RECEIVE_SMS"}, 1);
}
}
this.button1.setTag(Integer.valueOf(permission));
this.button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
if (MainActivity.this.button1.getBackground().getConstantState().equals(MainActivity.this.getResources().getDrawable(R.drawable.stop).getConstantState())) {
MainActivity.this.button1.setBackgroundResource(R.drawable.start);
} else if (((Integer) view.getTag()).intValue() == 0) {
MainActivity.this.button1.setBackgroundResource(R.drawable.stop);
}
}
});
this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothAdapter bluetoothAdapter2 = this.bluetoothAdapter;
if (bluetoothAdapter2 == null) {
this.button5.setBackgroundResource(R.drawable.off);
} else if (bluetoothAdapter2.isEnabled()) {
this.button5.setBackgroundResource(R.drawable.on);
} else {
this.button5.setBackgroundResource(R.drawable.off);
startActivityForResult(new Intent("android.bluetooth.adapter.action.REQUEST_ENABLE"), 10);
}
setSeekBar();
}
public void TextToSpeech(String str) {
if (this.isTTSReady == 0) {
this.tts.setPitch(1.0f);
this.tts.setSpeechRate((float) this.speed);
if (Build.VERSION.SDK_INT >= 21) {
this.tts.addEarcon("[alarm]", BuildConfig.APPLICATION_ID, R.raw.alarm);
this.tts.playEarcon("[alarm]", 1, (Bundle) null, "utteranceId");
this.tts.speak(str, 1, (Bundle) null, "utteranceId");
if (this.tts.isSpeaking()) {
Log.d("TEST", "SUCCESS");
return;
}
return;
}
HashMap<String, String> map = new HashMap<>();
map.put("utteranceId", "UniqueID");
this.tts.speak(str, 1, map);
}
}
//메시지 수신권한 질의결과
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
if (requestCode != 1 || grantResults.length <= 0) {
return;
}
if (grantResults[0] == 0) {
Toast.makeText(this, "메시지 수신권한을 사용자가 승인함", 1).show();
this.button3.setBackgroundResource(R.drawable.on);
this.button1.setBackgroundResource(R.drawable.stop);
} else if (grantResults[0] == -1) {
Toast.makeText(this, "메시지 수신권한을 사용자가 거부함", 1).show();
this.button3.setBackgroundResource(R.drawable.off);
this.button1.setBackgroundResource(R.drawable.start);
} else {
Toast.makeText(this, "메시지 수신권한을 부여받지 못함", 1).show();
this.button3.setBackgroundResource(R.drawable.off);
this.button1.setBackgroundResource(R.drawable.start);
}
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 10 && resultCode == 0) {
this.button5.setBackgroundResource(R.drawable.off);
} else if (requestCode == 10 && resultCode == -1) {
this.button5.setBackgroundResource(R.drawable.on);
}
}
//종료
public void onDestroy() {
TextToSpeech textToSpeech = this.tts;
if (textToSpeech != null) {
textToSpeech.stop();
this.tts.shutdown();
}
super.onDestroy();
}
}
\ No newline at end of file
package com.example.talktalkspeak;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
public class NotificationService extends NotificationListenerService {
public static final String TAG = "katextisok";
Context context;
public static final class ApplicationPackageNames {
public static final String KAKAO_PACK_NAME = "com.kakao.talk";
public static final String KAKAO_SAMPLE_PACK_NAME = "com.kakao.sdk.sample";
}
public static final class InterceptedNotificationCode {
public static final int KAKAO_CODE = 2;
public static final int KAKAO_SAMPLE_CODE = 1;
}
public void onCreate() {
super.onCreate();
this.context = getApplicationContext();
}
class NLServiceReceiver extends BroadcastReceiver {
NLServiceReceiver() {
}
public void onReceive(Context context, Intent intent) {
if (intent.getStringExtra("command").equals("clearall")) {
Toast.makeText(context, "clearall", 0).show();
NotificationService.this.cancelAllNotifications();
} else if (intent.getStringExtra("command").equals("list")) {
Toast.makeText(context, "list", 0).show();
Intent i1 = new Intent("NOTIFICATION_LISTENER_SERVICE");
i1.putExtra("notification_event", "====================");
NotificationService.this.sendBroadcast(i1);
int i = 1;
for (StatusBarNotification sbn : NotificationService.this.getActiveNotifications()) {
Intent i2 = new Intent("NOTIFICATION_LISTENER_SERVICE");
i2.putExtra("notification_event", i + " " + sbn.getPackageName() + "\n");
NotificationService.this.sendBroadcast(i2);
i++;
}
Intent i3 = new Intent("NOTIFICATION_LISTENER_EXAMPLE");
i3.putExtra("notificaation_event", "==== Notification List====");
NotificationService.this.sendBroadcast(i3);
}
}
}
public IBinder onBind(Intent intent) {
return super.onBind(intent);
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public void onNotificationPosted(StatusBarNotification sbn) {
if (sbn != null) {
int notificationCode = matchNotificationCode(sbn);
if (notificationCode == 1) {
Intent intent = new Intent("android.service.notification.NotificationListenerService");
intent.putExtra("Notification Code", notificationCode);
Bundle extras = sbn.getNotification().extras;
String sampletitle = extras.getString(NotificationCompat.EXTRA_TITLE);
CharSequence samplebody = extras.getCharSequence(NotificationCompat.EXTRA_TEXT);
Log.i("NotificationListener", "샘플 푸시 제목 : " + sampletitle);
Log.i("NotificationListener", "샘플 푸시 내용 : " + samplebody);
intent.putExtra("sampleTitle", sampletitle);
intent.putExtra("sampleBody", samplebody);
sendBroadcast(intent);
} else if (notificationCode == 2) {
Intent intent2 = new Intent("android.service.notification.NotificationListenerService");
intent2.putExtra("Notification Code", notificationCode);
Bundle extras2 = sbn.getNotification().extras;
String realTitle = extras2.getString(NotificationCompat.EXTRA_TITLE);
CharSequence realBody = extras2.getCharSequence(NotificationCompat.EXTRA_TEXT);
Log.i("NotificationListener", "푸시 제목 : " + realTitle);
Log.i("NotificationListener", "푸시 내용 : " + realBody);
if (realTitle != null && realBody != null) {
if (realTitle != null || realBody != null) {
intent2.putExtra("realTitle", realTitle);
intent2.putExtra("realBody", realBody);
sendBroadcast(intent2);
}
}
}
}
}
public void onNotificationRemoved(StatusBarNotification sbn) {
Log.i("kaTalk", "Notification Removed");
}
private int matchNotificationCode(StatusBarNotification sbn) {
String packageName = sbn.getPackageName();
if (packageName.equals(ApplicationPackageNames.KAKAO_PACK_NAME)) {
return 2;
}
if (packageName.equals(ApplicationPackageNames.KAKAO_SAMPLE_PACK_NAME)) {
return 1;
}
return 0;
}
}
\ No newline at end of file
package com.example.talktalkspeak;
public class Permission {
String pname;
}
\ No newline at end of file
package com.example.talktalkspeak;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.telephony.SmsMessage;
import android.util.Log;
import java.text.SimpleDateFormat;
import java.util.Date;
public class SmsReceiver extends BroadcastReceiver {
private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")) {
SmsMessage[] messages = parseSmsMessage(intent.getExtras());
if (messages.length > 0) {
sendToActivity(context, messages[0].getOriginatingAddress(), messages[0].getMessageBody().toString(), new Date(messages[0].getTimestampMillis()));
}
}
}
private String GetName(Context context, String str) {
String name = "str";
Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(str));
Cursor cursor = context.getContentResolver().query(uri, new String[]{"display_name"}, (String) null, (String[]) null, (String) null);
if (cursor != null) {
if (cursor.moveToFirst()) {
name = cursor.getString(0);
}
cursor.close();
}
return name;
}
private void sendToActivity(Context context, String sender, String contents, Date receivedDate) {
Intent intent = new Intent(context, MainActivity.class);
intent.addFlags(872415232);
intent.putExtra("sender", sender);
intent.putExtra("contents", contents);
intent.putExtra("receivedDate", format.format(receivedDate));
intent.putExtra("class", "SMS");
Log.d("SMSToSpeech", "Sender :" + sender);
Log.d("SMSToSpeech", "contents : " + contents);
Log.d("SMSToSpeech", "receivedDate : " + receivedDate);
context.startActivity(intent);
}
private SmsMessage[] parseSmsMessage(Bundle bundle) {
Object[] objs = (Object[]) bundle.get("pdus");
SmsMessage[] messages = new SmsMessage[objs.length];
for (int i = 0; i < objs.length; i++) {
if (Build.VERSION.SDK_INT >= 23) {
messages[i] = SmsMessage.createFromPdu((byte[]) objs[i], bundle.getString("format"));
} else {
messages[i] = SmsMessage.createFromPdu((byte[]) objs[i]);
}
}
return messages;
}
}
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/scrollView" android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical">
<Button
android:id="@+id/button1"
android:layout_width="220dp"
android:layout_height="220dp"
android:layout_margin="100dp"
android:background="@drawable/start"
app:srcCompat="@drawable/start" />
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"/>
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent">
<TextView android:textStyle="bold" android:textColor="@android:color/black" android:gravity="left|center_vertical|center_horizontal|center" android:id="@+id/textView2" android:background="#F7FE2E" android:paddingLeft="10dp" android:layout_width="match_parent" android:layout_height="40dp" android:text="알림 안내 권한" app:layout_constraintHorizontal_bias="0.313" app:layout_constraintVertical_bias="0.253"/>
<Button
android:id="@+id/button2"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="right|center_vertical|center_horizontal|center"
android:layout_marginRight="10dp"
android:background="@drawable/setting"
app:layout_constraintHorizontal_bias="0.95"
app:layout_constraintVertical_bias="0.289" />
</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/textView20" android:background="#FFFFFF" android:paddingLeft="10dp" android:layout_width="match_parent" android:layout_height="60dp" android:text="권한 허용 여부"/>
<Button
android:id="@+id/button3"
android:layout_width="50dp"
android:layout_height="40dp"
android:layout_gravity="right|center_vertical|center_horizontal|center"
android:layout_marginRight="10dp"
android:background="@drawable/on"
app:layout_constraintHorizontal_bias="0.95"
app:layout_constraintVertical_bias="0.188" />
</FrameLayout>
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent">
<TextView android:textStyle="bold" android:textColor="@android:color/black" android:gravity="left|center_vertical|center_horizontal|center" android:id="@+id/textView3" android:background="#F7FE2E" android:paddingLeft="10dp" android:layout_width="match_parent" android:layout_height="40dp" android:text="블루투스 연결상태" app:layout_constraintHorizontal_bias="0.313" app:layout_constraintVertical_bias="0.352"/>
<Button
android:id="@+id/button4"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="right|center_vertical|center_horizontal|center"
android:layout_marginRight="10dp"
android:background="@drawable/setting"
app:layout_constraintHorizontal_bias="0.95"
app:layout_constraintVertical_bias="0.387" />
</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/textView30" android:background="#FFFFFF" android:paddingLeft="10dp" android:layout_width="match_parent" android:layout_height="60dp" android:text="현재 상태"/>
<Button
android:id="@+id/button5"
android:layout_width="50dp"
android:layout_height="40dp"
android:layout_gravity="right|center_vertical|center_horizontal|center"
android:layout_marginRight="10dp"
android:background="@drawable/on"
app:layout_constraintHorizontal_bias="0.95"
app:layout_constraintVertical_bias="0.486" />
</FrameLayout>
<LinearLayout 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/textView31" android:background="#FFFFFF" android:paddingLeft="10dp" android:layout_width="0dp" android:layout_height="60dp" android:text="연결된 기기" android:layout_weight="1"/>
<TextView android:textSize="20sp" android:textColor="@android:color/black" android:gravity="right|center_vertical|center_horizontal|center" android:id="@+id/textView32" android:background="#FFFFFF" android:paddingRight="10dp" android:layout_width="0dp" android:layout_height="60dp" android:text="" android:layout_weight="1"/>
</LinearLayout>
<TextView android:textStyle="bold" android:textColor="@android:color/black" android:gravity="left|center_vertical|center_horizontal|center" android:id="@+id/textView4" android:background="#F7FE2E" android:paddingLeft="10dp" android:layout_width="match_parent" android:layout_height="40dp" android:text="사운드 설정" app:layout_constraintHorizontal_bias="0.313" app:layout_constraintVertical_bias="0.448"/>
<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/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>
<TextView android:textStyle="bold" android:textColor="@android:color/black" android:gravity="left|center_vertical|center_horizontal|center" android:id="@+id/textView5" android:background="#F7FE2E" android:paddingLeft="10dp" android:layout_width="match_parent" android:layout_height="40dp" android:text="읽기 설정" app:layout_constraintHorizontal_bias="0.313" app:layout_constraintVertical_bias="0.546"/>
<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/textView50" android:background="#FFFFFF" android:paddingLeft="10dp" android:layout_width="match_parent" android:layout_height="60dp" android:text="TTS 엔진 설정"/>
<Spinner
android:id="@+id/spinner2"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="right|center_vertical|center_horizontal|center" />
</FrameLayout>
</LinearLayout>
</ScrollView>
\ 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" />
</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" />
</adaptive-icon>
\ No newline at end of file
No preview for this file type
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="읽기속도">
<item>느림(0.5배속)</item>
<item>보통(1배속)</item>
<item>약간빠름(1.5배속)</item>
<item>빠름(2배속)</item>
</array>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
</resources>
<resources>
<string name="app_name">talktalkspeak</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
#Fri Jun 12 12:23:29 KST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
rootProject.name='talktalkspeak'
include ':app'