From ba5c8afc19e15959fbe3da8f8f3d5e9a70892b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20=C3=87olako=C4=9Flu?= Date: Tue, 26 May 2020 18:25:50 +0300 Subject: [PATCH] Initial Commit --- .gitignore | 3 + .gitsecret/keys/pubring.kbx | Bin 0 -> 1475 bytes .gitsecret/keys/pubring.kbx~ | Bin 0 -> 32 bytes .gitsecret/keys/trustdb.gpg | Bin 0 -> 1200 bytes .gitsecret/paths/mapping.cfg | 1 + README.md | 3 +- YeetClock_app/.gitignore | 14 + YeetClock_app/.idea/.gitignore | 8 + YeetClock_app/.idea/.name | 1 + YeetClock_app/.idea/codeStyles/Project.xml | 131 ++++++++ .../.idea/codeStyles/codeStyleConfig.xml | 5 + YeetClock_app/.idea/compiler.xml | 6 + YeetClock_app/.idea/gradle.xml | 20 ++ YeetClock_app/.idea/jarRepositories.xml | 25 ++ YeetClock_app/.idea/misc.xml | 12 + YeetClock_app/app/.gitignore | 1 + YeetClock_app/app/build.gradle | 42 +++ YeetClock_app/app/proguard-rules.pro | 21 ++ .../yeetclock/ExampleInstrumentedTest.kt | 24 ++ .../app/src/main/AndroidManifest.xml | 26 ++ .../yigitcolakoglu/yeetclock/MainActivity.kt | 24 ++ .../yeetclock/ui/main/AlarmFragment.kt | 133 ++++++++ .../yeetclock/ui/main/ColorPicker.kt | 205 ++++++++++++ .../yeetclock/ui/main/PageViewModel.kt | 19 ++ .../yeetclock/ui/main/PlaceholderFragment.kt | 59 ++++ .../yeetclock/ui/main/SectionsPagerAdapter.kt | 41 +++ .../drawable-v24/ic_launcher_foreground.xml | 34 ++ .../res/drawable/ic_launcher_background.xml | 74 +++++ .../main/res/drawable/scrubber_control.xml | 3 + .../app/src/main/res/layout/activity_main.xml | 37 +++ .../src/main/res/layout/fragment_alarm.xml | 47 +++ .../main/res/layout/fragment_color_picker.xml | 38 +++ .../app/src/main/res/layout/fragment_main.xml | 23 ++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 2963 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 4905 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2060 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 2783 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4490 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 6895 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 6387 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 10413 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 9128 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 15132 bytes .../app/src/main/res/values-w820dp/dimens.xml | 6 + .../app/src/main/res/values/colors.xml | 6 + .../app/src/main/res/values/dimens.xml | 8 + .../app/src/main/res/values/strings.xml | 9 + .../app/src/main/res/values/styles.xml | 20 ++ .../main/res/xml/network_security_config.xml | 6 + .../yeetclock/ExampleUnitTest.kt | 17 + YeetClock_app/build.gradle | 27 ++ YeetClock_app/gradle.properties | 21 ++ .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54329 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + YeetClock_app/gradlew | 172 ++++++++++ YeetClock_app/gradlew.bat | 84 +++++ YeetClock_app/settings.gradle | 2 + display_i2c/display_i2c.ino | 7 + mainboard/mainboard.ino | 309 ++++++++++++++++++ mainboard/notes.h | 90 +++++ mainboard/secrets.h.secret | Bin 0 -> 391 bytes mainboard/tetris.h | 50 +++ 64 files changed, 1929 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 .gitsecret/keys/pubring.kbx create mode 100644 .gitsecret/keys/pubring.kbx~ create mode 100644 .gitsecret/keys/trustdb.gpg create mode 100644 .gitsecret/paths/mapping.cfg create mode 100644 YeetClock_app/.gitignore create mode 100644 YeetClock_app/.idea/.gitignore create mode 100644 YeetClock_app/.idea/.name create mode 100644 YeetClock_app/.idea/codeStyles/Project.xml create mode 100644 YeetClock_app/.idea/codeStyles/codeStyleConfig.xml create mode 100644 YeetClock_app/.idea/compiler.xml create mode 100644 YeetClock_app/.idea/gradle.xml create mode 100644 YeetClock_app/.idea/jarRepositories.xml create mode 100644 YeetClock_app/.idea/misc.xml create mode 100644 YeetClock_app/app/.gitignore create mode 100644 YeetClock_app/app/build.gradle create mode 100644 YeetClock_app/app/proguard-rules.pro create mode 100644 YeetClock_app/app/src/androidTest/java/com/yigitcolakoglu/yeetclock/ExampleInstrumentedTest.kt create mode 100644 YeetClock_app/app/src/main/AndroidManifest.xml create mode 100644 YeetClock_app/app/src/main/java/com/yigitcolakoglu/yeetclock/MainActivity.kt create mode 100644 YeetClock_app/app/src/main/java/com/yigitcolakoglu/yeetclock/ui/main/AlarmFragment.kt create mode 100644 YeetClock_app/app/src/main/java/com/yigitcolakoglu/yeetclock/ui/main/ColorPicker.kt create mode 100644 YeetClock_app/app/src/main/java/com/yigitcolakoglu/yeetclock/ui/main/PageViewModel.kt create mode 100644 YeetClock_app/app/src/main/java/com/yigitcolakoglu/yeetclock/ui/main/PlaceholderFragment.kt create mode 100644 YeetClock_app/app/src/main/java/com/yigitcolakoglu/yeetclock/ui/main/SectionsPagerAdapter.kt create mode 100644 YeetClock_app/app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 YeetClock_app/app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 YeetClock_app/app/src/main/res/drawable/scrubber_control.xml create mode 100644 YeetClock_app/app/src/main/res/layout/activity_main.xml create mode 100644 YeetClock_app/app/src/main/res/layout/fragment_alarm.xml create mode 100644 YeetClock_app/app/src/main/res/layout/fragment_color_picker.xml create mode 100644 YeetClock_app/app/src/main/res/layout/fragment_main.xml create mode 100644 YeetClock_app/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 YeetClock_app/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 YeetClock_app/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 YeetClock_app/app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 YeetClock_app/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 YeetClock_app/app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 YeetClock_app/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 YeetClock_app/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 YeetClock_app/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 YeetClock_app/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 YeetClock_app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 YeetClock_app/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 YeetClock_app/app/src/main/res/values-w820dp/dimens.xml create mode 100644 YeetClock_app/app/src/main/res/values/colors.xml create mode 100644 YeetClock_app/app/src/main/res/values/dimens.xml create mode 100644 YeetClock_app/app/src/main/res/values/strings.xml create mode 100644 YeetClock_app/app/src/main/res/values/styles.xml create mode 100644 YeetClock_app/app/src/main/res/xml/network_security_config.xml create mode 100644 YeetClock_app/app/src/test/java/com/yigitcolakoglu/yeetclock/ExampleUnitTest.kt create mode 100644 YeetClock_app/build.gradle create mode 100644 YeetClock_app/gradle.properties create mode 100644 YeetClock_app/gradle/wrapper/gradle-wrapper.jar create mode 100644 YeetClock_app/gradle/wrapper/gradle-wrapper.properties create mode 100755 YeetClock_app/gradlew create mode 100644 YeetClock_app/gradlew.bat create mode 100644 YeetClock_app/settings.gradle create mode 100644 display_i2c/display_i2c.ino create mode 100644 mainboard/mainboard.ino create mode 100644 mainboard/notes.h create mode 100644 mainboard/secrets.h.secret create mode 100644 mainboard/tetris.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f7fde0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.gitsecret/keys/random_seed +!*.secret +mainboard/secrets.h diff --git a/.gitsecret/keys/pubring.kbx b/.gitsecret/keys/pubring.kbx new file mode 100644 index 0000000000000000000000000000000000000000..782c6d5af76da4d8db98e32873661458275d04e9 GIT binary patch literal 1475 zcmZQzU{GLWWMJ}kib!Jsg1EEB>p>XAh5**ZOpIVw9RmZaAOjPF%*!nftE{gxh1;Eb zu%+5m!lS+J$5NmQ1(2$o)$Dp-wASsD#Y?AAUwS+=PAYt|T2rf)>)$8S8b7SV~aPEW1; zymd!w4`QuuxL_q;UShnI{?#N2DC*Tiv@`{fo(~7FBy6r&pGz zOhx(4eU5wCb7-npuoknYa4T$%+GX%RDdY0fjQ4*e>g6`?{<-|st;N4z)$UQ<8MOYa zuX{M3)FM2r@D-ZUBZ}dOMrIzFpIM@C zxII57F+2ar{G3t+o65}e%n}DMnG6tCy=_%dY04yI-1{#NQTi=HJi|R}p*96Obyi@h6w4ZOf{c&@-g7(p=Z4aY+7h4HAY$!|o+cC!> z{^Px_ysM7SS{?VX^=f*(Y})HL<=*5eo1~_HlZ~Bq`uEa^`>juvn))M^H?rn;M*FLs zs#R2}T%{;n=IbJyZKf`zRZ)|wb7GhOtmN{DdAhlJ-_Eh#F?zVf=lom`iysb6-Ky)~ z7?`+;s|g&wAZLC!YDdMCL~|F<9o7F|&(J;@6nQE8#QOzu`cv%v^ml#OcE#@4!EL4d z=9ha?H?T1<17nC`CnDvZY<5+Cxl6WhWw~1N;d>9dzyAL7keyq4Zj6NxUvA0iYK_K; z%D<$Ry7h!gt!-aA_1%|4%Q@e;7e8(dxHWICMeZ@(cRTK<*Q`JBfMNOUbFzPLZ=R#F ze9MLtUM=(AKjK|q-5;{dmv>Xmjy{c+!z;|%guYC1U$@M;qJX30#Kg&gGaMdNUyht8 zn&VWLcE4lW>sd*HfNT+hd-80e=$R9Zu_tM*J{>p>XA1_1z5`2~sq literal 0 HcmV?d00001 diff --git a/.gitsecret/keys/trustdb.gpg b/.gitsecret/keys/trustdb.gpg new file mode 100644 index 0000000000000000000000000000000000000000..fa80e431da7d916d393cfe370539d75ac4b28044 GIT binary patch literal 1200 zcmZQfFGy!*W@Ke#Vql0nYrLKTJ7DC(E{-8OstzMazyhP;G8!(R5ExAdl%)dzP0<8@ literal 0 HcmV?d00001 diff --git a/.gitsecret/paths/mapping.cfg b/.gitsecret/paths/mapping.cfg new file mode 100644 index 0000000..a51697a --- /dev/null +++ b/.gitsecret/paths/mapping.cfg @@ -0,0 +1 @@ +mainboard/secrets.h:47167f6bfaa3da3dec08230c4a4ddf0b8685ce551846aee445890942f7ba1fa7 diff --git a/README.md b/README.md index d5788f7..6f63e60 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ -# YeetClock \ No newline at end of file +# YeetClock +This is a personal project I made that is pretty cool alarm clock that also controls LED lights, shows the weather forecast, your 3D print's progress and the status of your self hosted self hosted services while also providing a mobile app so that you can control the led lights to your preference. diff --git a/YeetClock_app/.gitignore b/YeetClock_app/.gitignore new file mode 100644 index 0000000..603b140 --- /dev/null +++ b/YeetClock_app/.gitignore @@ -0,0 +1,14 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx diff --git a/YeetClock_app/.idea/.gitignore b/YeetClock_app/.idea/.gitignore new file mode 100644 index 0000000..73f69e0 --- /dev/null +++ b/YeetClock_app/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/YeetClock_app/.idea/.name b/YeetClock_app/.idea/.name new file mode 100644 index 0000000..0ea3647 --- /dev/null +++ b/YeetClock_app/.idea/.name @@ -0,0 +1 @@ +Yeet Clock \ No newline at end of file diff --git a/YeetClock_app/.idea/codeStyles/Project.xml b/YeetClock_app/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..e241d78 --- /dev/null +++ b/YeetClock_app/.idea/codeStyles/Project.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/YeetClock_app/.idea/codeStyles/codeStyleConfig.xml b/YeetClock_app/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/YeetClock_app/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/YeetClock_app/.idea/compiler.xml b/YeetClock_app/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/YeetClock_app/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/YeetClock_app/.idea/gradle.xml b/YeetClock_app/.idea/gradle.xml new file mode 100644 index 0000000..aa565f0 --- /dev/null +++ b/YeetClock_app/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/YeetClock_app/.idea/jarRepositories.xml b/YeetClock_app/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/YeetClock_app/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/YeetClock_app/.idea/misc.xml b/YeetClock_app/.idea/misc.xml new file mode 100644 index 0000000..3a2f2b4 --- /dev/null +++ b/YeetClock_app/.idea/misc.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/YeetClock_app/app/.gitignore b/YeetClock_app/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/YeetClock_app/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/YeetClock_app/app/build.gradle b/YeetClock_app/app/build.gradle new file mode 100644 index 0000000..1e77504 --- /dev/null +++ b/YeetClock_app/app/build.gradle @@ -0,0 +1,42 @@ +apply plugin: 'com.android.application' + +apply plugin: 'kotlin-android' + +apply plugin: 'kotlin-android-extensions' + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.3" + defaultConfig { + applicationId "com.yigitcolakoglu.yeetclock" + minSdkVersion 27 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.core:core-ktx:1.0.2' + implementation 'com.google.android.material:material:1.0.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'ca.antonious:materialdaypicker:0.7.2' + testImplementation 'junit:junit:4.12' + implementation 'com.android.volley:volley:1.1.1' + implementation 'com.google.code.gson:gson:2.8.5' + implementation 'com.google.code.gson:gson:2.8.6' + androidTestImplementation 'androidx.test:runner:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' +} diff --git a/YeetClock_app/app/proguard-rules.pro b/YeetClock_app/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/YeetClock_app/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# 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 diff --git a/YeetClock_app/app/src/androidTest/java/com/yigitcolakoglu/yeetclock/ExampleInstrumentedTest.kt b/YeetClock_app/app/src/androidTest/java/com/yigitcolakoglu/yeetclock/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..4ca67f2 --- /dev/null +++ b/YeetClock_app/app/src/androidTest/java/com/yigitcolakoglu/yeetclock/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.yigitcolakoglu.yeetclock + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.yigitcolakoglu.yeetclock", appContext.packageName) + } +} diff --git a/YeetClock_app/app/src/main/AndroidManifest.xml b/YeetClock_app/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..83629ad --- /dev/null +++ b/YeetClock_app/app/src/main/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/YeetClock_app/app/src/main/java/com/yigitcolakoglu/yeetclock/MainActivity.kt b/YeetClock_app/app/src/main/java/com/yigitcolakoglu/yeetclock/MainActivity.kt new file mode 100644 index 0000000..9177135 --- /dev/null +++ b/YeetClock_app/app/src/main/java/com/yigitcolakoglu/yeetclock/MainActivity.kt @@ -0,0 +1,24 @@ +package com.yigitcolakoglu.yeetclock + +import android.os.Bundle +import com.google.android.material.floatingactionbutton.FloatingActionButton +import com.google.android.material.snackbar.Snackbar +import com.google.android.material.tabs.TabLayout +import androidx.viewpager.widget.ViewPager +import androidx.appcompat.app.AppCompatActivity +import android.view.Menu +import android.view.MenuItem +import com.yigitcolakoglu.yeetclock.ui.main.SectionsPagerAdapter + +class MainActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + val sectionsPagerAdapter = SectionsPagerAdapter(this, supportFragmentManager) + val viewPager: ViewPager = findViewById(R.id.view_pager) + viewPager.adapter = sectionsPagerAdapter + val tabs: TabLayout = findViewById(R.id.tabs) + tabs.setupWithViewPager(viewPager) + } +} \ No newline at end of file diff --git a/YeetClock_app/app/src/main/java/com/yigitcolakoglu/yeetclock/ui/main/AlarmFragment.kt b/YeetClock_app/app/src/main/java/com/yigitcolakoglu/yeetclock/ui/main/AlarmFragment.kt new file mode 100644 index 0000000..d037793 --- /dev/null +++ b/YeetClock_app/app/src/main/java/com/yigitcolakoglu/yeetclock/ui/main/AlarmFragment.kt @@ -0,0 +1,133 @@ +package com.yigitcolakoglu.yeetclock.ui.main + +import android.content.Context +import android.net.Uri +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import android.widget.TimePicker +import android.widget.Toast +import ca.antonious.materialdaypicker.MaterialDayPicker +import com.android.volley.Request +import com.android.volley.Response +import com.android.volley.toolbox.StringRequest +import com.google.gson.Gson + +import com.yigitcolakoglu.yeetclock.R +import java.lang.Math.floor +import java.lang.Math.toIntExact +import java.sql.Time +import java.time.DayOfWeek +import kotlin.math.pow + +class AlarmFragment : Fragment() , View.OnClickListener{ + private var listener: OnFragmentInteractionListener? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + val layout = inflater.inflate(R.layout.fragment_alarm, container, false) + val daySelector = layout.findViewById(R.id.alarm_day_picker) + val timeSelector = layout.findViewById(R.id.alarm_time_picker) + val updateButton = layout.findViewById