Fixed Codacy Static and ktlint errors

This commit is contained in:
Smarshal21 2023-09-28 11:21:33 +05:30
parent 4d4eb2149c
commit 25e2cabbdf
3 changed files with 11 additions and 8 deletions

View file

@ -103,8 +103,9 @@ class GeocodingActivity :
viewModel = ViewModelProvider(this).get(GeoCodingViewModel::class.java)
// Observe geocoding results LiveData
viewModel.getGeocodingResultsLiveData().observe(this, Observer { results ->
// Update the adapter with the new results
viewModel.getGeocodingResultsLiveData().observe(
this,
Observer { results -> // Update the adapter with the new results
adapter.updateData(results)
})
val baseUrl = getString(R.string.osm_geocoder_url)
@ -200,7 +201,7 @@ class GeocodingActivity :
searchView?.maxWidth = Int.MAX_VALUE
searchView?.inputType = InputType.TYPE_TEXT_VARIATION_FILTER
var imeOptions = EditorInfo.IME_ACTION_DONE or EditorInfo.IME_FLAG_NO_FULLSCREEN
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && appPreferences!!.isKeyboardIncognito) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && appPreferences.isKeyboardIncognito) {
imeOptions = imeOptions or EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING
}
searchView?.imeOptions = imeOptions

View file

@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.viewmodels
import android.util.Log
@ -30,6 +31,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import okhttp3.OkHttpClient
import java.io.IOException
class GeoCodingViewModel : ViewModel() {
private val geocodingResultsLiveData = MutableLiveData<List<Address>>()
@ -53,7 +55,7 @@ class GeoCodingViewModel : ViewModel() {
try {
val results = nominatimClient.search(query) as ArrayList<Address>
geocodingResultsLiveData.postValue(results)
} catch (e: Exception) {
} catch (e: IOException) {
Log.e(TAG, "Failed to get geocoded addresses", e)
}
}