Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0b4c6c3 authored by Brian Attwell's avatar Brian Attwell
Browse files

Implement Help&Feedback. P1/2

Bug: 17377125
Change-Id: I111819543ff5fa5fd9786473ba9ff02c28353ee8
parent 92f8ccc1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -37,4 +37,8 @@
    <item
        android:id="@+id/menu_create_contact_shortcut"
        android:title="@string/menu_create_contact_shortcut" />

    <item
        android:id="@+id/menu_help"
        android:title="@string/menu_help" />
</menu>
+2 −2
Original line number Diff line number Diff line
@@ -477,8 +477,8 @@
    <!-- Menu item for the settings activity [CHAR LIMIT=64] -->
    <string name="menu_settings" msgid="377929915873428211">Settings</string>

    <!-- Menu item for invoking contextual help [CHAR LIMIT=64] -->
    <string name="menu_help">Help</string>
    <!-- Menu item for invoking contextual Help & Feedback [CHAR LIMIT=64] -->
    <string name="menu_help">Help &amp; feedback</string>

    <!-- The preference section title for contact display options [CHAR LIMIT=128] -->
    <string name="preference_displayOptions">Display options</string>
+5 −2
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ import com.android.contacts.quickcontact.QuickContactActivity;
import com.android.contacts.util.AccountPromptUtils;
import com.android.contacts.common.util.Constants;
import com.android.contacts.util.DialogManager;
import com.android.contacts.util.HelpUtils;
import com.android.contactsbind.HelpUtils;

import java.util.Locale;
import java.util.concurrent.atomic.AtomicInteger;
@@ -1028,7 +1028,7 @@ public class PeopleActivity extends ContactsActivity implements
                    clearFrequentsMenu.setVisible(false);
                    break;
            }
            HelpUtils.prepareHelpMenuItem(this, helpMenu, R.string.help_url_people_main);
            helpMenu.setVisible(HelpUtils.isHelpAndFeedbackAvailable());
        }
        final boolean showMiscOptions = !isSearchMode;
        makeMenuItemVisible(menu, R.id.menu_search, showMiscOptions);
@@ -1107,6 +1107,9 @@ public class PeopleActivity extends ContactsActivity implements
                ClearFrequentsDialog.show(getFragmentManager());
                return true;
            }
            case R.id.menu_help:
                HelpUtils.launchHelpAndFeedbackForMainScreen(this);
                return true;
            case R.id.menu_accounts: {
                final Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS);
                intent.putExtra(Settings.EXTRA_AUTHORITIES, new String[] {
+8 −0
Original line number Diff line number Diff line
@@ -144,6 +144,8 @@ import com.android.contacts.util.StructuredPostalUtils;
import com.android.contacts.widget.MultiShrinkScroller;
import com.android.contacts.widget.MultiShrinkScroller.MultiShrinkScrollerListener;
import com.android.contacts.widget.QuickContactImageView;
import com.android.contactsbind.HelpUtils;

import com.google.common.collect.Lists;

import java.lang.SecurityException;
@@ -2289,6 +2291,9 @@ public class QuickContactActivity extends ContactsActivity {
            final MenuItem shortcutMenuItem = menu.findItem(R.id.menu_create_contact_shortcut);
            shortcutMenuItem.setVisible(isShortcutCreatable());

            final MenuItem helpMenu = menu.findItem(R.id.menu_help);
            helpMenu.setVisible(HelpUtils.isHelpAndFeedbackAvailable());

            return true;
        }
        return false;
@@ -2371,6 +2376,9 @@ public class QuickContactActivity extends ContactsActivity {
            case R.id.menu_create_contact_shortcut:
                createLauncherShortcutWithContact();
                return true;
            case R.id.menu_help:
                HelpUtils.launchHelpAndFeedbackForContactScreen(this);
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
+40 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 */

package com.android.contactsbind;

import android.app.Activity;

/**
 * Utility for starting help and feedback activity. This stub class is designed to be overwritten
 * by an overlay.
 */
public class HelpUtils {

    /**
     * Returns {@code TRUE} if {@link @launchHelpAndFeedbackForMainScreen} and
     * {@link @launchHelpAndFeedbackForContactScreen} are implemented to start help and feedback
     * activities.
     */
    public static boolean isHelpAndFeedbackAvailable() {
        return false;
    }

    public static void launchHelpAndFeedbackForMainScreen(Activity activity) { }

    public static void launchHelpAndFeedbackForContactScreen(Activity activity) { }

}