|
@ -12,12 +12,17 @@ import android.os.Bundle; |
|
|
import android.os.Handler; |
|
|
import android.os.Handler; |
|
|
import android.support.design.widget.FloatingActionButton; |
|
|
import android.support.design.widget.FloatingActionButton; |
|
|
import android.support.design.widget.Snackbar; |
|
|
import android.support.design.widget.Snackbar; |
|
|
|
|
|
import android.support.v4.content.ContextCompat; |
|
|
|
|
|
import android.support.v4.content.res.ResourcesCompat; |
|
|
import android.support.v7.app.AlertDialog; |
|
|
import android.support.v7.app.AlertDialog; |
|
|
import android.support.v7.app.AppCompatDelegate; |
|
|
import android.support.v7.app.AppCompatDelegate; |
|
|
import android.support.v7.widget.RecyclerView; |
|
|
import android.support.v7.widget.RecyclerView; |
|
|
|
|
|
import android.text.Spannable; |
|
|
|
|
|
import android.text.SpannableString; |
|
|
import android.text.SpannableStringBuilder; |
|
|
import android.text.SpannableStringBuilder; |
|
|
import android.text.TextUtils; |
|
|
import android.text.TextUtils; |
|
|
import android.text.method.LinkMovementMethod; |
|
|
import android.text.method.LinkMovementMethod; |
|
|
|
|
|
import android.text.style.ForegroundColorSpan; |
|
|
import android.view.LayoutInflater; |
|
|
import android.view.LayoutInflater; |
|
|
import android.view.Menu; |
|
|
import android.view.Menu; |
|
|
import android.view.MenuItem; |
|
|
import android.view.MenuItem; |
|
@ -651,7 +656,15 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo |
|
|
// no page has been loaded yet. Give user the ability to refresh
|
|
|
// no page has been loaded yet. Give user the ability to refresh
|
|
|
recyclerView.setVisibility(View.GONE); |
|
|
recyclerView.setVisibility(View.GONE); |
|
|
TextView errorTextview = findViewById(R.id.error_textview); |
|
|
TextView errorTextview = findViewById(R.id.error_textview); |
|
|
errorTextview.setText(getString(R.string.network_error_retry_prompt)); |
|
|
|
|
|
|
|
|
Spannable errorText = new SpannableString(getString(R.string.network_error_retry_prompt)); |
|
|
|
|
|
errorText.setSpan( |
|
|
|
|
|
new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.accent, null)), |
|
|
|
|
|
errorText.toString().indexOf("Tap to retry"), |
|
|
|
|
|
errorText.length(), |
|
|
|
|
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
|
|
|
|
|
|
|
|
|
|
|
errorTextview.setText(errorText); |
|
|
errorTextview.setVisibility(View.VISIBLE); |
|
|
errorTextview.setVisibility(View.VISIBLE); |
|
|
errorTextview.setOnClickListener(view -> { |
|
|
errorTextview.setOnClickListener(view -> { |
|
|
viewModel.reloadPage(); |
|
|
viewModel.reloadPage(); |
|
@ -671,6 +684,15 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo |
|
|
Timber.w("Requested topic was unauthorized"); |
|
|
Timber.w("Requested topic was unauthorized"); |
|
|
recyclerView.setVisibility(View.GONE); |
|
|
recyclerView.setVisibility(View.GONE); |
|
|
TextView errorTextview = findViewById(R.id.error_textview); |
|
|
TextView errorTextview = findViewById(R.id.error_textview); |
|
|
|
|
|
|
|
|
|
|
|
Spannable errorText = new SpannableString(getString(R.string.unauthorized_topic_error)); |
|
|
|
|
|
errorText.setSpan( |
|
|
|
|
|
//TODO: maybe change the color to a red in order to indicate the error nature of the message
|
|
|
|
|
|
new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.accent, null)), |
|
|
|
|
|
0, |
|
|
|
|
|
errorText.length(), |
|
|
|
|
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
|
|
|
|
|
|
|
|
errorTextview.setText(getString(R.string.unauthorized_topic_error)); |
|
|
errorTextview.setText(getString(R.string.unauthorized_topic_error)); |
|
|
errorTextview.setVisibility(View.VISIBLE); |
|
|
errorTextview.setVisibility(View.VISIBLE); |
|
|
break; |
|
|
break; |
|
|