Merge branch '101-get-todays-entries' into 'master'

Resolve "Get todays entries"

Closes #101

See merge request marcel.schwarz/2020ss-qbc-geofence-timetracking!98
This commit is contained in:
Tobias Wieck 2020-06-04 19:10:53 +00:00
commit 23aa33209a
20 changed files with 368 additions and 97 deletions

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@ -37,9 +37,10 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0' implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.1.0' implementation 'com.google.android.material:material:1.1.0'
implementation "com.google.android.gms:play-services-location:17.0.0" implementation "com.google.android.gms:play-services-location:17.0.0"
implementation 'androidx.preference:preference:1.1.1' implementation 'androidx.preference:preference:1.1.1'

View File

@ -0,0 +1,44 @@
package de.hft.geotracker
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.TextView
import androidx.cardview.widget.CardView
import androidx.recyclerview.widget.RecyclerView
import de.hft.geotracker.activities.RecordEntry
class RecordsAdapter : RecyclerView.Adapter<TextItemViewHolder>() {
var data = listOf<RecordEntry>()
set(value) {
field = value
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TextItemViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val view = layoutInflater
.inflate(R.layout.text_item_view, parent, false) as CardView
return TextItemViewHolder(view)
}
override fun getItemCount(): Int {
return data.size
}
override fun onBindViewHolder(holder: TextItemViewHolder, position: Int) {
val item = data[position]
holder.textFrom.setText("Start: " + item.from)
holder.textTo.setText("End: " + item.to)
if (item.duration != -1) {
holder.textTotal.setText("Duration: " + item.duration)
}
}
}
class TextItemViewHolder(textView: CardView): RecyclerView.ViewHolder(textView) {
val textFrom = itemView.findViewById<TextView>(R.id.recyclerText_from)
val textTo = itemView.findViewById<TextView>(R.id.recyclerText_to)
val textTotal = itemView.findViewById<TextView>(R.id.recyclerText_total)
}

View File

@ -54,7 +54,7 @@ class Login : AppCompatActivity() {
.build() .build()
service = retrofit.create(GeofenceService::class.java) service = retrofit.create(GeofenceService::class.java)
login = findViewById(R.id.button_create_account) login = findViewById(R.id.button_login)
login.setOnClickListener { login.setOnClickListener {
intent = Intent(this, MainActivity::class.java) intent = Intent(this, MainActivity::class.java)
login() login()

View File

@ -1,8 +1,12 @@
package de.hft.geotracker.activities package de.hft.geotracker.activities
import android.Manifest
import android.Manifest.permission.ACCESS_COARSE_LOCATION
import android.Manifest.permission.ACCESS_FINE_LOCATION import android.Manifest.permission.ACCESS_FINE_LOCATION
import android.app.AlertDialog
import android.app.PendingIntent import android.app.PendingIntent
import android.content.Context import android.content.Context
import android.content.DialogInterface
import android.content.Intent import android.content.Intent
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.os.Bundle import android.os.Bundle
@ -12,12 +16,14 @@ import android.widget.*
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import androidx.core.app.ActivityCompat.requestPermissions import androidx.core.app.ActivityCompat.requestPermissions
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.gms.location.* import com.google.android.gms.location.*
import de.hft.geotracker.GeofenceBroadcastReceiver import de.hft.geotracker.GeofenceBroadcastReceiver
import de.hft.geotracker.R import de.hft.geotracker.R
import de.hft.geotracker.RecordsAdapter
import de.hft.geotracker.retrofit.* import de.hft.geotracker.retrofit.*
import kotlinx.android.synthetic.main.activity_home.* import kotlinx.android.synthetic.main.activity_home.*
import kotlinx.android.synthetic.main.dropdown_menu.*
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
@ -34,6 +40,7 @@ class MainActivity : AppCompatActivity() {
lateinit var actionButton: TextView lateinit var actionButton: TextView
var running = false var running = false
var accName: String? = null var accName: String? = null
var workingSince: String? = null
lateinit var accounts: ValuesTimetrackAccounts lateinit var accounts: ValuesTimetrackAccounts
lateinit var service: GeofenceService lateinit var service: GeofenceService
lateinit var locationRequest: LocationRequest lateinit var locationRequest: LocationRequest
@ -65,19 +72,20 @@ class MainActivity : AppCompatActivity() {
?.apply() ?.apply()
getSharedPreferences("LOCATION", Context.MODE_PRIVATE) getSharedPreferences("LOCATION", Context.MODE_PRIVATE)
.registerOnSharedPreferenceChangeListener { sharedPreferences, key -> .registerOnSharedPreferenceChangeListener { sharedPreferences, key ->
val btnState = sharedPreferences.getBoolean("ENABLED", false) val isInside = sharedPreferences.getBoolean("ENABLED", false)
println("Buttonstate: $btnState") println("Is inside? -> $isInside")
if (btnState) { if (isInside) {
button_start_stop?.text = getString(R.string.start)
button_start_stop?.setBackgroundColor(resources.getColor(R.color.logo_blue)) button_start_stop?.setBackgroundColor(resources.getColor(R.color.logo_blue))
} else { } else {
button_start_stop?.setBackgroundColor(resources.getColor(R.color.colorPrimaryDark)) button_start_stop?.setBackgroundColor(resources.getColor(R.color.colorPrimaryDark))
if (running) { if (running) {
button_start_stop.toggle()
callStartStop() callStartStop()
} }
button_start_stop?.text = getString(R.string.outside_place)
} }
button_start_stop.isEnabled = btnState button_start_stop.isEnabled = isInside
} }
//JWToken lesen //JWToken lesen
@ -102,37 +110,35 @@ class MainActivity : AppCompatActivity() {
val retrofit = builder.build() val retrofit = builder.build()
service = retrofit.create(GeofenceService::class.java) service = retrofit.create(GeofenceService::class.java)
showUsername() showUsername()
updateRecyclerView()
//Get Timetrack Accounts
val accountNames = mutableListOf<String>()
// accountNames.add("None")
val call = service.getAccounts()
call.enqueue(object: Callback<EmbeddedAccounts> {
override fun onResponse(
call: Call<EmbeddedAccounts>,
response: Response<EmbeddedAccounts>
) {
if (response.isSuccessful) {
accounts = response.body()!!.accounts
accounts.entries.forEach {
accountNames.add(it.name + "")
}
initializeDropdown(accountNames)
}
}
override fun onFailure(call: Call<EmbeddedAccounts>, t: Throwable) {
accountNames.add("None")
initializeDropdown(accountNames)
Toast.makeText(this@MainActivity, "You dont have any Timetrack Accounts ", Toast.LENGTH_LONG)
.show()
}
})
actionButton = findViewById(R.id.button_start_stop) actionButton = findViewById(R.id.button_start_stop)
actionButton.setBackgroundColor(resources.getColor(R.color.colorPrimaryDark))
actionButton.setOnClickListener { actionButton.setOnClickListener {
callStartStop() if (running) {
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
builder.setTitle(R.string.app_name)
builder.setMessage("Do you want to stop?")
builder.setIcon(R.drawable.ic_logo)
builder.setPositiveButton("Yes", object : DialogInterface.OnClickListener {
override fun onClick(dialog: DialogInterface, id: Int) {
callStartStop()
dialog.dismiss()
}
})
builder.setNegativeButton("No", object : DialogInterface.OnClickListener {
override fun onClick(dialog: DialogInterface, id: Int) {
dialog.dismiss()
}
})
val alert: AlertDialog = builder.create()
alert.show()
} else {
callStartStop()
}
} }
//Toolbar listener
my_toolbar.setOnMenuItemClickListener { menuItem -> my_toolbar.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) { when (menuItem.itemId) {
R.id.settings -> { R.id.settings -> {
@ -141,6 +147,9 @@ class MainActivity : AppCompatActivity() {
true true
} }
R.id.logout -> { R.id.logout -> {
if (running) {
callStartStop()
}
deleteFile("JWToken") deleteFile("JWToken")
startActivity(Intent(this, Login::class.java)) startActivity(Intent(this, Login::class.java))
println("Logout pressed") println("Logout pressed")
@ -149,30 +158,76 @@ class MainActivity : AppCompatActivity() {
else -> false else -> false
} }
} }
}
private fun updateRecyclerView() {
//Recycler View
val recView: RecyclerView = records_list
recView.setHasFixedSize(true)
val layoutManager: RecyclerView.LayoutManager = LinearLayoutManager(this)
val adapter = RecordsAdapter()
val recordList = ArrayList<RecordEntry>()
val call = service.getTodaysRecords()
call.enqueue(object: Callback<EmbeddedRecords> {
override fun onResponse(call: Call<EmbeddedRecords>, response: Response<EmbeddedRecords>) {
if (response.isSuccessful) {
val entries = response.body()!!.records.entries
if (!entries.isEmpty()) {
entries.forEach {
recordList.add(RecordEntry(it.startdate.substring(11, 16)
, it.enddate.substring(11, 16)
, it.duration))
}
if (running) {
recordList.add(RecordEntry(workingSince!!, "PENDING", -1))
}
adapter.data = recordList
recView.layoutManager = layoutManager
recView.adapter = adapter
} else {
println("No Records!")
}
} else {
println("Response for todays records was not successful")
}
}
override fun onFailure(call: Call<EmbeddedRecords>, t: Throwable) {
println("Getting todays records failed")
}
})
} }
private fun callStartStop() { private fun callStartStop() {
running = !running running = !running
if (running) { if (running) {
account_spinner.visibility = View.GONE account_spinner.visibility = View.GONE
button_start_stop?.text = getString(R.string.stop)
} else { } else {
account_spinner.visibility = View.VISIBLE account_spinner.visibility = View.VISIBLE
button_start_stop?.text = getString(R.string.start)
} }
if (!accName.isNullOrEmpty()) { if (!accName.isNullOrEmpty()) {
val call = service.triggerTracking(accName!!) val call = service.triggerTracking(accName!!)
call.enqueue(object : Callback<ValuesTracking> { call.enqueue(object : Callback<ValuesTracking> {
override fun onResponse(call: Call<ValuesTracking>, response: Response<ValuesTracking>) { override fun onResponse(call: Call<ValuesTracking>, response: Response<ValuesTracking>) {
latitude.text = response.body()?.startdate workingSince = response.body()?.startdate?.substring(11, 16)
longitude.text = response.body()?.enddate updateRecyclerView()
println("Tracking event successful!") println("Tracking event successful!")
} }
override fun onFailure(call: Call<ValuesTracking>, t: Throwable) { override fun onFailure(call: Call<ValuesTracking>, t: Throwable) {
println("Problem at start tracking: " + t.message) println("Problem at start tracking: " + t.message)
} }
}) })
} else {
println("Accounts list is emty")
} }
println("StartStop pressed: $running") println("StartStop pressed: $running")
//ToDO call /track Endpoint
} }
private fun showUsername() { private fun showUsername() {
@ -182,13 +237,16 @@ class MainActivity : AppCompatActivity() {
if (response.isSuccessful) { if (response.isSuccessful) {
val firstname = response.body()?.firstname val firstname = response.body()?.firstname
val location = response.body()?.location val location = response.body()?.location
val username = response.body()?.username
getTimetrackAccounts(username!!)
lbl_username.text = "Hello " + firstname lbl_username.text = "Hello " + firstname
println("Body: " + firstname)
if (location?.latitude == null) { if (location?.latitude == null) {
button_start_stop?.text = "No geofence set for you"
button_start_stop?.setBackgroundColor(resources.getColor(R.color.colorPrimaryDark))
Toast.makeText(this@MainActivity, "No geofence set for you", Toast.LENGTH_LONG) Toast.makeText(this@MainActivity, "No geofence set for you", Toast.LENGTH_LONG)
.show() .show()
} else { } else {
initializeGeofence(location?.latitude, location?.longitude, location?.radius) initializeGeofence(location.latitude, location.longitude, location.radius)
} }
} else { } else {
println("Response not successful: ${response.code()}") println("Response not successful: ${response.code()}")
@ -199,6 +257,41 @@ class MainActivity : AppCompatActivity() {
println("Response 'whoami' failed. " + t.message) println("Response 'whoami' failed. " + t.message)
} }
}) })
}
private fun getTimetrackAccounts(user: String) {
val accountNames = mutableListOf<String>()
// accountNames.add("None")
val call = service.getAccounts(user)
call.enqueue(object: Callback<EmbeddedAccounts> {
override fun onResponse(
call: Call<EmbeddedAccounts>,
response: Response<EmbeddedAccounts>
) {
if (response.isSuccessful) {
accounts = response.body()!!.accounts
if (!accounts.entries.isEmpty()) {
accounts.entries.forEach {
accountNames.add(it.name + "")
}
} else {
accountNames.add("None")
initializeDropdown(accountNames)
display_description.setText("You dont have any Timetrack Accounts")
Toast.makeText(this@MainActivity, "You dont have any Timetrack Accounts", Toast.LENGTH_LONG)
.show()
}
initializeDropdown(accountNames)
println("Dropdown initialized")
}
}
override fun onFailure(call: Call<EmbeddedAccounts>, t: Throwable) {
println("Failed to get accounts")
}
})
} }
private fun initializeDropdown(accountNames: MutableList<String>) { private fun initializeDropdown(accountNames: MutableList<String>) {
val spinner: Spinner = findViewById(R.id.account_spinner) val spinner: Spinner = findViewById(R.id.account_spinner)
@ -218,8 +311,6 @@ class MainActivity : AppCompatActivity() {
display_description.setText(accounts.entries.get(position).description) display_description.setText(accounts.entries.get(position).description)
display_revenue.setText(accounts.entries.get(position).revenue.toString()) display_revenue.setText(accounts.entries.get(position).revenue.toString())
} else { } else {
display_description.visibility = View.GONE
display_description_layout.visibility = View.GONE
display_revenue.visibility = View.GONE display_revenue.visibility = View.GONE
display_revenue_layout.visibility = View.GONE display_revenue_layout.visibility = View.GONE
} }
@ -237,6 +328,13 @@ class MainActivity : AppCompatActivity() {
.setExpirationDuration(Geofence.NEVER_EXPIRE) .setExpirationDuration(Geofence.NEVER_EXPIRE)
.setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER or Geofence.GEOFENCE_TRANSITION_EXIT) .setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER or Geofence.GEOFENCE_TRANSITION_EXIT)
.build() .build()
if (ActivityCompat.checkSelfPermission(
this,
ACCESS_FINE_LOCATION
) != PackageManager.PERMISSION_GRANTED
) {
requestPermissions(this, arrayOf(ACCESS_FINE_LOCATION), 1000)
}
geofencingClient.addGeofences(getGeofencingRequest(), geofencePendingIntent)?.run { geofencingClient.addGeofences(getGeofencingRequest(), geofencePendingIntent)?.run {
addOnSuccessListener { addOnSuccessListener {
println("Geofence added with: latitude: $lat longitude: $long radius: $rad") println("Geofence added with: latitude: $lat longitude: $long radius: $rad")
@ -266,6 +364,16 @@ class MainActivity : AppCompatActivity() {
startLocationUpdates() startLocationUpdates()
} }
private fun startLocationUpdates() { private fun startLocationUpdates() {
if (ActivityCompat.checkSelfPermission(
this,
ACCESS_FINE_LOCATION
) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
this,
Manifest.permission.ACCESS_COARSE_LOCATION
) != PackageManager.PERMISSION_GRANTED
) {
requestPermissions(this, arrayOf(ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION), 1000)
}
fusedLocationClient.requestLocationUpdates( fusedLocationClient.requestLocationUpdates(
locationRequest, locationRequest,
locationCallback, locationCallback,
@ -285,3 +393,11 @@ class MainActivity : AppCompatActivity() {
} }
} }
class RecordEntry(from: String, to: String, duration: Int) {
val from = from
val to = to
val duration = duration
}

View File

@ -3,6 +3,7 @@ package de.hft.geotracker.activities
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.widget.TextView import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import de.hft.geotracker.R import de.hft.geotracker.R
@ -11,14 +12,15 @@ class Register : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_register) setContentView(R.layout.activity_register)
reg = findViewById(R.id.button_create_account) reg = findViewById(R.id.button_login)
reg.setOnClickListener { reg.setOnClickListener {
createAccount() createAccount()
} }
} }
private fun createAccount() { private fun createAccount() {
startActivity(Intent(this, MainActivity::class.java)) Toast.makeText(this@Register, "Not yet implemented!", Toast.LENGTH_LONG)
.show()
} }

View File

@ -1,6 +1,8 @@
package de.hft.geotracker.activities package de.hft.geotracker.activities
import android.os.Bundle import android.os.Bundle
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import de.hft.geotracker.R import de.hft.geotracker.R
import kotlinx.android.synthetic.main.activity_home.* import kotlinx.android.synthetic.main.activity_home.*
@ -9,10 +11,14 @@ class Settings : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.settings_activity) setContentView(R.layout.activity_settings)
my_toolbar.setNavigationOnClickListener { my_toolbar.setNavigationOnClickListener {
onBackPressed() onBackPressed()
} }
findViewById<TextView>(R.id.button_submit).setOnClickListener {
Toast.makeText(this@Settings, "Not yet implemented!", Toast.LENGTH_LONG)
.show()
}
} }
} }

View File

@ -0,0 +1,8 @@
package de.hft.geotracker.retrofit
import com.google.gson.annotations.SerializedName
class EmbeddedRecords(records: ValuesRecordsArray) {
@SerializedName("_embedded")
var records = records
}

View File

@ -1,10 +1,7 @@
package de.hft.geotracker.retrofit package de.hft.geotracker.retrofit
import retrofit2.Call import retrofit2.Call
import retrofit2.http.Body import retrofit2.http.*
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query
interface GeofenceService { interface GeofenceService {
@POST("/login") @POST("/login")
@ -13,9 +10,12 @@ interface GeofenceService {
@GET("whoami") @GET("whoami")
fun getUser(): Call<ValuesUser> fun getUser(): Call<ValuesUser>
@GET("accounts") @GET("accounts/search/findByUsername")
fun getAccounts(): Call<EmbeddedAccounts> fun getAccounts(@Query("username") username : String): Call<EmbeddedAccounts>
@GET("track") @GET("track")
fun triggerTracking(@Query("account") account: String): Call<ValuesTracking> fun triggerTracking(@Query("account") account: String): Call<ValuesTracking>
@GET("records/search/today")
fun getTodaysRecords(): Call<EmbeddedRecords>
} }

View File

@ -0,0 +1,22 @@
package de.hft.geotracker.retrofit
import com.google.gson.annotations.SerializedName
class ValuesRecordEntry(
start: String,
end: String,
type: String,
duration: Int
) {
@SerializedName("startdate")
var startdate = start
@SerializedName("enddate")
var enddate = end
@SerializedName("type")
var type = type
@SerializedName("duration")
var duration = duration
}

View File

@ -0,0 +1,8 @@
package de.hft.geotracker.retrofit
import com.google.gson.annotations.SerializedName
class ValuesRecordsArray(entries: Array<ValuesRecordEntry>) {
@SerializedName("records")
var entries = entries
}

View File

@ -68,23 +68,20 @@
app:layout_constraintTop_toBottomOf="@+id/divider2" app:layout_constraintTop_toBottomOf="@+id/divider2"
app:layout_constraintVertical_bias="0.0" /> app:layout_constraintVertical_bias="0.0" />
<ToggleButton <Button
android:id="@+id/button_start_stop" android:id="@+id/button_start_stop"
style="@style/Widget.MaterialComponents.Button" style="@style/Widget.MaterialComponents.Button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="55dp"
android:layout_marginStart="@dimen/margin16" android:layout_marginStart="@dimen/margin16"
android:layout_marginEnd="@dimen/margin16" android:layout_marginEnd="@dimen/margin16"
android:layout_marginBottom="@dimen/margin16" android:layout_marginBottom="@dimen/margin16"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
android:checked="true"
android:enabled="false" android:enabled="false"
android:text="@string/outside_place"
android:textAppearance="@style/text_style" android:textAppearance="@style/text_style"
android:textColor="@color/logo_white" android:textColor="@color/logo_white"
android:textOff="@string/stop"
android:textOn="@string/btn_start_text"
android:textStyle="bold" android:textStyle="bold"
app:cornerRadius="8dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />
@ -99,8 +96,7 @@
android:foregroundGravity="right|center_horizontal" android:foregroundGravity="right|center_horizontal"
android:textAlignment="textEnd" android:textAlignment="textEnd"
app:layout_constraintBottom_toBottomOf="@+id/selected_acc" app:layout_constraintBottom_toBottomOf="@+id/selected_acc"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent" />
app:layout_constraintStart_toEndOf="@+id/selected_acc" />
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/display_description_layout" android:id="@+id/display_description_layout"
@ -144,7 +140,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin16" android:layout_marginStart="@dimen/margin16"
android:layout_marginEnd="@dimen/margin16" android:layout_marginEnd="@dimen/margin16"
android:layout_marginBottom="16dp"
android:colorControlNormal="@color/logo_blue" android:colorControlNormal="@color/logo_blue"
android:hint="Revenue" android:hint="Revenue"
android:textColorHint="@color/logo_white" android:textColorHint="@color/logo_white"
@ -152,11 +147,9 @@
app:boxBackgroundMode="outline" app:boxBackgroundMode="outline"
app:boxCornerRadiusTopEnd="0dp" app:boxCornerRadiusTopEnd="0dp"
app:boxCornerRadiusTopStart="0dp" app:boxCornerRadiusTopStart="0dp"
app:layout_constraintBottom_toTopOf="@+id/latitude"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/display_description_layout" app:layout_constraintTop_toBottomOf="@+id/display_description_layout"
app:layout_constraintVertical_bias="0.0"
app:layout_constraintVertical_chainStyle="packed"> app:layout_constraintVertical_chainStyle="packed">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
@ -173,42 +166,30 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<TextView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/altitude" android:id="@+id/records_list"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="0dp"
android:text="dummy" android:layout_marginStart="16dp"
android:textAppearance="@style/text_style" android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toTopOf="@+id/button_start_stop" app:layout_constraintBottom_toTopOf="@+id/button_start_stop"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_today" />
<TextView <TextView
android:id="@+id/latitude" android:id="@+id/text_today"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" android:text="@string/today_records"
android:text="dummy"
android:textAppearance="@style/text_style" android:textAppearance="@style/text_style"
android:textColor="@color/logo_white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/display_revenue_layout" /> app:layout_constraintTop_toBottomOf="@+id/display_revenue_layout" />
<TextView
android:id="@+id/longitude"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="dummy"
android:textAppearance="@style/text_style"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/latitude" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -63,7 +63,7 @@
android:textColorHint="@color/logo_white" android:textColorHint="@color/logo_white"
app:boxBackgroundColor="@color/common_google_signin_btn_text_dark_disabled" app:boxBackgroundColor="@color/common_google_signin_btn_text_dark_disabled"
app:boxBackgroundMode="outline" app:boxBackgroundMode="outline"
app:layout_constraintBottom_toTopOf="@+id/button_create_account" app:layout_constraintBottom_toTopOf="@+id/button_login"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -81,7 +81,7 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<Button <Button
android:id="@+id/button_create_account" android:id="@+id/button_login"
style="@style/Widget.MaterialComponents.Button" style="@style/Widget.MaterialComponents.Button"
android:layout_width="240dp" android:layout_width="240dp"
android:layout_height="55dp" android:layout_height="55dp"
@ -112,7 +112,7 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497" app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_create_account" app:layout_constraintTop_toBottomOf="@+id/button_login"
app:layout_constraintVertical_bias="0.0" /> app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -33,7 +33,7 @@
android:hint="@string/confirm_password" android:hint="@string/confirm_password"
android:inputType="textPassword" android:inputType="textPassword"
android:textAlignment="center" android:textAlignment="center"
app:layout_constraintBottom_toTopOf="@+id/button_create_account" app:layout_constraintBottom_toTopOf="@+id/button_login"
app:layout_constraintEnd_toEndOf="@+id/input_email_register" app:layout_constraintEnd_toEndOf="@+id/input_email_register"
app:layout_constraintTop_toBottomOf="@+id/input_password_layout" /> app:layout_constraintTop_toBottomOf="@+id/input_password_layout" />
@ -87,7 +87,7 @@
app:layout_constraintTop_toBottomOf="@+id/input_email_register" /> app:layout_constraintTop_toBottomOf="@+id/input_email_register" />
<Button <Button
android:id="@+id/button_create_account" android:id="@+id/button_login"
style="@style/Widget.MaterialComponents.Button" style="@style/Widget.MaterialComponents.Button"
android:layout_width="240dp" android:layout_width="240dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -30,7 +30,7 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<Button <Button
android:id="@+id/button" android:id="@+id/button_submit"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/colorPrimary"
app:cardCornerRadius="4dp"
android:layout_marginBottom="4dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">
<TextView
android:id="@+id/recyclerText_from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textAlignment="textStart"
android:textAppearance="@style/text_style"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/recyclerText_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textAlignment="viewStart"
android:textAppearance="@style/text_style"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/recyclerText_total"
app:layout_constraintStart_toEndOf="@+id/recyclerText_from"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/recyclerText_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textAppearance="@style/text_style"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

View File

@ -8,6 +8,7 @@
<string name="btn_start_text">START</string> <string name="btn_start_text">START</string>
<string name="pause">PAUSE</string> <string name="pause">PAUSE</string>
<string name="stop">STOP</string> <string name="stop">STOP</string>
<string name="start">START</string>
<string name="username_email">Your Username or E-Mail</string> <string name="username_email">Your Username or E-Mail</string>
<string name="username">Username</string> <string name="username">Username</string>
<string name="choose_username">Choose a Username</string> <string name="choose_username">Choose a Username</string>
@ -37,4 +38,6 @@
<string name="submit">Submit</string> <string name="submit">Submit</string>
<string name="logout">Logout</string> <string name="logout">Logout</string>
<string name="hello">Hello</string> <string name="hello">Hello</string>
<string name="outside_place">Outside your working place</string>
<string name="today_records">Todays Records:</string>
</resources> </resources>

View File

@ -8,7 +8,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.6.3' classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong

View File

@ -1,6 +1,6 @@
#Sun Apr 05 19:25:41 CEST 2020 #Tue Jun 02 21:02:45 CEST 2020
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip