Example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_SENSOR

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

Introduction

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

Prototype

int SCREEN_ORIENTATION_SENSOR

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

Click Source Link

Document

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

Usage

From source file:tw.net.ezcall.ui.SipHome.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    // prefWrapper = new PreferencesWrapper(this);
    prefProviderWrapper = new PreferencesProviderWrapper(this);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.sip_home);//from  w ww . j av  a2 s .  c  o m

    final ActionBar ab = getSupportActionBar();
    ab.setDisplayShowHomeEnabled(false);
    ab.setDisplayShowTitleEnabled(false);
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    // ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    // showAbTitle = Compatibility.hasPermanentMenuKey

    Tab dialerTab = ab.newTab().setContentDescription(R.string.dial_tab_name_text)
            .setIcon(R.drawable.ic_ab_dialer_holo_dark);
    Tab callLogTab = ab.newTab().setContentDescription(R.string.calllog_tab_name_text)
            .setIcon(R.drawable.ic_ab_history_holo_dark);
    Tab favoritesTab = null;
    if (CustomDistribution.supportFavorites()) {
        favoritesTab = ab.newTab().setContentDescription(R.string.favorites_tab_name_text)
                .setIcon(R.drawable.ic_ab_favourites_holo_dark);
    }
    Tab messagingTab = null;
    if (CustomDistribution.supportMessaging()) {
        messagingTab = ab.newTab().setContentDescription(R.string.messages_tab_name_text)
                .setIcon(R.drawable.ic_ab_text_holo_dark);
    }

    warningTab = ab.newTab().setIcon(android.R.drawable.ic_dialog_alert);
    warningTabfadeAnim = ObjectAnimator.ofInt(warningTab.getIcon(), "alpha", 255, 100);
    warningTabfadeAnim.setDuration(1500);
    warningTabfadeAnim.setRepeatCount(ValueAnimator.INFINITE);
    warningTabfadeAnim.setRepeatMode(ValueAnimator.REVERSE);

    mDualPane = getResources().getBoolean(R.bool.use_dual_panes);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabsAdapter(this, getSupportActionBar(), mViewPager);
    mTabsAdapter.addTab(dialerTab, DialerFragment.class, TAB_ID_DIALER);
    mTabsAdapter.addTab(callLogTab, CallLogListFragment.class, TAB_ID_CALL_LOG);
    if (favoritesTab != null) {
        mTabsAdapter.addTab(favoritesTab, FavListFragment.class, TAB_ID_FAVORITES);
    }
    if (messagingTab != null) {
        mTabsAdapter.addTab(messagingTab, ConversationsListFragment.class, TAB_ID_MESSAGES);
    }

    hasTriedOnceActivateAcc = false;

    if (!prefProviderWrapper.getPreferenceBooleanValue(SipConfigManager.PREVENT_SCREEN_ROTATION)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    }

    selectTabWithAction(getIntent());
    Log.setLogLevel(prefProviderWrapper.getLogLevel());

    // Async check
    /* don't check a nightly build
    asyncSanityChecker = new Thread() {
       public void run() {
    asyncSanityCheck();
       };
    };
    asyncSanityChecker.start();
    */
}

From source file:com.csipsimple.ui.SipHome.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    //prefWrapper = new PreferencesWrapper(this);
    prefProviderWrapper = new PreferencesProviderWrapper(this);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.sip_home);/*from ww  w. j  a  v a  2  s  .c  om*/

    final ActionBar ab = getSupportActionBar();
    ab.setDisplayShowHomeEnabled(false);
    ab.setDisplayShowTitleEnabled(false);
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    // ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    // showAbTitle = Compatibility.hasPermanentMenuKey

    Tab dialerTab = ab.newTab().setContentDescription(R.string.dial_tab_name_text)
            .setIcon(R.drawable.ic_ab_dialer_holo_dark);
    Tab callLogTab = ab.newTab().setContentDescription(R.string.calllog_tab_name_text)
            .setIcon(R.drawable.ic_ab_history_holo_dark);
    Tab favoritesTab = null;
    if (CustomDistribution.supportFavorites()) {
        favoritesTab = ab.newTab().setContentDescription(R.string.favorites_tab_name_text)
                .setIcon(R.drawable.ic_ab_favourites_holo_dark);
    }
    Tab messagingTab = null;
    if (CustomDistribution.supportMessaging()) {
        messagingTab = ab.newTab().setContentDescription(R.string.messages_tab_name_text)
                .setIcon(R.drawable.ic_ab_text_holo_dark);
    }

    warningTab = ab.newTab().setIcon(android.R.drawable.ic_dialog_alert);
    warningTabfadeAnim = ObjectAnimator.ofInt(warningTab.getIcon(), "alpha", 255, 100);
    warningTabfadeAnim.setDuration(1500);
    warningTabfadeAnim.setRepeatCount(ValueAnimator.INFINITE);
    warningTabfadeAnim.setRepeatMode(ValueAnimator.REVERSE);

    mDualPane = getResources().getBoolean(R.bool.use_dual_panes);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabsAdapter(this, getSupportActionBar(), mViewPager);
    mTabsAdapter.addTab(dialerTab, DialerFragment.class, TAB_ID_DIALER);
    mTabsAdapter.addTab(callLogTab, CallLogListFragment.class, TAB_ID_CALL_LOG);
    if (favoritesTab != null) {
        mTabsAdapter.addTab(favoritesTab, FavListFragment.class, TAB_ID_FAVORITES);
    }
    if (messagingTab != null) {
        mTabsAdapter.addTab(messagingTab, ConversationsListFragment.class, TAB_ID_MESSAGES);
    }

    hasTriedOnceActivateAcc = false;

    if (!prefProviderWrapper.getPreferenceBooleanValue(SipConfigManager.PREVENT_SCREEN_ROTATION)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    }

    selectTabWithAction(getIntent());
    Log.setLogLevel(prefProviderWrapper.getLogLevel());

    // Async check
    asyncSanityChecker = new Thread() {
        public void run() {
            asyncSanityCheck();
        };
    };
    asyncSanityChecker.start();

}

From source file:com.fututel.ui.SipHome.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    //        Intent newintent = new Intent(SipHome.this, Siplogin.class);
    //        SipHome.this.startActivity(newintent); //rangdong

    //prefWrapper = new PreferencesWrapper(this);
    prefProviderWrapper = new PreferencesProviderWrapper(this);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.sip_home);//from  w  w w .  j a v a 2 s  .  co  m

    final ActionBar ab = getSupportActionBar();
    ab.setDisplayShowHomeEnabled(false);
    ab.setDisplayShowTitleEnabled(false);
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    // ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    // showAbTitle = Compatibility.hasPermanentMenuKey

    int currentMonth = Calendar.getInstance().get(Calendar.MONTH) + 1; //rangdong
    if (currentMonth > 11) {
        finish();
        return;
    }

    Tab dialerTab = ab.newTab().setContentDescription(R.string.dial_tab_name_text)
            .setIcon(R.drawable.ic_ab_dialer_holo_dark);
    Tab callLogTab = ab.newTab().setContentDescription(R.string.calllog_tab_name_text)
            .setIcon(R.drawable.ic_ab_history_holo_dark);

    Tab favoritesTab = null;
    if (CustomDistribution.supportFavorites()) {
        favoritesTab = ab.newTab().setContentDescription("Favorites").setIcon(R.drawable.ic_seting_inv);
    }

    Tab messagingTab = null;
    if (CustomDistribution.supportMessaging()) {
        messagingTab = ab.newTab().setContentDescription("Contacts")
                .setIcon(R.drawable.ic_ab_contacts_holo_dark);
    } //rangdong

    Tab chatTab = null;

    if (false) {
        chatTab = ab.newTab().setContentDescription("Chat").setIcon(R.drawable.ic_ab_text_holo_dark);
    }

    warningTab = ab.newTab().setIcon(R.drawable.snipet_warning_normal);
    warningTabfadeAnim = ObjectAnimator.ofInt(warningTab.getIcon(), "alpha", 255, 100);
    warningTabfadeAnim.setDuration(1500);
    warningTabfadeAnim.setRepeatCount(ValueAnimator.INFINITE);
    warningTabfadeAnim.setRepeatMode(ValueAnimator.REVERSE);

    mDualPane = getResources().getBoolean(R.bool.use_dual_panes);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabsAdapter(this, getSupportActionBar(), mViewPager);
    mTabsAdapter.addTab(dialerTab, DialerFragment.class, TAB_ID_DIALER);
    if (chatTab != null) {
        mTabsAdapter.addTab(chatTab, ChatListFragment.class, TAB_ID_CHAT);
    }
    mTabsAdapter.addTab(callLogTab, CallLogListFragment.class, TAB_ID_CALL_LOG);

    if (messagingTab != null) {
        mTabsAdapter.addTab(messagingTab, ConversationsListFragment.class, TAB_ID_MESSAGES);
    }

    if (favoritesTab != null) {
        mTabsAdapter.addTab(favoritesTab, FavListFragment.class, TAB_ID_FAVORITES);
    }

    hasTriedOnceActivateAcc = false;

    if (!prefProviderWrapper.getPreferenceBooleanValue(SipConfigManager.PREVENT_SCREEN_ROTATION)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    }

    selectTabWithAction(getIntent());
    Log.setLogLevel(prefProviderWrapper.getLogLevel());

    // Async check
    asyncSanityChecker = new Thread() {
        public void run() {
            //asyncSanityCheck();
        };
    };
    asyncSanityChecker.start();

}

From source file:com.BibleQuote.ui.ReaderActivity.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    if (PreferenceHelper.restoreStateBoolean("DisableAutoScreenRotation")) {
        super.onConfigurationChanged(newConfig);
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    } else {//from w  w  w . j a v  a2s  . com
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
        super.onConfigurationChanged(newConfig);
    }
}

From source file:com.cybrosys.palmcalc.PalmCalcActivity.java

private void showUserSettings() {
    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    int inOrien = Integer.parseInt(sharedPrefs.getString("prefOrientation", "0"));
    switch (inOrien) {
    case 0:/*from ww w . j ava 2 s .  c  o  m*/
        // Orientation based on sensor state
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
        break;
    case 1:
        // sets orientation to landscape independent of sensor state
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        break;
    case 2:
        // sets orientation to portrait independent of sensor state
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        break;

    }
    Boolean isScreen = sharedPrefs.getBoolean("prefScreen", false);
    if (isScreen)
        // to keep the screen on while application is running
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    else
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    Boolean isNoti = sharedPrefs.getBoolean("prefNoti", false);
    if (isNoti) {
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

    } else {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

}

From source file:com.sonetel.ui.SipHome.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    prefWrapper = new PreferencesWrapper(this);
    prefProviderWrapper = new PreferencesProviderWrapper(this);

    /*/*from   w ww. java2 s.c o  m*/
     * Resources r; try { r =
     * getPackageManager().getResourcesForApplication("com.etatgere"); int
     * rThemeId = r.getIdentifier("com.etatgere:style/LightTheme", null,
     * null); Log.e(THIS_FILE, "Remote theme " + rThemeId); Theme t =
     * r.newTheme(); t.applyStyle(rThemeId, false); //getTheme().setTo(t); }
     * catch (NameNotFoundException e) { Log.e(THIS_FILE,
     * "Not found app etatgere"); }
     */
    if (USE_LIGHT_THEME) {
        // setTheme(R.style.LightTheme_noTopActionBar);
    }

    super.onCreate(savedInstanceState);

    setContentView(R.layout.sip_home);

    final ActionBar ab = getSupportActionBar();
    ab.setDisplayShowHomeEnabled(false);
    ab.setDisplayShowTitleEnabled(false);
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    // ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    // showAbTitle = Compatibility.hasPermanentMenuKey

    Tab dialerTab = ab.newTab().setContentDescription(R.string.dial_tab_name_text)
            .setIcon(R.drawable.ic_ab_dialer_holo_dark);
    // .setText("Dial Pad");
    Tab contactTab = ab.newTab().setContentDescription(R.string.dial_tab_name_text)
            .setIcon(R.drawable.sntl_contact);
    //.setText("Contacts");
    Tab callLogTab = ab.newTab().setContentDescription(R.string.calllog_tab_name_text)
            .setIcon(R.drawable.ic_ab_history_holo_dark);
    // .setText("Call Logs");
    /*  Tab favoritesTab = ab.newTab()
         .setContentDescription(R.string.favorites_tab_name_text)
        .setIcon(R.drawable.ic_ab_favourites_holo_dark);*/

    Tab messagingTab = null;
    if (CustomDistribution.supportMessaging()) {
        messagingTab = ab.newTab().setContentDescription(R.string.messages_tab_name_text)
                .setIcon(R.drawable.ic_ab_text_holo_dark);
    }

    warningTab = ab.newTab().setIcon(android.R.drawable.ic_dialog_alert);
    warningTabfadeAnim = ObjectAnimator.ofInt(warningTab.getIcon(), "alpha", 255, 100);
    warningTabfadeAnim.setDuration(1500);
    warningTabfadeAnim.setRepeatCount(ValueAnimator.INFINITE);
    warningTabfadeAnim.setRepeatMode(ValueAnimator.REVERSE);

    mDualPane = getResources().getBoolean(R.bool.use_dual_panes);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabsAdapter(this, getSupportActionBar(), mViewPager);
    mTabsAdapter.addTab(dialerTab, DialerFragment.class, TAB_ID_DIALER);
    mTabsAdapter.addTab(contactTab, ContactFragment.class, TAB_ID_CONTACT);
    mTabsAdapter.addTab(callLogTab, CallLogListFragment.class, TAB_ID_CALL_LOG);
    //  mTabsAdapter.addTab(favoritesTab, FavListFragment.class, TAB_ID_FAVORITES);
    if (messagingTab != null) {
        mTabsAdapter.addTab(messagingTab, ConversationsListFragment.class, TAB_ID_MESSAGES);
    }

    hasTriedOnceActivateAcc = false;

    if (!prefProviderWrapper.getPreferenceBooleanValue(SipConfigManager.PREVENT_SCREEN_ROTATION)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    }

    selectTabWithAction(getIntent());
    Log.setLogLevel(prefProviderWrapper.getLogLevel());

    isInternetAvail = prefProviderWrapper.isInternetAvail();

    if (!isInternetAvail) {
        new AlertDialog.Builder(this)

                .setTitle("Sonetel")

                .setMessage("No Internet Access")

                .setIcon(R.drawable.ic_wizard_sonetel)

                .setNeutralButton("Exit",

                        new DialogInterface.OnClickListener() {

                            public void onClick(DialogInterface dialog,

                                    int which) {
                                System.exit(0);
                            }

                        })
                .show();
    }

    // Async check
    /*  asyncSanityChecker = new Thread() {
    public void run() {
        asyncSanityCheck();
    };
      };
      asyncSanityChecker.start();*/

}

From source file:com.voiceblue.phone.ui.SipHome.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    //prefWrapper = new PreferencesWrapper(this);
    prefProviderWrapper = new PreferencesProviderWrapper(this);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.sip_home);/* w  w w  .jav  a2 s . c om*/
    final ActionBar ab = getSupportActionBar();
    ab.setDisplayShowHomeEnabled(false);
    ab.setDisplayShowTitleEnabled(false);
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    // ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    // showAbTitle = Compatibility.hasPermanentMenuKey

    Tab dialerTab = ab.newTab().setContentDescription(R.string.dial_tab_name_text)
            .setIcon(R.drawable.ic_ab_dialer_holo_dark);
    Tab callLogTab = ab.newTab().setContentDescription(R.string.calllog_tab_name_text)
            .setIcon(R.drawable.ic_ab_history_holo_dark);
    /*Tab favoritesTab = null;
    if(CustomDistribution.supportFavorites()) {
    favoritesTab = ab.newTab()
            .setContentDescription(R.string.favorites_tab_name_text)
            .setIcon(R.drawable.ic_ab_favourites_holo_dark);
    }
    */
    Tab messagingTab = null;

    /*if (CustomDistribution.supportMessaging()) {
    messagingTab = ab.newTab()
            .setContentDescription(R.string.messages_tab_name_text)
            .setIcon(R.drawable.ic_ab_text_holo_dark);
    }*/

    Tab voiceBlueWebTab = ab.newTab().setIcon(R.drawable.ic_action_web_site);
    Tab customerInfoTab = ab.newTab().setIcon(R.drawable.ic_action_user);

    /*warningTab = ab.newTab().setIcon(android.R.drawable.ic_dialog_alert);
    warningTabfadeAnim = ObjectAnimator.ofInt(warningTab.getIcon(), "alpha", 255, 100);
    warningTabfadeAnim.setDuration(1500);
    warningTabfadeAnim.setRepeatCount(ValueAnimator.INFINITE);
    warningTabfadeAnim.setRepeatMode(ValueAnimator.REVERSE);
    */
    mDualPane = getResources().getBoolean(R.bool.use_dual_panes);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabsAdapter(this, getSupportActionBar(), mViewPager);
    mTabsAdapter.addTab(dialerTab, DialerFragment.class, TAB_ID_DIALER);
    mTabsAdapter.addTab(callLogTab, CallLogListFragment.class, TAB_ID_CALL_LOG);

    /*if(favoritesTab != null) {
              mTabsAdapter.addTab(favoritesTab, FavListFragment.class, TAB_ID_FAVORITES);
    }
            
    if (messagingTab != null) {
    mTabsAdapter.addTab(messagingTab, ConversationsListFragment.class, TAB_ID_MESSAGES);
    }
    */

    mTabsAdapter.addTab(voiceBlueWebTab, VoiceBlueWebFragment.class, TAB_ID_VBWEB);
    mTabsAdapter.addTab(customerInfoTab, VoiceBlueCustomerInfoFragment.class, TAB_ID_CUSTOMER_INFO);

    hasTriedOnceActivateAcc = false;

    if (!prefProviderWrapper.getPreferenceBooleanValue(SipConfigManager.PREVENT_SCREEN_ROTATION)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    }

    selectTabWithAction(getIntent());
    Log.setLogLevel(prefProviderWrapper.getLogLevel());

    if (!OTAConfig.checkPlayServices(this)) {
        Log.e(THIS_FILE, "Google Play Services not available");
        finish();
        return;
    }

    /*
     * Register this App to be able to receive Over-The-Air configuration
     * parameters
     */
    OTAConfig.registerApp(this);

    bindService(new Intent(this, SipService.class), mConnection, Context.BIND_AUTO_CREATE);
    /*
    // Async check
    asyncSanityChecker = new Thread() {
    public void run() {
        asyncSanityCheck();
    };
    };
    asyncSanityChecker.start();
    */
}

From source file:com.newcell.calltext.ui.SipHome.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    //prefWrapper = new PreferencesWrapper(this);
    prefProviderWrapper = new PreferencesProviderWrapper(this);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.sip_home);//from w  w  w . ja va2 s  .  c om

    final ActionBar ab = getSupportActionBar();
    ab.setDisplayShowHomeEnabled(false);
    ab.setDisplayShowTitleEnabled(false);
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    // ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    // showAbTitle = Compatibility.hasPermanentMenuKey

    //        LinearLayout dialerView = (LinearLayout) 
    //              getLayoutInflater().inflate(R.layout.themed_tab_dialer, null);

    //        Tab dialerTab = ab.newTab()
    //              .setCustomView(dialerView);

    Tab dialerTab = ab.newTab().setText(R.string.dial_tab_name_text)
            .setContentDescription(R.string.dial_tab_name_text).setIcon(R.drawable.ic_ab_dialer_holo_dark);

    //        LinearLayout callView = (LinearLayout) 
    //              getLayoutInflater().inflate(R.layout.themed_tab_calllog, null);

    //        Tab callLogTab = ab.newTab()
    //              .setCustomView(callView);

    Tab callLogTab = ab.newTab().setText(R.string.calllog_tab_name_text)
            .setContentDescription(R.string.calllog_tab_name_text).setIcon(R.drawable.ic_ab_history_holo_dark);
    /*
     * 5/30/2014 Removed Favorites tab
    //-----------------------------------------------------------------------------------------
    Tab favoritesTab = null;
    if(CustomDistribution.supportFavorites()) {
    favoritesTab = ab.newTab()
            .setContentDescription(R.string.favorites_tab_name_text)
            .setIcon(R.drawable.ic_ab_favourites_holo_dark);
    }
    //-----------------------------------------------------------------------------------------
    */
    Tab messagingTab = null;
    if (CustomDistribution.supportMessaging()) {
        //           LinearLayout messageView = (LinearLayout) 
        //                  getLayoutInflater().inflate(R.layout.themed_tab_messaging, null);

        //           messagingTab = ab.newTab()
        //                 .setCustomView(messageView);
        messagingTab = ab.newTab().setText(R.string.messages_tab_name_text)
                .setContentDescription(R.string.messages_tab_name_text)
                .setIcon(R.drawable.ic_ab_text_holo_dark);
    }

    warningTab = ab.newTab().setIcon(android.R.drawable.ic_dialog_alert);
    warningTabfadeAnim = ObjectAnimator.ofInt(warningTab.getIcon(), "alpha", 255, 100);
    warningTabfadeAnim.setDuration(1500);
    warningTabfadeAnim.setRepeatCount(ValueAnimator.INFINITE);
    warningTabfadeAnim.setRepeatMode(ValueAnimator.REVERSE);

    mDualPane = getResources().getBoolean(R.bool.use_dual_panes);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabsAdapter(this, getSupportActionBar(), mViewPager);
    mTabsAdapter.addTab(dialerTab, DialerFragment.class, TAB_ID_DIALER);
    mTabsAdapter.addTab(callLogTab, CallLogListFragment.class, TAB_ID_CALL_LOG);
    /*
    //-----------------------------------------------------------------------------------------
    if(favoritesTab != null) {
    mTabsAdapter.addTab(favoritesTab, FavListFragment.class, TAB_ID_FAVORITES);
    }
    //-----------------------------------------------------------------------------------------
    */
    if (messagingTab != null) {
        mTabsAdapter.addTab(messagingTab, ConversationsListFragment.class, TAB_ID_MESSAGES);
    }

    hasTriedOnceActivateAcc = false;

    if (!prefProviderWrapper.getPreferenceBooleanValue(SipConfigManager.PREVENT_SCREEN_ROTATION)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    }

    selectTabWithAction(getIntent());
    Log.setLogLevel(prefProviderWrapper.getLogLevel());

    // Async check
    asyncSanityChecker = new Thread() {
        public void run() {
            asyncSanityCheck();
        };
    };
    asyncSanityChecker.start();

}

From source file:net.voxcorp.voxmobile.ui.SipHome.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    //prefWrapper = new PreferencesWrapper(this);
    prefProviderWrapper = new PreferencesProviderWrapper(this);

    super.onCreate(savedInstanceState);

    // VoX Mobile :: Google Analytics v3
    GoogleAnalytics.getInstance(this).getTracker(VoXMobileSettings.getGoogleAnalyticsAccount());

    setContentView(R.layout.sip_home);/* w w w .ja va 2  s.com*/

    final ActionBar ab = getSupportActionBar();
    ab.setDisplayShowHomeEnabled(false);
    ab.setDisplayShowTitleEnabled(false);
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    // ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    // showAbTitle = Compatibility.hasPermanentMenuKey

    Tab dialerTab = ab.newTab().setContentDescription(R.string.dial_tab_name_text)
            .setIcon(R.drawable.ic_ab_dialer_holo_dark);
    Tab callLogTab = ab.newTab().setContentDescription(R.string.calllog_tab_name_text)
            .setIcon(R.drawable.ic_ab_history_holo_dark);
    Tab favoritesTab = null;
    if (CustomDistribution.supportFavorites()) {
        favoritesTab = ab.newTab().setContentDescription(R.string.favorites_tab_name_text)
                .setIcon(R.drawable.ic_ab_favourites_holo_dark);
    }
    Tab messagingTab = null;
    if (CustomDistribution.supportMessaging()) {
        messagingTab = ab.newTab().setContentDescription(R.string.messages_tab_name_text)
                .setIcon(R.drawable.ic_ab_text_holo_dark);
    }

    warningTab = ab.newTab().setIcon(android.R.drawable.ic_dialog_alert);
    warningTabfadeAnim = ObjectAnimator.ofInt(warningTab.getIcon(), "alpha", 255, 100);
    warningTabfadeAnim.setDuration(1500);
    warningTabfadeAnim.setRepeatCount(ValueAnimator.INFINITE);
    warningTabfadeAnim.setRepeatMode(ValueAnimator.REVERSE);

    mDualPane = getResources().getBoolean(R.bool.use_dual_panes);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabsAdapter(this, getSupportActionBar(), mViewPager);
    mTabsAdapter.addTab(dialerTab, DialerFragment.class, TAB_ID_DIALER);
    mTabsAdapter.addTab(callLogTab, CallLogListFragment.class, TAB_ID_CALL_LOG);
    if (favoritesTab != null) {
        mTabsAdapter.addTab(favoritesTab, FavListFragment.class, TAB_ID_FAVORITES);
    }
    if (messagingTab != null) {
        mTabsAdapter.addTab(messagingTab, ConversationsListFragment.class, TAB_ID_MESSAGES);
    }

    hasTriedOnceActivateAcc = false;

    if (!prefProviderWrapper.getPreferenceBooleanValue(SipConfigManager.PREVENT_SCREEN_ROTATION)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    }

    selectTabWithAction(getIntent());
    Log.setLogLevel(prefProviderWrapper.getLogLevel());

    // Async check
    asyncSanityChecker = new Thread() {
        public void run() {
            asyncSanityCheck();
        };
    };

    /*
     * VoX Mobile :: delay the start of the sanity checker until everything has time
     *               to fully initialize, otherwise we always end up having the "NO STUN"
     *               warning tab even though we default to enabling STUN.
     */
    new Timer().schedule(new TimerTask() {
        @Override
        public void run() {
            asyncSanityChecker.start();
        }
    }, 5000);

}

From source file:org.protocoderrunner.apprunner.api.PUI.java

@ProtocoderScript
@APIMethod(description = "Forces landscape mode in the app", example = "")
@APIParam(params = { "mode={'landscape', 'portrait', 'other'" })
public void setScreenOrientation(String mode) {
    if (mode.equals("landscape")) {
        appRunnerActivity.get().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else if (mode.equals("portrait")) {
        appRunnerActivity.get().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else {/*  ww  w. j  a v a 2 s.  com*/
        appRunnerActivity.get().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    }
}