Skip to content

Commit

Permalink
chore: 1.2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrimault committed Feb 7, 2021
1 parent 17415a0 commit 21bcd38
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 80 deletions.
7 changes: 3 additions & 4 deletions occtax/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

version = "1.1.4"
version = "1.2.0"

android {
compileSdkVersion 29
Expand Down Expand Up @@ -66,7 +65,7 @@ dependencies {
implementation project(':viewpager')
implementation project(':maps')

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0'

Expand All @@ -76,7 +75,7 @@ dependencies {
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha03'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'com.l4digital.fastscroll:fastscroll:2.0.1'

testImplementation 'junit:junit:4.13'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class InputTaxon : AbstractInputTaxon {
if (countingMetadata.isEmpty()) return

val index = if (countingMetadata.index > 0) countingMetadata.index
else this.counting.keys.max()?.plus(1) ?: 1
else this.counting.keys.maxOrNull()?.plus(1) ?: 1

counting[index] = countingMetadata.apply { this.index = index }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.AnimationUtils
import android.widget.TextView
import android.widget.Toast
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat.getSystemService
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.snackbar.Snackbar
import fr.geonature.commons.data.Taxonomy
import fr.geonature.commons.input.AbstractInput
Expand All @@ -28,7 +31,6 @@ import fr.geonature.occtax.settings.PropertySettings
import fr.geonature.occtax.ui.input.IInputFragment
import fr.geonature.viewpager.ui.AbstractPagerFragmentActivity
import fr.geonature.viewpager.ui.IValidateFragment
import kotlinx.android.synthetic.main.fragment_recycler_view_fab.*

/**
* [Fragment] to let the user to add additional counting information for the given [Input].
Expand All @@ -43,6 +45,10 @@ class CountingFragment : Fragment(),

private var input: Input? = null
private var adapter: CountingRecyclerViewAdapter? = null
private var contentView: CoordinatorLayout? = null
private var recyclerView: RecyclerView? = null
private var emptyTextView: TextView? = null
private var fab: FloatingActionButton? = null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down Expand Up @@ -78,9 +84,14 @@ class CountingFragment : Fragment(),
savedInstanceState
)

empty.text = getString(R.string.counting_no_data)
contentView = view.findViewById(android.R.id.content)
recyclerView = view.findViewById(android.R.id.list)

fab.setOnClickListener {
emptyTextView = view.findViewById(android.R.id.empty)
emptyTextView?.text = getString(R.string.counting_no_data)

fab = view.findViewById(R.id.fab)
fab?.setOnClickListener {
launchEditCountingMetadataActivity()
}

Expand All @@ -106,51 +117,53 @@ class CountingFragment : Fragment(),
)?.vibrate(100)
}

Snackbar.make(
content,
R.string.counting_snackbar_counting_deleted,
Snackbar.LENGTH_LONG
)
.setAction(
R.string.counting_snackbar_counting_undo
) {
adapter?.add(
item,
position
)
(input?.getCurrentSelectedInputTaxon() as InputTaxon?)?.addCountingMetadata(
item
)
}
.show()
contentView?.also {
Snackbar.make(
it,
R.string.counting_snackbar_counting_deleted,
Snackbar.LENGTH_LONG
)
.setAction(
R.string.counting_snackbar_counting_undo
) {
adapter?.add(
item,
position
)
(input?.getCurrentSelectedInputTaxon() as InputTaxon?)?.addCountingMetadata(
item
)
}
.show()
}
}

override fun showEmptyTextView(show: Boolean) {
if (empty.visibility == View.VISIBLE == show) {
if (emptyTextView?.visibility == View.VISIBLE == show) {
return
}

if (show) {
empty.startAnimation(
emptyTextView?.startAnimation(
AnimationUtils.loadAnimation(
context,
android.R.anim.fade_in
)
)
empty.visibility = View.VISIBLE
emptyTextView?.visibility = View.VISIBLE
} else {
empty.startAnimation(
emptyTextView?.startAnimation(
AnimationUtils.loadAnimation(
context,
android.R.anim.fade_out
)
)
empty.visibility = View.GONE
emptyTextView?.visibility = View.GONE
}
}
})

with(list as RecyclerView) {
with(recyclerView as RecyclerView) {
layoutManager = LinearLayoutManager(context)
adapter = this@CountingFragment.adapter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.view.animation.AnimationUtils
import android.widget.TextView
import android.widget.Toast
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat.getSystemService
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.snackbar.BaseTransientBottomBar
import com.google.android.material.snackbar.Snackbar
import fr.geonature.commons.input.AbstractInput
Expand All @@ -27,7 +30,6 @@ import fr.geonature.occtax.ui.input.IInputFragment
import fr.geonature.occtax.ui.shared.dialog.CommentDialogFragment
import fr.geonature.viewpager.ui.AbstractPagerFragmentActivity
import fr.geonature.viewpager.ui.IValidateFragment
import kotlinx.android.synthetic.main.fragment_recycler_view_fab.*

/**
* Summary of all edited taxa.
Expand All @@ -40,6 +42,10 @@ class InputTaxaSummaryFragment : Fragment(),

private var input: Input? = null
private var adapter: InputTaxaSummaryRecyclerViewAdapter? = null
private var contentView: CoordinatorLayout? = null
private var recyclerView: RecyclerView? = null
private var emptyTextView: TextView? = null
private var fab: FloatingActionButton? = null

private val onCommentDialogFragmentListener =
object : CommentDialogFragment.OnCommentDialogFragmentListener {
Expand Down Expand Up @@ -83,9 +89,13 @@ class InputTaxaSummaryFragment : Fragment(),
// we have a menu item to show in action bar
setHasOptionsMenu(true)

empty.text = getString(R.string.summary_no_data)
contentView = view.findViewById(android.R.id.content)
recyclerView = view.findViewById(android.R.id.list)

fab.setOnClickListener {
emptyTextView = view.findViewById(android.R.id.empty)
emptyTextView?.text = getString(R.string.summary_no_data)

fab?.setOnClickListener {
((activity as AbstractPagerFragmentActivity?))?.also {
input?.clearCurrentSelectedInputTaxon()
it.goToPreviousPage()
Expand Down Expand Up @@ -116,79 +126,81 @@ class InputTaxaSummaryFragment : Fragment(),
)?.vibrate(100)
}

Snackbar.make(
content,
R.string.summary_snackbar_input_taxon_deleted,
Snackbar.LENGTH_LONG
)
.setAction(
R.string.summary_snackbar_input_taxon_undo
) {
adapter?.add(
item,
position
)
input?.addInputTaxon(item)
}
.addCallback(object : BaseTransientBottomBar.BaseCallback<Snackbar>() {
override fun onDismissed(
transientBottomBar: Snackbar?,
event: Int
contentView?.also {
Snackbar.make(
it,
R.string.summary_snackbar_input_taxon_deleted,
Snackbar.LENGTH_LONG
)
.setAction(
R.string.summary_snackbar_input_taxon_undo
) {
super.onDismissed(
transientBottomBar,
event
adapter?.add(
item,
position
)
input?.addInputTaxon(item)
}
.addCallback(object : BaseTransientBottomBar.BaseCallback<Snackbar>() {
override fun onDismissed(
transientBottomBar: Snackbar?,
event: Int
) {
super.onDismissed(
transientBottomBar,
event
)

(activity as AbstractPagerFragmentActivity?)?.validateCurrentPage()
(activity as AbstractPagerFragmentActivity?)?.validateCurrentPage()

// check if this step is still valid and apply automatic redirection if any
if (!this@InputTaxaSummaryFragment.validate()) {
val context = context ?: return
// check if this step is still valid and apply automatic redirection if any
if (!this@InputTaxaSummaryFragment.validate()) {
val context = context ?: return

Toast.makeText(
context,
R.string.summary_toast_no_input_taxon,
Toast.LENGTH_LONG
)
.show()
Toast.makeText(
context,
R.string.summary_toast_no_input_taxon,
Toast.LENGTH_LONG
)
.show()

((activity as AbstractPagerFragmentActivity?))?.also {
it.goToPreviousPage()
it.goToNextPage()
((activity as AbstractPagerFragmentActivity?))?.also { activity ->
activity.goToPreviousPage()
activity.goToNextPage()
}
}
}
}
})
.show()
})
.show()
}
}

override fun showEmptyTextView(show: Boolean) {
if (empty.visibility == View.VISIBLE == show) {
if (emptyTextView?.visibility == View.VISIBLE == show) {
return
}

if (show) {
empty.startAnimation(
emptyTextView?.startAnimation(
AnimationUtils.loadAnimation(
context,
android.R.anim.fade_in
)
)
empty.visibility = View.VISIBLE
emptyTextView?.visibility = View.VISIBLE
} else {
empty.startAnimation(
emptyTextView?.startAnimation(
AnimationUtils.loadAnimation(
context,
android.R.anim.fade_out
)
)
empty.visibility = View.GONE
emptyTextView?.visibility = View.GONE
}
}
})

with(list as RecyclerView) {
with(recyclerView as RecyclerView) {
layoutManager = LinearLayoutManager(context)
adapter = this@InputTaxaSummaryFragment.adapter

Expand Down
4 changes: 2 additions & 2 deletions occtax/version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Sat Oct 10 15:35:58 CEST 2020
VERSION_CODE=2035
#Sun Feb 07 16:17:34 CET 2021
VERSION_CODE=2070

0 comments on commit 21bcd38

Please sign in to comment.