Small changes for user with no data
This commit is contained in:
parent
20ab2931f2
commit
2ed09692f8
@ -106,6 +106,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
showUsername()
|
showUsername()
|
||||||
|
|
||||||
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()
|
callStartStop()
|
||||||
}
|
}
|
||||||
@ -166,6 +167,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
getTimetrackAccounts(username!!)
|
getTimetrackAccounts(username!!)
|
||||||
lbl_username.text = "Hello " + firstname
|
lbl_username.text = "Hello " + 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 {
|
||||||
@ -195,19 +198,24 @@ class MainActivity : AppCompatActivity() {
|
|||||||
) {
|
) {
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
accounts = response.body()!!.accounts
|
accounts = response.body()!!.accounts
|
||||||
accounts.entries.forEach {
|
if (!accounts.entries.isEmpty()) {
|
||||||
accountNames.add(it.name + "")
|
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)
|
initializeDropdown(accountNames)
|
||||||
println("Dropdown initialized")
|
println("Dropdown initialized")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
override fun onFailure(call: Call<EmbeddedAccounts>, t: Throwable) {
|
override fun onFailure(call: Call<EmbeddedAccounts>, t: Throwable) {
|
||||||
accountNames.add("None")
|
println("Failed to get accounts")
|
||||||
initializeDropdown(accountNames)
|
|
||||||
button_start_stop?.text = "No Timetrack Accounts"
|
|
||||||
Toast.makeText(this@MainActivity, "You dont have any Timetrack Accounts ", Toast.LENGTH_LONG)
|
|
||||||
.show()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -229,8 +237,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
|
||||||
}
|
}
|
||||||
|
@ -96,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"
|
||||||
|
Loading…
Reference in New Issue
Block a user