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:
commit
23aa33209a
25
android/.idea/jarRepositories.xml
generated
Normal file
25
android/.idea/jarRepositories.xml
generated
Normal 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>
|
2
android/.idea/misc.xml
generated
2
android/.idea/misc.xml
generated
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
@ -37,9 +37,10 @@ dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
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.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.gms:play-services-location:17.0.0"
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
|
@ -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)
|
||||
}
|
@ -54,7 +54,7 @@ class Login : AppCompatActivity() {
|
||||
.build()
|
||||
service = retrofit.create(GeofenceService::class.java)
|
||||
|
||||
login = findViewById(R.id.button_create_account)
|
||||
login = findViewById(R.id.button_login)
|
||||
login.setOnClickListener {
|
||||
intent = Intent(this, MainActivity::class.java)
|
||||
login()
|
||||
|
@ -1,8 +1,12 @@
|
||||
package de.hft.geotracker.activities
|
||||
|
||||
import android.Manifest
|
||||
import android.Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
import android.Manifest.permission.ACCESS_FINE_LOCATION
|
||||
import android.app.AlertDialog
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
@ -12,12 +16,14 @@ import android.widget.*
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.app.ActivityCompat.requestPermissions
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.gms.location.*
|
||||
import de.hft.geotracker.GeofenceBroadcastReceiver
|
||||
import de.hft.geotracker.R
|
||||
import de.hft.geotracker.RecordsAdapter
|
||||
import de.hft.geotracker.retrofit.*
|
||||
import kotlinx.android.synthetic.main.activity_home.*
|
||||
import kotlinx.android.synthetic.main.dropdown_menu.*
|
||||
import okhttp3.OkHttpClient
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
@ -34,6 +40,7 @@ class MainActivity : AppCompatActivity() {
|
||||
lateinit var actionButton: TextView
|
||||
var running = false
|
||||
var accName: String? = null
|
||||
var workingSince: String? = null
|
||||
lateinit var accounts: ValuesTimetrackAccounts
|
||||
lateinit var service: GeofenceService
|
||||
lateinit var locationRequest: LocationRequest
|
||||
@ -65,19 +72,20 @@ class MainActivity : AppCompatActivity() {
|
||||
?.apply()
|
||||
getSharedPreferences("LOCATION", Context.MODE_PRIVATE)
|
||||
.registerOnSharedPreferenceChangeListener { sharedPreferences, key ->
|
||||
val btnState = sharedPreferences.getBoolean("ENABLED", false)
|
||||
val isInside = sharedPreferences.getBoolean("ENABLED", false)
|
||||
|
||||
println("Buttonstate: $btnState")
|
||||
if (btnState) {
|
||||
println("Is inside? -> $isInside")
|
||||
if (isInside) {
|
||||
button_start_stop?.text = getString(R.string.start)
|
||||
button_start_stop?.setBackgroundColor(resources.getColor(R.color.logo_blue))
|
||||
} else {
|
||||
} else {
|
||||
button_start_stop?.setBackgroundColor(resources.getColor(R.color.colorPrimaryDark))
|
||||
if (running) {
|
||||
button_start_stop.toggle()
|
||||
callStartStop()
|
||||
}
|
||||
button_start_stop?.text = getString(R.string.outside_place)
|
||||
}
|
||||
button_start_stop.isEnabled = btnState
|
||||
button_start_stop.isEnabled = isInside
|
||||
}
|
||||
|
||||
//JWToken lesen
|
||||
@ -102,37 +110,35 @@ class MainActivity : AppCompatActivity() {
|
||||
val retrofit = builder.build()
|
||||
service = retrofit.create(GeofenceService::class.java)
|
||||
showUsername()
|
||||
|
||||
//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()
|
||||
}
|
||||
})
|
||||
updateRecyclerView()
|
||||
|
||||
actionButton = findViewById(R.id.button_start_stop)
|
||||
actionButton.setBackgroundColor(resources.getColor(R.color.colorPrimaryDark))
|
||||
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 ->
|
||||
when (menuItem.itemId) {
|
||||
R.id.settings -> {
|
||||
@ -141,6 +147,9 @@ class MainActivity : AppCompatActivity() {
|
||||
true
|
||||
}
|
||||
R.id.logout -> {
|
||||
if (running) {
|
||||
callStartStop()
|
||||
}
|
||||
deleteFile("JWToken")
|
||||
startActivity(Intent(this, Login::class.java))
|
||||
println("Logout pressed")
|
||||
@ -149,30 +158,76 @@ class MainActivity : AppCompatActivity() {
|
||||
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() {
|
||||
running = !running
|
||||
if (running) {
|
||||
account_spinner.visibility = View.GONE
|
||||
button_start_stop?.text = getString(R.string.stop)
|
||||
} else {
|
||||
account_spinner.visibility = View.VISIBLE
|
||||
button_start_stop?.text = getString(R.string.start)
|
||||
}
|
||||
if (!accName.isNullOrEmpty()) {
|
||||
val call = service.triggerTracking(accName!!)
|
||||
call.enqueue(object : Callback<ValuesTracking> {
|
||||
override fun onResponse(call: Call<ValuesTracking>, response: Response<ValuesTracking>) {
|
||||
latitude.text = response.body()?.startdate
|
||||
longitude.text = response.body()?.enddate
|
||||
workingSince = response.body()?.startdate?.substring(11, 16)
|
||||
updateRecyclerView()
|
||||
println("Tracking event successful!")
|
||||
}
|
||||
override fun onFailure(call: Call<ValuesTracking>, t: Throwable) {
|
||||
println("Problem at start tracking: " + t.message)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
println("Accounts list is emty")
|
||||
}
|
||||
println("StartStop pressed: $running")
|
||||
//ToDO call /track Endpoint
|
||||
}
|
||||
|
||||
private fun showUsername() {
|
||||
@ -182,13 +237,16 @@ class MainActivity : AppCompatActivity() {
|
||||
if (response.isSuccessful) {
|
||||
val firstname = response.body()?.firstname
|
||||
val location = response.body()?.location
|
||||
val username = response.body()?.username
|
||||
getTimetrackAccounts(username!!)
|
||||
lbl_username.text = "Hello " + firstname
|
||||
println("Body: " + firstname)
|
||||
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)
|
||||
.show()
|
||||
} else {
|
||||
initializeGeofence(location?.latitude, location?.longitude, location?.radius)
|
||||
initializeGeofence(location.latitude, location.longitude, location.radius)
|
||||
}
|
||||
} else {
|
||||
println("Response not successful: ${response.code()}")
|
||||
@ -199,6 +257,41 @@ class MainActivity : AppCompatActivity() {
|
||||
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>) {
|
||||
val spinner: Spinner = findViewById(R.id.account_spinner)
|
||||
@ -218,8 +311,6 @@ class MainActivity : AppCompatActivity() {
|
||||
display_description.setText(accounts.entries.get(position).description)
|
||||
display_revenue.setText(accounts.entries.get(position).revenue.toString())
|
||||
} else {
|
||||
display_description.visibility = View.GONE
|
||||
display_description_layout.visibility = View.GONE
|
||||
display_revenue.visibility = View.GONE
|
||||
display_revenue_layout.visibility = View.GONE
|
||||
}
|
||||
@ -237,6 +328,13 @@ class MainActivity : AppCompatActivity() {
|
||||
.setExpirationDuration(Geofence.NEVER_EXPIRE)
|
||||
.setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER or Geofence.GEOFENCE_TRANSITION_EXIT)
|
||||
.build()
|
||||
if (ActivityCompat.checkSelfPermission(
|
||||
this,
|
||||
ACCESS_FINE_LOCATION
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
requestPermissions(this, arrayOf(ACCESS_FINE_LOCATION), 1000)
|
||||
}
|
||||
geofencingClient.addGeofences(getGeofencingRequest(), geofencePendingIntent)?.run {
|
||||
addOnSuccessListener {
|
||||
println("Geofence added with: latitude: $lat longitude: $long radius: $rad")
|
||||
@ -266,6 +364,16 @@ class MainActivity : AppCompatActivity() {
|
||||
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(
|
||||
locationRequest,
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,6 +3,7 @@ package de.hft.geotracker.activities
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import de.hft.geotracker.R
|
||||
|
||||
@ -11,14 +12,15 @@ class Register : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_register)
|
||||
reg = findViewById(R.id.button_create_account)
|
||||
reg = findViewById(R.id.button_login)
|
||||
reg.setOnClickListener {
|
||||
createAccount()
|
||||
}
|
||||
}
|
||||
|
||||
private fun createAccount() {
|
||||
startActivity(Intent(this, MainActivity::class.java))
|
||||
Toast.makeText(this@Register, "Not yet implemented!", Toast.LENGTH_LONG)
|
||||
.show()
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package de.hft.geotracker.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import de.hft.geotracker.R
|
||||
import kotlinx.android.synthetic.main.activity_home.*
|
||||
@ -9,10 +11,14 @@ class Settings : AppCompatActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.settings_activity)
|
||||
setContentView(R.layout.activity_settings)
|
||||
my_toolbar.setNavigationOnClickListener {
|
||||
onBackPressed()
|
||||
}
|
||||
findViewById<TextView>(R.id.button_submit).setOnClickListener {
|
||||
Toast.makeText(this@Settings, "Not yet implemented!", Toast.LENGTH_LONG)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package de.hft.geotracker.retrofit
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class EmbeddedRecords(records: ValuesRecordsArray) {
|
||||
@SerializedName("_embedded")
|
||||
var records = records
|
||||
}
|
@ -1,10 +1,7 @@
|
||||
package de.hft.geotracker.retrofit
|
||||
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Query
|
||||
import retrofit2.http.*
|
||||
|
||||
interface GeofenceService {
|
||||
@POST("/login")
|
||||
@ -13,9 +10,12 @@ interface GeofenceService {
|
||||
@GET("whoami")
|
||||
fun getUser(): Call<ValuesUser>
|
||||
|
||||
@GET("accounts")
|
||||
fun getAccounts(): Call<EmbeddedAccounts>
|
||||
@GET("accounts/search/findByUsername")
|
||||
fun getAccounts(@Query("username") username : String): Call<EmbeddedAccounts>
|
||||
|
||||
@GET("track")
|
||||
fun triggerTracking(@Query("account") account: String): Call<ValuesTracking>
|
||||
|
||||
@GET("records/search/today")
|
||||
fun getTodaysRecords(): Call<EmbeddedRecords>
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -68,23 +68,20 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/divider2"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
<ToggleButton
|
||||
<Button
|
||||
android:id="@+id/button_start_stop"
|
||||
style="@style/Widget.MaterialComponents.Button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="55dp"
|
||||
android:layout_marginStart="@dimen/margin16"
|
||||
android:layout_marginEnd="@dimen/margin16"
|
||||
android:layout_marginBottom="@dimen/margin16"
|
||||
android:background="@color/colorPrimary"
|
||||
android:checked="true"
|
||||
android:enabled="false"
|
||||
android:text="@string/outside_place"
|
||||
android:textAppearance="@style/text_style"
|
||||
android:textColor="@color/logo_white"
|
||||
android:textOff="@string/stop"
|
||||
android:textOn="@string/btn_start_text"
|
||||
android:textStyle="bold"
|
||||
app:cornerRadius="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
@ -99,8 +96,7 @@
|
||||
android:foregroundGravity="right|center_horizontal"
|
||||
android:textAlignment="textEnd"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/selected_acc"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/selected_acc" />
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/display_description_layout"
|
||||
@ -144,7 +140,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin16"
|
||||
android:layout_marginEnd="@dimen/margin16"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:colorControlNormal="@color/logo_blue"
|
||||
android:hint="Revenue"
|
||||
android:textColorHint="@color/logo_white"
|
||||
@ -152,11 +147,9 @@
|
||||
app:boxBackgroundMode="outline"
|
||||
app:boxCornerRadiusTopEnd="0dp"
|
||||
app:boxCornerRadiusTopStart="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/latitude"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/display_description_layout"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
app:layout_constraintVertical_chainStyle="packed">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
@ -173,42 +166,30 @@
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/altitude"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="dummy"
|
||||
android:textAppearance="@style/text_style"
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/records_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
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_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text_today" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/latitude"
|
||||
android:id="@+id/text_today"
|
||||
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:text="@string/today_records"
|
||||
android:textAppearance="@style/text_style"
|
||||
android:textColor="@color/logo_white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
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>
|
@ -63,7 +63,7 @@
|
||||
android:textColorHint="@color/logo_white"
|
||||
app:boxBackgroundColor="@color/common_google_signin_btn_text_dark_disabled"
|
||||
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_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@ -81,7 +81,7 @@
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_create_account"
|
||||
android:id="@+id/button_login"
|
||||
style="@style/Widget.MaterialComponents.Button"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="55dp"
|
||||
@ -112,7 +112,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.497"
|
||||
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" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -33,7 +33,7 @@
|
||||
android:hint="@string/confirm_password"
|
||||
android:inputType="textPassword"
|
||||
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_constraintTop_toBottomOf="@+id/input_password_layout" />
|
||||
|
||||
@ -87,7 +87,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/input_email_register" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_create_account"
|
||||
android:id="@+id/button_login"
|
||||
style="@style/Widget.MaterialComponents.Button"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -30,7 +30,7 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:id="@+id/button_submit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
55
android/app/src/main/res/layout/text_item_view.xml
Normal file
55
android/app/src/main/res/layout/text_item_view.xml
Normal 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>
|
@ -8,6 +8,7 @@
|
||||
<string name="btn_start_text">START</string>
|
||||
<string name="pause">PAUSE</string>
|
||||
<string name="stop">STOP</string>
|
||||
<string name="start">START</string>
|
||||
<string name="username_email">Your Username or E-Mail</string>
|
||||
<string name="username">Username</string>
|
||||
<string name="choose_username">Choose a Username</string>
|
||||
@ -37,4 +38,6 @@
|
||||
<string name="submit">Submit</string>
|
||||
<string name="logout">Logout</string>
|
||||
<string name="hello">Hello</string>
|
||||
<string name="outside_place">Outside your working place</string>
|
||||
<string name="today_records">Todays Records:</string>
|
||||
</resources>
|
||||
|
@ -8,7 +8,7 @@ buildscript {
|
||||
|
||||
}
|
||||
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"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
@ -1,6 +1,6 @@
|
||||
#Sun Apr 05 19:25:41 CEST 2020
|
||||
#Tue Jun 02 21:02:45 CEST 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user