이수민

android

Showing 82 changed files with 2225 additions and 0 deletions
*.iml
.gradle
/local.properties
/.idea/caches/build_file_checksums.ser
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
.DS_Store
/build
/captures
.externalNativeBuild
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
</code_scheme>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<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="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="7">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="6">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" 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 26
defaultConfig {
applicationId "com.example.suemin.smartwindow"
minSdkVersion 24
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
# 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
package com.example.suemin.smartwindow;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.suemin.smartwindow", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.suemin.smartwindow">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-feature
android:name="android.hardware.bluetooth_le"
android:required="true" />
<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="com.example.suemin.smartwindow.view.MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.example.suemin.smartwindow.view.bluetooth.BluetoothLeService"/>
</application>
</manifest>
\ No newline at end of file
# Created by .ignore support plugin (hsz.mobi)
### Android template
# Built application files
*.apk
*.ap_
*.aab
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
release/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml
# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
# Google Services (e.g. APIs or Firebase)
# google-services.json
# Freeline
freeline.py
freeline/
freeline_project_description.json
# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
# Version control
vcs.xml
# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/
package com.example.suemin.smartwindow.view;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.media.AudioAttributes;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.app.NotificationCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.MenuItem;
import android.support.v7.widget.Toolbar;
import com.example.suemin.smartwindow.R;
import com.example.suemin.smartwindow.view.bluetooth.Bluetooth;
import com.example.suemin.smartwindow.view.environment.Env;
import com.example.suemin.smartwindow.view.home.Home;
public class MainActivity extends AppCompatActivity {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction;
Toolbar tb;
public static final String NOTIFICATION_CHANNEL_ID = "10001";
private int count = 0;
public static NotificationManager notificationManager;
public static NotificationCompat.Builder builder;
private static Uri sounduri;
Home homeFragment = new Home();
Env envFragment = new Env();
Bluetooth bluetoothFragment = new Bluetooth();
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
fragmentTransaction = fragmentManager.beginTransaction();
switch (item.getItemId()) {
case R.id.navigation_home:
replaceFragment(homeFragment);
return true;
case R.id.navigation_env:
replaceFragment(envFragment);
return true;
case R.id.navigation_bt:
replaceFragment(bluetoothFragment);
return true;
}
return false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tb = (Toolbar) findViewById(R.id.tb);
setSupportActionBar(tb);
fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.frameLayout, homeFragment).commitAllowingStateLoss();
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
builder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.icon_i2))
.setContentTitle("침입자 알림")
.setContentText("침입자가 감지되었습니다")
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setAutoCancel(true);
sounduri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.noti_sound);
}
public void replaceFragment(Fragment fragment) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.frameLayout, fragment).commit();
}
public static void NotificationSomethings() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setSmallIcon(R.drawable.icon);
CharSequence channelName = "channelname";
String description = "description";
int importance = NotificationManager.IMPORTANCE_HIGH;
AudioAttributes audioAttributes = new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_NOTIFICATION)
.setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)
.build();
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName , importance);
channel.setDescription(description);
channel.enableLights(true);
channel.setLightColor(Color.RED);
channel.setSound(sounduri, audioAttributes);
channel.enableVibration(true);
channel.setVibrationPattern(new long[] {100,200,300,200});
assert notificationManager != null;
notificationManager.createNotificationChannel(channel);
}else builder.setSmallIcon(R.mipmap.ic_launcher);
assert notificationManager != null;
notificationManager.notify(1234, builder.build());
}
}
package com.example.suemin.smartwindow.view.bluetooth;
import java.util.HashMap;
/**
* This class includes a small subset of standard GATT attributes for demonstration purposes.
*/
public class SampleAttributes {
private static HashMap<String, String> attributes = new HashMap();
public static String HM_10 = "0000ffe1-0000-1000-8000-00805f9b34fb";
public static String CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb";
static {
// Sample Services.
attributes.put("0000ffe0-0000-1000-8000-00805f9b34fb", "HM-10 Service");
attributes.put("0000180a-0000-1000-8000-00805f9b34fb", "Device Information Service");
// Sample Characteristics.
attributes.put(HM_10, "HM-10 Module");
attributes.put("00002a29-0000-1000-8000-00805f9b34fb", "Manufacturer Name String");
}
public static String lookup(String uuid, String defaultName) {
String name = attributes.get(uuid);
return name == null ? defaultName : name;
}
}
\ No newline at end of file
package com.example.suemin.smartwindow.view.bluetooth;
import android.content.Context;
import com.example.suemin.smartwindow.R;
import static com.example.suemin.smartwindow.view.MainActivity.NotificationSomethings;
import static com.example.suemin.smartwindow.view.bluetooth.Bluetooth.WindowState;
import static com.example.suemin.smartwindow.view.bluetooth.Bluetooth.setWindowState;
import static com.example.suemin.smartwindow.view.environment.listview.Finedust.getFineDustResult;
public class SensorResult {
static Context mcontext = null;
private static int otfd;
private static int infd;
private static String rain, intr, humd, temp = "0";
private static boolean raining = false, intruder = false;
public SensorResult(Context context){
this.mcontext=context;
}
private void setWindowBySensor() {
if ( "0".equals(otfd) || "0".equals(infd) || "0".equals(humd) || "0".equals(temp) ) { return ;}
else{
// 1. 비가 오거나 침입자 발생, 외부 미세먼지 수치가 높다
if (otfd > 80 || raining || intruder) {
// 열려있으면 닫는다
if (WindowState) {
setWindowState("y", mcontext.getString(R.string.addr_m));
}
}
// 1. 비 안오고 침입자 없고 미세먼지 보통 이하
if (otfd <= 80 && !raining && !intruder) {
// 닫혀있는데 내부 미세먼지 나쁨이상이거나 온도 높거나 습도 높으면 연다
if (!WindowState) {
if (infd > 80 || getTemperatureState() == "높음" || getHumidState() == "높음")
setWindowState("n", mcontext.getString(R.string.addr_m));
}
// 열려있는데 온도가 낮으면 닫는다
else {
if (getTemperatureState() == "낮음") {
setWindowState("y", mcontext.getString(R.string.addr_m));
}
}
}
}
}
public void setData(String data, String addr){
if(addr != null && mcontext != null){
String sensor = data.substring(0,5);
if(addr.equals(mcontext.getString(R.string.addr_r))) {
if (sensor.equals("intr ")) {
intr = data.substring(5);
intruder = true;
NotificationSomethings();
} else {
rain = data.substring(5);
raining = true;
}
}
else if (addr.equals(mcontext.getString(R.string.addr_d))){
if(sensor.equals("temp ")) {
temp = data.substring(5);
}
else if(sensor.equals("humd ")){
humd = data.substring(5);
}
else if(sensor.equals("dust ")){
if(Double.parseDouble(data.substring(5)) > 0) {
infd = Integer.parseInt(data.substring(5));
}
}
else{return;}
}
setWindowBySensor();
}
return ;
}
public static int getInnerDustResult(){
return infd;
}
public static double getHumidResult(){
if(humd == null){return 0;}
else { return Math.floor(Double.parseDouble(humd)*10)/10; }
}
public static double getTemperatureResult(){
if(temp == null){return 0;}
else { return Math.floor(Double.parseDouble(temp)*10)/10; }
}
public static String getRainResult(){
if(raining){
return "내림";
}
else {return "안내림";}
}
public static String getIntruderResult(){
if(intruder){
return "있음";
}
else {return "없음";}
}
public static String getOuterFineDustState(){
otfd = Integer.parseInt(getFineDustResult());
int value = otfd;
String state = null;
if(value <31){ state = "좋음";}
else if (value >30 && value <81){state = "보통";}
else if (value>80 && value <151){state = "나쁨";}
else{ state = "매우나쁨"; }
return state;
}
public static String getInnerFineDustState(){
int value = getInnerDustResult();
String state = null;
if(value <31){ state = "좋음";}
else if (value >30 && value <81){state = "보통";}
else if (value>80 && value <151){state = "나쁨";}
else{ state = "매우나쁨"; }
return state;
}
public static String getTemperatureState() {
double value = getTemperatureResult();
String state = null;
if (value < 18) {
state = "낮음";
} else if (value >= 18 && value <= 25) {
state = "적정";
} else{
state = "높음";
}
return state;
}
public static String getHumidState() {
double value = getHumidResult();
String state = null;
if (value < 40) {
state = "낮음";
} else if (value >= 40 && value <= 60) {
state = "적정";
} else {
state = "높음";
}
return state;
}
}
package com.example.suemin.smartwindow.view.environment;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.drawable.ColorDrawable;
import android.location.Address;
import android.location.Geocoder;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.suemin.smartwindow.R;
import com.example.suemin.smartwindow.view.environment.listview.CustomDialog;
import com.example.suemin.smartwindow.view.environment.listview.ListViewAdapter;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
public class Env extends Fragment {
private LocationManager locationManager;
private static final int REQUEST_CODE_LOCATION = 2;
private double lat;
private double lng;
private String addr;
private String subaddr;
public static String subaddr2;
private CustomDialog customDialog;
public Env() {
// Required empty public constructor
}
protected android.location.Location getCurrentLoca() {
android.location.Location currentLocation = null;
if(ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[] {Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_CODE_LOCATION);
} }
else {
locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 1, mLocationListener);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, mLocationListener);
}
return currentLocation;
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_CODE_LOCATION) {
if (permissions.length == 1 &&
permissions[0] == Manifest.permission.ACCESS_FINE_LOCATION &&
grantResults[0] == PackageManager.PERMISSION_GRANTED) {
} else {
}
// Permission was denied. Display an error message.
Toast.makeText(getActivity(), "LOCATION_ACCESS_PERMISSION_DENIED",Toast.LENGTH_SHORT).show();
}
}
private final LocationListener mLocationListener =new LocationListener() {
@Override
public void onLocationChanged(android.location.Location location) {
lat = location.getLatitude();
lng = location.getLongitude();
addr =getCurrentAddr(lat,lng);
int idx_s = addr.indexOf("시");
int idx_k = addr.indexOf("구");
int idx_g = addr.indexOf("동");
subaddr = addr.substring(idx_s+1, idx_g+1);
subaddr2 = addr.substring(idx_s+2, idx_k+1);
setLocationText(subaddr);
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
};
private String getCurrentAddr(double lat, double lng) {
Geocoder geocoder = new Geocoder(this.getActivity(), Locale.getDefault());
List<Address> addresses =null;
try {
addresses = geocoder.getFromLocation(
lat,
lng,
7);
} catch (IOException ioException) {
} catch (IllegalArgumentException illegalArgumentException) {
}
if (addresses == null) {
Log.d("getCurrentAddr: ","주소 미발견");
}
Address address = addresses.get(0);
return address.getAddressLine(0).toString()+"\n";
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getCurrentLoca();
}
public void setListView(View view) {
ListViewAdapter adapter = new ListViewAdapter();
ListView listView = (ListView) view.findViewById(R.id.list);
listView.setAdapter(adapter);
adapter.addItem("비", ContextCompat.getDrawable(this.getContext(), R.drawable.icon_rain));
adapter.addItem("실외 미세먼지", ContextCompat.getDrawable(this.getContext(), R.drawable.icon_om));
adapter.addItem("실내 미세먼지", ContextCompat.getDrawable(this.getContext(), R.drawable.icon_sm));
adapter.addItem("실내 온도", ContextCompat.getDrawable(this.getContext(), R.drawable.icon_t));
adapter.addItem("실내 습도", ContextCompat.getDrawable(this.getContext(), R.drawable.icon_s));
adapter.addItem("침입자", ContextCompat.getDrawable(this.getContext(), R.drawable.icon_i));
listView.setOnItemClickListener(listItemClickListener);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_env, container, false);
setListView(view);
return view;
}
private void setLocationText(String subaddr){
final TextView addrTxt = (TextView)getActivity().findViewById(R.id.location_text);
if(subaddr != null) addrTxt.setText(subaddr);
}
private AdapterView.OnItemClickListener listItemClickListener= new AdapterView.OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
customDialog = new CustomDialog(getActivity(), positiveListener);
customDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
customDialog.show();
customDialog.setText(position);
}
};
private View.OnClickListener positiveListener = new View.OnClickListener() {
public void onClick(View v) {
customDialog.dismiss();
}
};
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
@Override
public void onDetach() {
super.onDetach();
}
@Override
public void onDestroy() {
super.onDestroy();
locationManager.removeUpdates(mLocationListener);
}
}
package com.example.suemin.smartwindow.view.environment.listview;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import com.example.suemin.smartwindow.R;
import com.example.suemin.smartwindow.view.bluetooth.SensorResult;
public class CustomDialog extends Dialog {
private Button mPositiveButton;
private View.OnClickListener mPositiveListener;
private TextView AlertTitle, AlertNum, AlertState;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
layoutParams.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
layoutParams.dimAmount = 0.8f;
getWindow().setAttributes(layoutParams);
setContentView(R.layout.custom_dialog);
mPositiveButton=(Button)findViewById(R.id.pbutton);
mPositiveButton.setOnClickListener(mPositiveListener);
AlertTitle = (TextView) findViewById(R.id.dialog_title);
AlertNum = (TextView) findViewById(R.id.dialog_num);
AlertState= (TextView) findViewById(R.id.dialog_state);
}
public CustomDialog(@NonNull Context context, View.OnClickListener positiveListener) {
super(context);
this.mPositiveListener = positiveListener;
}
public boolean setText(int position)
{
switch (position) {
case 0:
AlertTitle.setText("현재 비");
AlertNum.setText(SensorResult.getRainResult());
break;
case 1:
AlertTitle.setText("현재 실외 미세먼지");
AlertNum.setText(Finedust.getFineDustResult()+"");
AlertState.setText("상태 : "+ SensorResult.getOuterFineDustState());
break;
case 2:
AlertTitle.setText("현재 실내 미세먼지");
AlertNum.setText("51");
AlertState.setText("상태 : " + SensorResult.getInnerFineDustState());
break;
case 3:
AlertTitle.setText("현재 실내 온도");
AlertNum.setText(SensorResult.getTemperatureResult() + "℃");
AlertState.setText("상태 : " + SensorResult.getTemperatureState());
break;
case 4:
AlertTitle.setText("현재 실내 습도");
AlertNum.setText(SensorResult.getHumidResult()+ "%");
AlertState.setText("상태 : " + SensorResult.getHumidState());
break;
case 5:
AlertTitle.setText("현재 침입자");
AlertNum.setText(SensorResult.getIntruderResult());
break;
}
return true;
}
}
package com.example.suemin.smartwindow.view.environment.listview;
import android.os.StrictMode;
import com.example.suemin.smartwindow.view.environment.Env;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
public class Finedust {
public static String getFineDustResult(){
String Key = "rqkQD0pLMXekuhOonOeI0xpbtEMtgBjTtMD5DZRWhDwQCezQGQsJ8bhg76N8YuihCKhY76QEWgsaZifSyupTDQ%3D%3D";
StrictMode.enableDefaults();
String currentLocation = Env.subaddr2;
boolean inPm10Value = false;
String pm10Value = null;
try{
URL url = new URL("http://openapi.airkorea.or.kr/openapi/services/rest/ArpltnInforInqireSvc/getMsrstnAcctoRltmMesureDnsty?numOfRows=1&pageNo=1&stationName="
+ currentLocation +"&dataTerm=DAILY&ver=1.3&ServiceKey="+Key);
XmlPullParserFactory parserCreator = XmlPullParserFactory.newInstance();
XmlPullParser parser = parserCreator.newPullParser();
parser.setInput(url.openStream(),null);
int parserEvent = parser.getEventType();
while(parserEvent != XmlPullParser.END_DOCUMENT){
switch(parserEvent){
case XmlPullParser.START_TAG:
if(parser.getName().equals("pm10Value")){
inPm10Value= true;
}
break;
case XmlPullParser.TEXT:
if(inPm10Value){
pm10Value = parser.getText();
inPm10Value = false;
}
break;
case XmlPullParser.END_TAG:
if(parser.getName().equals("item")){
}
break;
}
parserEvent= parser.next();
}
} catch (XmlPullParserException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return pm10Value;
}
}
package com.example.suemin.smartwindow.view.environment.listview;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.suemin.smartwindow.R;
import java.util.ArrayList;
public class ListViewAdapter extends BaseAdapter {
private ArrayList<ListViewItem> listViewItemList= new ArrayList<ListViewItem>();
public ListViewAdapter(){}
@Override
public int getCount() {
return listViewItemList.size();
}
@Override
public Object getItem(int position) {
return listViewItemList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final int pos = position;
final Context context = parent.getContext();
if(convertView == null){
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.listview_item, parent, false);
}
TextView titleTextView = (TextView) convertView.findViewById(R.id.textView1);
ImageView iconImageView = (ImageView) convertView.findViewById(R.id.imageView1);
ListViewItem listViewItem = listViewItemList.get(position);
titleTextView.setText(listViewItem.getTitle());
iconImageView.setImageDrawable(listViewItem.getIcon());
return convertView;
}
public void addItem(String title, Drawable icon){
ListViewItem item = new ListViewItem();
item.setTitle(title);
item.setIcon(icon);
listViewItemList.add(item);
}
}
package com.example.suemin.smartwindow.view.environment.listview;
import android.graphics.drawable.Drawable;
public class ListViewItem {
private String titleStr ;
private Drawable iconDrawable ;
public void setIcon(Drawable icon) {
iconDrawable = icon ;
}
public void setTitle(String title) {
titleStr = title ;
}
public Drawable getIcon() {
return this.iconDrawable ;
}
public String getTitle() {
return this.titleStr ;
}
}
package com.example.suemin.smartwindow.view.home;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;
import com.example.suemin.smartwindow.R;
import static com.example.suemin.smartwindow.view.bluetooth.Bluetooth.WindowState;
import static com.example.suemin.smartwindow.view.bluetooth.Bluetooth.setWindowState;
public class Home extends Fragment {
int num = 0;
public Home() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home, container, false);
final TextView optionState= (TextView) view.findViewById(R.id.textView_switch);
final ImageView imgState = (ImageView) view.findViewById(R.id.imageView2);
Switch sw = (Switch) view.findViewById(R.id.switch1);
sw.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked) {
optionState.setText("“ 열림 ”");
imgState.setImageResource(R.drawable.window_open);
if (!WindowState) {
setWindowState("n", getString(R.string.addr_m));
}
}
else{
num = num+1;
optionState.setText("“ 닫힘 ”");
imgState.setImageResource(R.drawable.window_closed);
if(WindowState) {setWindowState("y", getString(R.string.addr_m));
}
}
}
});
return view;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
@Override
public void onDetach() {
super.onDetach();
}
}
<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:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
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="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:shape="rectangle" >
<solid android:color="@color/colorPrimary" />
<gradient
android:startColor="@color/colorPrimary"
android:endColor="#FFFFFF"
android:angle= "270">
</gradient>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:shape="rectangle"
>
<solid android:color="#FFFFFF"></solid>
<corners
android:bottomLeftRadius="30dp"
android:bottomRightRadius="30dp"
android:topLeftRadius="30dp"
android:topRightRadius="30dp" />
<stroke
android:width="2dp"
android:color="@color/colorPrimaryDark" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:shape="rectangle" >
<solid android:color="@color/colorPrimaryDark" />
<corners
android:bottomLeftRadius="20dp"
android:bottomRightRadius="20dp"
android:topLeftRadius="20dp"
android:topRightRadius="20dp" />
<stroke
android:width="1dp"
android:color="@color/colorPrimaryDark" />
</shape>
\ No newline at end of file
<vector android:height="24dp" android:tint="#3A73C0"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"
>
<group
android:name="rotationGroup"
android:pivotX="12"
android:pivotY="12"
android:rotation= "90">
<path android:fillAlpha=".3" android:fillColor="#3a73c0" android:pathData="M17,5.33C17,4.6 16.4,4 15.67,4H14V2h-4v2H8.33C7.6,4 7,4.6 7,5.33V8h10V5.33z"/>
<path android:fillColor="#3a73c0" android:pathData="M7,8v12.67C7,21.4 7.6,22 8.33,22h7.33c0.74,0 1.34,-0.6 1.34,-1.33V8H7z"/>
</group>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="27.0"
android:viewportHeight="27.0">
<path
android:fillColor="@color/colorAccent"
android:pathData="M17.71,7.71L12,2h-1v7.59L6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 11,14.41L11,22h1l5.71,-5.71 -4.3,-4.29 4.3,-4.29zM13,5.83l1.88,1.88L13,9.59L13,5.83zM14.88,16.29L13,18.17v-3.76l1.88,1.88z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="30dp"
android:height="30dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#3a73c0"
android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96zM19,18H6c-2.21,0 -4,-1.79 -4,-4s1.79,-4 4,-4h0.71C7.37,7.69 9.48,6 12,6c3.04,0 5.5,2.46 5.5,5.5v0.5H19c1.66,0 3,1.34 3,3s-1.34,3 -3,3z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" />
</vector>
<?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="#008577"
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>
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
android:viewportWidth="480.011"
android:viewportHeight="480.011"
android:width="512dp"
android:height="512dp">
<path
android:pathData="M440.03 216.004c-14.362 -0.012 -26.964 -9.572 -30.844 -23.4 -10.301 -36.573 -32.069 -68.873 -62.1 -92.15 -63.11 -48.595 -151.033 -48.595 -214.143 0 -12.083 9.329 -22.896 20.195 -32.164 32.325l66.2 -19.471c16.955 -4.987 34.742 4.716 39.729 21.671s-4.716 34.742 -21.671 39.729l-135.994 40c-16.955 4.986 -34.742 -4.717 -39.728 -21.672 -0.694 -2.362 -1.114 -4.795 -1.251 -7.253l-8 -144c-1.104 -17.639 12.301 -32.832 29.939 -33.935s32.832 12.301 33.935 29.94c0.009 0.149 0.018 0.298 0.025 0.448l2.045 36.805c84.413 -89.396 222.822 -100.304 320.196 -25.237 40.928 31.727 70.593 75.753 84.629 125.6 4.75 17.023 -5.2 34.673 -22.223 39.423 -2.793 0.779 -5.678 1.175 -8.577 1.177zm-408.017 -192c-0.3 0 -0.593 0.009 -0.893 0.025 -8.816 0.503 -15.562 8.046 -15.082 16.863l8 144c0.491 8.823 8.041 15.577 16.864 15.087 1.228 -0.068 2.443 -0.278 3.623 -0.625l136 -40c8.478 -2.493 13.329 -11.387 10.835 -19.865s-11.387 -13.329 -19.865 -10.835l-87.453 25.722c-4.239 1.247 -8.686 -1.179 -9.932 -5.418 -0.624 -2.123 -0.342 -4.409 0.781 -6.316 12.433 -21.203 28.818 -39.824 48.268 -54.853l4.89 6.331 -4.89 -6.331c68.87 -53.045 164.83 -53.045 233.7 0 32.758 25.389 56.502 60.622 67.738 100.515 2.375 8.512 11.2 13.487 19.712 11.112s13.487 -11.2 11.112 -19.712c-13.103 -46.531 -40.794 -87.627 -79 -117.243 -80.393 -61.945 -192.431 -61.945 -272.824 0 -14.208 10.994 -27.043 23.658 -38.227 37.717 -2.753 3.456 -7.786 4.026 -11.242 1.273 -1.784 -1.421 -2.877 -3.536 -3.003 -5.814l-3.14 -56.523c-0.484 -8.471 -7.488 -15.096 -15.972 -15.11z"
android:fillColor="@color/colorAccent" />
<path
android:pathData="M240.013 480.004c-52.923 0.184 -104.385 -17.344 -146.193 -49.793 -40.928 -31.726 -70.592 -75.751 -84.627 -125.597 -4.689 -17.04 5.323 -34.654 22.363 -39.343 16.957 -4.666 34.501 5.226 39.284 22.15 10.301 36.571 32.069 68.869 62.1 92.143 76.608 59.134 186.648 44.969 245.782 -31.639 0.176 -0.228 0.351 -0.456 0.526 -0.685l-66.2 19.471c-16.882 5.23 -34.806 -4.216 -40.036 -21.098s4.216 -34.806 21.098 -40.036c0.292 -0.091 0.586 -0.177 0.881 -0.259l135.993 -40c16.955 -4.986 34.742 4.716 39.728 21.672 0.694 2.361 1.114 4.794 1.251 7.25l8 143.989c0.959 17.637 -12.54 32.723 -30.175 33.722 -0.6 0.034 -1.2 0.051 -1.8 0.051 -16.975 -0.012 -30.986 -13.276 -31.928 -30.225l-2.045 -36.8c-45.149 47.968 -108.129 75.124 -174.002 75.027zm-200.008 -199.985c-8.837 0.006 -15.995 7.175 -15.989 16.011 0.001 1.45 0.199 2.892 0.589 4.289 13.103 46.528 40.794 87.622 79 117.235 80.395 61.94 192.43 61.94 272.825 0 14.208 -10.994 27.042 -23.656 38.227 -37.714 2.753 -3.456 7.786 -4.026 11.242 -1.273 1.784 1.421 2.876 3.536 3.003 5.813l3.14 56.518c0.547 8.82 8.141 15.526 16.96 14.978 8.739 -0.542 15.419 -8.009 14.99 -16.754l-8 -143.988c-0.491 -8.823 -8.042 -15.577 -16.865 -15.086 -1.228 0.068 -2.444 0.278 -3.623 0.625l-135.995 40c-8.483 2.476 -13.352 11.359 -10.876 19.842s11.359 13.352 19.842 10.876c0.021 -0.006 0.041 -0.012 0.062 -0.018l87.449 -25.719c4.239 -1.247 8.686 1.178 9.933 5.416 0.625 2.123 0.342 4.411 -0.781 6.318 -12.433 21.202 -28.818 39.821 -48.268 54.848 -68.871 53.043 -164.829 53.043 -233.7 0 -32.755 -25.385 -56.498 -60.613 -67.735 -100.5 -1.936 -6.923 -8.242 -11.712 -15.43 -11.717z"
android:fillColor="@color/colorAccent" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
<font
android:fontStyle = "normal"
android:fontWeight="400"
android:font = "@font/noto"/>
<font
android:fontStyle = "normal"
android:fontWeight = "400"
android:font = "@font/beba"/>
</font-family>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.suemin.smartwindow.view.MainActivity"
>
<android.support.v7.widget.Toolbar
android:id="@+id/tb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark">
<ImageView
android:layout_width="32dp"
android:layout_height="30dp"
android:src="@drawable/icon"
android:paddingTop="8dp"
android:layout_marginRight="5dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:text="@string/app_name"
android:fontFamily="@font/beba"
android:textColor="@color/colorAccent"
android:textSize="21dp"
android:textStyle="bold"
/>
</android.support.v7.widget.Toolbar>
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:layout_marginBottom="?attr/actionBarSize"
/>
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:background="@color/colorPrimaryDark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/navigation" />
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/bt_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:gravity="left"
android:text="name"
android:textColor="@color/colorAccent"
android:fontFamily="@font/noto"
android:textSize="21dp"
/>
<TextView
android:id="@+id/bt_textView_addr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:gravity="left"
android:text="addr"
android:textColor="@color/colorAccent"
android:textSize="14dp"
android:layout_below="@+id/bt_textView"
/>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="250dp"
android:layout_height="wrap_content"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:gravity="center"
android:orientation="vertical"
android:background="@drawable/dialog_background">
<TextView
android:id="@+id/dialog_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:textSize="20dp" />
<TextView
android:id="@+id/dialog_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:textSize="60dp" />
<TextView
android:id="@+id/dialog_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:textSize="15dp" />
<Button
android:id="@+id/pbutton"
android:layout_width="50dp"
android:layout_height="25dp"
android:layout_marginBottom="10dp"
android:background="@drawable/dialog_button_background"
android:text="OK"
android:textColor="@color/colorAccent"/>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.suemin.smartwindow.view.bluetooth.Bluetooth"
android:background="@color/colorPrimaryDark">
<TextView
android:layout_width="wrap_content"
android:layout_height="22dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:text="검색된 기기"
android:textSize="12dp"
android:textStyle="bold"
android:textColor="#a04e4e4e"/>
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp">
</ListView>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_gravity="bottom"
android:paddingBottom="15dp">
<Button
android:id="@+id/bt_find_btn"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="20dp"
android:background="@drawable/sync"
/>
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.example.suemin.smartwindow.view.environment.Env"
android:background="@color/colorPrimaryDark">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<!-- TODO: Update blank fragment layout -->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginTop="10dp"
>
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="7dp"
android:id="@+id/imageView1"
android:layout_centerVertical="true"
android:src="@drawable/icon_loca"
/>
<TextView
android:id="@+id/location_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:layout_marginStart="2dp"
android:layout_toRightOf="@+id/imageView1"
android:text="위치 확인중..."
android:textColor="@color/colorAccent"
android:textSize="12dp"/>
</RelativeLayout>
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.example.suemin.smartwindow.view.home.Home"
android:background="@color/colorPrimaryDark">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView2"
android:layout_width="197dp"
android:layout_height="200dp"
android:layout_marginTop="80dp"
android:layout_marginBottom="50dp"
android:adjustViewBounds="true"
android:src="@drawable/window_closed"
android:layout_centerHorizontal="true"
/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="100dp"
android:layout_below="@id/imageView2"
android:layout_centerHorizontal="true"
>
<Switch
android:id="@+id/switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/switch1"
android:layout_centerHorizontal="true"
android:textColor="@color/colorAccent"
android:text="현재 창문 상태는"
android:textSize="17dp" />
<TextView
android:id="@+id/textView_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/noto"
android:text="“ 닫힘 ”"
android:textSize="25dp"
android:textStyle="bold"
android:textColor="@color/colorAccent"
android:layout_below="@id/textView2"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="State : "
android:textSize="18sp"/>
<Space android:layout_width="5dp"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/connection_state"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="no_data"
android:textSize="18sp"/>
</LinearLayout>
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Data : "
android:id="@+id/device_name"
android:textSize="18sp"/>
<Space android:layout_width="5dp"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/data_value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="no_data"
android:textSize="18sp"/>
</LinearLayout>
<ExpandableListView android:id="@+id/gatt_services_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="15dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="fill_horizontal"
android:fontFamily="@font/noto"
android:text="New Text"
android:layout_toRightOf="@id/imageView1"
android:textColor="@color/colorAccent"
android:textSize="21dp" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/imageView1"
android:layout_marginLeft="5dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_cloud_queue_black_24dp"
/>
</RelativeLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/sv_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:gravity="left"
android:text="name"
android:textColor="@color/colorAccent"
android:fontFamily="@font/noto"
android:textSize="21dp"
/>
<TextView
android:id="@+id/sv_uuid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:gravity="left"
android:text="addr"
android:textColor="@color/colorAccent"
android:textSize="14dp"
android:layout_below="@+id/sv_textView"
/>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/navigation_bt"
android:title="BT"
android:icon="@drawable/ic_bluetooth_black_24dp"
app:showAsAction="always"
/>
</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/navigation_home"
android:icon="@drawable/ic_home_black_24dp"
android:title="@string/title_home"
/>
<item
android:id="@+id/navigation_env"
android:icon="@drawable/ic_cloud_queue_black_24dp"
android:title="@string/title_activity_main2" />
<item
android:id="@+id/navigation_bt"
android:icon="@drawable/ic_bluetooth_black_24dp"
android:title="@string/title_activity_main33" />
</menu>
<?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
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#000000</color>
<color name="colorPrimaryDark">#7899ddff</color>
<color name="colorAccent">#f0646a71</color>
</resources>
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="text_margin">16dp</dimen>
</resources>
<resources>
<string name="app_name">SMART WINDOW</string>
<string name="title_home">Home</string>
<string name="title_activity_main2">Environment</string>
<string name="title_activity_main33">Bluetooth</string>
<string name="connected">Connected</string>
<string name="disconnected">Disconnected</string>
<string name="addr_m">90:E2:02:8F:36:70</string>
<string name="addr_d">90:E2:02:8E:1F:21</string>
<string name="addr_r">90:E2:02:92:A9:0E</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
package com.example.suemin.smartwindow;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
// 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.2.1'
// 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
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#!/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