Example usage for android.os Bundle getBoolean

List of usage examples for android.os Bundle getBoolean

Introduction

In this page you can find the example usage for android.os Bundle getBoolean.

Prototype

public boolean getBoolean(String key, boolean defaultValue) 

Source Link

Document

Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

Usage

From source file:at.ac.tuwien.detlef.activities.MainActivity.java

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

    startSettingsActivityIfNoDeviceIdSet();

    setContentView(R.layout.main_activity_layout);

    boolean showProgressDialog = false;

    /*/* w ww. j  a  v a  2 s. c  o m*/
     * Old Activity is recreated and the Activity has not been removed from
     * memory. The latter part is important because if it was, we have to
     * abort any ongoing refresh.
     */
    if ((savedInstanceState != null) && (refreshBg != null)) {
        curPodSync = new AtomicInteger(savedInstanceState.getInt(KEY_CUR_POD_SYNC, 0));
        numPodSync = new AtomicInteger(savedInstanceState.getInt(KEY_NUM_POD_SYNC, -1));
        showProgressDialog = savedInstanceState.getBoolean(KEY_SHOW_PROGRESS_DIALOG, false);
    } else {
        podcastHandler = new PodcastHandler();
        feedHandler = new FeedHandler();
        episodeActionHandler = new EpisodeActionHandler();
    }

    if (refreshBg == null) {
        refreshBg = Executors.newSingleThreadExecutor();
    }

    MediaPlayerNotification.create(this, false, null);

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the app.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

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

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    // When swiping between different sections, select the corresponding
    // tab.
    // We can also use ActionBar.Tab#select() to do this if we have a
    // reference to the Tab.
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by
        // the adapter.
        // Also specify this Activity object, which implements the
        // TabListener interface, as the
        // listener for when this tab is selected.
        actionBar
                .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }

    /* Ready the progress dialog */
    progressDialog = new ProgressDialog(this);
    prepareProgressDialog();
    if ((numPodSync.get() != -1) && showProgressDialog) {
        progressDialog.show();
    }

    playlistDAO = Singletons.i().getPlaylistDAO();
}

From source file:com.meetingninja.csse.MainActivity.java

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

    SessionManager.getInstance().init(MainActivity.this);
    session = SessionManager.getInstance();

    // Check if logged in
    if (!session.isLoggedIn()) {
        Log.v(TAG, "User is not logged in");
        Intent login = new Intent(this, LoginActivity.class);
        // Bring login to front
        login.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        // User cannot go back to this activity
        // login.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        // Show no animation when launching login page
        login.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(login);//ww  w.  j a  v a2 s.co m
        finish(); // close main activity
    } else { // Else continue
        Log.v(TAG, "UserID " + session.getUserID() + " is logged in");
        setContentView(R.layout.activity_main);
        setupActionBar();
        setupViews();

        // on first time display view for first nav item
        selectItem(session.getPage());

        // Check to see if data has been cached in the local database
        if (savedInstanceState != null) {
            isDataCached = savedInstanceState.getBoolean(KEY_SQL_CACHE, false);
        }
        if (!isDataCached && session.needsSync()) {
            ApplicationController.getInstance().loadUsers();
            isDataCached = true;
            session.setSynced();
        }

        // Track the usage of the application with Parse SDK
        ParseAnalytics.trackAppOpened(getIntent());
        ParseUser parseUser = ParseUser.getCurrentUser();
        if (parseUser != null) {
            ParseInstallation installation = ParseInstallation.getCurrentInstallation();
            installation.put("user", parseUser);
            installation.put("userId", parseUser.getObjectId());
            installation.saveEventually();
        }
    }

}

From source file:co.taqat.call.LinphoneActivity.java

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    Bundle extras = intent.getExtras();
    if (extras != null && extras.getBoolean("GoToChat", false)) {
        LinphoneService.instance().removeMessageNotification();
        String sipUri = extras.getString("ChatContactSipUri");
        doNotGoToCallActivity = true;//from w  w  w . j av a  2s.  co m
        displayChat(sipUri);
    } else if (extras != null && extras.getBoolean("GoToHistory", false)) {
        doNotGoToCallActivity = true;
        changeCurrentFragment(FragmentsAvailable.HISTORY_LIST, null);
    } else if (extras != null && extras.getBoolean("GoToInapp", false)) {
        LinphoneService.instance().removeMessageNotification();
        doNotGoToCallActivity = true;
        displayInapp();
    } else if (extras != null && extras.getBoolean("Notification", false)) {
        if (LinphoneManager.getLc().getCallsNb() > 0) {
            LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
            startIncallActivity(call);
        }
    } else {
        DialerFragment dialerFragment = DialerFragment.instance();
        if (dialerFragment != null) {
            if (extras != null && extras.containsKey("SipUriOrNumber")) {
                if (getResources().getBoolean(R.bool.automatically_start_intercepted_outgoing_gsm_call)) {
                    ((DialerFragment) dialerFragment).newOutgoingCall(extras.getString("SipUriOrNumber"));
                } else {
                    ((DialerFragment) dialerFragment)
                            .displayTextInAddressBar(extras.getString("SipUriOrNumber"));
                }
            } else {
                ((DialerFragment) dialerFragment).newOutgoingCall(intent);
            }
        }
        if (LinphoneManager.getLc().getCalls().length > 0) {
            // If a call is ringing, start incomingcallactivity
            Collection<LinphoneCall.State> incoming = new ArrayList<LinphoneCall.State>();
            incoming.add(LinphoneCall.State.IncomingReceived);
            if (LinphoneUtils.getCallsInState(LinphoneManager.getLc(), incoming).size() > 0) {
                if (CallActivity.isInstanciated()) {
                    CallActivity.instance().startIncomingCallActivity();
                } else {
                    startActivity(new Intent(this, CallIncomingActivity.class));
                }
            }
        }
    }
}

From source file:com.initialxy.cordova.themeablebrowser.ThemeableBrowser.java

/**
 * Display a new browser with the specified URL.
 *
 * @param url/*from   www. jav a  2s .c om*/
 * @param features
 * @return
 */
public String showWebPage(final String url, final Options features) {
    final CordovaWebView thatWebView = this.webView;

    // Create dialog in new thread
    Runnable runnable = new Runnable() {
        @SuppressLint("NewApi")
        public void run() {
            // Let's create the main dialog
            dialog = new ThemeableBrowserDialog(cordova.getActivity(), android.R.style.Theme_Black_NoTitleBar,
                    features.hardwareback);
            if (!features.disableAnimation) {
                dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog;
            }
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setCancelable(true);
            dialog.setThemeableBrowser(getThemeableBrowser());

            // Main container layout
            ViewGroup main = null;

            if (features.fullscreen) {
                main = new FrameLayout(cordova.getActivity());
            } else {
                main = new LinearLayout(cordova.getActivity());
                ((LinearLayout) main).setOrientation(LinearLayout.VERTICAL);
            }

            // Toolbar layout
            Toolbar toolbarDef = features.toolbar;
            FrameLayout toolbar = new FrameLayout(cordova.getActivity());
            toolbar.setBackgroundColor(hexStringToColor(
                    toolbarDef != null && toolbarDef.color != null ? toolbarDef.color : "#ffffffff"));
            toolbar.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT,
                    dpToPixels(toolbarDef != null ? toolbarDef.height : TOOLBAR_DEF_HEIGHT)));

            if (toolbarDef != null && (toolbarDef.image != null || toolbarDef.wwwImage != null)) {
                try {
                    Drawable background = getImage(toolbarDef.image, toolbarDef.wwwImage,
                            toolbarDef.wwwImageDensity);
                    setBackground(toolbar, background);
                } catch (Resources.NotFoundException e) {
                    emitError(ERR_LOADFAIL,
                            String.format("Image for toolbar, %s, failed to load", toolbarDef.image));
                } catch (IOException ioe) {
                    emitError(ERR_LOADFAIL,
                            String.format("Image for toolbar, %s, failed to load", toolbarDef.wwwImage));
                }
            }

            // Left Button Container layout
            LinearLayout leftButtonContainer = new LinearLayout(cordova.getActivity());
            FrameLayout.LayoutParams leftButtonContainerParams = new FrameLayout.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            leftButtonContainerParams.gravity = Gravity.LEFT | Gravity.CENTER_VERTICAL;
            leftButtonContainer.setLayoutParams(leftButtonContainerParams);
            leftButtonContainer.setVerticalGravity(Gravity.CENTER_VERTICAL);

            // Right Button Container layout
            LinearLayout rightButtonContainer = new LinearLayout(cordova.getActivity());
            FrameLayout.LayoutParams rightButtonContainerParams = new FrameLayout.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            rightButtonContainerParams.gravity = Gravity.RIGHT | Gravity.CENTER_VERTICAL;
            rightButtonContainer.setLayoutParams(rightButtonContainerParams);
            rightButtonContainer.setVerticalGravity(Gravity.CENTER_VERTICAL);

            // Edit Text Box
            edittext = new EditText(cordova.getActivity());
            RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams(
                    LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
            textLayoutParams.addRule(RelativeLayout.RIGHT_OF, 1);
            textLayoutParams.addRule(RelativeLayout.LEFT_OF, 5);
            edittext.setLayoutParams(textLayoutParams);
            edittext.setSingleLine(true);
            edittext.setText(url);
            edittext.setInputType(InputType.TYPE_TEXT_VARIATION_URI);
            edittext.setImeOptions(EditorInfo.IME_ACTION_GO);
            edittext.setInputType(InputType.TYPE_NULL); // Will not except input... Makes the text NON-EDITABLE
            edittext.setOnKeyListener(new View.OnKeyListener() {
                public boolean onKey(View v, int keyCode, KeyEvent event) {
                    // If the event is a key-down event on the "enter" button
                    if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
                        navigate(edittext.getText().toString());
                        return true;
                    }
                    return false;
                }
            });

            // Back button
            final Button back = createButton(features.backButton, "back button", new View.OnClickListener() {
                public void onClick(View v) {
                    emitButtonEvent(features.backButton, inAppWebView.getUrl());

                    if (features.backButtonCanClose && !canGoBack()) {
                        closeDialog();
                    } else {
                        goBack();
                    }
                }
            });

            if (back != null) {
                back.setEnabled(features.backButtonCanClose);
            }

            // Forward button
            final Button forward = createButton(features.forwardButton, "forward button",
                    new View.OnClickListener() {
                        public void onClick(View v) {
                            emitButtonEvent(features.forwardButton, inAppWebView.getUrl());

                            goForward();
                        }
                    });

            if (forward != null) {
                forward.setEnabled(false);
            }

            // Close/Done button
            Button close = createButton(features.closeButton, "close button", new View.OnClickListener() {
                public void onClick(View v) {
                    emitButtonEvent(features.closeButton, inAppWebView.getUrl());
                    closeDialog();
                }
            });

            // Menu button
            Spinner menu = features.menu != null ? new MenuSpinner(cordova.getActivity()) : null;
            if (menu != null) {
                menu.setLayoutParams(
                        new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
                menu.setContentDescription("menu button");
                setButtonImages(menu, features.menu, DISABLED_ALPHA);

                // We are not allowed to use onClickListener for Spinner, so we will use
                // onTouchListener as a fallback.
                menu.setOnTouchListener(new View.OnTouchListener() {
                    @Override
                    public boolean onTouch(View v, MotionEvent event) {
                        if (event.getAction() == MotionEvent.ACTION_UP) {
                            emitButtonEvent(features.menu, inAppWebView.getUrl());
                        }
                        return false;
                    }
                });

                if (features.menu.items != null) {
                    HideSelectedAdapter<EventLabel> adapter = new HideSelectedAdapter<EventLabel>(
                            cordova.getActivity(), android.R.layout.simple_spinner_item, features.menu.items);
                    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                    menu.setAdapter(adapter);
                    menu.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                        @Override
                        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
                            if (inAppWebView != null && i < features.menu.items.length) {
                                emitButtonEvent(features.menu.items[i], inAppWebView.getUrl(), i);
                            }
                        }

                        @Override
                        public void onNothingSelected(AdapterView<?> adapterView) {
                        }
                    });
                }
            }

            // Title
            final TextView title = features.title != null ? new TextView(cordova.getActivity()) : null;
            final TextView subtitle = features.title != null ? new TextView(cordova.getActivity()) : null;
            if (title != null) {
                FrameLayout.LayoutParams titleParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
                        LayoutParams.FILL_PARENT);
                titleParams.gravity = Gravity.CENTER;
                title.setLayoutParams(titleParams);
                title.setSingleLine();
                title.setEllipsize(TextUtils.TruncateAt.END);
                title.setGravity(Gravity.CENTER | Gravity.TOP);
                title.setTextColor(
                        hexStringToColor(features.title.color != null ? features.title.color : "#000000ff"));
                title.setTypeface(title.getTypeface(), Typeface.BOLD);
                title.setTextSize(TypedValue.COMPLEX_UNIT_PT, 8);

                FrameLayout.LayoutParams subtitleParams = new FrameLayout.LayoutParams(
                        LayoutParams.MATCH_PARENT, LayoutParams.FILL_PARENT);
                titleParams.gravity = Gravity.CENTER;
                subtitle.setLayoutParams(subtitleParams);
                subtitle.setSingleLine();
                subtitle.setEllipsize(TextUtils.TruncateAt.END);
                subtitle.setGravity(Gravity.CENTER | Gravity.BOTTOM);
                subtitle.setTextColor(hexStringToColor(
                        features.title.subColor != null ? features.title.subColor : "#000000ff"));
                subtitle.setTextSize(TypedValue.COMPLEX_UNIT_PT, 6);
                subtitle.setVisibility(View.GONE);

                if (features.title.staticText != null) {
                    title.setGravity(Gravity.CENTER);
                    title.setText(features.title.staticText);
                } else {
                    subtitle.setVisibility(View.VISIBLE);
                }
            }

            // WebView
            inAppWebView = new WebView(cordova.getActivity());
            final ViewGroup.LayoutParams inAppWebViewParams = features.fullscreen
                    ? new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
                    : new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0);
            if (!features.fullscreen) {
                ((LinearLayout.LayoutParams) inAppWebViewParams).weight = 1;
            }
            inAppWebView.setLayoutParams(inAppWebViewParams);
            inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
            WebViewClient client = new ThemeableBrowserClient(thatWebView, new PageLoadListener() {

                @Override
                public void onPageStarted(String url) {
                    if (inAppWebView != null && title != null && features.title != null
                            && features.title.staticText == null && features.title.showPageTitle
                            && features.title.loadingText != null) {
                        title.setText(features.title.loadingText);
                        subtitle.setText(url);
                    }
                }

                @Override
                public void onPageFinished(String url, boolean canGoBack, boolean canGoForward) {
                    if (inAppWebView != null && title != null && features.title != null
                            && features.title.staticText == null && features.title.showPageTitle) {
                        title.setText(inAppWebView.getTitle());
                        subtitle.setText(inAppWebView.getUrl());
                    }

                    if (back != null) {
                        back.setEnabled(canGoBack || features.backButtonCanClose);
                    }

                    if (forward != null) {
                        forward.setEnabled(canGoForward);
                    }
                }
            });
            inAppWebView.setWebViewClient(client);
            WebSettings settings = inAppWebView.getSettings();
            settings.setJavaScriptEnabled(true);
            settings.setJavaScriptCanOpenWindowsAutomatically(true);
            settings.setBuiltInZoomControls(features.zoom);
            settings.setDisplayZoomControls(false);
            settings.setPluginState(android.webkit.WebSettings.PluginState.ON);

            //Toggle whether this is enabled or not!
            Bundle appSettings = cordova.getActivity().getIntent().getExtras();
            boolean enableDatabase = appSettings == null
                    || appSettings.getBoolean("ThemeableBrowserStorageEnabled", true);
            if (enableDatabase) {
                String databasePath = cordova.getActivity().getApplicationContext()
                        .getDir("themeableBrowserDB", Context.MODE_PRIVATE).getPath();
                settings.setDatabasePath(databasePath);
                settings.setDatabaseEnabled(true);
            }
            settings.setDomStorageEnabled(true);

            if (features.clearcache) {
                CookieManager.getInstance().removeAllCookie();
            } else if (features.clearsessioncache) {
                CookieManager.getInstance().removeSessionCookie();
            }

            inAppWebView.loadUrl(url);
            inAppWebView.getSettings().setLoadWithOverviewMode(true);
            inAppWebView.getSettings().setUseWideViewPort(true);
            inAppWebView.requestFocus();
            inAppWebView.requestFocusFromTouch();

            // Add buttons to either leftButtonsContainer or
            // rightButtonsContainer according to user's alignment
            // configuration.
            int leftContainerWidth = 0;
            int rightContainerWidth = 0;

            if (features.customButtons != null) {
                for (int i = 0; i < features.customButtons.length; i++) {
                    final BrowserButton buttonProps = features.customButtons[i];
                    final int index = i;
                    Button button = createButton(buttonProps, String.format("custom button at %d", i),
                            new View.OnClickListener() {
                                @Override
                                public void onClick(View view) {
                                    if (inAppWebView != null) {
                                        emitButtonEvent(buttonProps, inAppWebView.getUrl(), index);
                                    }
                                }
                            });

                    if (ALIGN_RIGHT.equals(buttonProps.align)) {
                        rightButtonContainer.addView(button);
                        rightContainerWidth += button.getLayoutParams().width;
                    } else {
                        leftButtonContainer.addView(button, 0);
                        leftContainerWidth += button.getLayoutParams().width;
                    }
                }
            }

            // Back and forward buttons must be added with special ordering logic such
            // that back button is always on the left of forward button if both buttons
            // are on the same side.
            if (forward != null && features.forwardButton != null
                    && !ALIGN_RIGHT.equals(features.forwardButton.align)) {
                leftButtonContainer.addView(forward, 0);
                leftContainerWidth += forward.getLayoutParams().width;
            }

            if (back != null && features.backButton != null && ALIGN_RIGHT.equals(features.backButton.align)) {
                rightButtonContainer.addView(back);
                rightContainerWidth += back.getLayoutParams().width;
            }

            if (back != null && features.backButton != null && !ALIGN_RIGHT.equals(features.backButton.align)) {
                leftButtonContainer.addView(back, 0);
                leftContainerWidth += back.getLayoutParams().width;
            }

            if (forward != null && features.forwardButton != null
                    && ALIGN_RIGHT.equals(features.forwardButton.align)) {
                rightButtonContainer.addView(forward);
                rightContainerWidth += forward.getLayoutParams().width;
            }

            if (menu != null) {
                if (features.menu != null && ALIGN_RIGHT.equals(features.menu.align)) {
                    rightButtonContainer.addView(menu);
                    rightContainerWidth += menu.getLayoutParams().width;
                } else {
                    leftButtonContainer.addView(menu, 0);
                    leftContainerWidth += menu.getLayoutParams().width;
                }
            }

            if (close != null) {
                if (features.closeButton != null && ALIGN_RIGHT.equals(features.closeButton.align)) {
                    rightButtonContainer.addView(close);
                    rightContainerWidth += close.getLayoutParams().width;
                } else {
                    leftButtonContainer.addView(close, 0);
                    leftContainerWidth += close.getLayoutParams().width;
                }
            }

            // Add the views to our toolbar
            toolbar.addView(leftButtonContainer);
            // Don't show address bar.
            // toolbar.addView(edittext);
            toolbar.addView(rightButtonContainer);

            if (title != null) {
                int titleMargin = Math.max(leftContainerWidth, rightContainerWidth);

                FrameLayout.LayoutParams titleParams = (FrameLayout.LayoutParams) title.getLayoutParams();
                titleParams.setMargins(titleMargin, 8, titleMargin, 0);
                toolbar.addView(title);
            }

            if (subtitle != null) {
                int subtitleMargin = Math.max(leftContainerWidth, rightContainerWidth);

                FrameLayout.LayoutParams subtitleParams = (FrameLayout.LayoutParams) subtitle.getLayoutParams();
                subtitleParams.setMargins(subtitleMargin, 0, subtitleMargin, 8);
                toolbar.addView(subtitle);
            }

            if (features.fullscreen) {
                // If full screen mode, we have to add inAppWebView before adding toolbar.
                main.addView(inAppWebView);
            }

            // Don't add the toolbar if its been disabled
            if (features.location) {
                // Add our toolbar to our main view/layout
                main.addView(toolbar);
            }

            if (!features.fullscreen) {
                // If not full screen, we add inAppWebView after adding toolbar.
                main.addView(inAppWebView);
            }

            WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
            lp.copyFrom(dialog.getWindow().getAttributes());
            lp.width = WindowManager.LayoutParams.MATCH_PARENT;
            lp.height = WindowManager.LayoutParams.MATCH_PARENT;

            dialog.setContentView(main);
            dialog.show();
            dialog.getWindow().setAttributes(lp);
            // the goal of openhidden is to load the url and not display it
            // Show() needs to be called to cause the URL to be loaded
            if (features.hidden) {
                dialog.hide();
            }
        }
    };
    this.cordova.getActivity().runOnUiThread(runnable);
    return "";
}

From source file:com.easemob.chatuidemo.activity.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;
    setPost();//from  w ww. j  a  v  a 2  s  .c  o m
    /*
     * if(savedInstanceState!=null){
     * contactListFragment=(ContactlistFragment)
     * manager.findFragmentByTag("contaclist");
     * chatHistoryFragment=(ChatAllHistoryFragment)
     * manager.findFragmentByTag("chathistory");
     * logisticsFragment=(LogisticsFragment)
     * manager.findFragmentByTag("logistics");
     * findFragment=(Fragment_boshu_find) manager.findFragmentByTag("find");
     * }
     */
    if (savedInstanceState != null && savedInstanceState.getBoolean(Constant.ACCOUNT_REMOVED, false)) {
        // ??home???appcrash
        // fragment??
        MyApplication.getInstance().logout(null);
        finish();
        startActivity(new Intent(this, LoginActivity.class));
        return;
    } else if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false)) {
        // T??home???appcrash
        // fragment??
        finish();
        startActivity(new Intent(this, LoginActivity.class));
        return;
    }
    setContentView(R.layout.activity_main);
    initView();

    // MobclickAgent.setDebugMode( true );
    // --?--
    MobclickAgent.updateOnlineConfig(this);

    if (getIntent().getBooleanExtra("conflict", false) && !isConflictDialogShow) {
        showConflictDialog();
    } else if (getIntent().getBooleanExtra(Constant.ACCOUNT_REMOVED, false) && !isAccountRemovedDialogShow) {
        showAccountRemovedDialog();
    }

    inviteMessgeDao = new InviteMessgeDao(this);
    userDao = new UserDao(this);
    // fragment???
    // chatHistoryFragment = new ChatHistoryFragment();
    // ?fragment

    chatHistoryFragment = new ChatAllHistoryFragment();
    contactListFragment = new ContactlistFragment();
    settingFragment = new SettingsFragment();
    personFragment = new Fragment_boshu_Person();
    logisticsFragment = new LogisticsFragment();
    findFragment = new Fragment_boshu_find();

    fragments = new Fragment[] { chatHistoryFragment, contactListFragment, personFragment, logisticsFragment,
            settingFragment };
    // fragment

    manager.beginTransaction().add(R.id.fragment_container, personFragment)
            .add(R.id.fragment_container, chatHistoryFragment).add(R.id.fragment_container, contactListFragment)
            .add(R.id.fragment_container, logisticsFragment).add(R.id.fragment_container, settingFragment)
            .hide(logisticsFragment).hide(settingFragment).hide(personFragment).hide(contactListFragment)
            .show(chatHistoryFragment).commit();

    init();
    //
    upteVersionDialog.getInstance().postVersion(this, this.getWindowManager(), this.getLayoutInflater(), false);
}

From source file:com.eutectoid.dosomething.picker.PickerFragment.java

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

    accessTokenTracker = new AccessTokenTracker() {
        @Override/*from   w ww.  ja va  2  s  .c o m*/
        protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken, AccessToken currentAccessToken) {
            clearResults();
        }
    };

    setSettingsFromBundle(savedInstanceState);

    loadingStrategy = createLoadingStrategy();
    loadingStrategy.attach(adapter);

    selectionStrategy = createSelectionStrategy();
    selectionStrategy.readSelectionFromBundle(savedInstanceState, SELECTION_BUNDLE_KEY);

    // Should we display a title bar? (We need to do this after we've retrieved our bundle settings.)
    if (showTitleBar) {
        inflateTitleBar((ViewGroup) getView());
    }

    if (activityCircle != null && savedInstanceState != null) {
        boolean shown = savedInstanceState.getBoolean(ACTIVITY_CIRCLE_SHOW_KEY, false);
        if (shown) {
            displayActivityCircle();
        } else {
            // Should be hidden already, but just to be sure.
            hideActivityCircle();
        }
    }
}

From source file:com.mibr.android.intelligentreminder.INeedToo.java

/** Called when the activity is first created. */
@Override//from w w w .  j a v a2s .c om
public void onCreate(Bundle savedInstanceState) {
    /* this was just a test      if(mLocationManager==null) {
             mLocationManager=(android.location.LocationManager) getSystemService(Context.LOCATION_SERVICE);
          }
    */
    //      TabHost host=this.getTabHost();
    //      host.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
    //         
    //         @Override
    //         public void onTabChanged(String tabId) {
    //            if(INeedToo.this._doingCreatingTabs==false) {
    //               if(tabId.equals("tab1")) {
    //                  INeedToo.this._forceNonCompany=true;
    //               }
    //            }
    //         }
    //      });
    super.onCreate(savedInstanceState);
    mLocationClient = new LocationClient(this, this, this);
    mLocationClient.connect();
    try {
        if (getIntent().getAction() != null && getIntent().getAction().equals("doPrimitiveDeletedNeed")) {
            transmitNetwork(getIntent().getStringExtra("phoneid"));
            return;
        }
    } catch (Exception eieio) {
        return;
    }
    try {
        /*
                    putExtra("needId",needId).
          putExtra("foreignNeedId",foreignNeedId).
          putExtra("phoneid",phoneid).
          putExtra("foreignLocationId",foreignLocationId)
                
         */
        if (getIntent().getAction() != null
                && getIntent().getAction().equals("transmitNetworkDeletedThisNeedByOnBehalfOf")) {
            long needId = getIntent().getLongExtra("needId", -11);
            long foreignNeedId = getIntent().getLongExtra("foreignNeedId", -11);
            String phoneId = getIntent().getStringExtra("phoneid");
            long foreignLocationId = getIntent().getLongExtra("foreignLocationId", -11);
            if (needId != -11 && foreignNeedId != -11 && foreignLocationId != -11 && isNothingNot(phoneId))
                transmitNetworkDeletedThisNeedByOnBehalfOf(needId, foreignNeedId, phoneId, foreignLocationId);
            return;
        }
    } catch (Exception ei3) {
        return;
    }

    /*bbhbb 2011-03-26*/ /*bbhbb2013_05_01 isn't this being done below?
                         *    Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler("")); */

    mHandler = new Handler();

    doBindService();
    mSingleton = this;
    ///////////mSingleton.log("onCreating_INeedToo", 1);

    if (getPackageName().toLowerCase().indexOf("trial") != -1 && !isSpecialPhone()) {
        if (!iveCheckedAuthorizationStatusForThisPhone) {
            doViewCount = true;
            iveCheckedAuthorizationStatusForThisPhone = true;
            final Timer jdTimer = new Timer("Registering");
            jdTimer.schedule(new TimerTask() {
                public void run() {
                    Thread thread = new Thread(new Runnable() {
                        public void run() {
                            Intent intent = new Intent(INeedToo.this, INeedWebService.class)
                                    .setAction("CheckStatus");
                            startService(intent);
                            jdTimer.cancel();
                        }
                    });
                    thread.setPriority(Thread.MIN_PRIORITY);
                    thread.run();
                }
            }, 3000, 1000 * 60 * 10);

        }
    } else {
        if (IS_ANDROID_VERSION) {
            if (!isSpecialPhone()
                    || INeedToo.mSingleton.getPhoneId().toLowerCase().equals("20013fc135cd6097xx")) {

                final Timer jdTimer = new Timer("Licensing");
                jdTimer.schedule(new TimerTask() {
                    public void run() {
                        Thread thread = new Thread(new Runnable() {
                            public void run() {
                                // Construct the LicenseCheckerCallback. The library calls this when done.        
                                mLicenseCheckerCallback = new MyLicenseCheckerCallback();
                                // Construct the LicenseChecker with a Policy.        
                                mChecker = new LicenseChecker(INeedToo.this,
                                        new ServerManagedPolicy(INeedToo.this,
                                                new AESObfuscator(SALT, getPackageName(),
                                                        //                           "com.mibr.android.intelligentreminder",
                                                        getDeviceId())),
                                        BASE64_PUBLIC_KEY // Your public licensing key.
                                );
                                mChecker.checkAccess(mLicenseCheckerCallback);
                            }
                        });
                        thread.setPriority(Thread.MIN_PRIORITY);
                        thread.run();
                    }
                }, 3000, 1000 * 60 * 10);
            }
        }
    }

    try {
        _logFilter = Integer
                .valueOf(getSharedPreferences(INeedToo.PREFERENCES_LOCATION, Preferences.MODE_PRIVATE)
                        .getString("LoggingLevel", "3"));
    } catch (Exception e) {
    }

    if (!INeedLocationService.USING_LOCATION_SERVICES) {

        int logFilter = 3;
        try {
            logFilter = Integer
                    .valueOf(getSharedPreferences(INeedToo.PREFERENCES_LOCATION, Preferences.MODE_PRIVATE)
                            .getString("LoggingLevel", "3"));
        } catch (Exception e) {
        }
        Intent jdIntent = new Intent(this, INeedTimerServices.class).putExtra("logFilter", logFilter);

        getApplicationContext().startService(jdIntent);
    }
    Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler(""));
    if (INeedToo.mSingleton.getPhoneId().toLowerCase().equals("22a100000d9f25c5")) {
        DELAYPOSTTTS = 100;
    }

    // I don't need this because IHaveNeeds.onresume does it      getApplicationContext().startService(new Intent(this, INeedLocationService.class));
    if (!_doneSplashy) {
        _doneSplashy = true;
        if (!getVersionFile()) {
            stampVersion();
            showDialog(DIALOG_SPLASH);
        } else {
            //showDialog(DIALOG_SPLASH);
        }
    }
    if (allItems != null) {
        whereImAtInAllItems++;
        if (whereImAtInAllItems < allItems.size()) {
            showDialog(DOING_SAMPLE_NEEDS_DIALOG);
        } else {
            allItems = null;
        }
    }

    setTitle(getHeading());
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        _initialTabIndex = bundle.getInt("initialtabindex", 0);
        _didContact = bundle.getBoolean("iscontact", false);
        if (_initialTabIndex == 1) {
            _doingLocationCompany = bundle.getString("doingcompany");
        } else {
            _doingLocationCompany = null;
        }
    } else {
        _doingLocationCompany = null;
    }
    final TabHost tabHost = getTabHost();
    tabHost.addTab(tabHost.newTabSpec("tab1").setIndicator("Need",

            getResources().getDrawable(R.drawable.status_bar2_blackwhite))
            .setContent(new Intent(this, IHaveNeeds.class).putExtra("iscontact", this._didContact)));

    tabHost.addTab(tabHost.newTabSpec("tab2")
            .setIndicator("Location",
                    (BitmapDrawable) getResources().getDrawable(android.R.drawable.ic_menu_mapmode))
            .setContent(
                    new Intent(this, IHaveLocations.class).putExtra("doingcompany", _doingLocationCompany)));
    Intent intent = new Intent(this, NeedMap.class).putExtra("doingcompany", _doingLocationCompany);
    tabHost.addTab(tabHost.newTabSpec("tab2a")
            .setIndicator("Map", (BitmapDrawable) getResources().getDrawable(R.drawable.ic_dialog_map))
            .setContent(intent));
    /*
    tabHost.addTab(tabHost.newTabSpec("tab3").setIndicator(
    "History",(BitmapDrawable) getResources().getDrawable(
          R.drawable.chart)).setContent(
                new Intent(this, IHaveHistory.class)));
    */
    tabHost.addTab(tabHost.newTabSpec("tab4")
            .setIndicator("System",
                    (BitmapDrawable) getResources().getDrawable(R.drawable.status_bar1_blackwhite))
            .setContent(new Intent(this, ListPlus.class)));
    /*      tabHost.addTab(tabHost.newTabSpec("tab1").setIndicator(
    "Need",
    scaleTo((BitmapDrawable) getResources().getDrawable(
          R.drawable.status_bar2_blackwhite), 36f)).setContent(
                new Intent(this, IHaveNeeds.class).putExtra("iscontact", this._didContact)));
            
    tabHost.addTab(tabHost.newTabSpec("tab2").setIndicator(
       "Location",
       scaleTo((BitmapDrawable) getResources().getDrawable(
             android.R.drawable.ic_menu_mapmode), 36f)).setContent(
                   new Intent(this, IHaveLocations.class).putExtra("doingcompany", _doingLocationCompany)));
    tabHost.addTab(tabHost.newTabSpec("tab3").setIndicator(
    "History",
    scaleTo((BitmapDrawable) getResources().getDrawable(
          R.drawable.chart), 36f)).setContent(
                new Intent(this, IHaveHistory.class)));
    tabHost.addTab(tabHost.newTabSpec("tab4").setIndicator(
    "System",
    scaleTo((BitmapDrawable) getResources().getDrawable(
          R.drawable.status_bar1_blackwhite), 31f)).setContent(
                new Intent(this, ListPlus.class)));
    */
    tabHost.setCurrentTab(_initialTabIndex);
    boolean networkingOutbound = getSharedPreferences(INeedToo.PREFERENCES_LOCATION, Preferences.MODE_PRIVATE)
            .getBoolean("Networking_Outbound_Enabled", false);
    if (INeedWebService.mSingleton == null) {

        if (networkingOutbound) {
            enableTransmitting();
        }
        if (getSharedPreferences(INeedToo.PREFERENCES_LOCATION, Preferences.MODE_PRIVATE)
                .getBoolean("Networking_Inbound_Enabled", false)) {
            enableReceiving();
        }
    }
}

From source file:github.popeen.dsub.fragments.SelectDirectoryFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
    Bundle args = getArguments();
    if (args != null) {
        id = args.getString(Constants.INTENT_EXTRA_NAME_ID);
        name = args.getString(Constants.INTENT_EXTRA_NAME_NAME);
        directory = (Entry) args.getSerializable(Constants.INTENT_EXTRA_NAME_DIRECTORY);
        playlistId = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID);
        playlistName = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME);
        playlistOwner = args.getBoolean(Constants.INTENT_EXTRA_NAME_PLAYLIST_OWNER, false);
        podcastId = args.getString(Constants.INTENT_EXTRA_NAME_PODCAST_ID);
        podcastName = args.getString(Constants.INTENT_EXTRA_NAME_PODCAST_NAME);
        podcastDescription = args.getString(Constants.INTENT_EXTRA_NAME_PODCAST_DESCRIPTION);
        Object shareObj = args.getSerializable(Constants.INTENT_EXTRA_NAME_SHARE);
        share = (shareObj != null) ? (Share) shareObj : null;
        albumListType = args.getString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE);
        albumListExtra = args.getString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_EXTRA);
        albumListSize = args.getInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 0);
        refreshListing = args.getBoolean(Constants.INTENT_EXTRA_REFRESH_LISTINGS);
        artist = args.getBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, false);
        lookupEntry = args.getString(Constants.INTENT_EXTRA_SEARCH_SONG);
        topTracks = args.getBoolean(Constants.INTENT_EXTRA_TOP_TRACKS);
        showAll = args.getBoolean(Constants.INTENT_EXTRA_SHOW_ALL);

        String childId = args.getString(Constants.INTENT_EXTRA_NAME_CHILD_ID);
        if (childId != null) {
            id = childId;/*from   w  ww  . j  a  va 2  s .com*/
            lookupParent = true;
        }
        if (entries == null) {
            entries = (List<Entry>) args.getSerializable(Constants.FRAGMENT_LIST);
            albums = (List<Entry>) args.getSerializable(Constants.FRAGMENT_LIST2);

            if (albums == null) {
                albums = new ArrayList<Entry>();
            }
        }
    }

    rootView = inflater.inflate(R.layout.abstract_recycler_fragment, container, false);

    refreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.refresh_layout);
    refreshLayout.setOnRefreshListener(this);

    if (Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_LARGE_ALBUM_ART, true)) {
        largeAlbums = true;
    }

    recyclerView = (RecyclerView) rootView.findViewById(R.id.fragment_recycler);
    recyclerView.setHasFixedSize(true);
    fastScroller = (FastScroller) rootView.findViewById(R.id.fragment_fast_scroller);
    setupScrollList(recyclerView);
    setupLayoutManager(recyclerView, largeAlbums);

    if (entries == null) {
        if (primaryFragment || secondaryFragment) {
            load(false);
        } else {
            invalidated = true;
        }
    } else {

        licenseValid = true;
        finishLoading();
    }

    if (name != null) {
        setTitle(name);
    }

    return rootView;
}

From source file:fi.iki.murgo.irssinotifier.IrssiNotifierActivity.java

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

    preferences = new Preferences(this);

    int versionCode = 0;
    try {/*  w ww .j  a  va2 s  . co  m*/
        versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    if (preferences.isThemeDisabled()) {
        setTheme(R.style.Theme_LameIrssiTheme);
    }

    MessageToServer.setVersion(versionCode);
    Preferences.setVersion(versionCode);

    // do initial settings
    if (preferences.getAccountName() == null || preferences.getGcmRegistrationId() == null
            || preferences.getGcmRegistrationIdVersion() != versionCode
            || (LicenseHelper.isPlusVersion(this) && preferences.getLicenseCount() == 0)) {
        Log.d(TAG, "Asking for initial settings");
        Intent i = new Intent(this, InitialSettingsActivity.class);
        startActivity(i);
        finish();
        return;
    }

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setIndeterminateProgressBarVisibility(false);

    Intent i = getIntent();
    if (i != null) {
        String intentChannelToView = i.getStringExtra("Channel");
        if (intentChannelToView != null && !preferences.isFeedViewDefault())
            channelToView = intentChannelToView;
    }

    boolean b = false;
    if (savedInstanceState != null) {
        b = savedInstanceState.getBoolean("rotated", false);
        channelToView = savedInstanceState.getString("channelToView");
    }

    IrcNotificationManager.getInstance().mainActivityOpened(this);
    startMainApp(b);
}

From source file:com.grass.caishi.cc.activity.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    if (savedInstanceState != null && savedInstanceState.getBoolean(Constant.ACCOUNT_REMOVED, false)) {
        // ??home???appcrash
        // fragment??
        MyApplication.getInstance().logout(null);
        finish();/*  w ww .  j  av  a 2  s. co m*/
        startActivity(new Intent(this, LoginActivity.class));
        return;
    } else if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false)) {
        // T??home???appcrash
        // fragment??
        finish();
        startActivity(new Intent(this, LoginActivity.class));
        return;
    }

    hideNavigationBar();

    setContentView(R.layout.activity_main);
    initView();
    try {
        add_code = Integer.valueOf(PreferenceUtils.getInstance(this).getSettingUserCityCode());
    } catch (Exception e) {
        //
    }
    if (getIntent().getBooleanExtra("conflict", false) && !isConflictDialogShow) {
        showConflictDialog();
    } else if (getIntent().getBooleanExtra(Constant.ACCOUNT_REMOVED, false) && !isAccountRemovedDialogShow) {
        showAccountRemovedDialog();
    }

    inviteMessgeDao = new InviteMessgeDao(this);
    userDao = new UserDao(this);

    selectCityFrament = new SelectCityFragment();
    selectMainFrament = new SelectMainFragment();
    // fragment???
    // chatHistoryFragment = new ChatHistoryFragment();
    // ?fragment
    chatMessageFragment = new ChatMessageFragment();
    friendsListFragment = new FriendsListFragment();
    settingFragment = new SettingsFragment();
    fragments = new Fragment[] { chatMessageFragment, selectCityFrament, selectMainFrament, friendsListFragment,
            settingFragment };

    getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, chatMessageFragment)
            .add(R.id.fragment_container, friendsListFragment).hide(friendsListFragment)
            .show(chatMessageFragment).commit();

    init();

    // refreshFriends();
    mainLoad();

    new Thread(new Runnable() {
        @Override
        public void run() {
            //
            deleteAllFiles(StorageUtils.getOwnCacheDirectory(MainActivity.this, Constant.CACHE_DIR_IMAGE));
        }
    }).start();
    if (!getIntent().getBooleanExtra("login", false)) {
        refreshFriends();
    }

    findViewById(R.id.btn_main_circle_community).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO 21
            startActivity(new Intent(MainActivity.this, TimeListActivity.class));
        }
    });
}