Example usage for android.content.res Configuration ORIENTATION_PORTRAIT

List of usage examples for android.content.res Configuration ORIENTATION_PORTRAIT

Introduction

In this page you can find the example usage for android.content.res Configuration ORIENTATION_PORTRAIT.

Prototype

int ORIENTATION_PORTRAIT

To view the source code for android.content.res Configuration ORIENTATION_PORTRAIT.

Click Source Link

Document

Constant for #orientation , value corresponding to the port resource qualifier.

Usage

From source file:com.flipzu.flipzu.Recorder.java

private void initGATracker() {
    /* get analytics singleton */
    tracker = GoogleAnalyticsTracker.getInstance();

    /* start tracker. Dispatch every 60 seconds. */
    tracker.startNewSession("UA-20341887-1", 60, this);

    /* debug GA */
    tracker.setDebug(false);/*  w  w  w  .j av a 2  s.c  om*/
    tracker.setDryRun(false);

    // Determine the screen orientation and set it in a custom variable.
    String orientation = "unknown";
    switch (this.getResources().getConfiguration().orientation) {
    case Configuration.ORIENTATION_LANDSCAPE:
        orientation = "landscape";
        break;
    case Configuration.ORIENTATION_PORTRAIT:
        orientation = "portrait";
        break;
    }
    tracker.setCustomVar(3, "Screen Orientation", orientation, 2);
}

From source file:com.shipdream.lib.android.mvc.MvcFragment.java

private static Orientation parseOrientation(int androidOrientation) {
    if (androidOrientation == Configuration.ORIENTATION_PORTRAIT) {
        return Orientation.PORTRAIT;
    } else if (androidOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        return Orientation.LANDSCAPE;
    } else {/*from  w  w  w . jav a2  s. com*/
        return Orientation.UNSPECIFIED;
    }
}

From source file:com.android.gallery3d.filtershow.FilterShowActivity.java

public void loadEditorPanel(FilterRepresentation representation, final Editor currentEditor) {
    if (representation.getEditorId() == ImageOnlyEditor.ID) {
        currentEditor.reflectCurrentFilter();
        return;/*from  w w w  . jav a  2  s  .co m*/
    }
    final int currentId = currentEditor.getID();
    Runnable showEditor = new Runnable() {
        @Override
        public void run() {
            EditorPanel panel = new EditorPanel();
            panel.setEditor(currentId);
            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
            transaction.remove(getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG));
            transaction.replace(R.id.main_panel_container, panel, MainPanel.FRAGMENT_TAG);
            transaction.commit();
        }
    };
    Fragment main = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
    boolean doAnimation = false;
    if (mShowingImageStatePanel
            && getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        doAnimation = true;
    }
    if (doAnimation && main != null && main instanceof MainPanel) {
        MainPanel mainPanel = (MainPanel) main;
        View container = mainPanel.getView().findViewById(R.id.category_panel_container);
        View bottom = mainPanel.getView().findViewById(R.id.bottom_panel);
        int panelHeight = container.getHeight() + bottom.getHeight();
        ViewPropertyAnimator anim = mainPanel.getView().animate();
        anim.translationY(panelHeight).start();
        final Handler handler = new Handler();
        handler.postDelayed(showEditor, anim.getDuration());
    } else {
        showEditor.run();
    }
}

From source file:com.tweetlanes.android.core.view.TweetFeedFragment.java

private void lockScreenRotation() {
    if (getActivity() != null) {
        switch (getActivity().getResources().getConfiguration().orientation) {
        case Configuration.ORIENTATION_PORTRAIT:
            getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
            break;
        case Configuration.ORIENTATION_LANDSCAPE:
            getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
            break;
        }/* w w w .ja v  a  2 s . c om*/
    }
}

From source file:com.lloydtorres.stately.helpers.RaraHelper.java

/**
 * Returns a StaggeredGridLayoutManager that has 1 column on portrait and 2 columns on landscape.
 * @param c Context//from  w  w  w .  j a  v  a  2  s  . c  om
 * @return See above
 */
public static StaggeredGridLayoutManager getStaggeredLayoutManager(Context c) {
    // One column on portrait, two columns on landscape
    int noColumns = c.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT ? 1
            : 2;
    return new StaggeredGridLayoutManager(noColumns, StaggeredGridLayoutManager.VERTICAL);
}

From source file:com.hplasplas.cam_capture.activitys.CamCapture.java

private Bundle createBundleBitmap(String fileName, int index, int requestedHeight, int requestedWidth) {

    return createBundleBitmap(fileName, index, requestedHeight, requestedWidth, 0,
            Configuration.ORIENTATION_PORTRAIT);
}

From source file:com.example.mapsv2.ClustersAreListsActivity.java

private void showInfo(final int x, int y, final Cluster cluster) {
    final int orientation = getResources().getConfiguration().orientation;

    // (re-)Load cluster data into the ListView
    @SuppressWarnings("unchecked")
    ArrayAdapter<String> adapter = (ArrayAdapter<String>) listView.getAdapter();
    adapter.clear();//w ww  .j a va 2  s.c o  m

    for (Marker m : cluster.markers) {
        adapter.add(m.getTitle());
    }
    adapter.notifyDataSetChanged();

    // Reconfigure the layout params to position the info window on screen
    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) infoWindow.getLayoutParams();

    if (orientation == Configuration.ORIENTATION_PORTRAIT) {
        lp.topMargin = y;
        lp.leftMargin = defaultMargin;
        lp.rightMargin = defaultMargin;
        lp.width = LayoutParams.MATCH_PARENT;
        lp.height = LayoutParams.WRAP_CONTENT;
        lp.gravity = Gravity.LEFT | Gravity.TOP;
        infoWindow.setBackgroundResource(R.drawable.info_window_bg_up);
    } else if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
        lp.leftMargin = x + defaultMargin;
        lp.topMargin = defaultMargin;
        lp.bottomMargin = defaultMargin;
        lp.gravity = Gravity.LEFT | Gravity.CENTER_VERTICAL;
        lp.width = LayoutParams.WRAP_CONTENT;
        lp.height = LayoutParams.WRAP_CONTENT;
        infoWindow.setBackgroundResource(R.drawable.info_window_bg_left);
    }
    infoWindow.setLayoutParams(lp);
    fullScreenOverlay.setVisibility(View.VISIBLE);
}

From source file:org.easyrpg.player.player.EasyRpgPlayerActivity.java

public void updateButtonsPosition() {
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT);//from   w  w w . j  a va2s.  co  m

    int screenWidth = getWindowManager().getDefaultDisplay().getWidth();
    int screenHeight = getWindowManager().getDefaultDisplay().getHeight();

    for (VirtualButton b : inputLayout.getButtonList()) {
        Helper.setLayoutPosition(this, b, b.getPosX(), b.getPosY());

        // We have to adjust the position in portrait configuration
        if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
            params = (RelativeLayout.LayoutParams) b.getLayoutParams();
            // vertical : use approximatively the second part of the screen
            params.topMargin += (int) (screenHeight / 6);
            // horizontal : use a little gap to avoid button to be out of
            // the screen for button to the right
            if (b.getPosX() > 0.5) {
                params.leftMargin -= screenWidth / 8;
            }

            b.setLayoutParams(params);
        }
    }
}

From source file:com.flipzu.flipzu.Player.java

private void initGATracker() {
    /* get analytics singleton */
    tracker = GoogleAnalyticsTracker.getInstance();

    /* start tracker. Dispatch every 30 seconds. */
    tracker.startNewSession("UA-20341887-1", 30, this);

    /* debug GA */
    tracker.setDebug(false);//  w  w  w.ja v  a  2 s  . com
    tracker.setDryRun(false);

    // Determine the screen orientation and set it in a custom variable.
    String orientation = "unknown";
    switch (this.getResources().getConfiguration().orientation) {
    case Configuration.ORIENTATION_LANDSCAPE:
        orientation = "landscape";
        break;
    case Configuration.ORIENTATION_PORTRAIT:
        orientation = "portrait";
        break;
    }
    tracker.setCustomVar(3, "Screen Orientation", orientation, 2);
}