mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-01-03 14:40:07 +02:00
Some fixes
This commit is contained in:
parent
1c1640f53c
commit
e32101a6bb
7 changed files with 33 additions and 44 deletions
|
@ -747,12 +747,10 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
itemFilter.setTitle(show_filtered);
|
itemFilter.setTitle(show_filtered);
|
||||||
}
|
}
|
||||||
popup.setOnDismissListener(menu1 -> {
|
popup.setOnDismissListener(menu1 -> {
|
||||||
if (binding.viewPager.getAdapter() != null) {
|
Fragment fragment = getSupportFragmentManager().findFragmentByTag("f" + binding.viewPager.getCurrentItem());
|
||||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag("f" + binding.viewPager.getCurrentItem());
|
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
||||||
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
FragmentMastodonTimeline fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
|
||||||
FragmentMastodonTimeline fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
|
fragmentMastodonTimeline.refreshAllAdapters();
|
||||||
fragmentMastodonTimeline.refreshAllAdapters();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
String finalShow_filtered = show_filtered;
|
String finalShow_filtered = show_filtered;
|
||||||
|
|
|
@ -277,7 +277,7 @@ public class Account extends BaseAccount implements Serializable {
|
||||||
throw new DBException("db is null. Wrong initialization.");
|
throw new DBException("db is null. Wrong initialization.");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Cursor c = db.query(Sqlite.TABLE_USER_ACCOUNT, null, Sqlite.COL_API + " = 'MASTODON'", null, null, null, null, null);
|
Cursor c = db.query(Sqlite.TABLE_USER_ACCOUNT, null, null, null, null, null, null, null);
|
||||||
return cursorToListUser(c);
|
return cursorToListUser(c);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class CrossActionHelper {
|
||||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(context, Helper.dialogStyle());
|
AlertDialog.Builder builderSingle = new AlertDialog.Builder(context, Helper.dialogStyle());
|
||||||
builderSingle.setTitle(context.getString(R.string.choose_accounts));
|
builderSingle.setTitle(context.getString(R.string.choose_accounts));
|
||||||
final AccountsSearchAdapter accountsSearchAdapter = new AccountsSearchAdapter(context, accountList);
|
final AccountsSearchAdapter accountsSearchAdapter = new AccountsSearchAdapter(context, accountList);
|
||||||
final BaseAccount[] accountArray = new Account[accounts.size()];
|
final BaseAccount[] accountArray = new BaseAccount[accounts.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (BaseAccount account : accounts) {
|
for (BaseAccount account : accounts) {
|
||||||
accountArray[i] = account;
|
accountArray[i] = account;
|
||||||
|
|
|
@ -312,22 +312,19 @@ public class PinnedTimelineHelper {
|
||||||
popup.setOnDismissListener(menu1 -> {
|
popup.setOnDismissListener(menu1 -> {
|
||||||
if (changes[0]) {
|
if (changes[0]) {
|
||||||
FragmentMastodonTimeline fragmentMastodonTimeline;
|
FragmentMastodonTimeline fragmentMastodonTimeline;
|
||||||
if (activityMainBinding.viewPager.getAdapter() != null) {
|
Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag("f" + activityMainBinding.viewPager.getCurrentItem());
|
||||||
Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag("f" + activityMainBinding.viewPager.getCurrentItem());
|
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
||||||
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
|
||||||
fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
|
FragmentTransaction fragTransaction = activity.getSupportFragmentManager().beginTransaction();
|
||||||
FragmentTransaction fragTransaction = activity.getSupportFragmentManager().beginTransaction();
|
fragTransaction.detach(fragmentMastodonTimeline).commit();
|
||||||
fragTransaction.detach(fragmentMastodonTimeline).commit();
|
Bundle bundle = new Bundle();
|
||||||
Bundle bundle = new Bundle();
|
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.TAG);
|
||||||
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.TAG);
|
bundle.putSerializable(Helper.ARG_TAG_TIMELINE, tagTimeline);
|
||||||
bundle.putSerializable(Helper.ARG_TAG_TIMELINE, tagTimeline);
|
fragmentMastodonTimeline.setArguments(bundle);
|
||||||
fragmentMastodonTimeline.setArguments(bundle);
|
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
|
||||||
FragmentTransaction fragTransaction2 = activity.getSupportFragmentManager().beginTransaction();
|
fragTransaction2.attach(fragmentMastodonTimeline);
|
||||||
fragTransaction2.attach(fragmentMastodonTimeline);
|
fragTransaction2.commit();
|
||||||
fragTransaction2.commit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -529,11 +526,9 @@ public class PinnedTimelineHelper {
|
||||||
});
|
});
|
||||||
changes[0] = true;
|
changes[0] = true;
|
||||||
FragmentMastodonTimeline fragmentMastodonTimeline = null;
|
FragmentMastodonTimeline fragmentMastodonTimeline = null;
|
||||||
if (activityMainBinding.viewPager.getAdapter() != null) {
|
Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag("f" + activityMainBinding.viewPager.getCurrentItem());
|
||||||
Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag("f" + activityMainBinding.viewPager.getCurrentItem());
|
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
||||||
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
|
||||||
fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (fragmentMastodonTimeline == null)
|
if (fragmentMastodonTimeline == null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -576,12 +571,10 @@ public class PinnedTimelineHelper {
|
||||||
MenuItem item = popup.getMenu().add(0, 0, Menu.NONE, title);
|
MenuItem item = popup.getMenu().add(0, 0, Menu.NONE, title);
|
||||||
item.setOnMenuItemClickListener(item1 -> {
|
item.setOnMenuItemClickListener(item1 -> {
|
||||||
FragmentMastodonTimeline fragmentMastodonTimeline = null;
|
FragmentMastodonTimeline fragmentMastodonTimeline = null;
|
||||||
if (activityMainBinding.viewPager.getAdapter() != null) {
|
Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag("f" + activityMainBinding.viewPager.getCurrentItem());
|
||||||
Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag("f" + activityMainBinding.viewPager.getCurrentItem());
|
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
||||||
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
|
||||||
fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
|
fragmentMastodonTimeline.refreshAllAdapters();
|
||||||
fragmentMastodonTimeline.refreshAllAdapters();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
FragmentTransaction fragTransaction1 = activity.getSupportFragmentManager().beginTransaction();
|
FragmentTransaction fragTransaction1 = activity.getSupportFragmentManager().beginTransaction();
|
||||||
if (fragmentMastodonTimeline == null)
|
if (fragmentMastodonTimeline == null)
|
||||||
|
@ -659,12 +652,10 @@ public class PinnedTimelineHelper {
|
||||||
popup.setOnDismissListener(menu -> {
|
popup.setOnDismissListener(menu -> {
|
||||||
if (changes[0]) {
|
if (changes[0]) {
|
||||||
FragmentMastodonTimeline fragmentMastodonTimeline = null;
|
FragmentMastodonTimeline fragmentMastodonTimeline = null;
|
||||||
if (activityMainBinding.viewPager.getAdapter() != null) {
|
Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag("f" + activityMainBinding.viewPager.getCurrentItem());
|
||||||
Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag("f" + activityMainBinding.viewPager.getCurrentItem());
|
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
||||||
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
|
||||||
fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
|
fragmentMastodonTimeline.refreshAllAdapters();
|
||||||
fragmentMastodonTimeline.refreshAllAdapters();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
FragmentTransaction fragTransaction1 = activity.getSupportFragmentManager().beginTransaction();
|
FragmentTransaction fragTransaction1 = activity.getSupportFragmentManager().beginTransaction();
|
||||||
if (fragmentMastodonTimeline == null)
|
if (fragmentMastodonTimeline == null)
|
||||||
|
|
|
@ -247,7 +247,7 @@ public class SpannableHelper {
|
||||||
content.setSpan(new LongClickableSpan() {
|
content.setSpan(new LongClickableSpan() {
|
||||||
@Override
|
@Override
|
||||||
public void onLongClick(View view) {
|
public void onLongClick(View view) {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(view.getContext(), Helper.dialogStyle());
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, Helper.dialogStyle());
|
||||||
PopupLinksBinding popupLinksBinding = PopupLinksBinding.inflate(LayoutInflater.from(context));
|
PopupLinksBinding popupLinksBinding = PopupLinksBinding.inflate(LayoutInflater.from(context));
|
||||||
dialogBuilder.setView(popupLinksBinding.getRoot());
|
dialogBuilder.setView(popupLinksBinding.getRoot());
|
||||||
AlertDialog alertDialog = dialogBuilder.create();
|
AlertDialog alertDialog = dialogBuilder.create();
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class FragmentMastodonContext extends Fragment {
|
||||||
focusedStatus = (Status) getArguments().getSerializable(Helper.ARG_STATUS);
|
focusedStatus = (Status) getArguments().getSerializable(Helper.ARG_STATUS);
|
||||||
}
|
}
|
||||||
if (focusedStatus == null) {
|
if (focusedStatus == null) {
|
||||||
requireActivity().getSupportFragmentManager().beginTransaction().remove(this).commit();
|
getChildFragmentManager().beginTransaction().remove(this).commit();
|
||||||
}
|
}
|
||||||
binding = FragmentPaginationBinding.inflate(inflater, container, false);
|
binding = FragmentPaginationBinding.inflate(inflater, container, false);
|
||||||
int c1 = getResources().getColor(R.color.cyanea_accent_reference);
|
int c1 = getResources().getColor(R.color.cyanea_accent_reference);
|
||||||
|
|
|
@ -267,7 +267,7 @@ public class FragmentNotificationContainer extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTabReselected(TabLayout.Tab tab) {
|
public void onTabReselected(TabLayout.Tab tab) {
|
||||||
Fragment fragment = requireActivity().getSupportFragmentManager().findFragmentByTag("f" + binding.viewpager.getCurrentItem());
|
Fragment fragment = getChildFragmentManager().findFragmentByTag("f" + binding.viewpager.getCurrentItem());
|
||||||
if (fragment instanceof FragmentMastodonNotification) {
|
if (fragment instanceof FragmentMastodonNotification) {
|
||||||
FragmentMastodonNotification fragmentMastodonNotification = ((FragmentMastodonNotification) fragment);
|
FragmentMastodonNotification fragmentMastodonNotification = ((FragmentMastodonNotification) fragment);
|
||||||
fragmentMastodonNotification.scrollToTop();
|
fragmentMastodonNotification.scrollToTop();
|
||||||
|
@ -280,7 +280,7 @@ public class FragmentNotificationContainer extends Fragment {
|
||||||
|
|
||||||
public void scrollToTop() {
|
public void scrollToTop() {
|
||||||
if (binding != null) {
|
if (binding != null) {
|
||||||
Fragment fragment = requireActivity().getSupportFragmentManager().findFragmentByTag("f" + binding.viewpager.getCurrentItem());
|
Fragment fragment = getChildFragmentManager().findFragmentByTag("f" + binding.viewpager.getCurrentItem());
|
||||||
if (fragment instanceof FragmentMastodonNotification) {
|
if (fragment instanceof FragmentMastodonNotification) {
|
||||||
((FragmentMastodonNotification) fragment).scrollToTop();
|
((FragmentMastodonNotification) fragment).scrollToTop();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue