/*
 * Copyright 2013 Urban Airship and Contributors
 */

package com.urbanairship.richpush.sample.inbox;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.urbanairship.Logger;
import com.urbanairship.richpush.RichPushManager;
import com.urbanairship.richpush.RichPushMessage;
import com.urbanairship.widget.RichPushMessageView;

/**
 * Fragment that displays a rich push message in a RichPushMessageView
 */
public class MessageFragment extends Fragment {

    private static final String MESSAGE_ID_KEY = "com.urbanairship.richpush.URL_KEY";
    private RichPushMessageView browser;

    /**
     * Creates a new MessageFragment
     * @param messageId The message's id to display
     * @return messageFragment new MessageFragment
     */
    public static MessageFragment newInstance(String messageId) {
        MessageFragment message = new MessageFragment();
        Bundle arguments = new Bundle();
        arguments.putString(MESSAGE_ID_KEY, messageId);
        message.setArguments(arguments);
        return message;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        browser = new RichPushMessageView(container.getContext());
        browser.setLayoutParams(container.getLayoutParams());
        return browser;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        String messageId = getArguments().getString(MESSAGE_ID_KEY);
        RichPushMessage message = RichPushManager.shared().getRichPushUser().getInbox().getMessage(messageId);

        if (message != null) {
            browser.loadRichPushMessage(message);
        } else {
            Logger.info("Couldn't retrieve message for ID: " + messageId);
        }
    }
}

@@ -99,16 +99,81 @@
 inbox;%0A%0A
+import android.annotation.SuppressLint;%0Aimport android.os.Build;%0A
 import a
@@ -1991,11 +1991,388 @@
  %7D%0A    %7D
+%0A%0A    @SuppressLint(%22NewApi%22)%0A    @Override%0A    public void onPause() %7B%0A        super.onPause();%0A%0A        if (Build.VERSION.SDK_INT %3E= 11) %7B%0A            browser.onPause();%0A        %7D%0A    %7D%0A%0A    @SuppressLint(%22NewApi%22)%0A    @Override%0A    public void onResume() %7B%0A        super.onResume();%0A%0A        if (Build.VERSION.SDK_INT %3E= 11) %7B%0A            browser.onResume();%0A        %7D%0A    %7D
 %0A%7D%0A

Call webkit browser pause/resume