cleanup code
This commit is contained in:
parent
3c685800d8
commit
50b0d1fb8d
15 changed files with 13 additions and 90 deletions
|
|
@ -21,7 +21,6 @@ import android.os.Bundle
|
|||
import android.support.v4.app.ActivityOptionsCompat
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.support.v4.view.ViewCompat
|
||||
import android.support.v4.widget.SwipeRefreshLayout
|
||||
import android.support.v7.widget.GridLayoutManager
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.util.Log
|
||||
|
|
@ -29,8 +28,6 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import com.keylesspalace.tusky.R
|
||||
import com.keylesspalace.tusky.ViewMediaActivity
|
||||
import com.keylesspalace.tusky.ViewVideoActivity
|
||||
|
|
|
|||
|
|
@ -58,8 +58,6 @@ import javax.inject.Inject;
|
|||
* overlap functionality. So, I'm momentarily leaving it and hopefully working on those will clear
|
||||
* up what needs to be where. */
|
||||
public abstract class SFragment extends BaseFragment {
|
||||
protected static final int COMPOSE_RESULT = 1;
|
||||
|
||||
protected String loggedInAccountId;
|
||||
protected String loggedInUsername;
|
||||
|
||||
|
|
@ -137,7 +135,7 @@ public abstract class SFragment extends BaseFragment {
|
|||
.repyingStatusAuthor(actionableStatus.getAccount().getLocalUsername())
|
||||
.replyingStatusContent(actionableStatus.getContent().toString())
|
||||
.build(getContext());
|
||||
startActivityForResult(intent, COMPOSE_RESULT);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
protected void more(final Status status, View view, final int position) {
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ public class TimelineFragment extends SFragment implements
|
|||
}
|
||||
|
||||
private void setupSwipeRefreshLayout() {
|
||||
Context context = Objects.requireNonNull(getContext());
|
||||
Context context = requireContext();
|
||||
swipeRefreshLayout.setOnRefreshListener(this);
|
||||
swipeRefreshLayout.setColorSchemeResources(R.color.primary);
|
||||
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(ThemeUtils.getColor(context,
|
||||
|
|
@ -274,7 +274,7 @@ public class TimelineFragment extends SFragment implements
|
|||
}
|
||||
|
||||
private void setupRecyclerView() {
|
||||
Context context = Objects.requireNonNull(getContext());
|
||||
Context context = requireContext();
|
||||
recyclerView.setHasFixedSize(true);
|
||||
layoutManager = new LinearLayoutManager(context);
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
|
|
@ -349,7 +349,7 @@ public class TimelineFragment extends SFragment implements
|
|||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
if (jumpToTopAllowed()) {
|
||||
TabLayout layout = Objects.requireNonNull(getActivity()).findViewById(R.id.tab_layout);
|
||||
TabLayout layout = requireActivity().findViewById(R.id.tab_layout);
|
||||
if (layout != null) {
|
||||
onTabSelectedListener = new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
|
|
@ -417,8 +417,7 @@ public class TimelineFragment extends SFragment implements
|
|||
@Override
|
||||
public void onDestroyView() {
|
||||
if (jumpToTopAllowed()) {
|
||||
TabLayout tabLayout = Objects.requireNonNull(getActivity())
|
||||
.findViewById(R.id.tab_layout);
|
||||
TabLayout tabLayout = requireActivity().findViewById(R.id.tab_layout);
|
||||
if (tabLayout != null) {
|
||||
tabLayout.removeOnTabSelectedListener(onTabSelectedListener);
|
||||
}
|
||||
|
|
@ -427,8 +426,7 @@ public class TimelineFragment extends SFragment implements
|
|||
}
|
||||
|
||||
private void setupNothingView() {
|
||||
Drawable top = AppCompatResources.getDrawable(Objects.requireNonNull(getContext()),
|
||||
R.drawable.elephant_friend);
|
||||
Drawable top = AppCompatResources.getDrawable(requireContext(), R.drawable.elephant_friend);
|
||||
if (top != null) {
|
||||
top.setBounds(0, 0, top.getIntrinsicWidth() / 2, top.getIntrinsicHeight() / 2);
|
||||
}
|
||||
|
|
@ -663,7 +661,7 @@ public class TimelineFragment extends SFragment implements
|
|||
updateAdapter();
|
||||
}
|
||||
|
||||
public void removeAllByAccountId(String accountId) {
|
||||
private void removeAllByAccountId(String accountId) {
|
||||
// using iterator to safely remove items while iterating
|
||||
Iterator<Either<Placeholder, Status>> iterator = statuses.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
|
|
@ -1067,7 +1065,7 @@ public class TimelineFragment extends SFragment implements
|
|||
public void onInserted(int position, int count) {
|
||||
adapter.notifyItemRangeInserted(position, count);
|
||||
if (position == 0) {
|
||||
recyclerView.scrollBy(0, Utils.dpToPx(Objects.requireNonNull(getContext()), -30));
|
||||
recyclerView.scrollBy(0, Utils.dpToPx(requireContext(), -30));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue