Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.recyclerview.widget.RecyclerView;

import de.icod.techidon.E;
Expand Down Expand Up @@ -238,6 +240,9 @@ protected void onHidden(){
protected void onShown(){
super.onShown();
imgLoader.activate();
if (fab != null) {
updateFabLongClickAccessibilityAction();
}
}

@Override
Expand Down Expand Up @@ -556,11 +561,39 @@ public void getSelectorBounds(View view, Rect outRect){
fab.setVisibility(View.VISIBLE);
fab.setOnClickListener(this::onFabClick);
fab.setOnLongClickListener(this::onFabLongClick);
updateFabLongClickAccessibilityAction();
} else if (fab != null) {
fab.setVisibility(View.GONE);
}
}

private void updateFabLongClickAccessibilityAction() {
if (fab == null)
return;

boolean multipleAccounts = AccountSessionManager.getInstance().getLoggedInAccounts().size() > 1;

Comment on lines +570 to +575
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateFabLongClickAccessibilityAction() duplicates the same logic now present in HomeTabFragment (and partially in other views). To reduce the chance of future drift (e.g., label/resource changes), consider extracting this into a shared helper (e.g., in UiUtils) that takes the target view and label resource.

Copilot uses AI. Check for mistakes.
// Only expose a long-click action (including to accessibility services)
// when there are multiple accounts to manage.
fab.setLongClickable(multipleAccounts);

if (multipleAccounts) {
ViewCompat.replaceAccessibilityAction(
fab,
AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK,
getString(R.string.choose_account),
null
);
} else {
ViewCompat.replaceAccessibilityAction(
fab,
AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK,
null,
null
);
}
}

@Override
public void onConfigurationChanged(Configuration newConfig){
super.onConfigurationChanged(newConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import android.widget.Toolbar;

import androidx.annotation.NonNull;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.widget.ViewPager2;

Expand Down Expand Up @@ -148,6 +150,7 @@ public View onCreateContentView(LayoutInflater inflater, ViewGroup container, Bu
fab = view.findViewById(R.id.fab);
fab.setOnClickListener(this::onFabClick);
fab.setOnLongClickListener(this::onFabLongClick);
updateFabLongClickAccessibilityAction();
pager = new ViewPager2(getContext());
toolbarFrame = (FrameLayout) LayoutInflater.from(getContext()).inflate(R.layout.home_toolbar, getToolbar(), false);

Expand Down Expand Up @@ -686,10 +689,37 @@ public void onDestroyView(){
@Override
protected void onShown() {
super.onShown();
if (fab != null) {
updateFabLongClickAccessibilityAction();
}
Object timelines = AccountSessionManager.get(accountID).getLocalPreferences().timelines;
if (timelines != null && timelinesList!= timelines) UiUtils.restartApp();
}

private void updateFabLongClickAccessibilityAction() {
if (fab == null)
return;

boolean multipleAccounts = AccountSessionManager.getInstance().getLoggedInAccounts().size() > 1;
fab.setLongClickable(multipleAccounts);

if (multipleAccounts) {
ViewCompat.replaceAccessibilityAction(
fab,
AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK,
getString(R.string.choose_account),
null
);
} else {
ViewCompat.replaceAccessibilityAction(
fab,
AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK,
null,
null
);
}
Comment on lines +704 to +720
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateFabLongClickAccessibilityAction() mirrors the same implementation added in BaseStatusListFragment. Consider extracting a shared helper (e.g., UiUtils.updateLongClickActionLabel(view, enabled, @StringRes label)) to avoid duplicated accessibility logic across fragments.

Suggested change
fab.setLongClickable(multipleAccounts);
if (multipleAccounts) {
ViewCompat.replaceAccessibilityAction(
fab,
AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK,
getString(R.string.manage_accounts),
null
);
} else {
ViewCompat.replaceAccessibilityAction(
fab,
AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK,
null,
null
);
}
UiUtils.updateLongClickActionLabel(fab, multipleAccounts, R.string.manage_accounts);

Copilot uses AI. Check for mistakes.
}

@Override
public void onViewStateRestored(Bundle savedInstanceState) {
super.onViewStateRestored(savedInstanceState);
Expand Down
Loading