Example usage for android.app ActionBar hide

List of usage examples for android.app ActionBar hide

Introduction

In this page you can find the example usage for android.app ActionBar hide.

Prototype

public abstract void hide();

Source Link

Document

Hide the ActionBar if it is currently showing.

Usage

From source file:info.ipeanut.googletrainingcoursedemos.displayingbitmaps.ui.ImageDetailActivity.java

@TargetApi(VERSION_CODES.HONEYCOMB)
@Override/*from www  . java  2 s.c  o  m*/
public void onCreate(Bundle savedInstanceState) {
    if (BuildConfig.DEBUG) {
        Utils.enableStrictMode();
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_detail_pager);

    // Fetch screen height and width, to use as our max size when loading images as this
    // activity runs full screen
    final DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    final int height = displayMetrics.heightPixels;
    final int width = displayMetrics.widthPixels;

    // For this sample we'll use half of the longest width to resize our images. As the
    // image scaling ensures the image is larger than this, we should be left with a
    // resolution that is appropriate for both portrait and landscape. For best image quality
    // we shouldn't divide by 2, but this will use more memory and require a larger memory
    // cache.
    final int longest = (height > width ? height : width) / 2;

    ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, IMAGE_CACHE_DIR);
    cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of app memory

    // The ImageFetcher takes care of loading images into our ImageView children asynchronously
    mImageFetcher = new ImageFetcher(this, longest);
    mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams);
    mImageFetcher.setImageFadeIn(false);

    // Set up ViewPager and backing adapter
    mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), Images.imageUrls.length);
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mAdapter);
    mPager.setPageMargin((int) getResources().getDimension(R.dimen.horizontal_page_margin));
    mPager.setOffscreenPageLimit(2);

    // Set up activity to go full screen
    getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN);

    // Enable some additional newer visibility and ActionBar features to create a more
    // immersive photo viewing experience
    if (Utils.hasHoneycomb()) {
        final ActionBar actionBar = getActionBar();

        if (null == actionBar) {
            return;
        }
        // Hide title text and set home as up
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);

        // Hide and show the ActionBar as the visibility changes
        mPager.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
            @Override
            public void onSystemUiVisibilityChange(int vis) {
                if ((vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) {
                    actionBar.hide();
                } else {
                    actionBar.show();
                }
            }
        });

        // Start low profile mode and hide ActionBar
        mPager.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
        actionBar.hide();
    }

    // Set the current item based on the extra passed in to this activity
    final int extraCurrentItem = getIntent().getIntExtra(EXTRA_IMAGE, -1);
    if (extraCurrentItem != -1) {
        mPager.setCurrentItem(extraCurrentItem);
    }
}

From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java

/**
 * The {@link ViewPager} that will display the three primary sections of the app, one at a
 * time.//from  w w w . j a v a 2 s .  c om
 */

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tabs);

    init();

    mAccount = CreateSyncAccount(this);
    //registering the broadcast
    registerReceiver(broadcastReceiver, new IntentFilter("uploadsuccessful"));

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();

    actionBar.hide();
    //atteching fragment to framelayout
    PickSchoolsFragment myf = new PickSchoolsFragment();
    transaction = getSupportFragmentManager().beginTransaction();
    transaction.add(R.id.frame, myf);
    transaction.commit();

    llPickSchools.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            if (checkcurrentfragment()) {
                showconfirmationdialog(1);
            } else {

                showpickupschool();
            }

        }
    });

    llDrills.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            if (checkcurrentfragment()) {
                showconfirmationdialog(2);
            } else {

                showdrill();
            }

        }
    });

    llServiceCalls.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (checkcurrentfragment()) {
                showconfirmationdialog(3);
            } else {
                showservice();
            }

        }
    });

    llNewInstalls.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (checkcurrentfragment()) {
                showconfirmationdialog(4);
            } else {

                showinstall();
            }
        }
    });

    llPendingUploads.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (checkcurrentfragment()) {
                showconfirmationdialog(5);
            } else {
                showpending();
            }
        }
    });

}

From source file:com.android.music.MusicBrowserActivity.java

public void onCreateContinue(Bundle savedInstanceState) {
    MusicLogUtils.d(TAG, "onCreate");
    ActionBar actionBar = getActionBar();
    actionBar.hide();

    setVolumeControlStream(AudioManager.STREAM_MUSIC);

    PDebug.Start("MusicBrowserActivity.bindToService()");
    mToken = MusicUtils.bindToService(this, this);
    PDebug.End("MusicBrowserActivity.bindToService()");

    mMusicPlugin = Extensions.getPluginObject(getApplicationContext());

    mHasMenukey = ViewConfiguration.get(this).hasPermanentMenuKey();
    PDebug.Start("MusicBrowserActivity.dispatchCreate()");
    mActivityManager = new LocalActivityManager(this, false);
    mActivityManager.dispatchCreate(savedInstanceState);
    PDebug.End("MusicBrowserActivity.dispatchCreate()");

    mTabHost = getTabHost();//from w w  w  . ja  v a2s .c  o  m
    PDebug.Start("MusicBrowserActivity.initTab()");
    initTab();
    PDebug.End("MusicBrowserActivity.initTab()");

    PDebug.Start("MusicBrowserActivity.setCurrentTab()");
    mCurrentTab = MusicUtils.getIntPref(this, SAVE_TAB, ARTIST_INDEX);
    MusicLogUtils.d(TAG, "onCreate mCurrentTab: " + mCurrentTab);
    if ((mCurrentTab < 0) || (mCurrentTab >= mTabCount)) {
        mCurrentTab = ARTIST_INDEX;
    }
    /// M: reset the defalt tab value
    if (mCurrentTab == ARTIST_INDEX) {
        mTabHost.setCurrentTab(ALBUM_INDEX);
    }
    mTabHost.setOnTabChangedListener(this);
    PDebug.End("MusicBrowserActivity.setCurrentTab()");

    PDebug.Start("MusicBrowserActivity.initPager()");
    initPager();
    PDebug.End("MusicBrowserActivity.initPager()");

    PDebug.Start("MusicBrowserActivity.setAdapter()");
    mViewPager = (ViewPager) findViewById(R.id.viewpage);
    mViewPager.setAdapter(new MusicPagerAdapter());
    mViewPager.setOnPageChangeListener(this);
    //mViewPager.setOffscreenPageLimit(VIEW_PAGER_OFFSCREEN_PAGE_NUM);
    PDebug.End("MusicBrowserActivity.setAdapter()");

    IntentFilter f = new IntentFilter();
    f.addAction(MusicUtils.SDCARD_STATUS_UPDATE);
    registerReceiver(mSdcardstatustListener, f);
    createFakeMenu();
    /// M: Init search button click listener in nowplaying.
    initSearchButton();
    PDebug.End("MusicBrowserActivity.onCreate");
}

From source file:de.bahnhoefe.deutschlands.bahnhofsfotos.DetailsActivity.java

public void onPictureClicked() {
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && !fullscreen) {
        ValueAnimator animation = ValueAnimator.ofFloat(header.getAlpha(), 0f);
        animation.setDuration(500);/*from w w w  .j  ava  2s. com*/
        animation.addUpdateListener(new AnimationUpdateListener());
        animation.start();
        detailsLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_IMMERSIVE);
        ActionBar bar = getActionBar();
        if (bar != null)
            bar.hide();
        android.support.v7.app.ActionBar sbar = getSupportActionBar();
        if (sbar != null)
            sbar.hide();
        fullscreen = true;
    } else {
        ValueAnimator animation = ValueAnimator
                .ofFloat(header == null ? tvBahnhofName.getAlpha() : header.getAlpha(), 1.0f);
        animation.setDuration(500);
        animation.addUpdateListener(new AnimationUpdateListener());
        animation.start();
        detailsLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
        ActionBar bar = getActionBar();
        if (bar != null)
            bar.show();
        android.support.v7.app.ActionBar sbar = getSupportActionBar();
        if (sbar != null)
            sbar.show();
        fullscreen = false;
    }

}

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

/**
 *
 *///w ww  .j  a  v a  2 s. co  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);
}

From source file:org.kegbot.app.PourInProgressActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate()");

    mCore = KegbotCore.getInstance(this);
    mFlowManager = mCore.getFlowManager();
    mConfig = mCore.getConfiguration();/*from   w w w  .  ja va  2  s .com*/
    mImageDownloader = mCore.getImageDownloader();

    overridePendingTransition(R.anim.image_fade_in, R.anim.image_fade_in);
    final ActionBar actionBar = getActionBar();
    //    if (actionBar != null) {
    //      actionBar.hide();
    //    }
    if (mConfig.getShowActionBar()) {
        actionBar.show();
    } else {
        actionBar.hide();
    }
    setContentView(R.layout.pour_in_progress_activity);

    mTapPager = (ViewPager) findViewById(R.id.tapPager);
    mPouringTapAdapter = new PouringTapAdapter(getFragmentManager());
    mTapPager.setAdapter(mPouringTapAdapter);
    mTapPager.setOnPageChangeListener(mPageChangeListener);

    mControlsFlipper = (ViewFlipper) findViewById(R.id.pour_controls_flipper);
    mClaimPourButton = (Button) findViewById(R.id.claimPourButton);
    mDrinkerName = (TextView) findViewById(R.id.pourDrinkerName);
    mDoneButton = (Button) findViewById(R.id.pourEndButton);
    mDrinkerImage = (ImageView) findViewById(R.id.pourDrinkerImage);
    mShoutText = (TextView) findViewById(R.id.shoutText);
    mAddButton = (Button) findViewById(R.id.pourAddButton);
    mSubtractButton = (Button) findViewById(R.id.pourSubtractButton);

    //for backgrounds
    mImageView0 = (ImageView) findViewById(R.id.imageView0);
    mImageView1 = (LinearLayout) findViewById(R.id.imageView1);

    mClaimPourButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            final Flow flow = getCurrentlyFocusedFlow();
            if (flow == null || flow.isAuthenticated() || flow.isFinished()) {
                return;
            }

            Log.d(TAG, "Attempting to claim flow id=" + flow.getFlowId());
            final Intent intent = KegtabCommon.getAuthDrinkerActivityIntent(PourInProgressActivity.this);
            intent.putExtra(EXTRA_FLOW_ID, flow.getFlowId());
            startActivityForResult(intent, REQUEST_AUTH_DRINKER);
            overridePendingTransition(R.anim.image_fade_in, R.anim.image_fade_in);
        }
    });

    mDoneButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            final FlowManager flowManager = mCore.getFlowManager();
            final Flow flow = getCurrentlyFocusedFlow();
            if (flow == null) {
                return;
            }
            Log.d(TAG, "Done button pressed, ending flow " + flow.getFlowId());
            overridePendingTransition(R.anim.image_fade_in, R.anim.image_fade_in);
            flowManager.endFlow(flow);

            // If we're finishing a non-dormant flow, and other dormant flows
            // exist, assume those were started optimistically and finish them
            // now.
            if (flow.getVolumeMl() > 0) {
                final AppConfiguration config = mCore.getConfiguration();
                final long minVolume = config.getMinimumVolumeMl();
                for (final Flow suspectFlow : flowManager.getAllActiveFlows()) {
                    if (suspectFlow.getVolumeMl() < minVolume) {
                        Log.d(TAG, "Also ending dormant flow: " + suspectFlow.getFlowId());
                        flowManager.endFlow(suspectFlow);
                    }
                }
            }
        }
    });

    mAddButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            final FlowManager flowManager = mCore.getFlowManager();
            final Flow flow = getCurrentlyFocusedFlow();
            if (flow == null) {
                return;
            }
            flow.addTicks(135);
            refreshFlows();
        }
    });

    mSubtractButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            final FlowManager flowManager = mCore.getFlowManager();
            final Flow flow = getCurrentlyFocusedFlow();
            if (flow == null) {
                return;
            }
            flow.addTicks(-135);
            refreshFlows();
        }
    });

    mShoutText = (EditText) findViewById(R.id.shoutText);
    mShoutText.addTextChangedListener(new TextWatcher() {
        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            final Flow flow = getCurrentlyFocusedFlow();
            if (flow == null) {
                Log.w(TAG, "Flow went away, dropping shout.");
                return;
            }
            flow.setShout(s.toString());
            flow.pokeActivity();
        }
    });

    mShowCamera = true;
    mCameraFragment = (CameraFragment) getFragmentManager().findFragmentById(R.id.camera);
    mAddButton.setVisibility(View.GONE);
    mSubtractButton.setVisibility(View.GONE);
    if (!mConfig.getUseCamera() || !mConfig.getTakePhotosDuringPour()) {
        mShowCamera = false;
        getFragmentManager().beginTransaction().hide(mCameraFragment).commit();
        mAddButton.setVisibility(View.VISIBLE);
        mSubtractButton.setVisibility(View.VISIBLE);
    }

    refreshFlows();
}

From source file:radu.pidroid.Controller.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.controller);

    ActionBar actionBar = getActionBar();
    actionBar.hide();

    speechButton = (ImageView) findViewById(R.id.speechButton);
    speechButton.setOnClickListener(new ImageView.OnClickListener() {
        public void onClick(View view) {
            startVoiceRecognition();/*from  w  w  w  .  jav a 2s  .c  o m*/
        } // onClick
    });

    touchControlsLayout = (RelativeLayout) findViewById(R.id.TouchControlsLayout);
    forwardsPowerImageView = (ImageView) findViewById(R.id.forwardsPowerImageView);
    forwardsPowerImageView.setOnTouchListener(this);
    backwardsPowerImageView = (ImageView) findViewById(R.id.backwardsPowerImageView);
    backwardsPowerImageView.setOnTouchListener(this);

    forwardsPowerProgressBar = (ProgressBar) findViewById(R.id.forwardsPowerProgressBar);
    backwardsPowerProgressBar = (ProgressBar) findViewById(R.id.backwardsPowerProgressBar);

    sliderControlsLayout = (RelativeLayout) findViewById(R.id.SliderControlsLayout);
    forwardsPowerSeekBar = (SeekBar) findViewById(R.id.forwardsPowerSeekBar);
    forwardsPowerSeekBar.setOnSeekBarChangeListener(this);
    backwardsPowerSeekBar = (SeekBar) findViewById(R.id.backwardsPowerSeekBar);
    backwardsPowerSeekBar.setOnSeekBarChangeListener(this);

    joystickControlsLayout = (RelativeLayout) findViewById(R.id.JoystickControlsLayout);
    largeCameraJoystickView = (JoystickView) findViewById(R.id.largeCameraJoystickView);
    largeCameraJoystickView.setMoveListener(this);
    directionJoystickView = (JoystickView) findViewById(R.id.directionJoystickView);
    directionJoystickView.setMoveListener(this);

    videoFeedMjpegView = (MjpegView) findViewById(R.id.videoFeedSurfaceView);
    hudImageView = (ImageView) findViewById(R.id.hudImageView);
    levelIndicatorImageView = (ImageView) findViewById(R.id.levelIndicatorImageView);

    mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    mGeomagnetic = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);

    smallCameraJoystickView = (JoystickView) findViewById(R.id.cameraJoystickView);
    smallCameraJoystickView.setMoveListener(this);
    smallCameraJoystickView.setTag("smallCamera");

    spinControlOn = false;
    toggleSpinImageView = (ImageView) findViewById(R.id.toggleSpinImageView);
    toggleSpinImageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            // if spinControl is ON then tiltControls are OFF and vice versa
            spinControlOn = !spinControlOn;
            tiltControlsOn = !tiltControlsOn;

            if (spinControlOn)
                toggleSpinImageView.setImageResource(R.drawable.spin_button_down);
            else
                toggleSpinImageView.setImageResource(R.drawable.spin_button_up);

            // Let PiDroid know whether to spin
            mMessenger.toggleSpin(spinControlOn);
        } // onClick
    });

    // Get the message from the intent
    Intent intent = getIntent();
    serverIP = intent.getStringExtra(Main.EXTRA_SERVERIP);
    serverPort = intent.getIntExtra(Main.EXTRA_SERVERPORT, 8090);

    mMessenger = new Messenger(this, serverIP, serverPort);
    mRecogniser = new CommandRecogniser(this, mMessenger, videoFeedMjpegView);

    if (Main.detailsCheckBox.isChecked())
        loadPreferences();
    else
        clearPreferences();

    setupNavigationDrawer();
    setupVideoFeed();

    if (tutorialsOn)
        new ControllerTutorial(this).start();
}

From source file:com.example.camera360.ui.ImageDetailActivity.java

@SuppressWarnings("unchecked")
@TargetApi(11)//from   w  ww  . java2  s .  co  m
@Override
public void onCreate(Bundle savedInstanceState) {
    if (BuildConfig.DEBUG) {
        Utils.enableStrictMode();
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_detail_pager);

    arrayList = (ArrayList<HashMap<String, String>>) getIntent().getSerializableExtra(IMAGE_URL);

    // Fetch screen height and width, to use as our max size when loading
    // images as this
    // activity runs full screen

    baseAnimate = new BaseAnimate();

    final DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    final int height = displayMetrics.heightPixels;
    final int width = displayMetrics.widthPixels;

    // For this sample we'll use half of the longest width to resize our
    // images. As the
    // image scaling ensures the image is larger than this, we should be
    // left with a
    // resolution that is appropriate for both portrait and landscape. For
    // best image quality
    // we shouldn't divide by 2, but this will use more memory and require a
    // larger memory
    // cache.
    final int longest = (height > width ? height : width) / 2;

    ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, IMAGE_CACHE_DIR);
    cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of
    // app memory

    mImageDetailLayout = (FrameLayout) findViewById(R.id.image_detail_layout);

    mImageDetailView = (LinearLayout) findViewById(R.id.image_detail);

    // The ImageFetcher takes care of loading images into our ImageView
    // children asynchronously
    mImageFetcher = new ImageFetcher(this, longest);
    mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams);
    mImageFetcher.setImageFadeIn(false);

    // Set up ViewPager and backing adapter
    mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), arrayList.size());

    mInflater = LayoutInflater.from(mImageDetailLayout.getContext());

    mPager = (ViewPager) findViewById(R.id.view_pager);
    mPager.setAdapter(mAdapter);
    mPager.setPageMargin((int) getResources().getDimension(R.dimen.image_detail_pager_margin));
    mPager.setOffscreenPageLimit(2);

    // Set up activity to go full screen
    getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN);

    // Enable some additional newer visibility and ActionBar features to
    // create a more
    // immersive photo viewing experience
    if (Utils.hasHoneycomb()) {
        final ActionBar actionBar = getActionBar();

        // Hide title text and set home as up
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);

        // Hide and show the ActionBar as the visibility changes
        mPager.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
            @Override
            public void onSystemUiVisibilityChange(int vis) {
                if ((vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) {
                    actionBar.hide();
                } else {
                    actionBar.show();
                }
            }
        });

        // Start low profile mode and hide ActionBar
        mPager.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
        actionBar.hide();
    }

    // Set the current item based on the extra passed in to this activity
    final int extraCurrentItem = getIntent().getIntExtra(EXTRA_IMAGE, -1);

    currentIndex = extraCurrentItem;

    if (extraCurrentItem != -1) {
        mPager.setCurrentItem(extraCurrentItem);
    }

    mPager.setOnPageChangeListener(new ImageOnPageChangeListener());

    initHeaderMenu();

    addFooterMenu();

    initImageDetail();

    setImageInfo();
}

From source file:org.woltage.irssiconnectbot.ConsoleActivity.java

@Override
@TargetApi(11)/*ww w .j a v a  2  s.c  o m*/
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    if (!InstallMosh.isInstallStarted()) {
        new InstallMosh(this);
    }

    configureStrictMode();
    hardKeyboard = getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY;

    hardKeyboard = hardKeyboard && !Build.MODEL.contains("Transformer");

    this.setContentView(R.layout.act_console);
    BugSenseHandler.setup(this, "d27a12dc");

    clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    prefs = PreferenceManager.getDefaultSharedPreferences(this);

    // hide action bar if requested by user
    try {
        ActionBar actionBar = getActionBar();
        if (!prefs.getBoolean(PreferenceConstants.ACTIONBAR, true)) {
            actionBar.hide();
        }
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
    } catch (NoSuchMethodError error) {
        Log.w(TAG, "Android sdk version pre 11. Not touching ActionBar.");
    }

    // hide status bar if requested by user
    if (prefs.getBoolean(PreferenceConstants.FULLSCREEN, false)) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    // TODO find proper way to disable volume key beep if it exists.
    setVolumeControlStream(AudioManager.STREAM_MUSIC);

    // handle requested console from incoming intent
    requested = getIntent().getData();

    inflater = LayoutInflater.from(this);

    flip = (ViewFlipper) findViewById(R.id.console_flip);
    empty = (TextView) findViewById(android.R.id.empty);

    stringPromptGroup = (RelativeLayout) findViewById(R.id.console_password_group);
    stringPromptInstructions = (TextView) findViewById(R.id.console_password_instructions);
    stringPrompt = (EditText) findViewById(R.id.console_password);
    stringPrompt.setOnKeyListener(new OnKeyListener() {
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (event.getAction() == KeyEvent.ACTION_UP)
                return false;
            if (keyCode != KeyEvent.KEYCODE_ENTER)
                return false;

            // pass collected password down to current terminal
            String value = stringPrompt.getText().toString();

            PromptHelper helper = getCurrentPromptHelper();
            if (helper == null)
                return false;
            helper.setResponse(value);

            // finally clear password for next user
            stringPrompt.setText("");
            updatePromptVisible();

            return true;
        }
    });

    booleanPromptGroup = (RelativeLayout) findViewById(R.id.console_boolean_group);
    booleanPrompt = (TextView) findViewById(R.id.console_prompt);

    booleanYes = (Button) findViewById(R.id.console_prompt_yes);
    booleanYes.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            PromptHelper helper = getCurrentPromptHelper();
            if (helper == null)
                return;
            helper.setResponse(Boolean.TRUE);
            updatePromptVisible();
        }
    });

    booleanNo = (Button) findViewById(R.id.console_prompt_no);
    booleanNo.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            PromptHelper helper = getCurrentPromptHelper();
            if (helper == null)
                return;
            helper.setResponse(Boolean.FALSE);
            updatePromptVisible();
        }
    });

    // preload animations for terminal switching
    slide_left_in = AnimationUtils.loadAnimation(this, R.anim.slide_left_in);
    slide_left_out = AnimationUtils.loadAnimation(this, R.anim.slide_left_out);
    slide_right_in = AnimationUtils.loadAnimation(this, R.anim.slide_right_in);
    slide_right_out = AnimationUtils.loadAnimation(this, R.anim.slide_right_out);

    fade_out_delayed = AnimationUtils.loadAnimation(this, R.anim.fade_out_delayed);
    fade_stay_hidden = AnimationUtils.loadAnimation(this, R.anim.fade_stay_hidden);

    // Preload animation for keyboard button
    keyboard_fade_in = AnimationUtils.loadAnimation(this, R.anim.keyboard_fade_in);
    keyboard_fade_out = AnimationUtils.loadAnimation(this, R.anim.keyboard_fade_out);

    inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

    final RelativeLayout keyboardGroup = (RelativeLayout) findViewById(R.id.keyboard_group);

    if (Build.MODEL.contains("Transformer")
            && getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY
            && prefs.getBoolean(PreferenceConstants.ACTIONBAR, true)) {
        keyboardGroup.setEnabled(false);
        keyboardGroup.setVisibility(View.INVISIBLE);
    }

    mKeyboardButton = (ImageView) findViewById(R.id.button_keyboard);
    mKeyboardButton.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            View flip = findCurrentView(R.id.console_flip);
            if (flip == null)
                return;

            inputManager.showSoftInput(flip, InputMethodManager.SHOW_FORCED);
            keyboardGroup.setVisibility(View.GONE);
        }
    });

    final ImageView symButton = (ImageView) findViewById(R.id.button_sym);
    symButton.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            View flip = findCurrentView(R.id.console_flip);
            if (flip == null)
                return;

            TerminalView terminal = (TerminalView) flip;

            TerminalKeyListener handler = terminal.bridge.getKeyHandler();
            handler.showCharPickerDialog(terminal);
            keyboardGroup.setVisibility(View.GONE);
        }
    });

    mInputButton = (ImageView) findViewById(R.id.button_input);
    mInputButton.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            View flip = findCurrentView(R.id.console_flip);
            if (flip == null)
                return;

            final TerminalView terminal = (TerminalView) flip;
            Thread promptThread = new Thread(new Runnable() {
                public void run() {
                    String inj = getCurrentPromptHelper().requestStringPrompt(null, "");
                    terminal.bridge.injectString(inj);
                }
            });
            promptThread.setName("Prompt");
            promptThread.setDaemon(true);
            promptThread.start();

            keyboardGroup.setVisibility(View.GONE);
        }
    });

    final ImageView ctrlButton = (ImageView) findViewById(R.id.button_ctrl);
    ctrlButton.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            View flip = findCurrentView(R.id.console_flip);
            if (flip == null)
                return;
            TerminalView terminal = (TerminalView) flip;

            TerminalKeyListener handler = terminal.bridge.getKeyHandler();
            handler.metaPress(TerminalKeyListener.META_CTRL_ON);
            terminal.bridge.tryKeyVibrate();

            keyboardGroup.setVisibility(View.GONE);
        }
    });

    final ImageView escButton = (ImageView) findViewById(R.id.button_esc);
    escButton.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            View flip = findCurrentView(R.id.console_flip);
            if (flip == null)
                return;
            TerminalView terminal = (TerminalView) flip;

            TerminalKeyListener handler = terminal.bridge.getKeyHandler();
            handler.sendEscape();
            terminal.bridge.tryKeyVibrate();
            keyboardGroup.setVisibility(View.GONE);
        }
    });

    // detect fling gestures to switch between terminals
    final GestureDetector detect = new GestureDetector(new ICBSimpleOnGestureListener(this));

    flip.setLongClickable(true);
    flip.setOnTouchListener(new ICBOnTouchListener(this, keyboardGroup, detect));

}

From source file:org.jorge.lolin1.ui.activities.ChampionDetailFragmentActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    if (!preferences.getBoolean("showcase_champion_detail_done", Boolean.FALSE))
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    selectedChampion = getIntent().getParcelableExtra(SELECTED_CHAMPION);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_champion_detail);
    ActionBar actionBar;
    assert getActionBar() != null;
    if (findViewById(R.id.champion_title) != null) {
        //Portrait layout
        if (!(actionBar = getActionBar()).isShowing()) {
            actionBar.show();/*ww  w.j  a  va  2  s  . c  om*/
        }
        actionBar.setDisplayHomeAsUpEnabled(Boolean.TRUE);
        ((TextView) findViewById(R.id.champion_name)).setText(selectedChampion.getName());
        ((TextView) findViewById(R.id.champion_title)).setText(selectedChampion.getTitle());
        initChampionInfoPager();
        if (!preferences.getBoolean("showcase_champion_detail_done", Boolean.FALSE))
            detailShowcase = new ShowcaseView.Builder(this).setContentText(R.string.tutorial_detail_contents)
                    .setContentTitle(R.string.tutorial_detail_title)
                    .setStyle(R.style.CustomShowcaseThemePlusNoButton)
                    .setTarget(new ViewTarget(R.id.champion_detail_pager, this)).build();
        ChampionDetailFragmentActivity.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ((ImageView) findViewById(R.id.champion_bust))
                        .setImageDrawable(new BitmapDrawable(getResources(), ChampionManager.getInstance()
                                .getBustImageByChampion(200, 200, selectedChampion, getApplicationContext())));
            }
        });
    } else {
        //Landscape layout
        if ((actionBar = getActionBar()).isShowing()) {
            actionBar.hide();
        }
        skinsViewPager = ((ViewPager) findViewById(R.id.skins_view_pager));
        initChampionSkinsPager();
    }
}