mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-31 23:03:54 +01:00
feat:Used Snackbar and timber instead of log and Toast
This commit is contained in:
parent
baaa0d86c8
commit
d7683f8ca6
2 changed files with 12 additions and 5 deletions
|
|
@ -7,7 +7,7 @@ import android.text.Html
|
|||
import android.text.Spanned
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.view.WindowManager
|
||||
import android.widget.Toast
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import fr.free.nrw.commons.R
|
||||
import fr.free.nrw.commons.databinding.DialogFeedbackBinding
|
||||
import fr.free.nrw.commons.feedback.model.Feedback
|
||||
|
|
@ -49,15 +49,21 @@ class FeedbackDialog(
|
|||
} catch (e: Exception) {
|
||||
when (e) {
|
||||
is UnknownHostException -> {
|
||||
Toast.makeText(context, R.string.error_feedback, Toast.LENGTH_SHORT).show()
|
||||
Snackbar.make(findViewById(android.R.id.content),
|
||||
R.string.error_feedback,
|
||||
Snackbar.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
is ConnectException -> {
|
||||
Toast.makeText(context, R.string.error_feedback, Toast.LENGTH_SHORT).show()
|
||||
Snackbar.make(findViewById(android.R.id.content),
|
||||
R.string.error_feedback,
|
||||
Snackbar.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
else -> {
|
||||
Toast.makeText(context, R.string.error_feedback, Toast.LENGTH_SHORT).show()
|
||||
Snackbar.make(findViewById(android.R.id.content),
|
||||
R.string.error_feedback,
|
||||
Snackbar.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import fr.free.nrw.commons.settings.SettingsActivity
|
|||
import io.reactivex.Single
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Named
|
||||
|
||||
|
|
@ -190,7 +191,7 @@ class MoreBottomSheetFragment : BottomSheetDialogFragment() {
|
|||
}
|
||||
Toast.makeText(requireContext(), getString(messageResId), Toast.LENGTH_SHORT).show()
|
||||
}, { error ->
|
||||
error.printStackTrace()
|
||||
Timber.e(error)
|
||||
Toast.makeText(requireContext(), R.string.error_feedback, Toast.LENGTH_SHORT).show()
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue