Browse Source

Pendel Logic READY

Pendelsession information save in profile in progress
new fragment "fragment_start_pendulum" finished
last step save Data from Pendulum in Profil
master
Feyzu 3 years ago
parent
commit
d94de55d57
17 changed files with 260 additions and 67 deletions
  1. +2
    -2
      .idea/misc.xml
  2. +0
    -2
      app/src/main/java/com/example/acapendulum20/canvas/CanvasPendulum.kt
  3. +12
    -1
      app/src/main/java/com/example/acapendulum20/data/MeasurementDao.kt
  4. +32
    -1
      app/src/main/java/com/example/acapendulum20/data/MeasurementDatabase.kt
  5. +6
    -7
      app/src/main/java/com/example/acapendulum20/fragments/add/AddFragment.kt
  6. +0
    -1
      app/src/main/java/com/example/acapendulum20/fragments/list/ListFragment.kt
  7. +31
    -7
      app/src/main/java/com/example/acapendulum20/fragments/pendulum/PendulumFragment.kt
  8. +71
    -0
      app/src/main/java/com/example/acapendulum20/fragments/pendulum/StartPendulumFragment.kt
  9. +3
    -1
      app/src/main/java/com/example/acapendulum20/fragments/update/UpdateFragment.kt
  10. +12
    -8
      app/src/main/java/com/example/acapendulum20/model/Measurement.kt
  11. +3
    -2
      app/src/main/java/com/example/acapendulum20/model/Session.kt
  12. +12
    -1
      app/src/main/java/com/example/acapendulum20/repository/MeasurementRepository.kt
  13. +31
    -1
      app/src/main/java/com/example/acapendulum20/viewmodel/MeasurementViewmodel.kt
  14. +6
    -6
      app/src/main/res/layout/fragment_pendulum.xml
  15. +11
    -8
      app/src/main/res/layout/fragment_start_pendulum.xml
  16. +26
    -17
      app/src/main/res/navigation/my_nav.xml
  17. +2
    -2
      app/src/main/res/values/themes.xml

+ 2
- 2
.idea/misc.xml View File

@ -13,9 +13,9 @@
<entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/custom_row.xml" value="0.384375" /> <entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/custom_row.xml" value="0.384375" />
<entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/fragment_add.xml" value="0.45416666666666666" /> <entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/fragment_add.xml" value="0.45416666666666666" />
<entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/fragment_list.xml" value="0.45416666666666666" /> <entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/fragment_list.xml" value="0.45416666666666666" />
<entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/fragment_pendulum.xml" value="0.37640449438202245" />
<entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/fragment_pendulum.xml" value="0.1" />
<entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/fragment_pendulum2.xml" value="0.5541666666666667" /> <entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/fragment_pendulum2.xml" value="0.5541666666666667" />
<entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/fragment_start_pendulum.xml" value="0.3880208333333333" />
<entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/fragment_start_pendulum.xml" value="0.33" />
<entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/fragment_update.xml" value="0.33" /> <entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/fragment_update.xml" value="0.33" />
<entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/start_pendulum_fragment.xml" value="0.38697916666666665" /> <entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/layout/start_pendulum_fragment.xml" value="0.38697916666666665" />
<entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/menu/delete_menu.xml" value="0.5541666666666667" /> <entry key="..\:/Users/Feyzu/AndroidStudioProjects/acaPendulum20/app/src/main/res/menu/delete_menu.xml" value="0.5541666666666667" />


+ 0
- 2
app/src/main/java/com/example/acapendulum20/canvas/CanvasPendulum.kt View File

@ -53,7 +53,6 @@ class CanvasPendulum @JvmOverloads constructor(
) )
//draw sensor left //draw sensor left
paint.style = Paint.Style.FILL_AND_STROKE paint.style = Paint.Style.FILL_AND_STROKE
paint.strokeWidth = 1f paint.strokeWidth = 1f
paint.color = Color.RED paint.color = Color.RED
@ -67,7 +66,6 @@ class CanvasPendulum @JvmOverloads constructor(
canvas?.drawCircle((width / 3).toFloat(), 910f, 30f, paint) canvas?.drawCircle((width / 3).toFloat(), 910f, 30f, paint)
//draw sensor right //draw sensor right
paint.style = Paint.Style.FILL_AND_STROKE paint.style = Paint.Style.FILL_AND_STROKE
paint.strokeWidth = 1f paint.strokeWidth = 1f
paint.color = Color.RED paint.color = Color.RED


+ 12
- 1
app/src/main/java/com/example/acapendulum20/data/MeasurementDao.kt View File

@ -1,4 +1,15 @@
package com.example.acapendulum20.data package com.example.acapendulum20.data
class MeasurementDao {
import androidx.lifecycle.LiveData
import androidx.room.*
import com.example.acapendulum20.model.Measurement
import com.example.acapendulum20.model.User
@Dao
interface MeasurementDao {
@Insert(onConflict = OnConflictStrategy.IGNORE )
fun addMeasurement(measurement: Measurement)
} }

+ 32
- 1
app/src/main/java/com/example/acapendulum20/data/MeasurementDatabase.kt View File

@ -1,4 +1,35 @@
package com.example.acapendulum20.data package com.example.acapendulum20.data
class MeasurementDatabase {
import android.content.Context
import android.icu.util.Measure
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.example.acapendulum20.model.User
import com.example.acapendulum20.model.Measurement
@Database(entities = [Measurement::class], version = 1, exportSchema = false)
abstract class MeasurementDatabase: RoomDatabase() {
abstract fun measurementDao(): MeasurementDao
companion object {
@Volatile
private var INSTANCE: MeasurementDatabase? = null
fun getDatabase(context: Context): MeasurementDatabase{
val tempInstance = INSTANCE
if(tempInstance != null){
return tempInstance
}
synchronized(this){
val instance = Room.databaseBuilder(
context.applicationContext,
MeasurementDatabase::class.java,
"measurement_database"
).build()
INSTANCE = instance
return instance
}
}
}
} }

+ 6
- 7
app/src/main/java/com/example/acapendulum20/fragments/add/AddFragment.kt View File

@ -33,20 +33,19 @@ class AddFragment : Fragment() {
view.add_btn.setOnClickListener{ view.add_btn.setOnClickListener{
insertDataToDatabase() insertDataToDatabase()
} }
return view return view
} }
private fun insertDataToDatabase() { private fun insertDataToDatabase() {
val firstName = addFirstName_et.text.toString() val firstName = addFirstName_et.text.toString()
val lastName = addLastName_et.text.toString() val lastName = addLastName_et.text.toString()
val age = addAge_et.text
val age = addAge_et.text.toString()
val sex = addSex_et.text.toString() val sex = addSex_et.text.toString()
val handiness = addHandiness_et.text.toString() val handiness = addHandiness_et.text.toString()
if(inputCheck(firstName, lastName, sex, handiness, age)){ if(inputCheck(firstName, lastName, sex, handiness, age)){
//Create User Objeect
val user = User(UUID.randomUUID().toString(), firstName, lastName,Integer.parseInt(age.toString()), sex, handiness)
//Create User Object
val user = User(UUID.randomUUID().toString(), firstName, lastName,Integer.parseInt(age), sex, handiness)
//Add Data to Database //Add Data to Database
mUserViewModel.addUser(user) mUserViewModel.addUser(user)
Toast.makeText(requireContext(),"Successfully added!", Toast.LENGTH_LONG).show() Toast.makeText(requireContext(),"Successfully added!", Toast.LENGTH_LONG).show()
@ -57,8 +56,8 @@ class AddFragment : Fragment() {
} }
} }
private fun inputCheck(firstName: String, lastName: String, sex: String, handiness:String, age: Editable): Boolean{
return !(TextUtils.isEmpty(firstName) && TextUtils.isEmpty(lastName) && TextUtils.isEmpty(sex) && TextUtils.isEmpty(handiness) && age.isEmpty())
private fun inputCheck(firstName: String, lastName: String, sex: String, handiness: String, age: String): Boolean{
val validated = !TextUtils.isEmpty(firstName) && !TextUtils.isEmpty(lastName) && !TextUtils.isEmpty(sex) && !TextUtils.isEmpty(handiness) && !age.isEmpty()
return validated
} }
} }

+ 0
- 1
app/src/main/java/com/example/acapendulum20/fragments/list/ListFragment.kt View File

@ -37,7 +37,6 @@ class ListFragment : Fragment() {
adapter.setData(user) adapter.setData(user)
}) })
view.floatingActionButton.setOnClickListener { view.floatingActionButton.setOnClickListener {
findNavController().navigate(R.id.action_listFragment_to_addFragment) findNavController().navigate(R.id.action_listFragment_to_addFragment)
} }


+ 31
- 7
app/src/main/java/com/example/acapendulum20/fragments/pendulum/PendulumFragment.kt View File

@ -2,19 +2,29 @@ package com.example.acapendulum20.fragments.pendulum
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.os.Bundle import android.os.Bundle
import android.os.CountDownTimer
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.MotionEvent import android.view.MotionEvent
import android.view.View import android.view.View
import android.view.View.OnTouchListener import android.view.View.OnTouchListener
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.Button import android.widget.Button
import android.widget.TextView
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.navigation.fragment.navArgs
import com.example.acapendulum20.R import com.example.acapendulum20.R
import com.example.acapendulum20.canvas.CanvasPendulum import com.example.acapendulum20.canvas.CanvasPendulum
import com.example.acapendulum20.viewmodel.MeasurementViewmodel
import kotlinx.android.synthetic.main.fragment_pendulum.*
import java.time.LocalDateTime
class PendulumFragment : Fragment() { class PendulumFragment : Fragment() {
private val args by navArgs<PendulumFragmentArgs>()
private lateinit var mMeasurementViewmodel: MeasurementViewmodel
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, inflater: LayoutInflater, container: ViewGroup?,
@ -27,11 +37,29 @@ class PendulumFragment : Fragment() {
//activate the magnet //activate the magnet
val button = view.findViewById<Button>(R.id.activate_btn) val button = view.findViewById<Button>(R.id.activate_btn)
//Save results
//Show targetVelocity and maxAttemptTime
val targetVelocity = view.findViewById<TextView>(R.id.targetVelocity_view)
val maxAttemptTime = view.findViewById<TextView>(R.id.maxAttemptTime_view)
val timer = view.findViewById<TextView>(R.id.timer_view)
//button.setOnClickListener{
// mCanvasPendulum.startPendulum()
//}
targetVelocity.text = args.targetVelocity.toString()
maxAttemptTime.text = args.maxAttemptTime.toString()
//timer.text =
//time count down for 30 seconds
//with 1 second as countDown interval
object : CountDownTimer(args.maxAttemptTime.toLong()*1000, 1000){
override fun onTick(millisUntilFinished: Long) {
timer.setText("sec.: " + millisUntilFinished / 1000)
}
override fun onFinish() {
timer.setText("done!")
}
}.start()
button.setOnTouchListener(object : View.OnTouchListener{ button.setOnTouchListener(object : View.OnTouchListener{
override fun onTouch(v: View?, event: MotionEvent?): Boolean { override fun onTouch(v: View?, event: MotionEvent?): Boolean {
@ -47,10 +75,6 @@ class PendulumFragment : Fragment() {
return true return true
} }
}) })
//System.currentTimeMillis()
//System.nanoTime()
return view return view
} }
} }

+ 71
- 0
app/src/main/java/com/example/acapendulum20/fragments/pendulum/StartPendulumFragment.kt View File

@ -0,0 +1,71 @@
package com.example.acapendulum20.fragments.pendulum
import android.os.Bundle
import android.text.Editable
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import androidx.room.ForeignKey
import com.example.acapendulum20.R
import com.example.acapendulum20.StartPendulum
import com.example.acapendulum20.fragments.update.UpdateFragmentArgs
import com.example.acapendulum20.model.Measurement
import com.example.acapendulum20.model.User
import com.example.acapendulum20.viewmodel.MeasurementViewmodel
import com.example.acapendulum20.viewmodel.UserViewmodel
import kotlinx.android.synthetic.main.fragment_start_pendulum.*
import kotlinx.android.synthetic.main.fragment_start_pendulum.view.*
import java.time.LocalDateTime
import java.util.*
class StartPendulumFragment: Fragment() {
private val args by navArgs<StartPendulumFragmentArgs>()
private lateinit var mMeasurementViewmodel: MeasurementViewmodel
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
val view = inflater.inflate(R.layout.fragment_start_pendulum, container, false)
mMeasurementViewmodel = ViewModelProvider(this).get(MeasurementViewmodel::class.java)
//navigate to pendulumFragment
view.startPendulum_btn.setOnClickListener{
insertDataToDatabase()
}
return view
}
private fun insertDataToDatabase() {
val targetVelocity = (targetVelocity_et.text).toString()
val maxAttemptTime = (maxAttemptTime_et.text).toString()
val owner = args.owner
if(inputCheck(targetVelocity, maxAttemptTime)){
//Create Measurement Object
val measurement = Measurement(UUID.randomUUID().toString(), targetVelocity.toFloat(),maxAttemptTime.toFloat(),0.0f,0.00f,0.00f,owner)
//Add Data to Database
mMeasurementViewmodel.addMeasurement(measurement)
Toast.makeText(requireContext(),"Successfully added!", Toast.LENGTH_LONG).show()
//Navigate Back
val action = StartPendulumFragmentDirections.actionStartPendulumFragmentToPendulumFragment(targetVelocity.toFloat(),maxAttemptTime.toFloat(),owner)
findNavController().navigate(action)
}else{
Toast.makeText(requireContext(),"Please fill out all fields.", Toast.LENGTH_LONG).show()
}
}
private fun inputCheck(targetVelocity: String, maxAttemptTime: String): Boolean{
val validated = !TextUtils.isEmpty(targetVelocity) && !TextUtils.isEmpty(maxAttemptTime)
return validated
}
}

+ 3
- 1
app/src/main/java/com/example/acapendulum20/fragments/update/UpdateFragment.kt View File

@ -39,7 +39,9 @@ class UpdateFragment : Fragment() {
//navigate to fragment_start_pendulum //navigate to fragment_start_pendulum
view.startTest_btn.setOnClickListener{ view.startTest_btn.setOnClickListener{
findNavController().navigate(R.id.action_updateFragment_to_startPendulum)
val owner = args.currentUser.id
val action = UpdateFragmentDirections.actionUpdateFragmentToStartPendulumFragment(owner)
findNavController().navigate(action)
} }
//navigate to fragment_update //navigate to fragment_update


+ 12
- 8
app/src/main/java/com/example/acapendulum20/model/Measurement.kt View File

@ -7,21 +7,25 @@ import androidx.room.ForeignKey
import com.example.acapendulum20.data.UserDao import com.example.acapendulum20.data.UserDao
import com.example.acapendulum20.data.UserDao_Impl import com.example.acapendulum20.data.UserDao_Impl
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
import java.time.LocalDateTime
@Parcelize @Parcelize
@Entity(tableName = "measurement_table", foreignKeys = [ForeignKey(entity = Session::class,
@Entity(tableName = "measurement_table")
/*, foreignKeys = [ForeignKey(entity = Session::class,
parentColumns = arrayOf("id"), parentColumns = arrayOf("id"),
childColumns = arrayOf("sessionRef"), childColumns = arrayOf("sessionRef"),
onDelete = ForeignKey.CASCADE)] onDelete = ForeignKey.CASCADE)]
) )
data class Measurement (
*/
data class Measurement(
@PrimaryKey @PrimaryKey
val id: String, val id: String,
val testNr: Int,
val targetVelocity: Int,
val maxAttemptTime: Int,
val attemptTime: Int,
val sessionRef: String,
val targetVelocity: Float,
val maxAttemptTime: Float,
val attemptTime: Float,
val startTime: Float,
val endTime: Float,
val owner: String,
): Parcelable ): Parcelable

+ 3
- 2
app/src/main/java/com/example/acapendulum20/model/Session.kt View File

@ -6,7 +6,7 @@ import androidx.room.ForeignKey
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
@Parcelize
/*@Parcelize
@Entity(tableName = "session_table", foreignKeys = [ForeignKey(entity = User::class, @Entity(tableName = "session_table", foreignKeys = [ForeignKey(entity = User::class,
parentColumns = arrayOf("id"), parentColumns = arrayOf("id"),
childColumns = arrayOf("userRef"), childColumns = arrayOf("userRef"),
@ -18,4 +18,5 @@ data class Session (
val sessionEnd: Long, val sessionEnd: Long,
val userRef: String, val userRef: String,
): Parcelable
): Parcelable
*/

+ 12
- 1
app/src/main/java/com/example/acapendulum20/repository/MeasurementRepository.kt View File

@ -1,4 +1,15 @@
package com.example.acapendulum20.repository package com.example.acapendulum20.repository
class MeasurementRepository {
import androidx.lifecycle.LiveData
import com.example.acapendulum20.data.MeasurementDao
import com.example.acapendulum20.data.UserDao
import com.example.acapendulum20.model.Measurement
import com.example.acapendulum20.model.User
class MeasurementRepository(private val measurementDao: MeasurementDao) {
suspend fun addMeasurement(measurement: Measurement){
measurementDao.addMeasurement(measurement)
}
} }

+ 31
- 1
app/src/main/java/com/example/acapendulum20/viewmodel/MeasurementViewmodel.kt View File

@ -1,4 +1,34 @@
package com.example.acapendulum20.viewmodel package com.example.acapendulum20.viewmodel
class MeasurementViewmodel {
import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.viewModelScope
import com.example.acapendulum20.data.MeasurementDao
import com.example.acapendulum20.data.MeasurementDatabase
import com.example.acapendulum20.data.UserDatabase
import com.example.acapendulum20.data.UserDatabase.Companion.getDatabase
import com.example.acapendulum20.model.Measurement
import com.example.acapendulum20.model.User
import com.example.acapendulum20.repository.MeasurementRepository
import com.example.acapendulum20.repository.UserRepository
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class MeasurementViewmodel(application: Application): AndroidViewModel(application) {
private val repository: MeasurementRepository
init{
val measurementDao = MeasurementDatabase.getDatabase(application).measurementDao()
repository = MeasurementRepository(measurementDao)
}
fun addMeasurement(measurement: Measurement){
viewModelScope.launch(Dispatchers.IO){
repository.addMeasurement(measurement)
}
}
} }

+ 6
- 6
app/src/main/res/layout/fragment_pendulum.xml View File

@ -13,7 +13,7 @@
android:id="@+id/actV_view" android:id="@+id/actV_view"
android:layout_width="120dp" android:layout_width="120dp"
android:layout_height="60dp" android:layout_height="60dp"
android:text="act. V"
android:hint="act. V"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/activate_btn" app:layout_constraintEnd_toStartOf="@+id/activate_btn"
app:layout_constraintHorizontal_bias="0.548" app:layout_constraintHorizontal_bias="0.548"
@ -22,12 +22,12 @@
app:layout_constraintVertical_bias="0.791" /> app:layout_constraintVertical_bias="0.791" />
<TextView <TextView
android:id="@+id/maxTime_view"
android:id="@+id/maxAttemptTime_view"
android:layout_width="120dp" android:layout_width="120dp"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginBottom="52dp" android:layout_marginBottom="52dp"
android:text="max time"
android:hint="maxAttemptTime"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0" app:layout_constraintHorizontal_bias="1.0"
@ -36,12 +36,12 @@
app:layout_constraintVertical_bias="0.933" /> app:layout_constraintVertical_bias="0.933" />
<TextView <TextView
android:id="@+id/goalV_view"
android:id="@+id/targetVelocity_view"
android:layout_width="120dp" android:layout_width="120dp"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginBottom="52dp" android:layout_marginBottom="52dp"
android:text="goal v"
android:hint="targetVelocity"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/speichern_btn" app:layout_constraintEnd_toStartOf="@+id/speichern_btn"
app:layout_constraintHorizontal_bias="0.0" app:layout_constraintHorizontal_bias="0.0"
@ -53,7 +53,7 @@
android:id="@+id/timer_view" android:id="@+id/timer_view"
android:layout_width="120dp" android:layout_width="120dp"
android:layout_height="60dp" android:layout_height="60dp"
android:text="Timer"
android:hint="Timer"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.483" app:layout_constraintHorizontal_bias="0.483"


+ 11
- 8
app/src/main/res/layout/fragment_start_pendulum.xml View File

@ -6,7 +6,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="1dp" android:padding="1dp"
tools:context=".StartPendulum">
tools:context=".fragments.pendulum.StartPendulumFragment">
<Button <Button
android:id="@+id/startPendulum_btn" android:id="@+id/startPendulum_btn"
@ -20,11 +20,12 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.632" /> app:layout_constraintVertical_bias="0.632" />
<TextView
android:id="@+id/goalVSet_view"
<EditText
android:id="@+id/targetVelocity_et"
android:layout_width="160dp" android:layout_width="160dp"
android:layout_height="60dp" android:layout_height="60dp"
android:text="goal velocity set"
android:hint="target velocity"
android:inputType="number"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498" app:layout_constraintHorizontal_bias="0.498"
@ -32,15 +33,17 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.366" /> app:layout_constraintVertical_bias="0.366" />
<TextView
android:id="@+id/maxTimeSet_view"
<EditText
android:id="@+id/maxAttemptTime_et"
android:layout_width="160dp" android:layout_width="160dp"
android:layout_height="60dp" android:layout_height="60dp"
android:text="max time set"
android:hint="max attempt time"
android:inputType="number"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498" app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/goalVSet_view"
app:layout_constraintTop_toBottomOf="@+id/targetVelocity_et"
app:layout_constraintVertical_bias="0.079" /> app:layout_constraintVertical_bias="0.079" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

+ 26
- 17
app/src/main/res/navigation/my_nav.xml View File

@ -31,35 +31,44 @@
android:name="com.example.acapendulum20.fragments.update.UpdateFragment" android:name="com.example.acapendulum20.fragments.update.UpdateFragment"
android:label="Update" android:label="Update"
tools:layout="@layout/fragment_update" > tools:layout="@layout/fragment_update" >
<action
android:id="@+id/action_updateFragment_to_listFragment"
app:destination="@id/listFragment" />
<argument <argument
android:name="currentUser" android:name="currentUser"
app:argType="com.example.acapendulum20.model.User" /> app:argType="com.example.acapendulum20.model.User" />
<action <action
android:id="@+id/action_updateFragment_to_startPendulum"
app:destination="@id/startPendulum" />
</fragment>
<fragment
android:id="@+id/pendulumFragment"
android:name="com.example.acapendulum20.fragments.pendulum.PendulumFragment"
android:label="fragment_pendulum"
tools:layout="@layout/fragment_pendulum" >
android:id="@+id/action_updateFragment_to_listFragment"
app:destination="@id/listFragment" />
<action <action
android:id="@+id/action_pendulumFragment_to_startPendulum"
app:destination="@id/startPendulum" />
android:id="@+id/action_updateFragment_to_startPendulumFragment"
app:destination="@id/startPendulumFragment" />
</fragment> </fragment>
<fragment <fragment
android:id="@+id/startPendulum"
android:name="com.example.acapendulum20.StartPendulum"
android:id="@+id/startPendulumFragment"
android:name="com.example.acapendulum20.fragments.pendulum.StartPendulumFragment"
android:label="fragment_start_pendulum" android:label="fragment_start_pendulum"
tools:layout="@layout/fragment_start_pendulum" > tools:layout="@layout/fragment_start_pendulum" >
<action <action
android:id="@+id/action_startPendulum_to_pendulumFragment"
android:id="@+id/action_startPendulumFragment_to_pendulumFragment"
app:destination="@id/pendulumFragment" /> app:destination="@id/pendulumFragment" />
<argument
android:name="owner"
app:argType="string" />
</fragment>
<fragment
android:id="@+id/pendulumFragment"
android:name="com.example.acapendulum20.fragments.pendulum.PendulumFragment"
android:label="fragment_pendulum"
tools:layout="@layout/fragment_pendulum" >
<action <action
android:id="@+id/action_startPendulum_to_updateFragment"
android:id="@+id/action_pendulumFragment_to_updateFragment"
app:destination="@id/updateFragment" /> app:destination="@id/updateFragment" />
<argument
android:name="targetVelocity"
app:argType="float" />
<argument
android:name="maxAttemptTime"
app:argType="float" />
<argument
android:name="owner"
app:argType="string" />
</fragment> </fragment>
</navigation> </navigation>

+ 2
- 2
app/src/main/res/values/themes.xml View File

@ -2,7 +2,7 @@
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Theme.AcaPendulum20" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> <style name="Theme.AcaPendulum20" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. --> <!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimary">@color/black</item>
<item name="colorPrimaryVariant">@color/purple_700</item> <item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item> <item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. --> <!-- Secondary brand color. -->
@ -10,7 +10,7 @@
<item name="colorSecondaryVariant">@color/teal_700</item> <item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item> <item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. --> <!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimary</item>
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
</style> </style>
</resources> </resources>

Loading…
Cancel
Save