mirror of
https://github.com/MatomoCamp/matomocamp-companion-android.git
synced 2024-09-19 16:13:46 +02:00
Tint the error Snackbar using colorError
This commit is contained in:
parent
207b5b45a1
commit
0752dbc6ee
2 changed files with 5 additions and 8 deletions
|
@ -4,9 +4,6 @@ import android.app.SearchManager;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
|
@ -77,10 +74,10 @@ public class SearchResultActivity extends SimpleToolbarActivity {
|
|||
viewModel.setQuery(query);
|
||||
|
||||
if (SearchViewModel.isQueryTooShort(query)) {
|
||||
SpannableString errorMessage = new SpannableString(getString(R.string.search_length_error));
|
||||
int textColor = ContextCompat.getColor(this, R.color.color_error_inverse);
|
||||
errorMessage.setSpan(new ForegroundColorSpan(textColor), 0, errorMessage.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
Snackbar.make(findViewById(R.id.content), errorMessage, Snackbar.LENGTH_LONG).show();
|
||||
Snackbar.make(findViewById(R.id.content), R.string.search_length_error, Snackbar.LENGTH_LONG)
|
||||
.setTextColor(ContextCompat.getColor(this, R.color.color_on_error))
|
||||
.setBackgroundTint(ContextCompat.getColor(this, R.color.color_error))
|
||||
.show();
|
||||
}
|
||||
|
||||
} else if (Intent.ACTION_VIEW.equals(intentAction)) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<color name="schedule_time_background">#29000000</color>
|
||||
<color name="schedule_time_running_background">@color/color_secondary</color>
|
||||
<color name="color_error">@color/design_default_color_error</color>
|
||||
<color name="color_error_inverse">@color/design_dark_default_color_error</color>
|
||||
<color name="color_on_error">@color/design_default_color_on_error</color>
|
||||
<color name="shortcut_background">#F5F5F5</color>
|
||||
|
||||
<!-- Track types -->
|
||||
|
|
Loading…
Reference in a new issue