mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Merge branch 'fix_510' into develop
This commit is contained in:
commit
6d411a5033
6 changed files with 94 additions and 71 deletions
|
@ -909,7 +909,9 @@ public class Helper {
|
||||||
if (args != null) fragment.setArguments(args);
|
if (args != null) fragment.setArguments(args);
|
||||||
ft.add(containerViewId, fragment, tag);
|
ft.add(containerViewId, fragment, tag);
|
||||||
if (backStackName != null) ft.addToBackStack(backStackName);
|
if (backStackName != null) ft.addToBackStack(backStackName);
|
||||||
ft.commit();
|
if(!fragmentManager.isDestroyed()) {
|
||||||
|
ft.commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fragmentManager.executePendingTransactions();
|
fragmentManager.executePendingTransactions();
|
||||||
return fragment;
|
return fragment;
|
||||||
|
@ -1138,11 +1140,13 @@ public class Helper {
|
||||||
.toSquare()
|
.toSquare()
|
||||||
.setBackgroundColor(fetchAccentColor(activity))
|
.setBackgroundColor(fetchAccentColor(activity))
|
||||||
.build();
|
.build();
|
||||||
Glide.with(activity)
|
if (Helper.isValidContextForGlide(activity)) {
|
||||||
.asDrawable()
|
Glide.with(activity)
|
||||||
.load(avatar)
|
.asDrawable()
|
||||||
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
|
.load(avatar)
|
||||||
.into(view);
|
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
|
||||||
|
.into(view);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,36 +64,41 @@ public class FragmentMediaProfile extends Fragment {
|
||||||
private ImageAdapter imageAdapter;
|
private ImageAdapter imageAdapter;
|
||||||
private boolean checkRemotely;
|
private boolean checkRemotely;
|
||||||
private String accountId;
|
private String accountId;
|
||||||
|
private Bundle arguments;
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
|
||||||
binding = FragmentPaginationBinding.inflate(inflater, container, false);
|
binding = FragmentPaginationBinding.inflate(inflater, container, false);
|
||||||
|
arguments = getArguments();
|
||||||
|
return binding.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
||||||
boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
|
boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
|
||||||
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar);
|
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar);
|
||||||
|
|
||||||
if (getArguments() != null) {
|
if (arguments != null) {
|
||||||
long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1);
|
long bundleId = arguments.getLong(Helper.ARG_INTENT_ID, -1);
|
||||||
if (bundleId != -1) {
|
if (bundleId != -1) {
|
||||||
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
|
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
|
||||||
} else {
|
} else {
|
||||||
if (getArguments().containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
|
if (arguments.containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
|
||||||
try {
|
try {
|
||||||
accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID));
|
accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, arguments.getString(Helper.ARG_CACHED_ACCOUNT_ID));
|
||||||
} catch (DBException e) {
|
} catch (DBException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initializeAfterBundle(getArguments());
|
initializeAfterBundle(arguments);
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
initializeAfterBundle(null);
|
|
||||||
}
|
}
|
||||||
return binding.getRoot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void initializeAfterBundle(Bundle bundle) {
|
private void initializeAfterBundle(Bundle bundle) {
|
||||||
|
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
|
@ -102,7 +107,9 @@ public class FragmentMediaProfile extends Fragment {
|
||||||
}
|
}
|
||||||
checkRemotely = bundle.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
|
checkRemotely = bundle.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
|
||||||
}
|
}
|
||||||
|
if(accountTimeline == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
flagLoading = false;
|
flagLoading = false;
|
||||||
accountsVM = new ViewModelProvider(requireActivity()).get(AccountsVM.class);
|
accountsVM = new ViewModelProvider(requireActivity()).get(AccountsVM.class);
|
||||||
mediaStatuses = new ArrayList<>();
|
mediaStatuses = new ArrayList<>();
|
||||||
|
@ -141,10 +148,6 @@ public class FragmentMediaProfile extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Intialize the common view for statuses on different timelines
|
* Intialize the common view for statuses on different timelines
|
||||||
|
|
|
@ -76,6 +76,7 @@ public class FragmentMastodonAccount extends Fragment {
|
||||||
private Boolean local;
|
private Boolean local;
|
||||||
private boolean checkRemotely;
|
private boolean checkRemotely;
|
||||||
private String instance, token, remoteAccountId;
|
private String instance, token, remoteAccountId;
|
||||||
|
private Bundle arguments;
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
ViewGroup container, Bundle savedInstanceState) {
|
ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
@ -84,27 +85,8 @@ public class FragmentMastodonAccount extends Fragment {
|
||||||
token = currentToken;
|
token = currentToken;
|
||||||
flagLoading = false;
|
flagLoading = false;
|
||||||
binding = FragmentPaginationBinding.inflate(inflater, container, false);
|
binding = FragmentPaginationBinding.inflate(inflater, container, false);
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
|
||||||
boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
|
|
||||||
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar);
|
|
||||||
if (getArguments() != null) {
|
|
||||||
long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1);
|
|
||||||
if (bundleId != -1) {
|
|
||||||
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
|
|
||||||
} else {
|
|
||||||
if (getArguments().containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
|
|
||||||
try {
|
|
||||||
accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID));
|
|
||||||
} catch (DBException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
initializeAfterBundle(getArguments());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
initializeAfterBundle(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
arguments = getArguments();
|
||||||
|
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
@ -149,7 +131,26 @@ public class FragmentMastodonAccount extends Fragment {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
binding.loader.setVisibility(View.VISIBLE);
|
binding.loader.setVisibility(View.VISIBLE);
|
||||||
binding.recyclerView.setVisibility(View.GONE);
|
binding.recyclerView.setVisibility(View.GONE);
|
||||||
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
||||||
|
boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
|
||||||
|
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar);
|
||||||
|
if (arguments != null) {
|
||||||
|
long bundleId = arguments.getLong(Helper.ARG_INTENT_ID, -1);
|
||||||
|
if (bundleId != -1) {
|
||||||
|
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
|
||||||
|
} else {
|
||||||
|
if (arguments.containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
|
||||||
|
try {
|
||||||
|
accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, arguments.getString(Helper.ARG_CACHED_ACCOUNT_ID));
|
||||||
|
} catch (DBException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
initializeAfterBundle(arguments);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
initializeAfterBundle(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,6 +28,7 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
@ -157,6 +158,8 @@ public class FragmentMastodonContext extends Fragment {
|
||||||
return found ? position : -1;
|
return found ? position : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Bundle arguments;
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
ViewGroup container, Bundle savedInstanceState) {
|
ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
@ -165,13 +168,19 @@ public class FragmentMastodonContext extends Fragment {
|
||||||
focusedStatusURI = null;
|
focusedStatusURI = null;
|
||||||
refresh = true;
|
refresh = true;
|
||||||
binding = FragmentPaginationBinding.inflate(inflater, container, false);
|
binding = FragmentPaginationBinding.inflate(inflater, container, false);
|
||||||
if (getArguments() != null) {
|
arguments = getArguments();
|
||||||
long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1);
|
return binding.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
if (arguments != null) {
|
||||||
|
long bundleId = arguments.getLong(Helper.ARG_INTENT_ID, -1);
|
||||||
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
|
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
|
||||||
} else {
|
} else {
|
||||||
initializeAfterBundle(null);
|
initializeAfterBundle(null);
|
||||||
}
|
}
|
||||||
return binding.getRoot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeAfterBundle(Bundle bundle) {
|
private void initializeAfterBundle(Bundle bundle) {
|
||||||
|
|
|
@ -90,6 +90,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
private StatusAdapter statusAdapter;
|
private StatusAdapter statusAdapter;
|
||||||
private Timeline.TimeLineEnum timelineType;
|
private Timeline.TimeLineEnum timelineType;
|
||||||
private List<Status> timelineStatuses;
|
private List<Status> timelineStatuses;
|
||||||
|
private Bundle arguments;
|
||||||
//Handle actions that can be done in other fragments
|
//Handle actions that can be done in other fragments
|
||||||
private final BroadcastReceiver receive_action = new BroadcastReceiver() {
|
private final BroadcastReceiver receive_action = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -348,16 +349,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
binding.loader.setVisibility(View.VISIBLE);
|
|
||||||
binding.recyclerView.setVisibility(View.GONE);
|
|
||||||
if (search != null) {
|
|
||||||
binding.swipeContainer.setRefreshing(false);
|
|
||||||
binding.swipeContainer.setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
@ -369,24 +361,37 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
|
|
||||||
timelineType = Timeline.TimeLineEnum.HOME;
|
timelineType = Timeline.TimeLineEnum.HOME;
|
||||||
binding = FragmentPaginationBinding.inflate(inflater, container, false);
|
binding = FragmentPaginationBinding.inflate(inflater, container, false);
|
||||||
if (getArguments() != null) {
|
arguments = getArguments();
|
||||||
long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1);
|
return binding.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
binding.loader.setVisibility(View.VISIBLE);
|
||||||
|
binding.recyclerView.setVisibility(View.GONE);
|
||||||
|
if (search != null) {
|
||||||
|
binding.swipeContainer.setRefreshing(false);
|
||||||
|
binding.swipeContainer.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arguments != null) {
|
||||||
|
long bundleId = arguments.getLong(Helper.ARG_INTENT_ID, -1);
|
||||||
if (bundleId != -1) {
|
if (bundleId != -1) {
|
||||||
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
|
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
|
||||||
} else {
|
} else {
|
||||||
if (getArguments().containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
|
if (arguments.containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
|
||||||
try {
|
try {
|
||||||
accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID));
|
accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, arguments.getString(Helper.ARG_CACHED_ACCOUNT_ID));
|
||||||
} catch (DBException e) {
|
} catch (DBException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initializeAfterBundle(getArguments());
|
initializeAfterBundle(arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return binding.getRoot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeAfterBundle(Bundle bundle) {
|
private void initializeAfterBundle(Bundle bundle) {
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
timelineType = (Timeline.TimeLineEnum) bundle.get(Helper.ARG_TIMELINE_TYPE);
|
timelineType = (Timeline.TimeLineEnum) bundle.get(Helper.ARG_TIMELINE_TYPE);
|
||||||
|
|
|
@ -47,21 +47,26 @@ public class FragmentProfileTimeline extends Fragment {
|
||||||
private FragmentProfileTimelinesBinding binding;
|
private FragmentProfileTimelinesBinding binding;
|
||||||
private boolean checkRemotely;
|
private boolean checkRemotely;
|
||||||
private boolean show_boosts = true, show_replies = true;
|
private boolean show_boosts = true, show_replies = true;
|
||||||
|
private Bundle arguments;
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
ViewGroup container, Bundle savedInstanceState) {
|
ViewGroup container, Bundle savedInstanceState) {
|
||||||
binding = FragmentProfileTimelinesBinding.inflate(inflater, container, false);
|
binding = FragmentProfileTimelinesBinding.inflate(inflater, container, false);
|
||||||
if (getArguments() != null) {
|
arguments = getArguments();
|
||||||
String cached_account_id = getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID);
|
return binding.getRoot();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
if (arguments != null) {
|
||||||
|
String cached_account_id = arguments.getString(Helper.ARG_CACHED_ACCOUNT_ID);
|
||||||
try {
|
try {
|
||||||
account = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, cached_account_id);
|
account = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, cached_account_id);
|
||||||
} catch (DBException e) {
|
} catch (DBException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
checkRemotely = getArguments().getBoolean(Helper.ARG_CHECK_REMOTELY, false);
|
checkRemotely = arguments.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
|
||||||
initializeAfterBundle();
|
initializeAfterBundle();
|
||||||
}
|
}
|
||||||
return binding.getRoot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,10 +168,6 @@ public class FragmentProfileTimeline extends Fragment {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue