Example usage for android.content Intent FLAG_DEBUG_LOG_RESOLUTION

List of usage examples for android.content Intent FLAG_DEBUG_LOG_RESOLUTION

Introduction

In this page you can find the example usage for android.content Intent FLAG_DEBUG_LOG_RESOLUTION.

Prototype

int FLAG_DEBUG_LOG_RESOLUTION

To view the source code for android.content Intent FLAG_DEBUG_LOG_RESOLUTION.

Click Source Link

Document

A flag you can enable for debugging: when set, log messages will be printed during the resolution of this intent to show you what has been found to create the final resolved list.

Usage

From source file:com.nagravision.mediaplayer.FullscreenActivity.java

/**
 *
 *//*from   www  .  ja  va 2s  . c  o  m*/
@SuppressLint("InlinedApi")
@Override
protected void onCreate(Bundle inBundle) {
    Log.v(LOG_TAG, "FullscreenActivity::onCreate - Enter\n");
    super.onCreate(inBundle);

    getApplication().registerActivityLifecycleCallbacks(this);

    if (Build.VERSION.SDK_INT < 16) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
            WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    setContentView(R.layout.activity_fullscreen);
    mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    mMoviesList = (ListView) findViewById(R.id.start_drawer);
    mUrlsAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_activated_1, MOVIES_ARR);
    mMoviesList.setAdapter(mUrlsAdapter);
    mVideoHolder = (VideoView) findViewById(R.id.fullscreen_content);

    View decorView = getWindow().getDecorView();
    // Hide the status bar.
    int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_FULLSCREEN;
    if (Build.VERSION.SDK_INT >= 19) {
        uiOptions |= View.SYSTEM_UI_FLAG_IMMERSIVE;
    }
    decorView.setSystemUiVisibility(uiOptions);
    // Remember that you should never show the action bar if the
    // status bar is hidden, so hide that too if necessary.
    final ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.hide();

    mNotifBuilder = new Notification.Builder(this);
    mNotifMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    mExplicitIntent = new Intent(Intent.ACTION_VIEW);
    mExplicitIntent.setClass(this, this.getClass());
    mDefaultIntent = PendingIntent.getActivity(this, REQUEST_DISPLAY, mExplicitIntent,
            Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_DEBUG_LOG_RESOLUTION);
    mInfosActionIntent = new Intent();
    mInfosActionIntent.setAction("com.nagravision.mediaplayer.VIDEO_INFOS");
    mInfosActionIntent.addCategory(Intent.CATEGORY_DEFAULT);
    mInfosActionIntent.addCategory(Intent.CATEGORY_INFO);
    mInfosIntent = PendingIntent.getActivity(this, REQUEST_INFOS, mInfosActionIntent,
            Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_DEBUG_LOG_RESOLUTION);

    if (Build.VERSION.SDK_INT >= 19) {
        mVideoHolder.setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                        | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE);
    } else {
        mVideoHolder.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN);
    }
    OnItemClickListener mMessageClickedHandler = new OnItemClickListener() {
        public void onItemClick(@SuppressWarnings("rawtypes") AdapterView parent, View v, int position,
                long id) {
            Log.v(LOG_TAG, "FullscreenActivity.onCreate.OnItemClickListener::onItemClick - Enter\n");
            ClickItem(position, 0);
        }
    };

    mMoviesList.setOnItemClickListener(mMessageClickedHandler);

    getWindow().setFormat(PixelFormat.TRANSLUCENT);
    mControlsView = new MediaController(this, true);
    mControlsView.setPrevNextListeners(new View.OnClickListener() {
        /*
         * Next listener
         */
        @Override
        public void onClick(View view) {
            Log.v(LOG_TAG, "FullscreenActivity.onCreate.OnClickListener::onClick(next) - Enter\n");
            mVideoHolder.stopPlayback();
            int position = 0;
            if (mLastPosition > 0)
                position = mLastPosition + 1;
            if (position >= MOVIES_URLS.length)
                position = 0;
            ClickItem(position, 0);

            String toaststr = getResources().getString(R.string.next_movie_toast_string) + MOVIES_ARR[position];
            Toast.makeText(FullscreenActivity.this, toaststr, Toast.LENGTH_LONG).show();
        }
    }, new View.OnClickListener() {
        /*
         * Prev listener
         */
        @Override
        public void onClick(View view) {
            Log.v(LOG_TAG, "FullscreenActivity.onCreate.OnClickListener::onClick(prev) - Enter\n");
            mVideoHolder.stopPlayback();
            int position = 0;
            if (mLastPosition > 0)
                position = mLastPosition - 1;
            if (position < 0)
                position = MOVIES_URLS.length - 1;
            ClickItem(position, 0);

            String toaststr = getResources().getString(R.string.prev_movie_toast_string) + MOVIES_ARR[position];
            Toast.makeText(FullscreenActivity.this, toaststr, Toast.LENGTH_LONG).show();
        }
    });
    mVideoHolder.setMediaController(mControlsView);

    // Set up an instance of SystemUiHider to control the system UI for
    // this activity.
    mSystemUiHider = SystemUiHider.getInstance(this, mVideoHolder, HIDER_FLAGS);
    mSystemUiHider.setup();
    mSystemUiHider.setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() {
        // Cached values.
        int mControlsHeight;
        int mShortAnimTime;

        @Override
        @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
        public void onVisibilityChange(boolean visible) {
            Log.v(LOG_TAG, "FullscreenActivity.OnVisibilityChangeListener::onVisibilityChange - Enter\n");

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
                if (mControlsHeight == 0)
                    mControlsHeight = mControlsView.getHeight();
                if (mShortAnimTime == 0)
                    mShortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
                mControlsView.animate().translationY(visible ? 0 : mControlsHeight).setDuration(mShortAnimTime);
            } else
                mControlsView.setVisibility(visible ? View.VISIBLE : View.GONE);

            if (visible && AUTO_HIDE)
                delayedHide(AUTO_HIDE_DELAY_MILLIS);
        }
    });

    // Set up the user interaction to manually show or hide the system UI.
    mVideoHolder.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (TOGGLE_ON_CLICK) {
                mSystemUiHider.toggle();
            } else {
                mSystemUiHider.show();
            }
        }
    });

    mDrawer.openDrawer(mMoviesList);
}