类android.app.assist.AssistContent源码实例Demo

下面列出了怎么用android.app.assist.AssistContent的API类实例代码及写法,或者点击链接到github查看源代码。

@Override
public void handleAssist(final Bundle data, final AssistStructure structure,
        final AssistContent content, final int index, final int count) {
    // We want to pre-warm the AssistStructure before handing it off to the main
    // thread.  We also want to do this on a separate thread, so that if the app
    // is for some reason slow (due to slow filling in of async children in the
    // structure), we don't block other incoming IPCs (such as the screenshot) to
    // us (since we are a oneway interface, they get serialized).  (Okay?)
    Thread retriever = new Thread("AssistStructure retriever") {
        @Override
        public void run() {
            Throwable failure = null;
            if (structure != null) {
                try {
                    structure.ensureData();
                } catch (Throwable e) {
                    Log.w(TAG, "Failure retrieving AssistStructure", e);
                    failure = e;
                }
            }
            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageOOOOII(MSG_HANDLE_ASSIST,
                    data, failure == null ? structure : null, failure, content,
                    index, count));
        }
    };
    retriever.start();
}
 
void doOnHandleAssist(Bundle data, AssistStructure structure, Throwable failure,
        AssistContent content) {
    if (failure != null) {
        onAssistStructureFailure(failure);
    }
    onHandleAssist(data, structure, content);
}
 
void doOnHandleAssistSecondary(Bundle data, AssistStructure structure, Throwable failure,
        AssistContent content, int index, int count) {
    if (failure != null) {
        onAssistStructureFailure(failure);
    }
    onHandleAssistSecondary(data, structure, content, index, count);
}
 
源代码4 项目: Neptune   文件: InstrActivityProxy1.java
@Override
public void onProvideAssistContent(AssistContent outContent) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        super.onProvideAssistContent(outContent);
        if (getController() != null) {
            getController().getPlugin().onProvideAssistContent(outContent);
        }
    }
}
 
源代码5 项目: delion   文件: ChromeActivity.java
@Override
@TargetApi(Build.VERSION_CODES.M)
public void onProvideAssistContent(AssistContent outContent) {
    if (getAssistStatusHandler() == null || !getAssistStatusHandler().isAssistSupported()) {
        // No information is provided in incognito mode.
        return;
    }
    Tab tab = getActivityTab();
    if (tab != null && !isInOverviewMode()) {
        outContent.setWebUri(Uri.parse(tab.getUrl()));
    }
}
 
源代码6 项目: AndroidChromium   文件: ChromeActivity.java
@Override
@TargetApi(Build.VERSION_CODES.M)
public void onProvideAssistContent(AssistContent outContent) {
    if (getAssistStatusHandler() == null || !getAssistStatusHandler().isAssistSupported()) {
        // No information is provided in incognito mode.
        return;
    }
    Tab tab = getActivityTab();
    if (tab != null && !isInOverviewMode()) {
        outContent.setWebUri(Uri.parse(tab.getUrl()));
    }
}
 
源代码7 项目: 365browser   文件: ChromeActivity.java
@Override
@TargetApi(Build.VERSION_CODES.M)
public void onProvideAssistContent(AssistContent outContent) {
    if (getAssistStatusHandler() == null || !getAssistStatusHandler().isAssistSupported()) {
        // No information is provided in incognito mode.
        return;
    }
    Tab tab = getActivityTab();
    if (tab != null && !isInOverviewMode()) {
        outContent.setWebUri(Uri.parse(tab.getUrl()));
    }
}
 
源代码8 项目: timecat   文件: BBVoiceInteractionSession.java
@Override
public void onHandleAssist(Bundle data, AssistStructure structure, AssistContent content) {
    super.onHandleAssist(data, structure, content);
}
 
源代码9 项目: timecat   文件: BBVoiceInteractionSession.java
@Override
public void onHandleAssistSecondary(Bundle data, AssistStructure structure, AssistContent content, int index, int count) {
    super.onHandleAssistSecondary(data, structure, content, index, count);
}
 
源代码10 项目: Saiy-PS   文件: SaiyInteractionSession.java
@Override
public void onHandleAssist(Bundle data, AssistStructure structure, AssistContent content) {
}
 
源代码11 项目: materialup   文件: PostActivity.java
@Override
@TargetApi(Build.VERSION_CODES.M)
public void onProvideAssistContent(AssistContent outContent) {
    outContent.setWebUri(Uri.parse(shot.url));
}
 
源代码12 项目: android-proguards   文件: DesignerNewsStory.java
@Override @TargetApi(Build.VERSION_CODES.M)
public void onProvideAssistContent(AssistContent outContent) {
    outContent.setWebUri(Uri.parse(story.url));
}
 
源代码13 项目: android-proguards   文件: DribbbleShot.java
@Override @TargetApi(Build.VERSION_CODES.M)
public void onProvideAssistContent(AssistContent outContent) {
    outContent.setWebUri(Uri.parse(shot.url));
}
 
/**
 * Called to receive data from the application that the user was currently viewing when
 * an assist session is started.  If the original show request did not specify
 * {@link #SHOW_WITH_ASSIST}, this method will not be called.
 *
 * @param data Arbitrary data supplied by the app through
 * {@link android.app.Activity#onProvideAssistData Activity.onProvideAssistData}.
 * May be null if assist data has been disabled by the user or device policy.
 * @param structure If available, the structure definition of all windows currently
 * displayed by the app.  May be null if assist data has been disabled by the user
 * or device policy; will be an empty stub if the application has disabled assist
 * by marking its window as secure.
 * @param content Additional content data supplied by the app through
 * {@link android.app.Activity#onProvideAssistContent Activity.onProvideAssistContent}.
 * May be null if assist data has been disabled by the user or device policy; will
 * not be automatically filled in with data from the app if the app has marked its
 * window as secure.
 */
public void onHandleAssist(@Nullable Bundle data, @Nullable AssistStructure structure,
        @Nullable AssistContent content) {
}
 
/**
 * Called to receive data from other applications that the user was or is interacting with,
 * that are currently on the screen in a multi-window display environment, not including the
 * currently focused activity. This could be
 * a free-form window, a picture-in-picture window, or another window in a split-screen display.
 * <p>
 * This method is very similar to
 * {@link #onHandleAssist} except that it is called
 * for additional non-focused activities along with an index and count that indicates
 * which additional activity the data is for. {@code index} will be between 1 and
 * {@code count}-1 and this method is called once for each additional window, in no particular
 * order. The {@code count} indicates how many windows to expect assist data for, including the
 * top focused activity, which continues to be returned via {@link #onHandleAssist}.
 * <p>
 * To be responsive to assist requests, process assist data as soon as it is received,
 * without waiting for all queued activities to return assist data.
 *
 * @param data Arbitrary data supplied by the app through
 * {@link android.app.Activity#onProvideAssistData Activity.onProvideAssistData}.
 * May be null if assist data has been disabled by the user or device policy.
 * @param structure If available, the structure definition of all windows currently
 * displayed by the app.  May be null if assist data has been disabled by the user
 * or device policy; will be an empty stub if the application has disabled assist
 * by marking its window as secure.
 * @param content Additional content data supplied by the app through
 * {@link android.app.Activity#onProvideAssistContent Activity.onProvideAssistContent}.
 * May be null if assist data has been disabled by the user or device policy; will
 * not be automatically filled in with data from the app if the app has marked its
 * window as secure.
 * @param index the index of the additional activity that this data
 *        is for.
 * @param count the total number of additional activities for which the assist data is being
 *        returned, including the focused activity that is returned via
 *        {@link #onHandleAssist}.
 */
public void onHandleAssistSecondary(@Nullable Bundle data, @Nullable AssistStructure structure,
        @Nullable AssistContent content, int index, int count) {
}
 
源代码16 项目: CompositeAndroid   文件: BlueprintActivity.java
/**
 * This is called when the user is requesting an assist, to provide references
 * to content related to the current activity.  Before being called, the
 * {@code outContent} Intent is filled with the base Intent of the activity (the Intent
 * returned by {@link #getIntent()}).  The Intent's extras are stripped of any types
 * that are not valid for {@link PersistableBundle} or non-framework Parcelables, and
 * the flags {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION} and
 * {@link Intent#FLAG_GRANT_PERSISTABLE_URI_PERMISSION} are cleared from the Intent.
 *
 * <p>Custom implementation may adjust the content intent to better reflect the top-level
 * context of the activity, and fill in its ClipData with additional content of
 * interest that the user is currently viewing.  For example, an image gallery application
 * that has launched in to an activity allowing the user to swipe through pictures should
 * modify the intent to reference the current image they are looking it; such an
 * application when showing a list of pictures should add a ClipData that has
 * references to all of the pictures currently visible on screen.</p>
 *
 * @param outContent The assist content to return.
 */
@Override
public void onProvideAssistContent(AssistContent outContent) {
    super.onProvideAssistContent(outContent);
}
 
源代码17 项目: CompositeAndroid   文件: ICompositeActivity.java
void onProvideAssistContent(AssistContent outContent); 
源代码18 项目: CompositeAndroid   文件: ICompositeActivity.java
void super_onProvideAssistContent(AssistContent outContent); 
 类所在包
 类方法
 同包方法