Skip to content

Commit

Permalink
actions: less warnings is more (fixes #3667) (#3669)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
strawberrybread and dogi authored Jun 21, 2024
1 parent c634de6 commit 4bfcf13
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "org.ole.planet.myplanet"
minSdkVersion 21
targetSdkVersion 34
versionCode 1610
versionName "0.16.10"
versionCode 1611
versionName "0.16.11"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package org.ole.planet.myplanet.ui.enterprises

import android.content.DialogInterface
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.DatePicker
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AlertDialog
import androidx.recyclerview.widget.LinearLayoutManager
import com.borax12.materialdaterangepicker.date.DatePickerDialog
Expand Down Expand Up @@ -76,21 +78,29 @@ class FinanceFragment : BaseTeamFragment() {

private fun showDatePickerDialog() {
val now = Calendar.getInstance()
DatePickerDialog.newInstance({ _: DatePickerDialog?, year: Int, monthOfYear: Int, dayOfMonth: Int, yearEnd: Int, monthOfYearEnd: Int, dayOfMonthEnd: Int ->
val start = Calendar.getInstance()
val end = Calendar.getInstance()
start[year, monthOfYear] = dayOfMonth
end[yearEnd, monthOfYearEnd] = dayOfMonthEnd
list = fRealm.where(RealmMyTeam::class.java).equalTo("teamId", teamId)
.equalTo("docType", "transaction")
.between("date", start.timeInMillis, end.timeInMillis).sort("date", Sort.DESCENDING)
.findAll()
updatedFinanceList(list as RealmResults<RealmMyTeam>)
}, now[Calendar.YEAR], now[Calendar.MONTH], now[Calendar.DAY_OF_MONTH]).show(
requireActivity().fragmentManager, ""

val dpd = DatePickerDialog.newInstance(
{ _: DatePickerDialog?, year: Int, monthOfYear: Int, dayOfMonth: Int, yearEnd: Int, monthOfYearEnd: Int, dayOfMonthEnd: Int ->
val start = Calendar.getInstance()
val end = Calendar.getInstance()
start[year, monthOfYear] = dayOfMonth
end[yearEnd, monthOfYearEnd] = dayOfMonthEnd
val list = fRealm.where(RealmMyTeam::class.java)
.equalTo("teamId", teamId)
.equalTo("docType", "transaction")
.between("date", start.timeInMillis, end.timeInMillis)
.sort("date", Sort.DESCENDING)
.findAll()
updatedFinanceList(list)
},
now[Calendar.YEAR],
now[Calendar.MONTH],
now[Calendar.DAY_OF_MONTH]
)
dpd.show(requireActivity().fragmentManager, "DATE_PICKER")
}

@RequiresApi(Build.VERSION_CODES.O)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (user?.isManager() == true || user?.isLeader() == true) {
Expand Down Expand Up @@ -123,6 +133,7 @@ class FinanceFragment : BaseTeamFragment() {
if (total >= 0) fragmentFinanceBinding.balanceCaution.visibility = View.GONE
}

@RequiresApi(Build.VERSION_CODES.O)
private fun addTransaction() {
AlertDialog.Builder(requireActivity()).setView(setUpAlertUi()).setTitle(R.string.add_transaction)
.setPositiveButton("Submit") { _: DialogInterface?, _: Int ->
Expand Down

0 comments on commit 4bfcf13

Please sign in to comment.