Skip to content

Commit

Permalink
Remove unused OCR-related UI items
Browse files Browse the repository at this point in the history
Signed-off-by: Patryk Miś <foss@patrykmis.com>
  • Loading branch information
PatrykMis committed Jan 7, 2024
1 parent 3e2c3b5 commit fd25fe7
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public class TalkbackMenuProcessor {
private static final int ORDER_SHOW_HIDE_SCREEN = 20;

private static final int ORDER_SYSTEM_ACTIONS = 25;
public static final int ORDER_IMAGE_CAPTION = 26;

private final TalkBackService service;
private final ActorState actorState;
Expand Down Expand Up @@ -117,10 +116,6 @@ public boolean prepareMenu(ContextMenu menu) {
addItemOrSubMenuForCurrentNode(
menu, R.id.granularity_menu, R.string.title_granularity, ORDER_NAVIGATION);

// Image caption
addItemOrSubMenuForCurrentNode(
menu, R.id.image_caption_menu, R.string.title_image_caption, ORDER_IMAGE_CAPTION);

// Read From & Last Phrase Spoken & screen search at context_menu.xml
addContextMenuXMLMenu(menu);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,12 @@ public NodeMenuRuleProcessor(
RuleSpannables ruleSpannables = new RuleSpannables(analytics);
rules.add(ruleSpannables);

RuleImageCaption ruleImageCaption = new RuleImageCaption(pipeline, analytics);
rules.add(ruleImageCaption);

nodeMenuRuleHashMap = new HashMap<>();
nodeMenuRuleHashMap.put(R.id.custom_action_menu, ruleCustomAction);
nodeMenuRuleHashMap.put(R.id.viewpager_menu, ruleViewPager);
nodeMenuRuleHashMap.put(R.id.granularity_menu, ruleGranularity);
nodeMenuRuleHashMap.put(R.id.links_menu, ruleSpannables);
nodeMenuRuleHashMap.put(R.id.labeling_breakout_add_label, ruleUnlabeledNode);
nodeMenuRuleHashMap.put(R.id.image_caption_menu, ruleImageCaption);
}

/**
Expand Down Expand Up @@ -188,7 +184,7 @@ public List<String> getSelfNodeMenuActionTypes(AccessibilityNodeInfoCompat node)
// Track which rules accept the node.
for (NodeMenuRule rule : rules) {
// The items which are generated by these rules won't be read out as action hints.
if (rule instanceof RuleGranularity || rule instanceof RuleImageCaption) {
if (rule instanceof RuleGranularity) {
continue;
}
if (!rule.isEnabled(service) || !rule.accept(service, node)) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import android.text.TextUtils;
import androidx.preference.Preference;
import com.google.android.accessibility.talkback.R;
import com.google.android.accessibility.talkback.actor.ImageCaptioner;
import com.google.android.accessibility.talkback.preference.PreferencesActivityUtils;
import com.google.android.accessibility.utils.SharedPreferencesUtils;

Expand Down Expand Up @@ -93,14 +92,6 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
}
};
prefs.registerOnSharedPreferenceChangeListener(listener);

// For describe-image menu item.
Preference describeImagePreference =
findPreference(
context.getString(R.string.pref_show_context_menu_image_caption_setting_key));
if (describeImagePreference != null) {
describeImagePreference.setVisible(ImageCaptioner.supportsImageCaption(context));
}
}

@Override
Expand Down
1 change: 0 additions & 1 deletion talkback/src/main/res/values-watch/donottranslate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
<bool name="pref_show_context_menu_language_default">false</bool>
<bool name="pref_show_context_menu_tts_settings_default">false</bool>
<bool name="pref_show_context_menu_voice_commands_default">false</bool>
<bool name="pref_show_context_menu_image_caption_default">false</bool>
<bool name="pref_show_navigation_menu_controls_default">false</bool>
<bool name="pref_show_navigation_menu_links_default">false</bool>
<bool name="pref_show_navigation_menu_landmarks_default">false</bool>
Expand Down
1 change: 0 additions & 1 deletion talkback/src/main/res/values/donottranslate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,6 @@
<bool name="pref_show_context_menu_talkback_settings_default">true</bool>
<bool name="pref_show_context_menu_system_action_default">false</bool>
<bool name="pref_show_context_menu_tts_settings_default">true</bool>
<bool name="pref_show_context_menu_image_caption_default">true</bool>

<bool name="pref_show_navigation_menu_characters_default">true</bool>
<bool name="pref_show_navigation_menu_words_default">true</bool>
Expand Down
8 changes: 0 additions & 8 deletions talkback/src/main/res/xml/context_menu_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@
android:title="@string/title_labeling_show_or_hide_controls"
app:singleLineTitle="false"
android:summary="@string/summary_labeling_controls"/>
<CheckBoxPreference
android:layout="@layout/listitem_2texts"
android:defaultValue="@bool/pref_show_context_menu_image_caption_default"
android:key="@string/pref_show_context_menu_image_caption_setting_key"
android:order="27"
android:title="@string/title_image_caption"
app:singleLineTitle="false"
android:summary="@string/summary_image_caption"/>
</PreferenceCategory>
<PreferenceCategory
android:key="@string/pref_show_context_menu_navigation_category_key"
Expand Down

0 comments on commit fd25fe7

Please sign in to comment.