mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-29 01:48:53 +03:00
Fixed Codacy Static and ktlint errors
This commit is contained in:
parent
4d4eb2149c
commit
25e2cabbdf
3 changed files with 11 additions and 8 deletions
|
@ -36,7 +36,7 @@ class GeocodingAdapter(private val context: Context, private var dataSource: Lis
|
||||||
fun onItemClick(position: Int)
|
fun onItemClick(position: Int)
|
||||||
}
|
}
|
||||||
fun updateData(data: List<Address>) {
|
fun updateData(data: List<Address>) {
|
||||||
this.dataSource = data
|
this.dataSource = data
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,10 +103,11 @@ class GeocodingActivity :
|
||||||
viewModel = ViewModelProvider(this).get(GeoCodingViewModel::class.java)
|
viewModel = ViewModelProvider(this).get(GeoCodingViewModel::class.java)
|
||||||
|
|
||||||
// Observe geocoding results LiveData
|
// Observe geocoding results LiveData
|
||||||
viewModel.getGeocodingResultsLiveData().observe(this, Observer { results ->
|
viewModel.getGeocodingResultsLiveData().observe(
|
||||||
// Update the adapter with the new results
|
this,
|
||||||
adapter.updateData(results)
|
Observer { results -> // Update the adapter with the new results
|
||||||
})
|
adapter.updateData(results)
|
||||||
|
})
|
||||||
val baseUrl = getString(R.string.osm_geocoder_url)
|
val baseUrl = getString(R.string.osm_geocoder_url)
|
||||||
val email = context.getString(R.string.osm_geocoder_contact)
|
val email = context.getString(R.string.osm_geocoder_contact)
|
||||||
nominatimClient = TalkJsonNominatimClient(baseUrl, okHttpClient, email)
|
nominatimClient = TalkJsonNominatimClient(baseUrl, okHttpClient, email)
|
||||||
|
@ -200,7 +201,7 @@ class GeocodingActivity :
|
||||||
searchView?.maxWidth = Int.MAX_VALUE
|
searchView?.maxWidth = Int.MAX_VALUE
|
||||||
searchView?.inputType = InputType.TYPE_TEXT_VARIATION_FILTER
|
searchView?.inputType = InputType.TYPE_TEXT_VARIATION_FILTER
|
||||||
var imeOptions = EditorInfo.IME_ACTION_DONE or EditorInfo.IME_FLAG_NO_FULLSCREEN
|
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
|
imeOptions = imeOptions or EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING
|
||||||
}
|
}
|
||||||
searchView?.imeOptions = imeOptions
|
searchView?.imeOptions = imeOptions
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.nextcloud.talk.viewmodels
|
package com.nextcloud.talk.viewmodels
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
@ -30,6 +31,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
class GeoCodingViewModel : ViewModel() {
|
class GeoCodingViewModel : ViewModel() {
|
||||||
private val geocodingResultsLiveData = MutableLiveData<List<Address>>()
|
private val geocodingResultsLiveData = MutableLiveData<List<Address>>()
|
||||||
|
@ -53,9 +55,9 @@ class GeoCodingViewModel : ViewModel() {
|
||||||
try {
|
try {
|
||||||
val results = nominatimClient.search(query) as ArrayList<Address>
|
val results = nominatimClient.search(query) as ArrayList<Address>
|
||||||
geocodingResultsLiveData.postValue(results)
|
geocodingResultsLiveData.postValue(results)
|
||||||
} catch (e: Exception) {
|
} catch (e: IOException) {
|
||||||
Log.e(TAG, "Failed to get geocoded addresses", e)
|
Log.e(TAG, "Failed to get geocoded addresses", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue