Fixes public visibility being disabled when replying, and changes the default to public like non-reply posts.

main
Vavassor 8 years ago
parent 801ae3e7e0
commit e4deecc674
  1. 3
      app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java
  2. 16
      app/src/main/java/com/keylesspalace/tusky/fragment/ComposeOptionsFragment.java

@ -64,7 +64,6 @@ import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager;
import android.webkit.MimeTypeMap; import android.webkit.MimeTypeMap;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
@ -541,7 +540,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm
private void showComposeOptions() { private void showComposeOptions() {
ComposeOptionsFragment fragment = ComposeOptionsFragment.newInstance( ComposeOptionsFragment fragment = ComposeOptionsFragment.newInstance(
statusVisibility, statusHideText, inReplyToId != null); statusVisibility, statusHideText);
fragment.show(getSupportFragmentManager(), null); fragment.show(getSupportFragmentManager(), null);
} }

@ -46,13 +46,11 @@ public class ComposeOptionsFragment extends BottomSheetDialogFragment {
private CheckBox hideText; private CheckBox hideText;
private Listener listener; private Listener listener;
public static ComposeOptionsFragment newInstance(String visibility, boolean hideText, public static ComposeOptionsFragment newInstance(String visibility, boolean hideText) {
boolean isReply) {
Bundle arguments = new Bundle(); Bundle arguments = new Bundle();
ComposeOptionsFragment fragment = new ComposeOptionsFragment(); ComposeOptionsFragment fragment = new ComposeOptionsFragment();
arguments.putString("visibility", visibility); arguments.putString("visibility", visibility);
arguments.putBoolean("hideText", hideText); arguments.putBoolean("hideText", hideText);
arguments.putBoolean("isReply", isReply);
fragment.setArguments(arguments); fragment.setArguments(arguments);
return fragment; return fragment;
} }
@ -72,15 +70,9 @@ public class ComposeOptionsFragment extends BottomSheetDialogFragment {
Bundle arguments = getArguments(); Bundle arguments = getArguments();
String statusVisibility = arguments.getString("visibility"); String statusVisibility = arguments.getString("visibility");
boolean statusHideText = arguments.getBoolean("hideText"); boolean statusHideText = arguments.getBoolean("hideText");
boolean isReply = arguments.getBoolean("isReply");
radio = (RadioGroup) rootView.findViewById(R.id.radio_visibility); radio = (RadioGroup) rootView.findViewById(R.id.radio_visibility);
int radioCheckedId; int radioCheckedId = R.id.radio_public;
if (!isReply) {
radioCheckedId = R.id.radio_public;
} else {
radioCheckedId = R.id.radio_unlisted;
}
if (statusVisibility != null) { if (statusVisibility != null) {
switch (statusVisibility) { switch (statusVisibility) {
case "public": radioCheckedId = R.id.radio_public; break; case "public": radioCheckedId = R.id.radio_public; break;
@ -100,10 +92,6 @@ public class ComposeOptionsFragment extends BottomSheetDialogFragment {
setRadioButtonDrawable(getContext(), privateButton, R.drawable.ic_lock_outline_24dp); setRadioButtonDrawable(getContext(), privateButton, R.drawable.ic_lock_outline_24dp);
setRadioButtonDrawable(getContext(), directButton, R.drawable.ic_email_24dp); setRadioButtonDrawable(getContext(), directButton, R.drawable.ic_email_24dp);
if (isReply) {
publicButton.setEnabled(false);
}
hideText = (CheckBox) rootView.findViewById(R.id.compose_hide_text); hideText = (CheckBox) rootView.findViewById(R.id.compose_hide_text);
hideText.setChecked(statusHideText); hideText.setChecked(statusHideText);

Loading…
Cancel
Save