fix crash in ViewThreadFragment

This commit is contained in:
Conny Duck 2018-07-07 12:09:15 +02:00
parent a65ee0a7bb
commit b2c0ed69f6
2 changed files with 8 additions and 8 deletions

View file

@ -26,7 +26,6 @@ import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.keylesspalace.tusky.entity.Status;
import com.keylesspalace.tusky.fragment.ViewThreadFragment;
import com.keylesspalace.tusky.util.LinkHelper;
@ -49,12 +48,9 @@ public class ViewThreadActivity extends BottomSheetActivity implements HasSuppor
return intent;
}
public static Intent startIntentFromStatus(Context context, Status status) {
return startIntent(context, status.getActionableId(), status.getActionableStatus().getUrl());
}
private static final String ID_EXTRA = "id";
private static final String URL_EXTRA = "url";
private static final String FRAGMENT_TAG = "ViewThreadFragment_";
private int revealButtonState = REVEAL_BUTTON_HIDDEN;
@ -78,9 +74,14 @@ public class ViewThreadActivity extends BottomSheetActivity implements HasSuppor
}
String id = getIntent().getStringExtra(ID_EXTRA);
fragment = (ViewThreadFragment)getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG + id);
if(fragment == null) {
fragment = ViewThreadFragment.newInstance(id);
}
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragment = ViewThreadFragment.newInstance(id);
fragmentTransaction.replace(R.id.fragment_container, fragment);
fragmentTransaction.replace(R.id.fragment_container, fragment, FRAGMENT_TAG + id);
fragmentTransaction.commit();
}

View file

@ -144,7 +144,6 @@ public final class ViewThreadFragment extends SFragment implements
});
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {