Example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_UNSPECIFIED

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

Introduction

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

Prototype

int SCREEN_ORIENTATION_UNSPECIFIED

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

Click Source Link

Document

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

Usage

From source file:com.shipdream.lib.android.mvc.view.BaseTestCase.java

@After
public void tearDown() throws Exception {
    navigationController.navigateBack(this, null);
    navigationController.navigateBack(this);

    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);

    lifeCycleValidator.reset();/*from  ww w . j  ava  2 s.  c  om*/
    lifeCycleValidatorA.reset();
    lifeCycleValidatorB.reset();
    lifeCycleValidatorC.reset();
    lifeCycleValidatorD.reset();

    cleanDependencies();
    AndroidMvc.graph().release(this);
    Assert.assertTrue(scopeCache.getCacheMap().size() == 0);

    activity.runOnUiThread(new Runnable() {
        private void clearStateOfFragments(Fragment fragment) {
            FragmentManager fm = activity.getSupportFragmentManager();

            if (fragment != null) {
                AndroidMvc.graph().release(fragment);
                try {
                    fm.beginTransaction().remove(fragment).commitAllowingStateLoss();
                } catch (Exception e) {
                    LoggerFactory.getLogger(BaseTestCase.this.getClass()).warn(e.getMessage(), e);
                }

                List<Fragment> frags = fragment.getChildFragmentManager().getFragments();
                if (frags != null) {
                    int size = frags.size();
                    for (int i = 0; i < size; i++) {
                        Fragment frag = frags.get(i);
                        if (frag != null) {
                            AndroidMvc.graph().release(frag);
                            try {
                                fm.beginTransaction().remove(fragment).commitAllowingStateLoss();
                            } catch (Exception e) {
                                LoggerFactory.getLogger(BaseTestCase.this.getClass()).warn(e.getMessage(), e);
                            }

                            clearStateOfFragments(frag);
                        }
                    }
                }
            }
        }

        @Override
        public void run() {
            //Make sure delegate fragment is removed from support fragment manager before
            //starting next test case
            FragmentManager fm = activity.getSupportFragmentManager();
            Fragment fragment = fm.findFragmentByTag(activity.getDelegateFragmentTag());
            clearStateOfFragments(fragment);
        }
    });
    super.tearDown();
}

From source file:org.uoyabause.android.YabauseHandler.java

/** Called when the activity is first created. */
@Override//from  w  ww . j  a  v  a  2 s.c  o  m
public void onCreate(Bundle savedInstanceState) {
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(Yabause.this);
    boolean lock_landscape = sharedPref.getBoolean("pref_landscape", false);
    if (lock_landscape == true) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }

    super.onCreate(savedInstanceState);
    System.gc();

    YabauseApplication application = (YabauseApplication) getApplication();
    mTracker = application.getDefaultTracker();

    setContentView(R.layout.main);
    getWindow().setSustainedPerformanceMode(true);
    getWindow().addFlags(
            WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_FULLSCREEN);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLayout.setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
    mNavigationView = (NavigationView) findViewById(R.id.nav_view);
    mNavigationView.setNavigationItemSelectedListener(this);
    if (sharedPref.getBoolean("pref_analog_pad", false) == true) {
        mNavigationView.setCheckedItem(R.id.pad_mode);
    }

    DrawerLayout.DrawerListener drawerListener = new DrawerLayout.DrawerListener() {
        @Override
        public void onDrawerSlide(View view, float v) {

        }

        @Override
        public void onDrawerOpened(View view) {
            if (menu_showing == false) {
                menu_showing = true;
                YabauseRunnable.pause();
                audio.mute(audio.SYSTEM);
                String name = YabauseRunnable.getGameTitle();
                TextView tx = (TextView) findViewById(R.id.menu_title);
                if (tx != null) {
                    tx.setText(name);
                }

                if (adView != null) {
                    LinearLayout lp = (LinearLayout) findViewById(R.id.navilayer);
                    if (lp != null) {
                        final int mCount = lp.getChildCount();
                        boolean find = false;
                        for (int i = 0; i < mCount; ++i) {
                            final View mChild = lp.getChildAt(i);
                            if (mChild == adView) {
                                find = true;
                            }
                        }
                        if (find == false) {
                            lp.addView(adView);
                        }
                        AdRequest adRequest = new AdRequest.Builder()
                                .addTestDevice("303A789B146C169D4BDB5652D928FF8E").build();
                        adView.loadAd(adRequest);
                    }
                }

            }
        }

        @Override
        public void onDrawerClosed(View view) {

            if (waiting_reault == false && menu_showing == true) {
                menu_showing = false;
                YabauseRunnable.resume();
                audio.unmute(audio.SYSTEM);
            }

        }

        @Override
        public void onDrawerStateChanged(int i) {
        }
    };
    this.mDrawerLayout.setDrawerListener(drawerListener);

    audio = new YabauseAudio(this);

    Intent intent = getIntent();
    String game = intent.getStringExtra("org.uoyabause.android.FileName");
    if (game != null && game.length() > 0) {
        YabauseStorage storage = YabauseStorage.getStorage();
        gamepath = storage.getGamePath(game);
    } else
        gamepath = "";

    String exgame = intent.getStringExtra("org.uoyabause.android.FileNameEx");
    if (exgame != null) {
        gamepath = exgame;
    }

    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    readPreferences();

    padm = PadManager.getPadManager();
    padm.loadSettings();
    waiting_reault = false;

    handler = new YabauseHandler(this);
    yabauseThread = new YabauseRunnable(this);

    UiModeManager uiModeManager = (UiModeManager) getSystemService(Context.UI_MODE_SERVICE);
    if (uiModeManager.getCurrentModeType() != Configuration.UI_MODE_TYPE_TELEVISION) {
        SharedPreferences prefs = getSharedPreferences("private", Context.MODE_PRIVATE);
        Boolean hasDonated = prefs.getBoolean("donated", false);
        if (hasDonated) {
            adView = null;
        } else {
            adView = new AdView(this);
            adView.setAdUnitId(getString(R.string.banner_ad_unit_id2));
            adView.setAdSize(AdSize.BANNER);
            AdRequest adRequest = new AdRequest.Builder().build();
            adView.loadAd(adRequest);
            adView.setAdListener(new AdListener() {
                @Override
                public void onAdOpened() {
                    // Save app state before going to the ad overlay.
                }
            });
        }
    } else {
        adView = null;
    }

}

From source file:com.jp.miaulavirtual.DisplayMessageActivity.java

public void process(Boolean status, int id) {
    if (status) {
        Toast.makeText(getBaseContext(), getString(R.string.toast_1), Toast.LENGTH_SHORT).show();
    } else {//from   w w  w .j  a  va2 s  .c om
        String msg = null;
        switch (id) {
        case 0: // cancelled
            dialog.dismiss();
            msg = getString(R.string.toast_0);
            break;
        case 2: // not enough free storage space
            dialog.dismiss();
            msg = getString(R.string.toast_2);
            break;
        case 3: // invalid URL
            dialog.dismiss();
            msg = getString(R.string.toast_3);
            break;
        case 4: // file not found
            dialog.dismiss();
            msg = getString(R.string.toast_4);
            break;
        case 5: // general error
            msg = getString(R.string.toast_5);
            break;
        case 6: // conection problems
            msg = getString(R.string.toast_6);
            afterBroadcaster2();
            break;
        case 7: // conection problems 2
            dialog.dismiss();
            msg = getString(R.string.toast_6);
            afterBroadcaster2();
            break;
        case 8: // general error 2
            dialog.dismiss();
            msg = getString(R.string.toast_5);
            afterBroadcaster2();
            break;
        case 9: // conection problems 2
            dialog.dismiss();
            msg = getString(R.string.toast_7);
            afterBroadcaster2();
            break;
        }
        Toast.makeText(getBaseContext(), msg, Toast.LENGTH_SHORT).show();
    }
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    task_status = true;
}

From source file:com.mediatek.miravision.ui.MiraVisionActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.miravision_activity);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.left_drawer);

    // set a custom shadow that overlays the main content when the drawer
    // opens//from  ww w . ja  v  a2 s .  com
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    // set up the drawer's list view with items and click listener
    sDrawerListAdapter = new DrawerListViewAdapter(this);
    mDrawerList.setAdapter(sDrawerListAdapter);
    mDrawerList.setOnItemClickListener(this);
    mDrawerList.setDivider(null);

    // enable ActionBar app icon to behave as action to toggle nav drawer
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setTitle(R.string.mira_vision_tm);

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the sliding drawer and the action bar app icon
    mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
            mDrawerLayout, /* DrawerLayout object */
            R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
            R.string.drawer_open, /* "open drawer" description for accessibility */
            R.string.drawer_close /* "close drawer" description for accessibility */
    ) {
        public void onDrawerClosed(View view) {
            invalidateOptionsMenu(); // creates call to
            // onPrepareOptionsMenu()
        }

        public void onDrawerOpened(View drawerView) {
            invalidateOptionsMenu(); // creates call to
            // onPrepareOptionsMenu()
        }
    };
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    if (savedInstanceState == null) {
        show(getFragmentManager(), new IntroductionFragment(), ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }
}

From source file:com.appnexus.opensdk.MRAIDImplementation.java

void close() {
    if (expanded) {
        AdView.LayoutParams lp = new AdView.LayoutParams(owner.getLayoutParams());
        lp.height = default_height;
        lp.width = default_width;
        lp.gravity = Gravity.CENTER;/*from  w w w  .j a  v a  2s .c o m*/
        owner.setLayoutParams(lp);
        owner.close();
        this.owner.loadUrl("javascript:window.mraid.util.stateChangeEvent('default');");
        this.owner.owner.adListener.onAdCollapsed(this.owner.owner);

        // Allow orientation changes
        Activity a = ((Activity) this.owner.getContext());
        if (a != null)
            a.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
        expanded = false;
    } else {
        // state must be default
        owner.hide();
        hidden = true;
    }
}

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

private void initChampionInfoPager() {
    final PageIndicator championDetailPageIndicator;
    List<Fragment> fragments = new ArrayList<>();
    fragments.add(new ChampionStatsSupportFragment());
    fragments.add(new ChampionAbilitiesSupportFragment());
    fragments.add(new ChampionLoreSupportFragment());
    championDetailPager = (TransitionViewPager) findViewById(R.id.champion_detail_pager);
    championDetailPager.setTransitionEffect(TRANSITION_EFFECT);
    championDetailPager.setAdapter(new ChampionDetailPageAdapter(getSupportFragmentManager(), fragments));
    championDetailPageIndicator = ((PageIndicator) findViewById(R.id.champion_detail_pager_indicator));
    championDetailPageIndicator.setViewPager(championDetailPager);
    championDetailPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override//from  w w w.ja va2  s  . c o  m
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            logString("debug", "Page selected: " + position);
            championDetailPageIndicator.setCurrentItem(position);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
            logString("debug", "State changed: " + state);
            if (detailShowcase != null) {
                SharedPreferences preferences = PreferenceManager
                        .getDefaultSharedPreferences(getApplicationContext());
                preferences.edit().putBoolean("showcase_champion_detail_done", Boolean.TRUE).apply();
                detailShowcase.hide();
                setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
            }
        }
    });
}

From source file:com.af.synapse.MainActivity.java

@SuppressWarnings("ConstantConditions")
private void continueCreate() {
    View v = LayoutInflater.from(this).inflate(R.layout.activity_main, null);

    mViewPager = (ViewPager) v.findViewById(R.id.mainPager);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPagerPageChangeListener());
    mDrawerList = (ListView) v.findViewById(R.id.left_drawer);

    String[] section_titles = new String[Utils.configSections.size()];
    for (int i = 0; i < Utils.configSections.size(); i++)
        section_titles[i] = Utils.localise(((JSONObject) Utils.configSections.get(i)).get("name"));

    mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_item, section_titles));
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
    mDrawerList.setItemChecked(0, true);

    mDrawerLayout = (DrawerLayout) v.findViewById(R.id.drawer_layout);
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open,
            R.string.drawer_close);/* ww  w .j  a  v a  2s.  c o  m*/
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    ActionBar actionBar = getActionBar();

    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);

    mDrawerToggle.syncState();

    ActionValueUpdater.refreshButtons(true);

    for (TabSectionFragment f : fragments)
        f.onElementsMainStart();

    setContentView(v);
    actionBar.show();
    Utils.appStarted = true;

    setPaddingDimensions();
    L.i("Interface creation finished in " + (System.nanoTime() - startTime) + "ns");

    if (Utils.appStarted)
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);

    if (!BootService.getBootFlag() && !BootService.getBootFlagPending()) {
        new AlertDialog.Builder(this).setTitle(R.string.popup_failed_boot_title)
                .setMessage(R.string.popup_failed_boot_message).setCancelable(true)
                .setPositiveButton(R.string.popup_failed_boot_ack, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                    }
                }).show();
    }
}

From source file:de.dmxcontrol.activity.ControlActivity.java

@Override
protected void onStart() {
    super.onStart();

    switch (SCREEN_MODE) {
    case Prefs.SCREEN_MODE_AUTOMATIC:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
        break;/*  w  ww  .j  a  v a 2 s  .c o m*/
    case Prefs.SCREEN_MODE_PORTRAIT:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        break;
    case Prefs.SCREEN_MODE_LANDSCAPE:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }

    ServiceFrontend.get().setNetworkListener(mMessageListener);
    mUpdatePanel = new UpdatePanel();

}

From source file:com.jp.miaulavirtual.DisplayMessageActivity.java

public void process(String out) {
    String response = out;/*w w  w.  java  2s.co m*/
    if (isTheHome) {
        if (clickedPosition == 0)
            comunidades = true; //Click Comunidades y otros
        String[] theData = new String[2];
        theData[0] = urls[clickedPosition].toString(); // url
        theData[1] = names[clickedPosition].toString(); // name
        onData.add(theData);
    } else {
        if (clickedPosition == 0) { //Click atrs
            onData.remove(onData.size() - 1); // remove data
            comunidades = false;
            if (onData.size() >= 2 && (onData.get(0)[0].toString().equals(onData.get(1)[0].toString())))
                comunidades = true;
        } else {
            String[] theData = new String[2];
            theData[0] = urls[clickedPosition].toString(); // url
            theData[1] = names[clickedPosition].toString(); // name
            onData.add(theData);
        }
    }
    afterBroadcaster(response);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    task_status = true;
}

From source file:com.dycody.android.idealnote.MainActivity.java

public void onBackPressed() {

    Fragment f;/*  w w w .ja  v a2  s. co  m*/

    // SketchFragment
    f = checkFragmentInstance(R.id.fragment_container, SketchFragment.class);
    if (f != null) {
        ((SketchFragment) f).save();

        // Removes forced portrait orientation for this fragment
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);

        mFragmentManager.popBackStack();
        return;
    }

    // DetailFragment
    f = checkFragmentInstance(R.id.fragment_container, DetailFragment.class);
    if (f != null) {
        ((DetailFragment) f).goBack = true;
        ((DetailFragment) f).saveAndExit((DetailFragment) f);
        return;
    }

    // ListFragment
    f = checkFragmentInstance(R.id.fragment_container, ListFragment.class);
    if (f != null) {
        // Before exiting from app the navigation drawer is opened
        if (prefs.getBoolean("settings_navdrawer_on_exit", false) && getDrawerLayout() != null
                && !getDrawerLayout().isDrawerOpen(GravityCompat.START)) {
            getDrawerLayout().openDrawer(GravityCompat.START);
        } else if (!prefs.getBoolean("settings_navdrawer_on_exit", false) && getDrawerLayout() != null
                && getDrawerLayout().isDrawerOpen(GravityCompat.START)) {
            getDrawerLayout().closeDrawer(GravityCompat.START);
        } else {
            if (!((ListFragment) f).closeFab()) {
                super.onBackPressed();
            }
        }
        return;
    }
    super.onBackPressed();
}