Commit 0d52d3da authored by Nathanael Gall's avatar Nathanael Gall
Browse files

version 1.0

parent a8e62589
......@@ -12,8 +12,7 @@ import android.widget.CheckBox
import android.widget.EditText
import android.widget.TimePicker
import androidx.navigation.fragment.findNavController
import com.google.firebase.database.DataSnapshot
import java.util.*
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
......
......@@ -6,7 +6,6 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.util.Log
import com.google.android.material.floatingactionbutton.FloatingActionButton
import androidx.appcompat.app.AppCompatActivity
import com.google.firebase.database.DataSnapshot
import com.google.firebase.database.DatabaseError
......@@ -39,8 +38,14 @@ class MainActivity : AppCompatActivity(),FragmentCallback{
set(Calendar.MINUTE,minute)
}
Log.d("bob", "goWatch: "+(System.currentTimeMillis()-calendar.timeInMillis)+repeat.toString())
if (!repeat){clock?.setRepeating(AlarmManager.RTC_WAKEUP,calendar.timeInMillis,1000*60*60*24, pending)}
else{clock?.set(AlarmManager.RTC_WAKEUP, calendar.timeInMillis, pending)}
if (repeat){
clock?.setRepeating(AlarmManager.RTC_WAKEUP,calendar.timeInMillis,1000*60, pending)
Log.d("bob", "goWatch: repeating")
} else{
clock?.set(AlarmManager.RTC_WAKEUP, calendar.timeInMillis, pending)
Log.d("bob", "goWatch: singletime")
}
......@@ -71,19 +76,5 @@ class MainActivity : AppCompatActivity(),FragmentCallback{
}
/* override fun onCreateOptionsMenu(menu: Menu): Boolean {
// Inflate the menu; this adds items to the action bar if it is present.
menuInflater.inflate(R.menu.menu_main, menu)
return true
}*/
/* override fun onOptionsItemSelected(item: MenuItem): Boolean {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
return when (item.itemId) {
R.id.action_settings -> true
else -> super.onOptionsItemSelected(item)
}
}*/
}
\ No newline at end of file
......@@ -52,9 +52,11 @@ class VideoSetterFragment : Fragment() {
val groupName = view?.findViewById<EditText>(R.id.groupField)?.text.toString()
val alarmVideoURI = view?.findViewById<EditText>(R.id.videoLinkText)?.text.toString()
if (groupName.length>3){
val database = Firebase.database
val myRef = database.getReference(groupName)
myRef.setValue(alarmVideoURI)}
val database = Firebase.database
val myRef = database.getReference(groupName)
myRef.setValue(alarmVideoURI)
Toast.makeText(activity, "ok", Toast.LENGTH_SHORT).show()
}
else { Toast.makeText(activity, "You dun goofed", Toast.LENGTH_SHORT).show()}
}
......
package com.example.guguseli
import android.app.AlarmManager
import android.app.KeyguardManager
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.os.PowerManager
import android.util.Log
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import com.google.android.youtube.player.YouTubeBaseActivity
import com.google.android.youtube.player.YouTubeInitializationResult
import com.google.android.youtube.player.YouTubePlayer
......@@ -18,7 +12,7 @@ import com.google.android.youtube.player.YouTubePlayerView
class tv : YouTubeBaseActivity(),YouTubePlayer.OnInitializedListener{
private var alarmVideoURL: String="https://www.youtube.com/watch?v=dQw4w9WgXcQ?t=215"
private var alarmVideoURL: String="dQw4w9WgXcQ"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
......@@ -28,9 +22,6 @@ class tv : YouTubeBaseActivity(),YouTubePlayer.OnInitializedListener{
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD)
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
setContentView(R.layout.activity_tv)
val bundle: Bundle? = intent.extras
alarmVideoURL = bundle?.get("alarmVideoURL").toString()
......@@ -58,7 +49,10 @@ class tv : YouTubeBaseActivity(),YouTubePlayer.OnInitializedListener{
) {
if (p1==null){return}
if (!p2){
p1.loadVideo(alarmVideoURL.removePrefix("https://youtu.be/"))
val s =alarmVideoURL.removePrefix("https://youtu.be/")
Log.d("bob", "onInitializationSuccess: "+s)
// p1.setFullscreen(true)
p1.loadVideo(s)
p1.play()
}
}
......
......@@ -20,7 +20,15 @@
android:numbersSelectorColor="#8BC34A"
android:timePickerMode="spinner" />
<LinearLayout
<EditText
android:id="@+id/groupFieldA"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="no"
android:inputType="text"
android:text="@string/group" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
......@@ -39,12 +47,5 @@
android:layout_height="wrap_content"
android:text="@string/confirm_alarm_button" />
</LinearLayout>
<EditText
android:id="@+id/groupFieldA"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:importantForAutofill="no"
android:inputType="text" />
</LinearLayout>
\ No newline at end of file
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.guguseli.MainActivity">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu>
\ No newline at end of file
......@@ -26,5 +26,6 @@
<string name="group_name">Group Name</string>
<string name="wecker">wecker</string>
<string name="link_explanation">The Link has to be of the form: https://youtu.be/NhMrgtxHLIo</string>
<string name="group">group</string>
</resources>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment