Example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_PORTRAIT

List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_PORTRAIT

Introduction

In this page you can find the example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_PORTRAIT.

Prototype

int SCREEN_ORIENTATION_PORTRAIT

To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_PORTRAIT.

Click Source Link

Document

Constant corresponding to portrait in the android.R.attr#screenOrientation attribute.

Usage

From source file:com.orangelabs.rcs.ri.sharing.image.ImageSharingList.java

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

    /* Set layout */
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.image_sharing_list);

    mImageSharingService = getImageSharingApi();

    mListView = (ListView) findViewById(android.R.id.list);
    TextView emptyView = (TextView) findViewById(android.R.id.empty);
    mListView.setEmptyView(emptyView);//from  ww w . ja va 2s  . co m
    registerForContextMenu(mListView);

    mAdapter = new ImageSharingListAdapter(this);
    mListView.setAdapter(mAdapter);
    /*
     * Initialize the Loader with id '1' and callbacks 'mCallbacks'.
     */
    getSupportLoaderManager().initLoader(LOADER_ID, null, this);
}

From source file:piuk.blockchain.android.ui.zxing.CaptureActivity.java

private int getCurrentOrientation() {
    int rotation = getWindowManager().getDefaultDisplay().getRotation();
    switch (rotation) {
    case Surface.ROTATION_0:
    case Surface.ROTATION_270:
        return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    default:// ww w. j av  a 2s  . c  om
        return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;//reverse-mounted cameras on devices like the Nexus 5X
    }
}

From source file:com.orangelabs.rcs.ri.sharing.video.VideoSharingList.java

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

    /* Set layout */
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.video_sharing_list);

    mVideoSharingService = getVideoSharingApi();

    mListView = (ListView) findViewById(android.R.id.list);
    TextView emptyView = (TextView) findViewById(android.R.id.empty);
    mListView.setEmptyView(emptyView);/*  w w  w  .  ja v a 2  s. c o m*/
    registerForContextMenu(mListView);

    mAdapter = new VideoSharingListAdapter(this);
    mListView.setAdapter(mAdapter);
    /*
     * Initialize the Loader with id '1' and callbacks 'mCallbacks'.
     */
    getSupportLoaderManager().initLoader(LOADER_ID, null, this);
}

From source file:com.happyhours.activity.MyLocationDemoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.my_location_demo);
    mMessageView = (TextView) findViewById(R.id.message_text);
    address_text = (TextView) findViewById(R.id.address_text);
    context = this;
    getActionBar().setIcon(R.drawable.logo);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setBackgroundDrawable(getResources().getDrawable(R.color.menu_text_color));
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}

From source file:com.orangelabs.rcs.ri.messaging.chat.group.GroupChatList.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    /* Set layout */
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.chat_list);/*w  w w  . j a v  a  2  s .  c  o  m*/

    mChatService = getChatApi();

    /* Set list adapter */
    mListView = (ListView) findViewById(android.R.id.list);
    TextView emptyView = (TextView) findViewById(android.R.id.empty);
    mListView.setEmptyView(emptyView);
    registerForContextMenu(mListView);

    mAdapter = new GroupChatListAdapter(this);
    mListView.setAdapter(mAdapter);
    /*
     * Initialize the Loader with id '1' and callbacks 'mCallbacks'.
     */
    getSupportLoaderManager().initLoader(LOADER_ID, null, this);
}

From source file:me.wizos.loread.view.webview.VideoImpl.java

public void onHideCustomView() {
    if (videoView == null) {
        return;//from  w w w.j ava 2  s .  c om
    }
    if (mActivity != null && mActivity.getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

    if (!mFlags.isEmpty()) {
        for (Pair<Integer, Integer> mPair : mFlags) {
            mActivity.getWindow().setFlags(mPair.second, mPair.first);
        }
        mFlags.clear();
    }

    videoView.setVisibility(View.GONE);
    if (videoParentView != null && videoView != null) {
        videoParentView.removeView(videoView);

    }
    if (videoParentView != null) {
        // ??ActivityActivity???
        videoParentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
        videoParentView.setVisibility(View.GONE);
    }

    if (this.mCallback != null) {
        mCallback.onCustomViewHidden();
    }
    this.videoView = null;
    if (mWebView != null) {
        mWebView.setVisibility(View.VISIBLE);
    }
    isPlaying = false;
}

From source file:ru.mtuci.musicanalyzer.apollo.ui.activities.ProfileActivity.java

/**
 * {@inheritDoc}/*from w ww .j a  v a2 s  .co  m*/
 */
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Temporay until I can work out a nice landscape layout
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    // Get the preferences
    mPreferences = PreferenceUtils.getInstace(this);

    // Initialze the image fetcher
    mImageFetcher = ApolloUtils.getImageFetcher(this);

    // Initialize the Bundle
    mArguments = savedInstanceState != null ? savedInstanceState : getIntent().getExtras();
    // Get the MIME type
    mType = mArguments.getString(Config.MIME_TYPE);
    // Get the profile title
    mProfileName = mArguments.getString(Config.NAME);
    // Get the artist name
    if (isArtist() || isAlbum()) {
        mArtistName = mArguments.getString(Config.ARTIST_NAME);
    }

    // Initialize the pager adapter
    mPagerAdapter = new PagerAdapter(this);

    // Initialze the carousel
    mTabCarousel = (ProfileTabCarousel) findViewById(R.id.acivity_profile_base_tab_carousel);
    mTabCarousel.reset();
    mTabCarousel.getPhoto().setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            ProfileType profileType;
            if (isArtist()) {
                profileType = ProfileType.ARTIST;
            } else if (isAlbum()) {
                profileType = ProfileType.ALBUM;
            } else {
                profileType = ProfileType.OTHER;
            }
            PhotoSelectionDialog.newInstance(isArtist() ? mArtistName : mProfileName, profileType)
                    .show(getSupportFragmentManager(), "PhotoSelectionDialog");
        }
    });
    // Set up the action bar
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    /* Set up the artist profile */
    if (isArtist()) {
        // Add the carousel images
        mTabCarousel.setArtistProfileHeader(this, mArtistName);

        // Artist profile fragments
        mPagerAdapter.add(ArtistSongFragment.class, mArguments);
        mPagerAdapter.add(ArtistAlbumFragment.class, mArguments);

        // Action bar title
        mResources.setTitle(mArtistName);

    } else
    // Set up the album profile
    if (isAlbum()) {
        // Add the carousel images
        mTabCarousel.setAlbumProfileHeader(this, mProfileName, mArtistName);

        // Album profile fragments
        mPagerAdapter.add(AlbumSongFragment.class, mArguments);

        // Action bar title = album name
        mResources.setTitle(mProfileName);
        // Action bar subtitle = year released
        mResources.setSubtitle(mArguments.getString(Config.ALBUM_YEAR));
    } else
    // Set up the favorites profile
    if (isFavorites()) {
        // Add the carousel images
        mTabCarousel.setPlaylistOrGenreProfileHeader(this, mProfileName);

        // Favorite fragment
        mPagerAdapter.add(FavoriteFragment.class, null);

        // Action bar title = Favorites
        mResources.setTitle(mProfileName);
    } else
    // Set up the last added profile
    if (isLastAdded()) {
        // Add the carousel images
        mTabCarousel.setPlaylistOrGenreProfileHeader(this, mProfileName);

        // Last added fragment
        mPagerAdapter.add(LastAddedFragment.class, null);

        // Action bar title = Last added
        mResources.setTitle(mProfileName);
    } else
    // Set up the user playlist profile
    if (isPlaylist()) {
        // Add the carousel images
        mTabCarousel.setPlaylistOrGenreProfileHeader(this, mProfileName);

        // Playlist profile fragments
        mPagerAdapter.add(PlaylistSongFragment.class, mArguments);

        // Action bar title = playlist name
        mResources.setTitle(mProfileName);
    } else
    // Set up the genre profile
    if (isGenre()) {
        // Add the carousel images
        mTabCarousel.setPlaylistOrGenreProfileHeader(this, mProfileName);

        // Genre profile fragments
        mPagerAdapter.add(GenreSongFragment.class, mArguments);

        // Action bar title = playlist name
        mResources.setTitle(mProfileName);
    }

    // Initialize the ViewPager
    mViewPager = (ViewPager) findViewById(R.id.acivity_profile_base_pager);
    // Attch the adapter
    mViewPager.setAdapter(mPagerAdapter);
    // Offscreen limit
    mViewPager.setOffscreenPageLimit(mPagerAdapter.getCount() - 1);
    // Attach the page change listener
    mViewPager.setOnPageChangeListener(this);
    // Attach the carousel listener
    mTabCarousel.setListener(this);
}

From source file:com.google.cloud.solutions.smashpix.MainActivity.java

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

  createImageStorageDirectory();/*from  w  w  w .  java  2s . c  o  m*/
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  Logger.getLogger(LOGGER_NAME).setLevel(Constants.LOGGING_LEVEL);

  AccountManager accountManager = AccountManager.get(this);
  Account[] accounts = accountManager.getAccountsByType(ACCOUNT_TYPE);
  accountName = accounts[0].name;

  credential =
      GoogleAccountCredential.usingAudience(this, AUDIENCE_NAMESPACE + Constants.WEB_CLIENT_ID);
  credential.setSelectedAccountName(accountName);
  Image.Builder builder = new Image.Builder(
    AndroidHttp.newCompatibleTransport(),
    new GsonFactory(),
    credential);
  builder.setApplicationName(Constants.APP_NAME);
  service = builder.build();

  listImages();
}

From source file:com.cyanogenmod.effem.FmRadio.java

/**
 * Required method from parent class/*from w  w w  . j  a  v  a  2s . co  m*/
 *
 * @param icicle - The previous instance of this app
 */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    context = getApplicationContext();
    setContentView(R.layout.main);

    // restore preferences
    SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
    mSelectedBand = settings.getInt("selectedBand", 1);
    mCurrentFrequency = settings.getInt("currentFrequency", 0);
    if (context.getResources().getBoolean(R.bool.speaker_supported)) {
        mSelectedOutput = settings.getInt("selectedOutput", 0) > 0 ? 1 : 0;
    }

    // misc setup
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    // worker thread for async execution of FM stuff
    mWorker = new HandlerThread("EffemWorker");
    mWorker.start();
    mWorkerHandler = new Handler(mWorker.getLooper());

    // ui preparations
    setupButtons();
}

From source file:com.snu_artoon.arwebtoonplayer.WebtoonView.WebtoonViewActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.lock_rotate:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        return true;

    case R.id.unlock_rotate:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
        return true;

    case R.id.capture:
        captureScreen();//from   w  w  w . ja  v  a 2  s .  co  m
        return true;

    default:
        return false;
    }
}