Fixes intermittent crashes when clicking the reply button and opening a thread. Closes #26

main
Vavassor 8 years ago
parent 7b5c1fdd90
commit 19e2725824
  1. 3
      app/src/main/java/com/keylesspalace/tusky/LoginActivity.java
  2. 3
      app/src/main/java/com/keylesspalace/tusky/SFragment.java
  3. 21
      app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java
  4. 4
      app/src/main/java/com/keylesspalace/tusky/entity/Status.java

@ -22,6 +22,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
@ -41,7 +42,7 @@ import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class LoginActivity extends BaseActivity {
public class LoginActivity extends AppCompatActivity {
private static final String TAG = "LoginActivity"; // logging tag
private static String OAUTH_SCOPES = "read write follow";

@ -19,7 +19,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentTransaction;
@ -74,7 +73,7 @@ public class SFragment extends BaseFragment {
mentionedUsernames.remove(loggedInUsername);
Intent intent = new Intent(getContext(), ComposeActivity.class);
intent.putExtra("in_reply_to_id", inReplyToId);
intent.putExtra("reply_visibility", status.visibility.toString().toLowerCase());
intent.putExtra("reply_visibility", status.getVisibility().toString().toLowerCase());
intent.putExtra("mentioned_usernames", mentionedUsernames.toArray(new String[0]));
startActivity(intent);
}

@ -125,15 +125,18 @@ public class ViewThreadFragment extends SFragment implements StatusActionListene
}
private void onThreadRequestFailure(final String id) {
Snackbar.make(recyclerView, R.string.error_view_thread, Snackbar.LENGTH_LONG)
.setAction(R.string.action_retry, new View.OnClickListener() {
@Override
public void onClick(View v) {
sendThreadRequest(id);
sendStatusRequest(id);
}
})
.show();
View view = getView();
if (view != null) {
Snackbar.make(view, R.string.error_view_thread, Snackbar.LENGTH_LONG)
.setAction(R.string.action_retry, new View.OnClickListener() {
@Override
public void onClick(View v) {
sendThreadRequest(id);
sendStatusRequest(id);
}
})
.show();
}
}
public void onReply(int position) {

@ -77,6 +77,10 @@ public class Status {
public Visibility visibility;
public Visibility getVisibility() {
return visibility == null ? Visibility.UNLISTED : visibility;
}
@SerializedName("media_attachments")
public MediaAttachment[] attachments;

Loading…
Cancel
Save