이수민

android

Showing 82 changed files with 2225 additions and 0 deletions
1 +*.iml
2 +.gradle
3 +/local.properties
4 +/.idea/caches/build_file_checksums.ser
5 +/.idea/libraries
6 +/.idea/modules.xml
7 +/.idea/workspace.xml
8 +.DS_Store
9 +/build
10 +/captures
11 +.externalNativeBuild
1 +<component name="ProjectCodeStyleConfiguration">
2 + <code_scheme name="Project" version="173">
3 + <Objective-C-extensions>
4 + <file>
5 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
6 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
7 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
8 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
9 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
10 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
11 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
12 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
13 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
14 + </file>
15 + <class>
16 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
17 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
18 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
19 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
20 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
21 + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
22 + </class>
23 + <extensions>
24 + <pair source="cpp" header="h" fileNamingConvention="NONE" />
25 + <pair source="c" header="h" fileNamingConvention="NONE" />
26 + </extensions>
27 + </Objective-C-extensions>
28 + </code_scheme>
29 +</component>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="GradleSettings">
4 + <option name="linkedExternalProjectsSettings">
5 + <GradleProjectSettings>
6 + <option name="distributionType" value="DEFAULT_WRAPPED" />
7 + <option name="externalProjectPath" value="$PROJECT_DIR$" />
8 + <option name="modules">
9 + <set>
10 + <option value="$PROJECT_DIR$" />
11 + <option value="$PROJECT_DIR$/app" />
12 + </set>
13 + </option>
14 + <option name="resolveModulePerSourceSet" value="false" />
15 + </GradleProjectSettings>
16 + </option>
17 + </component>
18 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="NullableNotNullManager">
4 + <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
5 + <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
6 + <option name="myNullables">
7 + <value>
8 + <list size="7">
9 + <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
10 + <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
11 + <item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
12 + <item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
13 + <item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
14 + <item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
15 + <item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
16 + </list>
17 + </value>
18 + </option>
19 + <option name="myNotNulls">
20 + <value>
21 + <list size="6">
22 + <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
23 + <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
24 + <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
25 + <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
26 + <item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
27 + <item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
28 + </list>
29 + </value>
30 + </option>
31 + </component>
32 + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
33 + <output url="file://$PROJECT_DIR$/build/classes" />
34 + </component>
35 + <component name="ProjectType">
36 + <option name="id" value="Android" />
37 + </component>
38 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="RunConfigurationProducerService">
4 + <option name="ignoredProducers">
5 + <set>
6 + <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
7 + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
8 + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
9 + </set>
10 + </option>
11 + </component>
12 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +apply plugin: 'com.android.application'
2 +
3 +android {
4 + compileSdkVersion 26
5 + defaultConfig {
6 + applicationId "com.example.suemin.smartwindow"
7 + minSdkVersion 24
8 + targetSdkVersion 26
9 + versionCode 1
10 + versionName "1.0"
11 + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 + }
13 + buildTypes {
14 + release {
15 + minifyEnabled false
16 + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 + }
18 + }
19 +}
20 +
21 +dependencies {
22 + implementation fileTree(dir: 'libs', include: ['*.jar'])
23 + implementation 'com.android.support:appcompat-v7:26.+'
24 + implementation 'com.android.support:design:26.+'
25 + implementation 'com.android.support.constraint:constraint-layout:1.1.3'
26 + implementation 'com.android.support:support-v4:26.1.0'
27 + implementation 'com.android.support:recyclerview-v7:26.1.0'
28 + testImplementation 'junit:junit:4.12'
29 + androidTestImplementation 'com.android.support.test:runner:1.0.2'
30 + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
31 +}
1 +# Add project specific ProGuard rules here.
2 +# You can control the set of applied configuration files using the
3 +# proguardFiles setting in build.gradle.
4 +#
5 +# For more details, see
6 +# http://developer.android.com/guide/developing/tools/proguard.html
7 +
8 +# If your project uses WebView with JS, uncomment the following
9 +# and specify the fully qualified class name to the JavaScript interface
10 +# class:
11 +#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 +# public *;
13 +#}
14 +
15 +# Uncomment this to preserve the line number information for
16 +# debugging stack traces.
17 +#-keepattributes SourceFile,LineNumberTable
18 +
19 +# If you keep the line number information, uncomment this to
20 +# hide the original source file name.
21 +#-renamesourcefileattribute SourceFile
1 +package com.example.suemin.smartwindow;
2 +
3 +import android.content.Context;
4 +import android.support.test.InstrumentationRegistry;
5 +import android.support.test.runner.AndroidJUnit4;
6 +
7 +import org.junit.Test;
8 +import org.junit.runner.RunWith;
9 +
10 +import static org.junit.Assert.*;
11 +
12 +/**
13 + * Instrumented test, which will execute on an Android device.
14 + *
15 + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16 + */
17 +@RunWith(AndroidJUnit4.class)
18 +public class ExampleInstrumentedTest {
19 + @Test
20 + public void useAppContext() {
21 + // Context of the app under test.
22 + Context appContext = InstrumentationRegistry.getTargetContext();
23 +
24 + assertEquals("com.example.suemin.smartwindow", appContext.getPackageName());
25 + }
26 +}
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 + package="com.example.suemin.smartwindow">
4 +
5 + <uses-permission android:name="android.permission.INTERNET" />
6 + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
7 + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
8 + <uses-permission android:name="android.permission.BLUETOOTH" />
9 + <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
10 +
11 + <uses-feature
12 + android:name="android.hardware.bluetooth_le"
13 + android:required="true" />
14 +
15 + <application
16 + android:allowBackup="true"
17 + android:icon="@mipmap/ic_launcher"
18 + android:label="@string/app_name"
19 + android:roundIcon="@mipmap/ic_launcher_round"
20 + android:supportsRtl="true"
21 + android:theme="@style/AppTheme">
22 + <activity
23 + android:name="com.example.suemin.smartwindow.view.MainActivity"
24 + android:label="@string/app_name">
25 + <intent-filter>
26 + <action android:name="android.intent.action.MAIN" />
27 +
28 + <category android:name="android.intent.category.LAUNCHER" />
29 + </intent-filter>
30 + </activity>
31 + <service android:name="com.example.suemin.smartwindow.view.bluetooth.BluetoothLeService"/>
32 + </application>
33 +
34 +</manifest>
...\ No newline at end of file ...\ No newline at end of file
1 +# Created by .ignore support plugin (hsz.mobi)
2 +### Android template
3 +# Built application files
4 +*.apk
5 +*.ap_
6 +*.aab
7 +
8 +# Files for the ART/Dalvik VM
9 +*.dex
10 +
11 +# Java class files
12 +*.class
13 +
14 +# Generated files
15 +bin/
16 +gen/
17 +out/
18 +release/
19 +
20 +# Gradle files
21 +.gradle/
22 +build/
23 +
24 +# Local configuration file (sdk path, etc)
25 +local.properties
26 +
27 +# Proguard folder generated by Eclipse
28 +proguard/
29 +
30 +# Log Files
31 +*.log
32 +
33 +# Android Studio Navigation editor temp files
34 +.navigation/
35 +
36 +# Android Studio captures folder
37 +captures/
38 +
39 +# IntelliJ
40 +*.iml
41 +.idea/workspace.xml
42 +.idea/tasks.xml
43 +.idea/gradle.xml
44 +.idea/assetWizardSettings.xml
45 +.idea/dictionaries
46 +.idea/libraries
47 +# Android Studio 3 in .gitignore file.
48 +.idea/caches
49 +.idea/modules.xml
50 +# Comment next line if keeping position of elements in Navigation Editor is relevant for you
51 +.idea/navEditor.xml
52 +
53 +# Keystore files
54 +# Uncomment the following lines if you do not want to check your keystore files in.
55 +#*.jks
56 +#*.keystore
57 +
58 +# External native build folder generated in Android Studio 2.2 and later
59 +.externalNativeBuild
60 +
61 +# Google Services (e.g. APIs or Firebase)
62 +# google-services.json
63 +
64 +# Freeline
65 +freeline.py
66 +freeline/
67 +freeline_project_description.json
68 +
69 +# fastlane
70 +fastlane/report.xml
71 +fastlane/Preview.html
72 +fastlane/screenshots
73 +fastlane/test_output
74 +fastlane/readme.md
75 +
76 +# Version control
77 +vcs.xml
78 +
79 +# lint
80 +lint/intermediates/
81 +lint/generated/
82 +lint/outputs/
83 +lint/tmp/
84 +# lint/reports/
85 +
1 +package com.example.suemin.smartwindow.view;
2 +
3 +import android.app.NotificationChannel;
4 +import android.app.NotificationManager;
5 +import android.content.Context;
6 +import android.graphics.BitmapFactory;
7 +import android.graphics.Color;
8 +import android.media.AudioAttributes;
9 +import android.net.Uri;
10 +import android.os.Build;
11 +import android.os.Bundle;
12 +import android.support.annotation.NonNull;
13 +import android.support.design.widget.BottomNavigationView;
14 +import android.support.v4.app.Fragment;
15 +import android.support.v4.app.NotificationCompat;
16 +import android.support.v7.app.AppCompatActivity;
17 +import android.support.v4.app.FragmentManager;
18 +import android.support.v4.app.FragmentTransaction;
19 +import android.view.MenuItem;
20 +import android.support.v7.widget.Toolbar;
21 +
22 +
23 +import com.example.suemin.smartwindow.R;
24 +import com.example.suemin.smartwindow.view.bluetooth.Bluetooth;
25 +import com.example.suemin.smartwindow.view.environment.Env;
26 +import com.example.suemin.smartwindow.view.home.Home;
27 +
28 +public class MainActivity extends AppCompatActivity {
29 + FragmentManager fragmentManager = getSupportFragmentManager();
30 + FragmentTransaction fragmentTransaction;
31 + Toolbar tb;
32 +
33 + public static final String NOTIFICATION_CHANNEL_ID = "10001";
34 + private int count = 0;
35 + public static NotificationManager notificationManager;
36 + public static NotificationCompat.Builder builder;
37 + private static Uri sounduri;
38 +
39 + Home homeFragment = new Home();
40 + Env envFragment = new Env();
41 + Bluetooth bluetoothFragment = new Bluetooth();
42 +
43 + private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
44 + = new BottomNavigationView.OnNavigationItemSelectedListener() {
45 +
46 + @Override
47 + public boolean onNavigationItemSelected(@NonNull MenuItem item) {
48 + fragmentTransaction = fragmentManager.beginTransaction();
49 +
50 + switch (item.getItemId()) {
51 + case R.id.navigation_home:
52 + replaceFragment(homeFragment);
53 + return true;
54 + case R.id.navigation_env:
55 + replaceFragment(envFragment);
56 + return true;
57 + case R.id.navigation_bt:
58 + replaceFragment(bluetoothFragment);
59 + return true;
60 + }
61 + return false;
62 + }
63 + };
64 + @Override
65 + protected void onCreate(Bundle savedInstanceState) {
66 + super.onCreate(savedInstanceState);
67 + setContentView(R.layout.activity_main);
68 +
69 +
70 + tb = (Toolbar) findViewById(R.id.tb);
71 + setSupportActionBar(tb);
72 +
73 + fragmentTransaction = fragmentManager.beginTransaction();
74 + fragmentTransaction.replace(R.id.frameLayout, homeFragment).commitAllowingStateLoss();
75 +
76 + BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
77 +
78 + navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
79 +
80 + notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
81 + builder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
82 + .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.icon_i2))
83 + .setContentTitle("침입자 알림")
84 + .setContentText("침입자가 감지되었습니다")
85 + .setPriority(NotificationCompat.PRIORITY_DEFAULT)
86 + .setAutoCancel(true);
87 + sounduri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.noti_sound);
88 +
89 + }
90 + public void replaceFragment(Fragment fragment) {
91 + FragmentManager fragmentManager = getSupportFragmentManager();
92 + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
93 + fragmentTransaction.replace(R.id.frameLayout, fragment).commit();
94 + }
95 +
96 + public static void NotificationSomethings() {
97 +
98 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
99 +
100 + builder.setSmallIcon(R.drawable.icon);
101 + CharSequence channelName = "channelname";
102 + String description = "description";
103 + int importance = NotificationManager.IMPORTANCE_HIGH;
104 + AudioAttributes audioAttributes = new AudioAttributes.Builder()
105 + .setUsage(AudioAttributes.USAGE_NOTIFICATION)
106 + .setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)
107 + .build();
108 +
109 + NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName , importance);
110 + channel.setDescription(description);
111 + channel.enableLights(true);
112 + channel.setLightColor(Color.RED);
113 + channel.setSound(sounduri, audioAttributes);
114 + channel.enableVibration(true);
115 + channel.setVibrationPattern(new long[] {100,200,300,200});
116 +
117 + assert notificationManager != null;
118 + notificationManager.createNotificationChannel(channel);
119 +
120 + }else builder.setSmallIcon(R.mipmap.ic_launcher);
121 + assert notificationManager != null;
122 + notificationManager.notify(1234, builder.build());
123 +
124 + }
125 +
126 +}
1 +package com.example.suemin.smartwindow.view.bluetooth;
2 +
3 +import java.util.HashMap;
4 +
5 +/**
6 + * This class includes a small subset of standard GATT attributes for demonstration purposes.
7 + */
8 +public class SampleAttributes {
9 + private static HashMap<String, String> attributes = new HashMap();
10 + public static String HM_10 = "0000ffe1-0000-1000-8000-00805f9b34fb";
11 + public static String CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb";
12 +
13 + static {
14 + // Sample Services.
15 + attributes.put("0000ffe0-0000-1000-8000-00805f9b34fb", "HM-10 Service");
16 + attributes.put("0000180a-0000-1000-8000-00805f9b34fb", "Device Information Service");
17 + // Sample Characteristics.
18 + attributes.put(HM_10, "HM-10 Module");
19 + attributes.put("00002a29-0000-1000-8000-00805f9b34fb", "Manufacturer Name String");
20 + }
21 +
22 + public static String lookup(String uuid, String defaultName) {
23 + String name = attributes.get(uuid);
24 + return name == null ? defaultName : name;
25 + }
26 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.example.suemin.smartwindow.view.bluetooth;
2 +
3 +
4 +import android.content.Context;
5 +
6 +import com.example.suemin.smartwindow.R;
7 +import static com.example.suemin.smartwindow.view.MainActivity.NotificationSomethings;
8 +import static com.example.suemin.smartwindow.view.bluetooth.Bluetooth.WindowState;
9 +import static com.example.suemin.smartwindow.view.bluetooth.Bluetooth.setWindowState;
10 +import static com.example.suemin.smartwindow.view.environment.listview.Finedust.getFineDustResult;
11 +
12 +public class SensorResult {
13 + static Context mcontext = null;
14 + private static int otfd;
15 + private static int infd;
16 + private static String rain, intr, humd, temp = "0";
17 + private static boolean raining = false, intruder = false;
18 + public SensorResult(Context context){
19 + this.mcontext=context;
20 + }
21 + private void setWindowBySensor() {
22 + if ( "0".equals(otfd) || "0".equals(infd) || "0".equals(humd) || "0".equals(temp) ) { return ;}
23 + else{
24 +
25 + // 1. 비가 오거나 침입자 발생, 외부 미세먼지 수치가 높다
26 + if (otfd > 80 || raining || intruder) {
27 + // 열려있으면 닫는다
28 + if (WindowState) {
29 + setWindowState("y", mcontext.getString(R.string.addr_m));
30 + }
31 + }
32 + // 1. 비 안오고 침입자 없고 미세먼지 보통 이하
33 + if (otfd <= 80 && !raining && !intruder) {
34 + // 닫혀있는데 내부 미세먼지 나쁨이상이거나 온도 높거나 습도 높으면 연다
35 + if (!WindowState) {
36 + if (infd > 80 || getTemperatureState() == "높음" || getHumidState() == "높음")
37 + setWindowState("n", mcontext.getString(R.string.addr_m));
38 + }
39 + // 열려있는데 온도가 낮으면 닫는다
40 + else {
41 + if (getTemperatureState() == "낮음") {
42 + setWindowState("y", mcontext.getString(R.string.addr_m));
43 + }
44 + }
45 + }
46 + }
47 + }
48 + public void setData(String data, String addr){
49 + if(addr != null && mcontext != null){
50 + String sensor = data.substring(0,5);
51 + if(addr.equals(mcontext.getString(R.string.addr_r))) {
52 + if (sensor.equals("intr ")) {
53 + intr = data.substring(5);
54 + intruder = true;
55 + NotificationSomethings();
56 + } else {
57 + rain = data.substring(5);
58 + raining = true;
59 + }
60 + }
61 + else if (addr.equals(mcontext.getString(R.string.addr_d))){
62 + if(sensor.equals("temp ")) {
63 + temp = data.substring(5);
64 + }
65 + else if(sensor.equals("humd ")){
66 + humd = data.substring(5);
67 + }
68 + else if(sensor.equals("dust ")){
69 + if(Double.parseDouble(data.substring(5)) > 0) {
70 + infd = Integer.parseInt(data.substring(5));
71 + }
72 + }
73 + else{return;}
74 + }
75 + setWindowBySensor();
76 + }
77 + return ;
78 + }
79 + public static int getInnerDustResult(){
80 + return infd;
81 + }
82 + public static double getHumidResult(){
83 + if(humd == null){return 0;}
84 + else { return Math.floor(Double.parseDouble(humd)*10)/10; }
85 + }
86 + public static double getTemperatureResult(){
87 + if(temp == null){return 0;}
88 + else { return Math.floor(Double.parseDouble(temp)*10)/10; }
89 + }
90 + public static String getRainResult(){
91 + if(raining){
92 + return "내림";
93 + }
94 + else {return "안내림";}
95 +
96 + }
97 + public static String getIntruderResult(){
98 + if(intruder){
99 + return "있음";
100 + }
101 + else {return "없음";}
102 + }
103 + public static String getOuterFineDustState(){
104 + otfd = Integer.parseInt(getFineDustResult());
105 + int value = otfd;
106 + String state = null;
107 + if(value <31){ state = "좋음";}
108 + else if (value >30 && value <81){state = "보통";}
109 + else if (value>80 && value <151){state = "나쁨";}
110 + else{ state = "매우나쁨"; }
111 + return state;
112 + }
113 + public static String getInnerFineDustState(){
114 + int value = getInnerDustResult();
115 + String state = null;
116 + if(value <31){ state = "좋음";}
117 + else if (value >30 && value <81){state = "보통";}
118 + else if (value>80 && value <151){state = "나쁨";}
119 + else{ state = "매우나쁨"; }
120 + return state;
121 + }
122 + public static String getTemperatureState() {
123 + double value = getTemperatureResult();
124 + String state = null;
125 + if (value < 18) {
126 + state = "낮음";
127 + } else if (value >= 18 && value <= 25) {
128 + state = "적정";
129 + } else{
130 + state = "높음";
131 + }
132 + return state;
133 + }
134 + public static String getHumidState() {
135 + double value = getHumidResult();
136 + String state = null;
137 + if (value < 40) {
138 + state = "낮음";
139 + } else if (value >= 40 && value <= 60) {
140 + state = "적정";
141 + } else {
142 + state = "높음";
143 + }
144 + return state;
145 + }
146 +
147 +}
1 +package com.example.suemin.smartwindow.view.environment;
2 +
3 +import android.Manifest;
4 +import android.content.Context;
5 +import android.content.pm.PackageManager;
6 +import android.graphics.drawable.ColorDrawable;
7 +import android.location.Address;
8 +import android.location.Geocoder;
9 +import android.location.LocationListener;
10 +import android.location.LocationManager;
11 +import android.os.Build;
12 +import android.os.Bundle;
13 +import android.support.annotation.NonNull;
14 +import android.support.v4.app.Fragment;
15 +import android.support.v4.content.ContextCompat;
16 +import android.util.Log;
17 +import android.view.LayoutInflater;
18 +import android.view.View;
19 +import android.view.ViewGroup;
20 +import android.widget.AdapterView;
21 +import android.widget.ListView;
22 +import android.widget.TextView;
23 +import android.widget.Toast;
24 +
25 +import com.example.suemin.smartwindow.R;
26 +import com.example.suemin.smartwindow.view.environment.listview.CustomDialog;
27 +import com.example.suemin.smartwindow.view.environment.listview.ListViewAdapter;
28 +
29 +import java.io.IOException;
30 +import java.util.List;
31 +import java.util.Locale;
32 +
33 +
34 +public class Env extends Fragment {
35 + private LocationManager locationManager;
36 + private static final int REQUEST_CODE_LOCATION = 2;
37 +
38 + private double lat;
39 + private double lng;
40 +
41 + private String addr;
42 + private String subaddr;
43 + public static String subaddr2;
44 +
45 +
46 + private CustomDialog customDialog;
47 +
48 + public Env() {
49 + // Required empty public constructor
50 + }
51 +
52 + protected android.location.Location getCurrentLoca() {
53 + android.location.Location currentLocation = null;
54 + if(ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){
55 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
56 + requestPermissions(new String[] {Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_CODE_LOCATION);
57 + } }
58 + else {
59 + locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
60 + locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 1, mLocationListener);
61 + locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, mLocationListener);
62 +
63 + }
64 + return currentLocation;
65 + }
66 +
67 + @Override
68 + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
69 + super.onRequestPermissionsResult(requestCode, permissions, grantResults);
70 + if (requestCode == REQUEST_CODE_LOCATION) {
71 + if (permissions.length == 1 &&
72 + permissions[0] == Manifest.permission.ACCESS_FINE_LOCATION &&
73 + grantResults[0] == PackageManager.PERMISSION_GRANTED) {
74 + } else {
75 + }
76 + // Permission was denied. Display an error message.
77 + Toast.makeText(getActivity(), "LOCATION_ACCESS_PERMISSION_DENIED",Toast.LENGTH_SHORT).show();
78 + }
79 + }
80 +
81 + private final LocationListener mLocationListener =new LocationListener() {
82 + @Override
83 + public void onLocationChanged(android.location.Location location) {
84 + lat = location.getLatitude();
85 + lng = location.getLongitude();
86 + addr =getCurrentAddr(lat,lng);
87 + int idx_s = addr.indexOf("시");
88 + int idx_k = addr.indexOf("구");
89 + int idx_g = addr.indexOf("동");
90 + subaddr = addr.substring(idx_s+1, idx_g+1);
91 + subaddr2 = addr.substring(idx_s+2, idx_k+1);
92 + setLocationText(subaddr);
93 + }
94 +
95 + @Override
96 + public void onStatusChanged(String provider, int status, Bundle extras) {
97 + }
98 +
99 + @Override
100 + public void onProviderEnabled(String provider) {
101 + }
102 +
103 + @Override
104 + public void onProviderDisabled(String provider) {
105 +
106 + }
107 + };
108 +
109 + private String getCurrentAddr(double lat, double lng) {
110 + Geocoder geocoder = new Geocoder(this.getActivity(), Locale.getDefault());
111 + List<Address> addresses =null;
112 + try {
113 + addresses = geocoder.getFromLocation(
114 + lat,
115 + lng,
116 + 7);
117 + } catch (IOException ioException) {
118 + } catch (IllegalArgumentException illegalArgumentException) {
119 + }
120 + if (addresses == null) {
121 + Log.d("getCurrentAddr: ","주소 미발견");
122 + }
123 + Address address = addresses.get(0);
124 + return address.getAddressLine(0).toString()+"\n";
125 + }
126 +
127 +
128 + @Override
129 + public void onCreate(Bundle savedInstanceState) {
130 + super.onCreate(savedInstanceState);
131 + getCurrentLoca();
132 + }
133 +
134 + public void setListView(View view) {
135 + ListViewAdapter adapter = new ListViewAdapter();
136 +
137 + ListView listView = (ListView) view.findViewById(R.id.list);
138 + listView.setAdapter(adapter);
139 + adapter.addItem("비", ContextCompat.getDrawable(this.getContext(), R.drawable.icon_rain));
140 + adapter.addItem("실외 미세먼지", ContextCompat.getDrawable(this.getContext(), R.drawable.icon_om));
141 + adapter.addItem("실내 미세먼지", ContextCompat.getDrawable(this.getContext(), R.drawable.icon_sm));
142 + adapter.addItem("실내 온도", ContextCompat.getDrawable(this.getContext(), R.drawable.icon_t));
143 + adapter.addItem("실내 습도", ContextCompat.getDrawable(this.getContext(), R.drawable.icon_s));
144 + adapter.addItem("침입자", ContextCompat.getDrawable(this.getContext(), R.drawable.icon_i));
145 + listView.setOnItemClickListener(listItemClickListener);
146 + }
147 +
148 +
149 + @Override
150 + public View onCreateView(LayoutInflater inflater, ViewGroup container,
151 + Bundle savedInstanceState) {
152 + View view = inflater.inflate(R.layout.fragment_env, container, false);
153 + setListView(view);
154 +
155 + return view;
156 + }
157 + private void setLocationText(String subaddr){
158 + final TextView addrTxt = (TextView)getActivity().findViewById(R.id.location_text);
159 + if(subaddr != null) addrTxt.setText(subaddr);
160 + }
161 + private AdapterView.OnItemClickListener listItemClickListener= new AdapterView.OnItemClickListener(){
162 + @Override
163 + public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
164 + customDialog = new CustomDialog(getActivity(), positiveListener);
165 + customDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
166 + customDialog.show();
167 + customDialog.setText(position);
168 + }
169 + };
170 + private View.OnClickListener positiveListener = new View.OnClickListener() {
171 + public void onClick(View v) {
172 + customDialog.dismiss();
173 + }
174 + };
175 +
176 +
177 + @Override
178 + public void onAttach(Context context) {
179 + super.onAttach(context);
180 + }
181 +
182 + @Override
183 + public void onDetach() {
184 + super.onDetach();
185 + }
186 +
187 + @Override
188 + public void onDestroy() {
189 + super.onDestroy();
190 + locationManager.removeUpdates(mLocationListener);
191 + }
192 +
193 +
194 +}
1 +package com.example.suemin.smartwindow.view.environment.listview;
2 +
3 +import android.app.Dialog;
4 +import android.content.Context;
5 +import android.os.Bundle;
6 +import android.support.annotation.NonNull;
7 +import android.view.View;
8 +import android.view.WindowManager;
9 +import android.widget.Button;
10 +import android.widget.TextView;
11 +
12 +import com.example.suemin.smartwindow.R;
13 +import com.example.suemin.smartwindow.view.bluetooth.SensorResult;
14 +
15 +public class CustomDialog extends Dialog {
16 +
17 + private Button mPositiveButton;
18 +
19 + private View.OnClickListener mPositiveListener;
20 + private TextView AlertTitle, AlertNum, AlertState;
21 +
22 + @Override
23 + protected void onCreate(Bundle savedInstanceState) {
24 + super.onCreate(savedInstanceState);
25 +
26 + WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
27 + layoutParams.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
28 + layoutParams.dimAmount = 0.8f;
29 +
30 + getWindow().setAttributes(layoutParams);
31 +
32 + setContentView(R.layout.custom_dialog);
33 +
34 + mPositiveButton=(Button)findViewById(R.id.pbutton);
35 +
36 + mPositiveButton.setOnClickListener(mPositiveListener);
37 +
38 + AlertTitle = (TextView) findViewById(R.id.dialog_title);
39 + AlertNum = (TextView) findViewById(R.id.dialog_num);
40 + AlertState= (TextView) findViewById(R.id.dialog_state);
41 + }
42 +
43 + public CustomDialog(@NonNull Context context, View.OnClickListener positiveListener) {
44 + super(context);
45 + this.mPositiveListener = positiveListener;
46 + }
47 + public boolean setText(int position)
48 + {
49 + switch (position) {
50 + case 0:
51 + AlertTitle.setText("현재 비");
52 + AlertNum.setText(SensorResult.getRainResult());
53 + break;
54 + case 1:
55 + AlertTitle.setText("현재 실외 미세먼지");
56 + AlertNum.setText(Finedust.getFineDustResult()+"");
57 + AlertState.setText("상태 : "+ SensorResult.getOuterFineDustState());
58 + break;
59 + case 2:
60 + AlertTitle.setText("현재 실내 미세먼지");
61 + AlertNum.setText("51");
62 + AlertState.setText("상태 : " + SensorResult.getInnerFineDustState());
63 + break;
64 + case 3:
65 + AlertTitle.setText("현재 실내 온도");
66 + AlertNum.setText(SensorResult.getTemperatureResult() + "℃");
67 + AlertState.setText("상태 : " + SensorResult.getTemperatureState());
68 + break;
69 + case 4:
70 + AlertTitle.setText("현재 실내 습도");
71 + AlertNum.setText(SensorResult.getHumidResult()+ "%");
72 + AlertState.setText("상태 : " + SensorResult.getHumidState());
73 + break;
74 + case 5:
75 + AlertTitle.setText("현재 침입자");
76 + AlertNum.setText(SensorResult.getIntruderResult());
77 + break;
78 + }
79 + return true;
80 + }
81 +
82 +}
83 +
1 +package com.example.suemin.smartwindow.view.environment.listview;
2 +
3 +import android.os.StrictMode;
4 +
5 +import com.example.suemin.smartwindow.view.environment.Env;
6 +
7 +import org.xmlpull.v1.XmlPullParser;
8 +import org.xmlpull.v1.XmlPullParserException;
9 +import org.xmlpull.v1.XmlPullParserFactory;
10 +
11 +import java.io.IOException;
12 +import java.net.MalformedURLException;
13 +import java.net.URL;
14 +
15 +public class Finedust {
16 +
17 + public static String getFineDustResult(){
18 + String Key = "rqkQD0pLMXekuhOonOeI0xpbtEMtgBjTtMD5DZRWhDwQCezQGQsJ8bhg76N8YuihCKhY76QEWgsaZifSyupTDQ%3D%3D";
19 + StrictMode.enableDefaults();
20 + String currentLocation = Env.subaddr2;
21 + boolean inPm10Value = false;
22 + String pm10Value = null;
23 + try{
24 + URL url = new URL("http://openapi.airkorea.or.kr/openapi/services/rest/ArpltnInforInqireSvc/getMsrstnAcctoRltmMesureDnsty?numOfRows=1&pageNo=1&stationName="
25 + + currentLocation +"&dataTerm=DAILY&ver=1.3&ServiceKey="+Key);
26 + XmlPullParserFactory parserCreator = XmlPullParserFactory.newInstance();
27 + XmlPullParser parser = parserCreator.newPullParser();
28 + parser.setInput(url.openStream(),null);
29 + int parserEvent = parser.getEventType();
30 + while(parserEvent != XmlPullParser.END_DOCUMENT){
31 + switch(parserEvent){
32 + case XmlPullParser.START_TAG:
33 + if(parser.getName().equals("pm10Value")){
34 + inPm10Value= true;
35 + }
36 + break;
37 + case XmlPullParser.TEXT:
38 + if(inPm10Value){
39 + pm10Value = parser.getText();
40 + inPm10Value = false;
41 + }
42 + break;
43 + case XmlPullParser.END_TAG:
44 + if(parser.getName().equals("item")){
45 + }
46 + break;
47 + }
48 + parserEvent= parser.next();
49 +
50 + }
51 + } catch (XmlPullParserException e) {
52 + e.printStackTrace();
53 + } catch (MalformedURLException e) {
54 + e.printStackTrace();
55 + } catch (IOException e) {
56 + e.printStackTrace();
57 + }
58 + return pm10Value;
59 + }
60 +}
1 +package com.example.suemin.smartwindow.view.environment.listview;
2 +
3 +import android.content.Context;
4 +import android.graphics.drawable.Drawable;
5 +import android.view.LayoutInflater;
6 +import android.view.View;
7 +import android.view.ViewGroup;
8 +import android.widget.BaseAdapter;
9 +import android.widget.ImageView;
10 +import android.widget.TextView;
11 +
12 +import com.example.suemin.smartwindow.R;
13 +
14 +import java.util.ArrayList;
15 +
16 +public class ListViewAdapter extends BaseAdapter {
17 +
18 + private ArrayList<ListViewItem> listViewItemList= new ArrayList<ListViewItem>();
19 +
20 + public ListViewAdapter(){}
21 +
22 + @Override
23 + public int getCount() {
24 + return listViewItemList.size();
25 + }
26 +
27 + @Override
28 + public Object getItem(int position) {
29 + return listViewItemList.get(position);
30 + }
31 +
32 + @Override
33 + public long getItemId(int position) {
34 + return position;
35 + }
36 +
37 + @Override
38 + public View getView(int position, View convertView, ViewGroup parent) {
39 + final int pos = position;
40 + final Context context = parent.getContext();
41 +
42 + if(convertView == null){
43 + LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
44 + convertView = inflater.inflate(R.layout.listview_item, parent, false);
45 + }
46 +
47 + TextView titleTextView = (TextView) convertView.findViewById(R.id.textView1);
48 + ImageView iconImageView = (ImageView) convertView.findViewById(R.id.imageView1);
49 +
50 + ListViewItem listViewItem = listViewItemList.get(position);
51 +
52 + titleTextView.setText(listViewItem.getTitle());
53 + iconImageView.setImageDrawable(listViewItem.getIcon());
54 +
55 + return convertView;
56 + }
57 + public void addItem(String title, Drawable icon){
58 + ListViewItem item = new ListViewItem();
59 + item.setTitle(title);
60 + item.setIcon(icon);
61 + listViewItemList.add(item);
62 + }
63 +}
1 +package com.example.suemin.smartwindow.view.environment.listview;
2 +
3 +import android.graphics.drawable.Drawable;
4 +
5 +public class ListViewItem {
6 + private String titleStr ;
7 + private Drawable iconDrawable ;
8 +
9 + public void setIcon(Drawable icon) {
10 + iconDrawable = icon ;
11 + }
12 + public void setTitle(String title) {
13 + titleStr = title ;
14 + }
15 +
16 + public Drawable getIcon() {
17 + return this.iconDrawable ;
18 + }
19 + public String getTitle() {
20 + return this.titleStr ;
21 + }
22 +}
1 +package com.example.suemin.smartwindow.view.home;
2 +
3 +
4 +import android.content.Context;
5 +import android.os.Bundle;
6 +import android.support.v4.app.Fragment;
7 +import android.view.LayoutInflater;
8 +import android.view.View;
9 +import android.view.ViewGroup;
10 +import android.widget.CompoundButton;
11 +import android.widget.ImageView;
12 +import android.widget.Switch;
13 +import android.widget.TextView;
14 +
15 +import com.example.suemin.smartwindow.R;
16 +
17 +import static com.example.suemin.smartwindow.view.bluetooth.Bluetooth.WindowState;
18 +import static com.example.suemin.smartwindow.view.bluetooth.Bluetooth.setWindowState;
19 +
20 +
21 +
22 +public class Home extends Fragment {
23 +
24 +
25 + int num = 0;
26 +
27 + public Home() {
28 + // Required empty public constructor
29 + }
30 +
31 + @Override
32 + public void onCreate(Bundle savedInstanceState) {
33 + super.onCreate(savedInstanceState);
34 +
35 + }
36 + @Override
37 + public View onCreateView(LayoutInflater inflater, ViewGroup container,
38 + Bundle savedInstanceState) {
39 + View view = inflater.inflate(R.layout.fragment_home, container, false);
40 + final TextView optionState= (TextView) view.findViewById(R.id.textView_switch);
41 + final ImageView imgState = (ImageView) view.findViewById(R.id.imageView2);
42 + Switch sw = (Switch) view.findViewById(R.id.switch1);
43 + sw.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
44 + @Override
45 + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
46 + if(isChecked) {
47 + optionState.setText("“ 열림 ”");
48 + imgState.setImageResource(R.drawable.window_open);
49 + if (!WindowState) {
50 + setWindowState("n", getString(R.string.addr_m));
51 + }
52 + }
53 + else{
54 + num = num+1;
55 + optionState.setText("“ 닫힘 ”");
56 + imgState.setImageResource(R.drawable.window_closed);
57 + if(WindowState) {setWindowState("y", getString(R.string.addr_m));
58 + }
59 + }
60 + }
61 + });
62 + return view;
63 + }
64 +
65 +
66 +
67 + @Override
68 + public void onAttach(Context context) {
69 + super.onAttach(context);
70 + }
71 +
72 + @Override
73 + public void onDetach() {
74 + super.onDetach();
75 + }
76 +
77 +}
1 +<vector xmlns:android="http://schemas.android.com/apk/res/android"
2 + xmlns:aapt="http://schemas.android.com/aapt"
3 + android:width="108dp"
4 + android:height="108dp"
5 + android:viewportWidth="108"
6 + android:viewportHeight="108">
7 + <path
8 + android:fillType="evenOdd"
9 + 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"
10 + android:strokeWidth="1"
11 + android:strokeColor="#00000000">
12 + <aapt:attr name="android:fillColor">
13 + <gradient
14 + android:endX="78.5885"
15 + android:endY="90.9159"
16 + android:startX="48.7653"
17 + android:startY="61.0927"
18 + android:type="linear">
19 + <item
20 + android:color="#44000000"
21 + android:offset="0.0" />
22 + <item
23 + android:color="#00000000"
24 + android:offset="1.0" />
25 + </gradient>
26 + </aapt:attr>
27 + </path>
28 + <path
29 + android:fillColor="#FFFFFF"
30 + android:fillType="nonZero"
31 + 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"
32 + android:strokeWidth="1"
33 + android:strokeColor="#00000000" />
34 +</vector>
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:padding="10dp"
4 + android:shape="rectangle" >
5 + <solid android:color="@color/colorPrimary" />
6 + <gradient
7 + android:startColor="@color/colorPrimary"
8 + android:endColor="#FFFFFF"
9 + android:angle= "270">
10 + </gradient>
11 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:padding="10dp"
4 + android:shape="rectangle"
5 + >
6 + <solid android:color="#FFFFFF"></solid>
7 + <corners
8 + android:bottomLeftRadius="30dp"
9 + android:bottomRightRadius="30dp"
10 + android:topLeftRadius="30dp"
11 + android:topRightRadius="30dp" />
12 + <stroke
13 + android:width="2dp"
14 + android:color="@color/colorPrimaryDark" />
15 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:padding="10dp"
4 + android:shape="rectangle" >
5 + <solid android:color="@color/colorPrimaryDark" />
6 + <corners
7 + android:bottomLeftRadius="20dp"
8 + android:bottomRightRadius="20dp"
9 + android:topLeftRadius="20dp"
10 + android:topRightRadius="20dp" />
11 + <stroke
12 + android:width="1dp"
13 + android:color="@color/colorPrimaryDark" />
14 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<vector android:height="24dp" android:tint="#3A73C0"
2 + android:viewportHeight="24.0" android:viewportWidth="24.0"
3 + android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"
4 + >
5 + <group
6 + android:name="rotationGroup"
7 + android:pivotX="12"
8 + android:pivotY="12"
9 + android:rotation= "90">
10 + <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"/>
11 + <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"/>
12 + </group>
13 +</vector>
1 +<vector xmlns:android="http://schemas.android.com/apk/res/android"
2 + android:width="20dp"
3 + android:height="20dp"
4 + android:viewportWidth="27.0"
5 + android:viewportHeight="27.0">
6 + <path
7 + android:fillColor="@color/colorAccent"
8 + 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"/>
9 +</vector>
1 +<vector xmlns:android="http://schemas.android.com/apk/res/android"
2 + android:width="30dp"
3 + android:height="30dp"
4 + android:viewportWidth="24.0"
5 + android:viewportHeight="24.0">
6 + <path
7 + android:fillColor="#3a73c0"
8 + 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"/>
9 +</vector>
1 +<vector xmlns:android="http://schemas.android.com/apk/res/android"
2 + android:width="24dp"
3 + android:height="24dp"
4 + android:viewportWidth="24.0"
5 + android:viewportHeight="24.0">
6 + <path
7 + android:fillColor="#FF000000"
8 + android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" />
9 +</vector>
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<vector xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:width="108dp"
4 + android:height="108dp"
5 + android:viewportWidth="108"
6 + android:viewportHeight="108">
7 + <path
8 + android:fillColor="#008577"
9 + android:pathData="M0,0h108v108h-108z" />
10 + <path
11 + android:fillColor="#00000000"
12 + android:pathData="M9,0L9,108"
13 + android:strokeWidth="0.8"
14 + android:strokeColor="#33FFFFFF" />
15 + <path
16 + android:fillColor="#00000000"
17 + android:pathData="M19,0L19,108"
18 + android:strokeWidth="0.8"
19 + android:strokeColor="#33FFFFFF" />
20 + <path
21 + android:fillColor="#00000000"
22 + android:pathData="M29,0L29,108"
23 + android:strokeWidth="0.8"
24 + android:strokeColor="#33FFFFFF" />
25 + <path
26 + android:fillColor="#00000000"
27 + android:pathData="M39,0L39,108"
28 + android:strokeWidth="0.8"
29 + android:strokeColor="#33FFFFFF" />
30 + <path
31 + android:fillColor="#00000000"
32 + android:pathData="M49,0L49,108"
33 + android:strokeWidth="0.8"
34 + android:strokeColor="#33FFFFFF" />
35 + <path
36 + android:fillColor="#00000000"
37 + android:pathData="M59,0L59,108"
38 + android:strokeWidth="0.8"
39 + android:strokeColor="#33FFFFFF" />
40 + <path
41 + android:fillColor="#00000000"
42 + android:pathData="M69,0L69,108"
43 + android:strokeWidth="0.8"
44 + android:strokeColor="#33FFFFFF" />
45 + <path
46 + android:fillColor="#00000000"
47 + android:pathData="M79,0L79,108"
48 + android:strokeWidth="0.8"
49 + android:strokeColor="#33FFFFFF" />
50 + <path
51 + android:fillColor="#00000000"
52 + android:pathData="M89,0L89,108"
53 + android:strokeWidth="0.8"
54 + android:strokeColor="#33FFFFFF" />
55 + <path
56 + android:fillColor="#00000000"
57 + android:pathData="M99,0L99,108"
58 + android:strokeWidth="0.8"
59 + android:strokeColor="#33FFFFFF" />
60 + <path
61 + android:fillColor="#00000000"
62 + android:pathData="M0,9L108,9"
63 + android:strokeWidth="0.8"
64 + android:strokeColor="#33FFFFFF" />
65 + <path
66 + android:fillColor="#00000000"
67 + android:pathData="M0,19L108,19"
68 + android:strokeWidth="0.8"
69 + android:strokeColor="#33FFFFFF" />
70 + <path
71 + android:fillColor="#00000000"
72 + android:pathData="M0,29L108,29"
73 + android:strokeWidth="0.8"
74 + android:strokeColor="#33FFFFFF" />
75 + <path
76 + android:fillColor="#00000000"
77 + android:pathData="M0,39L108,39"
78 + android:strokeWidth="0.8"
79 + android:strokeColor="#33FFFFFF" />
80 + <path
81 + android:fillColor="#00000000"
82 + android:pathData="M0,49L108,49"
83 + android:strokeWidth="0.8"
84 + android:strokeColor="#33FFFFFF" />
85 + <path
86 + android:fillColor="#00000000"
87 + android:pathData="M0,59L108,59"
88 + android:strokeWidth="0.8"
89 + android:strokeColor="#33FFFFFF" />
90 + <path
91 + android:fillColor="#00000000"
92 + android:pathData="M0,69L108,69"
93 + android:strokeWidth="0.8"
94 + android:strokeColor="#33FFFFFF" />
95 + <path
96 + android:fillColor="#00000000"
97 + android:pathData="M0,79L108,79"
98 + android:strokeWidth="0.8"
99 + android:strokeColor="#33FFFFFF" />
100 + <path
101 + android:fillColor="#00000000"
102 + android:pathData="M0,89L108,89"
103 + android:strokeWidth="0.8"
104 + android:strokeColor="#33FFFFFF" />
105 + <path
106 + android:fillColor="#00000000"
107 + android:pathData="M0,99L108,99"
108 + android:strokeWidth="0.8"
109 + android:strokeColor="#33FFFFFF" />
110 + <path
111 + android:fillColor="#00000000"
112 + android:pathData="M19,29L89,29"
113 + android:strokeWidth="0.8"
114 + android:strokeColor="#33FFFFFF" />
115 + <path
116 + android:fillColor="#00000000"
117 + android:pathData="M19,39L89,39"
118 + android:strokeWidth="0.8"
119 + android:strokeColor="#33FFFFFF" />
120 + <path
121 + android:fillColor="#00000000"
122 + android:pathData="M19,49L89,49"
123 + android:strokeWidth="0.8"
124 + android:strokeColor="#33FFFFFF" />
125 + <path
126 + android:fillColor="#00000000"
127 + android:pathData="M19,59L89,59"
128 + android:strokeWidth="0.8"
129 + android:strokeColor="#33FFFFFF" />
130 + <path
131 + android:fillColor="#00000000"
132 + android:pathData="M19,69L89,69"
133 + android:strokeWidth="0.8"
134 + android:strokeColor="#33FFFFFF" />
135 + <path
136 + android:fillColor="#00000000"
137 + android:pathData="M19,79L89,79"
138 + android:strokeWidth="0.8"
139 + android:strokeColor="#33FFFFFF" />
140 + <path
141 + android:fillColor="#00000000"
142 + android:pathData="M29,19L29,89"
143 + android:strokeWidth="0.8"
144 + android:strokeColor="#33FFFFFF" />
145 + <path
146 + android:fillColor="#00000000"
147 + android:pathData="M39,19L39,89"
148 + android:strokeWidth="0.8"
149 + android:strokeColor="#33FFFFFF" />
150 + <path
151 + android:fillColor="#00000000"
152 + android:pathData="M49,19L49,89"
153 + android:strokeWidth="0.8"
154 + android:strokeColor="#33FFFFFF" />
155 + <path
156 + android:fillColor="#00000000"
157 + android:pathData="M59,19L59,89"
158 + android:strokeWidth="0.8"
159 + android:strokeColor="#33FFFFFF" />
160 + <path
161 + android:fillColor="#00000000"
162 + android:pathData="M69,19L69,89"
163 + android:strokeWidth="0.8"
164 + android:strokeColor="#33FFFFFF" />
165 + <path
166 + android:fillColor="#00000000"
167 + android:pathData="M79,19L79,89"
168 + android:strokeWidth="0.8"
169 + android:strokeColor="#33FFFFFF" />
170 +</vector>
1 +<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
2 + android:viewportWidth="480.011"
3 + android:viewportHeight="480.011"
4 + android:width="512dp"
5 + android:height="512dp">
6 + <path
7 + 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"
8 + android:fillColor="@color/colorAccent" />
9 + <path
10 + 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"
11 + android:fillColor="@color/colorAccent" />
12 +
13 +</vector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<font-family xmlns:android="http://schemas.android.com/apk/res/android">
3 + <font
4 + android:fontStyle = "normal"
5 + android:fontWeight="400"
6 + android:font = "@font/noto"/>
7 + <font
8 + android:fontStyle = "normal"
9 + android:fontWeight = "400"
10 + android:font = "@font/beba"/>
11 +</font-family>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto"
4 + xmlns:tools="http://schemas.android.com/tools"
5 + android:id="@+id/container"
6 + android:layout_width="match_parent"
7 + android:layout_height="match_parent"
8 + tools:context="com.example.suemin.smartwindow.view.MainActivity"
9 + >
10 +
11 +
12 + <android.support.v7.widget.Toolbar
13 + android:id="@+id/tb"
14 + android:layout_width="match_parent"
15 + android:layout_height="wrap_content"
16 + android:background="@color/colorPrimaryDark">
17 + <ImageView
18 + android:layout_width="32dp"
19 + android:layout_height="30dp"
20 + android:src="@drawable/icon"
21 + android:paddingTop="8dp"
22 + android:layout_marginRight="5dp"/>
23 +
24 + <TextView
25 + android:layout_width="match_parent"
26 + android:layout_height="match_parent"
27 + android:gravity="left"
28 + android:text="@string/app_name"
29 + android:fontFamily="@font/beba"
30 + android:textColor="@color/colorAccent"
31 + android:textSize="21dp"
32 + android:textStyle="bold"
33 + />
34 +
35 + </android.support.v7.widget.Toolbar>
36 +
37 + <FrameLayout
38 + android:id="@+id/frameLayout"
39 + android:layout_width="match_parent"
40 + android:layout_height="match_parent"
41 + android:layout_marginTop="?attr/actionBarSize"
42 + android:layout_marginBottom="?attr/actionBarSize"
43 + />
44 +
45 + <android.support.design.widget.BottomNavigationView
46 + android:id="@+id/navigation"
47 + android:layout_width="0dp"
48 + android:layout_height="wrap_content"
49 + android:layout_marginStart="0dp"
50 + android:layout_marginEnd="0dp"
51 + android:background="@color/colorPrimaryDark"
52 + app:layout_constraintBottom_toBottomOf="parent"
53 + app:layout_constraintLeft_toLeftOf="parent"
54 + app:layout_constraintRight_toRightOf="parent"
55 + app:menu="@menu/navigation" />
56 +
57 +</android.support.constraint.ConstraintLayout>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:layout_width="match_parent"
4 + android:layout_height="wrap_content"
5 + >
6 + <TextView
7 + android:id="@+id/bt_textView"
8 + android:layout_width="wrap_content"
9 + android:layout_height="wrap_content"
10 + android:layout_marginLeft="16dp"
11 + android:gravity="left"
12 + android:text="name"
13 + android:textColor="@color/colorAccent"
14 + android:fontFamily="@font/noto"
15 + android:textSize="21dp"
16 + />
17 + <TextView
18 + android:id="@+id/bt_textView_addr"
19 + android:layout_width="wrap_content"
20 + android:layout_height="wrap_content"
21 + android:layout_marginLeft="16dp"
22 + android:gravity="left"
23 + android:text="addr"
24 + android:textColor="@color/colorAccent"
25 + android:textSize="14dp"
26 + android:layout_below="@+id/bt_textView"
27 + />
28 +</RelativeLayout>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:layout_width="match_parent"
4 + android:layout_height="match_parent"
5 + android:gravity="center"
6 + android:orientation="vertical"
7 + >
8 +
9 + <LinearLayout
10 + android:layout_width="250dp"
11 + android:layout_height="wrap_content"
12 + android:paddingBottom="15dp"
13 + android:paddingTop="15dp"
14 + android:gravity="center"
15 + android:orientation="vertical"
16 + android:background="@drawable/dialog_background">
17 +
18 + <TextView
19 + android:id="@+id/dialog_title"
20 + android:layout_width="wrap_content"
21 + android:layout_height="wrap_content"
22 + android:layout_marginTop="10dp"
23 + android:layout_marginBottom="10dp"
24 + android:textSize="20dp" />
25 +
26 + <TextView
27 + android:id="@+id/dialog_num"
28 + android:layout_width="wrap_content"
29 + android:layout_height="wrap_content"
30 + android:layout_marginTop="5dp"
31 + android:layout_marginBottom="5dp"
32 + android:textSize="60dp" />
33 + <TextView
34 + android:id="@+id/dialog_state"
35 + android:layout_width="wrap_content"
36 + android:layout_height="wrap_content"
37 + android:layout_marginBottom="15dp"
38 + android:textSize="15dp" />
39 + <Button
40 + android:id="@+id/pbutton"
41 + android:layout_width="50dp"
42 + android:layout_height="25dp"
43 + android:layout_marginBottom="10dp"
44 + android:background="@drawable/dialog_button_background"
45 + android:text="OK"
46 + android:textColor="@color/colorAccent"/>
47 + </LinearLayout>
48 +
49 +
50 +
51 +</LinearLayout>
52 +
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:tools="http://schemas.android.com/tools"
4 + android:layout_width="match_parent"
5 + android:layout_height="match_parent"
6 + tools:context="com.example.suemin.smartwindow.view.bluetooth.Bluetooth"
7 + android:background="@color/colorPrimaryDark">
8 +
9 + <TextView
10 + android:layout_width="wrap_content"
11 + android:layout_height="22dp"
12 + android:layout_marginLeft="10dp"
13 + android:layout_marginTop="5dp"
14 + android:text="검색된 기기"
15 + android:textSize="12dp"
16 + android:textStyle="bold"
17 + android:textColor="#a04e4e4e"/>
18 + <ListView
19 + android:id="@android:id/list"
20 + android:layout_width="match_parent"
21 + android:layout_height="wrap_content"
22 + android:layout_marginTop="24dp">
23 +
24 + </ListView>
25 + <RelativeLayout
26 + android:layout_width="wrap_content"
27 + android:layout_height="60dp"
28 + android:layout_gravity="bottom"
29 + android:paddingBottom="15dp">
30 +
31 + <Button
32 + android:id="@+id/bt_find_btn"
33 + android:layout_width="50dp"
34 + android:layout_height="50dp"
35 + android:layout_alignParentRight="true"
36 + android:layout_alignParentBottom="true"
37 + android:layout_marginRight="20dp"
38 + android:background="@drawable/sync"
39 + />
40 + </RelativeLayout>
41 +
42 +
43 +
44 +</FrameLayout>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:tools="http://schemas.android.com/tools"
4 + android:layout_width="match_parent"
5 + android:layout_height="match_parent"
6 + xmlns:app="http://schemas.android.com/apk/res-auto"
7 + tools:context="com.example.suemin.smartwindow.view.environment.Env"
8 + android:background="@color/colorPrimaryDark">
9 +
10 + <LinearLayout
11 + android:layout_width="match_parent"
12 + android:layout_height="wrap_content"
13 + android:orientation="vertical"
14 + >
15 + <!-- TODO: Update blank fragment layout -->
16 + <RelativeLayout
17 + android:layout_width="wrap_content"
18 + android:layout_height="20dp"
19 + android:layout_marginTop="10dp"
20 + >
21 + <ImageView
22 + android:layout_width="10dp"
23 + android:layout_height="10dp"
24 + android:layout_marginStart="7dp"
25 + android:id="@+id/imageView1"
26 + android:layout_centerVertical="true"
27 + android:src="@drawable/icon_loca"
28 + />
29 +
30 + <TextView
31 + android:id="@+id/location_text"
32 + android:layout_width="wrap_content"
33 + android:layout_height="wrap_content"
34 + android:layout_marginTop="1dp"
35 + android:layout_marginStart="2dp"
36 + android:layout_toRightOf="@+id/imageView1"
37 + android:text="위치 확인중..."
38 + android:textColor="@color/colorAccent"
39 + android:textSize="12dp"/>
40 +
41 + </RelativeLayout>
42 + <ListView
43 + android:id="@+id/list"
44 + android:layout_width="match_parent"
45 + android:layout_height="wrap_content"
46 + />
47 + </LinearLayout>
48 +
49 +</FrameLayout>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:tools="http://schemas.android.com/tools"
4 + android:layout_width="match_parent"
5 + android:layout_height="match_parent"
6 + xmlns:app="http://schemas.android.com/apk/res-auto"
7 + tools:context="com.example.suemin.smartwindow.view.home.Home"
8 + android:background="@color/colorPrimaryDark">
9 +
10 +
11 + <RelativeLayout
12 + android:layout_width="match_parent"
13 + android:layout_height="match_parent"
14 + android:orientation="vertical">
15 +
16 + <ImageView
17 + android:id="@+id/imageView2"
18 + android:layout_width="197dp"
19 + android:layout_height="200dp"
20 + android:layout_marginTop="80dp"
21 + android:layout_marginBottom="50dp"
22 + android:adjustViewBounds="true"
23 + android:src="@drawable/window_closed"
24 + android:layout_centerHorizontal="true"
25 + />
26 +
27 + <RelativeLayout
28 + android:layout_width="wrap_content"
29 + android:layout_height="wrap_content"
30 + android:layout_marginStart="100dp"
31 + android:layout_below="@id/imageView2"
32 + android:layout_centerHorizontal="true"
33 + >
34 +
35 + <Switch
36 + android:id="@+id/switch1"
37 + android:layout_width="wrap_content"
38 + android:layout_height="wrap_content"
39 + android:layout_marginBottom="10dp"
40 + android:layout_alignParentTop="true"
41 + android:layout_centerHorizontal="true"
42 + />
43 +
44 + <TextView
45 + android:id="@+id/textView2"
46 + android:layout_width="wrap_content"
47 + android:layout_height="wrap_content"
48 + android:layout_below="@id/switch1"
49 + android:layout_centerHorizontal="true"
50 + android:textColor="@color/colorAccent"
51 + android:text="현재 창문 상태는"
52 + android:textSize="17dp" />
53 +
54 + <TextView
55 + android:id="@+id/textView_switch"
56 + android:layout_width="wrap_content"
57 + android:layout_height="wrap_content"
58 + android:fontFamily="@font/noto"
59 + android:text="“ 닫힘 ”"
60 + android:textSize="25dp"
61 + android:textStyle="bold"
62 + android:textColor="@color/colorAccent"
63 + android:layout_below="@id/textView2"
64 + android:layout_centerHorizontal="true"
65 + />
66 + </RelativeLayout>
67 + </RelativeLayout>
68 +
69 +</FrameLayout>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<!-- Copyright (C) 2013 The Android Open Source Project
3 + Licensed under the Apache License, Version 2.0 (the "License");
4 + you may not use this file except in compliance with the License.
5 + You may obtain a copy of the License at
6 + http://www.apache.org/licenses/LICENSE-2.0
7 + Unless required by applicable law or agreed to in writing, software
8 + distributed under the License is distributed on an "AS IS" BASIS,
9 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 + See the License for the specific language governing permissions and
11 + limitations under the License.
12 +-->
13 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
14 + android:orientation="vertical"
15 + android:layout_width="match_parent"
16 + android:layout_height="wrap_content"
17 + android:layout_margin="10dp">
18 + <LinearLayout android:orientation="horizontal"
19 + android:layout_width="match_parent"
20 + android:layout_height="wrap_content"
21 + android:layout_margin="10dp">
22 + <TextView android:layout_width="wrap_content"
23 + android:layout_height="wrap_content"
24 + android:text="State : "
25 + android:textSize="18sp"/>
26 + <Space android:layout_width="5dp"
27 + android:layout_height="wrap_content"/>
28 + <TextView android:id="@+id/connection_state"
29 + android:layout_width="match_parent"
30 + android:layout_height="wrap_content"
31 + android:text="no_data"
32 + android:textSize="18sp"/>
33 + </LinearLayout>
34 + <LinearLayout android:orientation="horizontal"
35 + android:layout_width="match_parent"
36 + android:layout_height="wrap_content"
37 + android:layout_margin="10dp">
38 + <TextView android:layout_width="wrap_content"
39 + android:layout_height="wrap_content"
40 + android:text="Data : "
41 + android:id="@+id/device_name"
42 + android:textSize="18sp"/>
43 + <Space android:layout_width="5dp"
44 + android:layout_height="wrap_content"/>
45 + <TextView android:id="@+id/data_value"
46 + android:layout_width="match_parent"
47 + android:layout_height="wrap_content"
48 + android:text="no_data"
49 + android:textSize="18sp"/>
50 + </LinearLayout>
51 + <ExpandableListView android:id="@+id/gatt_services_list"
52 + android:layout_width="match_parent"
53 + android:layout_height="wrap_content"/>
54 +</LinearLayout>
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:layout_width="match_parent"
4 + android:layout_height="wrap_content"
5 + >
6 + <RelativeLayout
7 + android:layout_width="wrap_content"
8 + android:layout_height="wrap_content"
9 + android:gravity="start">
10 +
11 + <TextView
12 + android:id="@+id/textView1"
13 + android:layout_width="wrap_content"
14 + android:layout_height="wrap_content"
15 + android:paddingLeft="15dp"
16 + android:layout_marginTop="10dp"
17 + android:layout_marginBottom="10dp"
18 + android:gravity="fill_horizontal"
19 + android:fontFamily="@font/noto"
20 + android:text="New Text"
21 + android:layout_toRightOf="@id/imageView1"
22 + android:textColor="@color/colorAccent"
23 + android:textSize="21dp" />
24 +
25 + <ImageView
26 + android:layout_width="50dp"
27 + android:layout_height="50dp"
28 + android:id="@+id/imageView1"
29 + android:layout_marginLeft="5dp"
30 + android:layout_centerVertical="true"
31 + android:src="@drawable/ic_cloud_queue_black_24dp"
32 + />
33 + </RelativeLayout>
34 +
35 +
36 +</RelativeLayout>
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:layout_width="match_parent"
4 + android:layout_height="wrap_content"
5 + >
6 + <TextView
7 + android:id="@+id/sv_textView"
8 + android:layout_width="wrap_content"
9 + android:layout_height="wrap_content"
10 + android:layout_marginLeft="16dp"
11 + android:gravity="left"
12 + android:text="name"
13 + android:textColor="@color/colorAccent"
14 + android:fontFamily="@font/noto"
15 + android:textSize="21dp"
16 + />
17 + <TextView
18 + android:id="@+id/sv_uuid"
19 + android:layout_width="wrap_content"
20 + android:layout_height="wrap_content"
21 + android:layout_marginLeft="16dp"
22 + android:gravity="left"
23 + android:text="addr"
24 + android:textColor="@color/colorAccent"
25 + android:textSize="14dp"
26 + android:layout_below="@+id/sv_textView"
27 + />
28 +</RelativeLayout>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<menu xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto">
4 + <item
5 + android:id="@+id/navigation_bt"
6 + android:title="BT"
7 + android:icon="@drawable/ic_bluetooth_black_24dp"
8 + app:showAsAction="always"
9 + />
10 +
11 + </menu>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<menu xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto">
4 + <item
5 + android:id="@+id/navigation_home"
6 + android:icon="@drawable/ic_home_black_24dp"
7 + android:title="@string/title_home"
8 + />
9 +
10 + <item
11 + android:id="@+id/navigation_env"
12 + android:icon="@drawable/ic_cloud_queue_black_24dp"
13 + android:title="@string/title_activity_main2" />
14 +
15 + <item
16 + android:id="@+id/navigation_bt"
17 + android:icon="@drawable/ic_bluetooth_black_24dp"
18 + android:title="@string/title_activity_main33" />
19 +
20 +</menu>
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3 + <background android:drawable="@drawable/ic_launcher_background" />
4 + <foreground android:drawable="@drawable/ic_launcher_foreground" />
5 +</adaptive-icon>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3 + <background android:drawable="@drawable/ic_launcher_background" />
4 + <foreground android:drawable="@drawable/ic_launcher_foreground" />
5 +</adaptive-icon>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<resources>
3 + <color name="colorPrimary">#000000</color>
4 + <color name="colorPrimaryDark">#7899ddff</color>
5 + <color name="colorAccent">#f0646a71</color>
6 +</resources>
1 +<resources>
2 + <!-- Default screen margins, per the Android Design guidelines. -->
3 + <dimen name="activity_horizontal_margin">16dp</dimen>
4 + <dimen name="activity_vertical_margin">16dp</dimen>
5 + <dimen name="text_margin">16dp</dimen>
6 +</resources>
1 +<resources>
2 + <string name="app_name">SMART WINDOW</string>
3 + <string name="title_home">Home</string>
4 + <string name="title_activity_main2">Environment</string>
5 + <string name="title_activity_main33">Bluetooth</string>
6 + <string name="connected">Connected</string>
7 + <string name="disconnected">Disconnected</string>
8 + <string name="addr_m">90:E2:02:8F:36:70</string>
9 + <string name="addr_d">90:E2:02:8E:1F:21</string>
10 + <string name="addr_r">90:E2:02:92:A9:0E</string>
11 +</resources>
1 +<resources>
2 +
3 + <!-- Base application theme. -->
4 + <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
5 + <!-- Customize your theme here. -->
6 + <item name="colorPrimary">@color/colorPrimary</item>
7 + <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
8 + <item name="colorAccent">@color/colorAccent</item>
9 + </style>
10 +
11 +</resources>
1 +package com.example.suemin.smartwindow;
2 +
3 +import org.junit.Test;
4 +
5 +import static org.junit.Assert.*;
6 +
7 +/**
8 + * Example local unit test, which will execute on the development machine (host).
9 + *
10 + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11 + */
12 +public class ExampleUnitTest {
13 + @Test
14 + public void addition_isCorrect() {
15 + assertEquals(4, 2 + 2);
16 + }
17 +}
...\ No newline at end of file ...\ No newline at end of file
1 +// Top-level build file where you can add configuration options common to all sub-projects/modules.
2 +
3 +buildscript {
4 +
5 + repositories {
6 + google()
7 + jcenter()
8 + }
9 + dependencies {
10 + classpath 'com.android.tools.build:gradle:3.2.1'
11 +
12 +
13 + // NOTE: Do not place your application dependencies here; they belong
14 + // in the individual module build.gradle files
15 + }
16 +}
17 +
18 +allprojects {
19 + repositories {
20 + google()
21 + jcenter()
22 + }
23 +}
24 +
25 +task clean(type: Delete) {
26 + delete rootProject.buildDir
27 +}
1 +# Project-wide Gradle settings.
2 +# IDE (e.g. Android Studio) users:
3 +# Gradle settings configured through the IDE *will override*
4 +# any settings specified in this file.
5 +# For more details on how to configure your build environment visit
6 +# http://www.gradle.org/docs/current/userguide/build_environment.html
7 +# Specifies the JVM arguments used for the daemon process.
8 +# The setting is particularly useful for tweaking memory settings.
9 +org.gradle.jvmargs=-Xmx1536m
10 +# When configured, Gradle will run in incubating parallel mode.
11 +# This option should only be used with decoupled projects. More details, visit
12 +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 +# org.gradle.parallel=true
14 +
15 +
1 +distributionBase=GRADLE_USER_HOME
2 +distributionPath=wrapper/dists
3 +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
4 +zipStoreBase=GRADLE_USER_HOME
5 +zipStorePath=wrapper/dists
1 +#!/usr/bin/env sh
2 +
3 +##############################################################################
4 +##
5 +## Gradle start up script for UN*X
6 +##
7 +##############################################################################
8 +
9 +# Attempt to set APP_HOME
10 +# Resolve links: $0 may be a link
11 +PRG="$0"
12 +# Need this for relative symlinks.
13 +while [ -h "$PRG" ] ; do
14 + ls=`ls -ld "$PRG"`
15 + link=`expr "$ls" : '.*-> \(.*\)$'`
16 + if expr "$link" : '/.*' > /dev/null; then
17 + PRG="$link"
18 + else
19 + PRG=`dirname "$PRG"`"/$link"
20 + fi
21 +done
22 +SAVED="`pwd`"
23 +cd "`dirname \"$PRG\"`/" >/dev/null
24 +APP_HOME="`pwd -P`"
25 +cd "$SAVED" >/dev/null
26 +
27 +APP_NAME="Gradle"
28 +APP_BASE_NAME=`basename "$0"`
29 +
30 +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 +DEFAULT_JVM_OPTS=""
32 +
33 +# Use the maximum available, or set MAX_FD != -1 to use that value.
34 +MAX_FD="maximum"
35 +
36 +warn () {
37 + echo "$*"
38 +}
39 +
40 +die () {
41 + echo
42 + echo "$*"
43 + echo
44 + exit 1
45 +}
46 +
47 +# OS specific support (must be 'true' or 'false').
48 +cygwin=false
49 +msys=false
50 +darwin=false
51 +nonstop=false
52 +case "`uname`" in
53 + CYGWIN* )
54 + cygwin=true
55 + ;;
56 + Darwin* )
57 + darwin=true
58 + ;;
59 + MINGW* )
60 + msys=true
61 + ;;
62 + NONSTOP* )
63 + nonstop=true
64 + ;;
65 +esac
66 +
67 +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 +
69 +# Determine the Java command to use to start the JVM.
70 +if [ -n "$JAVA_HOME" ] ; then
71 + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 + # IBM's JDK on AIX uses strange locations for the executables
73 + JAVACMD="$JAVA_HOME/jre/sh/java"
74 + else
75 + JAVACMD="$JAVA_HOME/bin/java"
76 + fi
77 + if [ ! -x "$JAVACMD" ] ; then
78 + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 +
80 +Please set the JAVA_HOME variable in your environment to match the
81 +location of your Java installation."
82 + fi
83 +else
84 + JAVACMD="java"
85 + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 +
87 +Please set the JAVA_HOME variable in your environment to match the
88 +location of your Java installation."
89 +fi
90 +
91 +# Increase the maximum file descriptors if we can.
92 +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 + MAX_FD_LIMIT=`ulimit -H -n`
94 + if [ $? -eq 0 ] ; then
95 + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 + MAX_FD="$MAX_FD_LIMIT"
97 + fi
98 + ulimit -n $MAX_FD
99 + if [ $? -ne 0 ] ; then
100 + warn "Could not set maximum file descriptor limit: $MAX_FD"
101 + fi
102 + else
103 + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 + fi
105 +fi
106 +
107 +# For Darwin, add options to specify how the application appears in the dock
108 +if $darwin; then
109 + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 +fi
111 +
112 +# For Cygwin, switch paths to Windows format before running java
113 +if $cygwin ; then
114 + APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 + JAVACMD=`cygpath --unix "$JAVACMD"`
117 +
118 + # We build the pattern for arguments to be converted via cygpath
119 + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 + SEP=""
121 + for dir in $ROOTDIRSRAW ; do
122 + ROOTDIRS="$ROOTDIRS$SEP$dir"
123 + SEP="|"
124 + done
125 + OURCYGPATTERN="(^($ROOTDIRS))"
126 + # Add a user-defined pattern to the cygpath arguments
127 + if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 + fi
130 + # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 + i=0
132 + for arg in "$@" ; do
133 + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 +
136 + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 + else
139 + eval `echo args$i`="\"$arg\""
140 + fi
141 + i=$((i+1))
142 + done
143 + case $i in
144 + (0) set -- ;;
145 + (1) set -- "$args0" ;;
146 + (2) set -- "$args0" "$args1" ;;
147 + (3) set -- "$args0" "$args1" "$args2" ;;
148 + (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 + esac
155 +fi
156 +
157 +# Escape application args
158 +save () {
159 + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 + echo " "
161 +}
162 +APP_ARGS=$(save "$@")
163 +
164 +# Collect all arguments for the java command, following the shell quoting and substitution rules
165 +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 +
167 +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 + cd "$(dirname "$0")"
170 +fi
171 +
172 +exec "$JAVACMD" "$@"
1 +@if "%DEBUG%" == "" @echo off
2 +@rem ##########################################################################
3 +@rem
4 +@rem Gradle startup script for Windows
5 +@rem
6 +@rem ##########################################################################
7 +
8 +@rem Set local scope for the variables with windows NT shell
9 +if "%OS%"=="Windows_NT" setlocal
10 +
11 +set DIRNAME=%~dp0
12 +if "%DIRNAME%" == "" set DIRNAME=.
13 +set APP_BASE_NAME=%~n0
14 +set APP_HOME=%DIRNAME%
15 +
16 +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 +set DEFAULT_JVM_OPTS=
18 +
19 +@rem Find java.exe
20 +if defined JAVA_HOME goto findJavaFromJavaHome
21 +
22 +set JAVA_EXE=java.exe
23 +%JAVA_EXE% -version >NUL 2>&1
24 +if "%ERRORLEVEL%" == "0" goto init
25 +
26 +echo.
27 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 +echo.
29 +echo Please set the JAVA_HOME variable in your environment to match the
30 +echo location of your Java installation.
31 +
32 +goto fail
33 +
34 +:findJavaFromJavaHome
35 +set JAVA_HOME=%JAVA_HOME:"=%
36 +set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 +
38 +if exist "%JAVA_EXE%" goto init
39 +
40 +echo.
41 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 +echo.
43 +echo Please set the JAVA_HOME variable in your environment to match the
44 +echo location of your Java installation.
45 +
46 +goto fail
47 +
48 +:init
49 +@rem Get command-line arguments, handling Windows variants
50 +
51 +if not "%OS%" == "Windows_NT" goto win9xME_args
52 +
53 +:win9xME_args
54 +@rem Slurp the command line arguments.
55 +set CMD_LINE_ARGS=
56 +set _SKIP=2
57 +
58 +:win9xME_args_slurp
59 +if "x%~1" == "x" goto execute
60 +
61 +set CMD_LINE_ARGS=%*
62 +
63 +:execute
64 +@rem Setup the command line
65 +
66 +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 +
68 +@rem Execute Gradle
69 +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 +
71 +:end
72 +@rem End local scope for the variables with windows NT shell
73 +if "%ERRORLEVEL%"=="0" goto mainEnd
74 +
75 +:fail
76 +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 +rem the _cmd.exe /c_ return code!
78 +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 +exit /b 1
80 +
81 +:mainEnd
82 +if "%OS%"=="Windows_NT" endlocal
83 +
84 +:omega