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) 

Source Link

Document

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

Usage

From source file:au.org.ala.fielddata.mobile.MobileFieldDataDashboard.java

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

    // Only show the splash screen on startup, and if the variant has been configured to do so.
    if (savedInstanceState == null && getResources().getBoolean(R.bool.show_splash_screen)) {

        showSplashScreen(getResources().getInteger(R.integer.splash_screen_duration));
    }/*from www. j a v  a2 s  . com*/
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    setContentView(R.layout.activity_mobile_data_dashboard);
    getSupportActionBar().setDisplayUseLogoEnabled(true);
    getSupportActionBar().setLogo(R.drawable.ic_launcher);

    preferences = new Preferences(this);
    PreferenceManager.setDefaultValues(getApplicationContext(), R.xml.preference1, true);
    PreferenceManager.setDefaultValues(getApplicationContext(), R.xml.network_preferences, true);

    status = (TextView) findViewById(R.id.status);

    getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    String[] titles = getResources().getStringArray(R.array.tab_titles);

    viewPager = (ViewPager) findViewById(R.id.tabContent);
    TabsAdapter tabsAdapter = new TabsAdapter(this, viewPager);
    viewPager.setAdapter(tabsAdapter);

    int selectedTabIndex = 0;
    if (savedInstanceState != null) {
        askedAboutGPS = savedInstanceState.getBoolean(GPS_QUESTION_BUNDLE_KEY);
        redirectedToLogin = savedInstanceState.getBoolean(REDIRECTED_TO_LOGIN_BUNDLE_KEY);
        selectedTabIndex = savedInstanceState.getInt(SELECTED_TAB_BUNDLE_KEY, 0);
    }
    selectedTabIndex = getIntent().getIntExtra(SELECTED_TAB_BUNDLE_KEY, selectedTabIndex);

    for (int i = 0; i < titles.length; i++) {
        String title = titles[i];
        ActionBar.Tab tab = getSupportActionBar().newTab();
        tab.setText(title);
        tab.setTabListener(tabsAdapter);
        getSupportActionBar().addTab(tab);
    }

    getSupportActionBar().setSelectedNavigationItem(selectedTabIndex);

}

From source file:com.android.contacts.detail.ContactDetailLayoutController.java

private void initialize(Bundle savedState) {
    boolean fragmentsAddedToFragmentManager = true;
    mDetailFragment = (ContactDetailFragment) mFragmentManager
            .findFragmentByTag(ContactDetailViewPagerAdapter.ABOUT_FRAGMENT_TAG);
    mUpdatesFragment = (ContactDetailUpdatesFragment) mFragmentManager
            .findFragmentByTag(ContactDetailViewPagerAdapter.UPDATES_FRAGMENT_TAG);

    // If the detail fragment was found in the {@link FragmentManager} then we don't need to add
    // it again. Otherwise, create the fragments dynamically and remember to add them to the
    // {@link FragmentManager}.
    if (mDetailFragment == null) {
        mDetailFragment = new ContactDetailFragment();
        mUpdatesFragment = new ContactDetailUpdatesFragment();
        fragmentsAddedToFragmentManager = false;
    }/*from   w  w w.  j a  va  2s . co m*/

    mDetailFragment.setListener(mContactDetailFragmentListener);
    NfcHandler.register(mActivity, mDetailFragment);

    // Read from savedState if possible
    int currentPageIndex = 0;
    if (savedState != null) {
        mContactUri = savedState.getParcelable(KEY_CONTACT_URI);
        mContactHasUpdates = savedState.getBoolean(KEY_CONTACT_HAS_UPDATES);
        currentPageIndex = savedState.getInt(KEY_CURRENT_PAGE_INDEX, 0);
    }

    switch (mLayoutMode) {
    case LayoutMode.VIEW_PAGER_AND_TAB_CAROUSEL: {
        // Inflate 2 view containers to pass in as children to the {@link ViewPager},
        // which will in turn be the parents to the mDetailFragment and mUpdatesFragment
        // since the fragments must have the same parent view IDs in both landscape and
        // portrait layouts.
        mDetailFragmentView = mLayoutInflater.inflate(R.layout.contact_detail_about_fragment_container,
                mViewPager, false);
        mUpdatesFragmentView = mLayoutInflater.inflate(R.layout.contact_detail_updates_fragment_container,
                mViewPager, false);

        mViewPagerAdapter = new ContactDetailViewPagerAdapter();
        mViewPagerAdapter.setAboutFragmentView(mDetailFragmentView);
        mViewPagerAdapter.setUpdatesFragmentView(mUpdatesFragmentView);

        mViewPager.addView(mDetailFragmentView);
        mViewPager.addView(mUpdatesFragmentView);
        mViewPager.setAdapter(mViewPagerAdapter);
        mViewPager.setOnPageChangeListener(mOnPageChangeListener);

        if (!fragmentsAddedToFragmentManager) {
            FragmentTransaction transaction = mFragmentManager.beginTransaction();
            transaction.add(R.id.about_fragment_container, mDetailFragment,
                    ContactDetailViewPagerAdapter.ABOUT_FRAGMENT_TAG);
            transaction.add(R.id.updates_fragment_container, mUpdatesFragment,
                    ContactDetailViewPagerAdapter.UPDATES_FRAGMENT_TAG);
            transaction.commitAllowingStateLoss();
            mFragmentManager.executePendingTransactions();
        }

        mTabCarousel.setListener(mTabCarouselListener);
        mTabCarousel.restoreCurrentTab(currentPageIndex);
        mDetailFragment.setVerticalScrollListener(new VerticalScrollListener(TAB_INDEX_DETAIL));
        mUpdatesFragment.setVerticalScrollListener(new VerticalScrollListener(TAB_INDEX_UPDATES));
        mViewPager.setCurrentItem(currentPageIndex);
        break;
    }
    case LayoutMode.TWO_COLUMN: {
        if (!fragmentsAddedToFragmentManager) {
            FragmentTransaction transaction = mFragmentManager.beginTransaction();
            transaction.add(R.id.about_fragment_container, mDetailFragment,
                    ContactDetailViewPagerAdapter.ABOUT_FRAGMENT_TAG);
            transaction.add(R.id.updates_fragment_container, mUpdatesFragment,
                    ContactDetailViewPagerAdapter.UPDATES_FRAGMENT_TAG);
            transaction.commitAllowingStateLoss();
            mFragmentManager.executePendingTransactions();
        }
        break;
    }
    case LayoutMode.FRAGMENT_CAROUSEL:
    case LayoutMode.TWO_COLUMN_FRAGMENT_CAROUSEL: {
        // Add the fragments to the fragment containers in the carousel using a
        // {@link FragmentTransaction} if they haven't already been added to the
        // {@link FragmentManager}.
        if (!fragmentsAddedToFragmentManager) {
            FragmentTransaction transaction = mFragmentManager.beginTransaction();
            transaction.add(R.id.about_fragment_container, mDetailFragment,
                    ContactDetailViewPagerAdapter.ABOUT_FRAGMENT_TAG);
            transaction.add(R.id.updates_fragment_container, mUpdatesFragment,
                    ContactDetailViewPagerAdapter.UPDATES_FRAGMENT_TAG);
            transaction.commitAllowingStateLoss();
            mFragmentManager.executePendingTransactions();
        }

        mFragmentCarousel.setFragmentViews((FrameLayoutWithOverlay) mDetailFragmentView,
                (FrameLayoutWithOverlay) mUpdatesFragmentView);
        mFragmentCarousel.setCurrentPage(currentPageIndex);

        break;
    }
    }

    // Setup the layout if we already have a saved state
    if (savedState != null) {
        if (mContactHasUpdates) {
            showContactWithUpdates(false);
        } else {
            showContactWithoutUpdates();
        }
    }
}

From source file:com.github.chenxiaolong.dualbootpatcher.patcher.PatchFileFragment.java

/**
 * {@inheritDoc}//from ww  w.  j  a v  a 2s. c o  m
 */
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    if (savedInstanceState != null) {
        mSelectedPatcherId = savedInstanceState.getString(EXTRA_SELECTED_PATCHER_ID);
        mSelectedInputUri = savedInstanceState.getParcelable(EXTRA_SELECTED_INPUT_URI);
        mSelectedOutputUri = savedInstanceState.getParcelable(EXTRA_SELECTED_OUTPUT_URI);
        mSelectedInputFileName = savedInstanceState.getString(EXTRA_SELECTED_INPUT_FILE_NAME);
        mSelectedInputFileSize = savedInstanceState.getLong(EXTRA_SELECTED_INPUT_FILE_SIZE);
        mSelectedTaskId = savedInstanceState.getInt(EXTRA_SELECTED_TASK_ID);
        mSelectedDevice = savedInstanceState.getParcelable(EXTRA_SELECTED_DEVICE);
        mSelectedRomId = savedInstanceState.getString(EXTRA_SELECTED_ROM_ID);
        mQueryingMetadata = savedInstanceState.getBoolean(EXTRA_QUERYING_METADATA);
    }

    // Initialize UI elements
    mRecycler = (RecyclerView) getActivity().findViewById(R.id.files_list);
    mFAB = (FloatingActionMenu) getActivity().findViewById(R.id.fab);
    mFABAddZip = (FloatingActionButton) getActivity().findViewById(R.id.fab_add_flashable_zip);
    mFABAddOdin = (FloatingActionButton) getActivity().findViewById(R.id.fab_add_odin_image);
    mProgressBar = (ProgressBar) getActivity().findViewById(R.id.loading);
    mAddZipMessage = (TextView) getActivity().findViewById(R.id.add_zip_message);

    mItemTouchCallback = new DragSwipeItemTouchCallback(this);
    ItemTouchHelper itemTouchHelper = new ItemTouchHelper(mItemTouchCallback);
    itemTouchHelper.attachToRecyclerView(mRecycler);

    // Disable change animation since we frequently update the progress, which makes the
    // animation very ugly
    ItemAnimator animator = mRecycler.getItemAnimator();
    if (animator instanceof SimpleItemAnimator) {
        ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
    }

    // Set up listener for the FAB
    mFABAddZip.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            startFileSelection(PatcherUtils.PATCHER_ID_MULTIBOOTPATCHER);
            mFAB.close(true);
        }
    });
    mFABAddOdin.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            startFileSelection(PatcherUtils.PATCHER_ID_ODINPATCHER);
            mFAB.close(true);
        }
    });

    // Set up adapter for the files list
    mAdapter = new PatchFileItemAdapter(getActivity(), mItems, this);
    mRecycler.setHasFixedSize(true);
    mRecycler.setAdapter(mAdapter);

    LinearLayoutManager llm = new LinearLayoutManager(getActivity());
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    mRecycler.setLayoutManager(llm);

    // Hide FAB initially
    mFAB.hideMenuButton(false);

    // Show loading progress bar
    updateLoadingStatus();

    // Initialize the patcher once the service is connected
    executeNeedsService(new Runnable() {
        @Override
        public void run() {
            mService.initializePatcher();
        }
    });

    // NOTE: No further loading should be done here. All initialization should be done in
    // onPatcherLoaded(), which is called once the patcher's data files have been extracted and
    // loaded.
}

From source file:can.yrt.onebusaway.ReportTripProblemFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    // Set the stop name.
    Bundle args = getArguments();/*from www .ja va2s.c  o  m*/
    final TextView tripName = (TextView) view.findViewById(R.id.trip_name);
    tripName.setText(MyTextUtils.toTitleCase(args.getString(TRIP_NAME)));

    // TODO: Switch this based on the trip mode
    final int tripArray = R.array.report_trip_problem_code_bus;

    //
    // The code spinner
    //
    mCodeView = (Spinner) view.findViewById(R.id.report_problem_code);
    ArrayAdapter<?> adapter = ArrayAdapter.createFromResource(getActivity(), tripArray,
            android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mCodeView.setAdapter(adapter);

    // Comment
    mUserComment = (TextView) view.findViewById(R.id.report_problem_comment);

    // On vehicle
    mUserOnVehicle = (CheckBox) view.findViewById(R.id.report_problem_onvehicle);
    final View label = view.findViewById(R.id.report_problem_uservehicle_label);
    mUserVehicle = (TextView) view.findViewById(R.id.report_problem_uservehicle);
    // Disabled by default
    label.setEnabled(false);
    mUserVehicle.setEnabled(false);

    mUserOnVehicle.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            boolean checked = mUserOnVehicle.isChecked();
            label.setEnabled(checked);
            mUserVehicle.setEnabled(checked);
        }
    });

    if (savedInstanceState != null) {
        int position = savedInstanceState.getInt(CODE);
        mCodeView.setSelection(position);

        CharSequence comment = savedInstanceState.getCharSequence(USER_COMMENT);
        mUserComment.setText(comment);

        boolean onVehicle = savedInstanceState.getBoolean(USER_ON_VEHICLE);
        mUserOnVehicle.setChecked(onVehicle);

        CharSequence num = savedInstanceState.getCharSequence(USER_VEHICLE_NUM);
        mUserVehicle.setText(num);
        mUserVehicle.setEnabled(onVehicle);
    }
}

From source file:ca.uwaterloo.magic.goodhikes.MapsActivity.java

/**
 * onCreate() is called only once for Activity, whereas onStart() - each time
 * appActivity is hidden from screen (user uses other apps), and then App is activated again.
 * <p/>/*from  ww  w  .ja v  a2  s  .c  o  m*/
 * Using startService() overrides the default service lifetime that is managed by
 * bindService(Intent, ServiceConnection, int): it requires the service to remain running
 * until stopService(Intent) is called, regardless of whether any clients are connected to it.
 */

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    database = RoutesDatabaseManager.getInstance(this);
    userManager = new UserManager(getApplicationContext());
    milestonePointMarkers = new ArrayList<Marker>();
    markerImageMap = new HashMap<String, Bitmap>();

    //Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);

    //Create and attach listeners to buttons
    mSettingsButton = (ImageButton) findViewById(R.id.settings_button);
    mShareButton = (ImageButton) findViewById(R.id.share_button);
    mStatisticsButton = (ImageButton) findViewById(R.id.statistics_button);
    mHistoryButton = (ImageButton) findViewById(R.id.history_button);
    mGPSTrackingButton = (ImageButton) findViewById(R.id.gps_tracking_control_button);
    mMilestoneButton = (ImageButton) findViewById(R.id.milestone_button);
    attachUICallbacks();

    if (savedInstanceState != null) {
        long routeId = savedInstanceState.getLong(RouteEntry._ID);
        selectedRoute = database.getRoute(routeId);
        followingExistingRoute = savedInstanceState.getBoolean("followingExistingRoute");
    }
}

From source file:com.hichinaschool.flashcards.anki.CardEditor.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // Log.i(AnkiDroidApp.TAG, "CardEditor: onCreate");
    Themes.applyTheme(this);
    super.onCreate(savedInstanceState);

    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

    Intent intent = getIntent();/*from  ww  w.  j  a va  2  s.com*/
    if (savedInstanceState != null) {
        mCaller = savedInstanceState.getInt("caller");
        mAddNote = savedInstanceState.getBoolean("addFact");
    } else {
        mCaller = intent.getIntExtra(EXTRA_CALLER, CALLER_NOCALLER);
        if (mCaller == CALLER_NOCALLER) {
            String action = intent.getAction();
            if (action != null && (ACTION_CREATE_FLASHCARD.equals(action)
                    || ACTION_CREATE_FLASHCARD_SEND.equals(action))) {
                mCaller = CALLER_INDICLASH;
            }
        }
    }
    // Log.i(AnkiDroidApp.TAG, "CardEditor: caller: " + mCaller);

    SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(getBaseContext());

    if (mCaller == CALLER_INDICLASH && preferences.getBoolean("intentAdditionInstantAdd", false)) {
        // save information without showing card editor
        fetchIntentInformation(intent);
        MetaDB.saveIntentInformation(CardEditor.this, Utils.joinFields(mSourceText));
        Themes.showThemedToast(CardEditor.this, getResources().getString(R.string.app_name) + ": "
                + getResources().getString(R.string.CardEditorLaterMessage), false);
        finish();
        return;
    }

    mCol = AnkiDroidApp.getCol();
    if (mCol == null) {
        reloadCollection(savedInstanceState);
        return;
    }

    registerExternalStorageListener();

    View mainView = getLayoutInflater().inflate(R.layout.card_editor, null);
    setContentView(mainView);
    Themes.setWallpaper(mainView);
    Themes.setContentStyle(mainView, Themes.CALLER_CARD_EDITOR);

    mFieldsLayoutContainer = (LinearLayout) findViewById(R.id.CardEditorEditFieldsLayout);

    mSave = (Button) findViewById(R.id.CardEditorSaveButton);
    mCancel = (Button) findViewById(R.id.CardEditorCancelButton);
    mLater = (Button) findViewById(R.id.CardEditorLaterButton);
    mDeckButton = (TextView) findViewById(R.id.CardEditorDeckText);
    mModelButton = (TextView) findViewById(R.id.CardEditorModelText);
    mTagsButton = (TextView) findViewById(R.id.CardEditorTagText);
    mSwapButton = (Button) findViewById(R.id.CardEditorSwapButton);
    mSwapButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            swapText(false);
        }
    });

    mAedictIntent = false;

    switch (mCaller) {
    case CALLER_NOCALLER:
        // Log.i(AnkiDroidApp.TAG, "CardEditor: no caller could be identified, closing");
        finish();
        return;

    case CALLER_REVIEWER:
        mCurrentEditedCard = Reviewer.getEditorCard();
        if (mCurrentEditedCard == null) {
            finish();
            return;
        }
        mEditorNote = mCurrentEditedCard.note();
        mAddNote = false;
        break;

    case CALLER_STUDYOPTIONS:
    case CALLER_DECKPICKER:
        mAddNote = true;
        break;

    case CALLER_BIGWIDGET_EDIT:
        // Card widgetCard = AnkiDroidWidgetBig.getCard();
        // if (widgetCard == null) {
        // finish();
        // return;
        // }
        // mEditorNote = widgetCard.getFact();
        // mAddNote = false;
        break;

    case CALLER_BIGWIDGET_ADD:
        mAddNote = true;
        break;

    case CALLER_CARDBROWSER_EDIT:
        mCurrentEditedCard = CardBrowser.sCardBrowserCard;
        if (mCurrentEditedCard == null) {
            finish();
            return;
        }
        mEditorNote = mCurrentEditedCard.note();
        mAddNote = false;
        break;

    case CALLER_CARDBROWSER_ADD:
        mAddNote = true;
        break;

    case CALLER_CARDEDITOR:
        mAddNote = true;
        break;

    case CALLER_CARDEDITOR_INTENT_ADD:
        mAddNote = true;
        break;

    case CALLER_INDICLASH:
        fetchIntentInformation(intent);
        if (mSourceText == null) {
            finish();
            return;
        }
        if (mSourceText[0].equals("Aedict Notepad") && addFromAedict(mSourceText[1])) {
            finish();
            return;
        }
        mAddNote = true;
        break;
    }

    setNote(mEditorNote);

    if (mAddNote) {
        setTitle(R.string.cardeditor_title_add_note);
        // set information transferred by intent
        String contents = null;
        if (mSourceText != null) {
            if (mAedictIntent && (mEditFields.size() == 3) && mSourceText[1].contains("[")) {
                contents = mSourceText[1].replaceFirst("\\[", "\u001f");
                contents = contents.substring(0, contents.length() - 1);
            } else {
                mEditFields.get(0).setText(mSourceText[0]);
                mEditFields.get(1).setText(mSourceText[1]);
            }
        } else {
            contents = intent.getStringExtra(EXTRA_CONTENTS);
        }
        if (contents != null) {
            setEditFieldTexts(contents);
        }

        LinearLayout modelButton = ((LinearLayout) findViewById(R.id.CardEditorModelButton));
        modelButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                showDialog(DIALOG_MODEL_SELECT);
            }
        });
        modelButton.setVisibility(View.VISIBLE);
        mSave.setText(getResources().getString(R.string.add));
        mCancel.setText(getResources().getString(R.string.close));

        mLater.setVisibility(View.VISIBLE);
        mLater.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String content = getFieldsText();
                if (content.length() > mEditFields.size() - 1) {
                    MetaDB.saveIntentInformation(CardEditor.this, content);
                    populateEditFields();
                    mSourceText = null;
                    Themes.showThemedToast(CardEditor.this,
                            getResources().getString(R.string.CardEditorLaterMessage), false);
                }
                if (mCaller == CALLER_INDICLASH || mCaller == CALLER_CARDEDITOR_INTENT_ADD) {
                    closeCardEditor();
                }
            }
        });
    } else {
        setTitle(R.string.cardeditor_title_edit_card);
        mSwapButton.setVisibility(View.GONE);
        mSwapButton = (Button) findViewById(R.id.CardEditorLaterButton);
        mSwapButton.setVisibility(View.VISIBLE);
        mSwapButton.setText(getResources().getString(R.string.fact_adder_swap));
        mSwapButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                swapText(false);
            }
        });
    }

    ((LinearLayout) findViewById(R.id.CardEditorDeckButton)).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            showDialog(DIALOG_DECK_SELECT);
        }
    });

    mPrefFixArabic = preferences.getBoolean("fixArabicText", false);
    // if Arabic reshaping is enabled, disable the Save button to avoid
    // saving the reshaped string to the deck
    if (mPrefFixArabic && !mAddNote) {
        mSave.setEnabled(false);
    }

    ((LinearLayout) findViewById(R.id.CardEditorTagButton)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showDialog(DIALOG_TAGS_SELECT);
        }
    });

    mSave.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (duplicateCheck(true)) {
                return;
            }
            boolean modified = false;
            for (FieldEditText f : mEditFields) {
                modified = modified | f.updateField();
            }
            if (mAddNote) {
                DeckTask.launchDeckTask(DeckTask.TASK_TYPE_ADD_FACT, mSaveFactHandler,
                        new DeckTask.TaskData(mEditorNote));
            } else {
                // added tag?
                for (String t : mCurrentTags) {
                    modified = modified || !mEditorNote.hasTag(t);
                }
                // removed tag?
                modified = modified || mEditorNote.getTags().size() > mCurrentTags.size();
                // changed did?
                boolean changedDid = mCurrentEditedCard.getDid() != mCurrentDid;
                modified = modified || changedDid;
                if (modified) {
                    mEditorNote.setTags(mCurrentTags);
                    // set did for card
                    if (changedDid) {
                        mCurrentEditedCard.setDid(mCurrentDid);
                    }
                    mChanged = true;
                }
                closeCardEditor();
                // if (mCaller == CALLER_BIGWIDGET_EDIT) {
                // // DeckTask.launchDeckTask(DeckTask.TASK_TYPE_UPDATE_FACT,
                // // mSaveFactHandler, new
                // // DeckTask.TaskData(Reviewer.UPDATE_CARD_SHOW_QUESTION,
                // // mDeck, AnkiDroidWidgetBig.getCard()));
                // } else if (!mCardReset) {
                // // Only send result to save if something was actually
                // // changed
                // if (mModified) {
                // setResult(RESULT_OK);
                // } else {
                // setResult(RESULT_CANCELED);
                // }
                // closeCardEditor();
                // }

            }
        }
    });

    mCancel.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            closeCardEditor();
        }

    });
}

From source file:co.taqat.call.assistant.AssistantActivity.java

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

    if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }//from   www.j  a  va2 s  .c o  m

    setContentView(R.layout.assistant);
    initUI();

    if (getIntent().getBooleanExtra("LinkPhoneNumber", false)) {
        isLink = true;
        //if (getIntent().getBooleanExtra("FromPref",false)){
        //   fromPref = true;
        //displayCreateAccount();
    } else {
        firstFragment = getResources().getBoolean(R.bool.assistant_use_linphone_login_as_first_fragment)
                ? AssistantFragmentsEnum.LINPHONE_LOGIN
                : AssistantFragmentsEnum.WELCOME;
        if (findViewById(R.id.fragment_container) != null) {
            if (savedInstanceState == null) {
                display(firstFragment);
            } else {
                currentFragment = (AssistantFragmentsEnum) savedInstanceState
                        .getSerializable("CurrentFragment");
            }
        }
    }
    if (savedInstanceState != null && savedInstanceState.containsKey("echoCanceller")) {
        echoCancellerAlreadyDone = savedInstanceState.getBoolean("echoCanceller");
    } else {
        echoCancellerAlreadyDone = false;
    }
    mPrefs = LinphonePreferences.instance();
    status.enableSideMenu(false);

    accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(),
            LinphonePreferences.instance().getXmlrpcUrl());
    accountCreator.setDomain(getResources().getString(R.string.default_domain));
    accountCreator.setListener(this);

    countryListAdapter = new CountryListAdapter(getApplicationContext());
    mListener = new LinphoneCoreListenerBase() {

        @Override
        public void configuringStatus(LinphoneCore lc, final LinphoneCore.RemoteProvisioningState state,
                String message) {
            if (progress != null)
                progress.dismiss();
            if (state == LinphoneCore.RemoteProvisioningState.ConfiguringSuccessful) {
                goToLinphoneActivity();
            } else if (state == LinphoneCore.RemoteProvisioningState.ConfiguringFailed) {
                Toast.makeText(AssistantActivity.instance(), getString(R.string.remote_provisioning_failure),
                        Toast.LENGTH_LONG).show();
            }
        }

        @Override
        public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, RegistrationState state,
                String smessage) {
            if (remoteProvisioningInProgress) {
                if (progress != null)
                    progress.dismiss();
                if (state == RegistrationState.RegistrationOk) {
                    remoteProvisioningInProgress = false;
                    success();
                }
            } else if (accountCreated && !newAccount) {
                if (address != null && address.asString().equals(cfg.getAddress().asString())) {
                    if (state == RegistrationState.RegistrationOk) {
                        if (progress != null)
                            progress.dismiss();
                        if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
                            accountCreator.isAccountUsed();
                        }
                    } else if (state == RegistrationState.RegistrationFailed) {
                        if (progress != null)
                            progress.dismiss();
                        if (dialog == null || !dialog.isShowing()) {
                            dialog = createErrorDialog(cfg, smessage);
                            dialog.show();
                        }
                    } else if (!(state == RegistrationState.RegistrationProgress)) {
                        if (progress != null)
                            progress.dismiss();
                    }
                }
            }
        }
    };
    instance = this;
}

From source file:com.amaze.filemanager.fragments.Main.java

void retrieveFromSavedInstance(final Bundle savedInstanceState) {

    Bundle b = new Bundle();
    String cur = savedInstanceState.getString("CURRENT_PATH");
    if (cur != null) {
        b.putInt("index", savedInstanceState.getInt("index"));
        b.putInt("top", savedInstanceState.getInt("top"));
        scrolls.put(cur, b);//from   www .j  a v  a  2s .co  m

        openMode = savedInstanceState.getInt("openMode", 0);
        if (openMode == 1)
            smbPath = savedInstanceState.getString("SmbPath");
        LIST_ELEMENTS = savedInstanceState.getParcelableArrayList("list");
        folder_count = savedInstanceState.getInt("folder_count", 0);
        file_count = savedInstanceState.getInt("file_count", 0);
        results = savedInstanceState.getBoolean("results");
        adapter = (Recycleradapter) savedInstanceState.getParcelable("adapter");
        createViews(LIST_ELEMENTS, true, (CURRENT_PATH), openMode, true, !IS_LIST);
        if (savedInstanceState.getBoolean("selection")) {

            for (int i : savedInstanceState.getIntegerArrayList("position")) {
                adapter.toggleChecked(i);
            }
        }
    }
}

From source file:com.android.settings.applications.CanBeOnSdCardChecker.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // initialize the inflater
    mInflater = inflater;/* ww  w.  j  a v a2s  .  c  o m*/

    View rootView = mInflater.inflate(R.layout.manage_applications_content, container, false);
    mContentContainer = container;
    mRootView = rootView;

    mViewPager = (ViewPager) rootView.findViewById(R.id.pager);
    MyPagerAdapter adapter = new MyPagerAdapter();
    mViewPager.setAdapter(adapter);
    mViewPager.setOnPageChangeListener(adapter);
    PagerTabStrip tabs = (PagerTabStrip) rootView.findViewById(R.id.tabs);
    tabs.setTabIndicatorColorResource(R.color.tab_selector);

    // We have to do this now because PreferenceFrameLayout looks at it
    // only when the view is added.
    if (container instanceof PreferenceFrameLayout) {
        ((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
    }

    if (savedInstanceState != null && savedInstanceState.getBoolean(EXTRA_RESET_DIALOG)) {
        buildResetDialog();
    }

    if (savedInstanceState == null) {
        // First time init: make sure view pager is showing the correct tab.
        for (int i = 0; i < mTabs.size(); i++) {
            TabInfo tab = mTabs.get(i);
            if (tab.mListType == mDefaultListType) {
                mViewPager.setCurrentItem(i);
                break;
            }
        }
    }

    return rootView;
}

From source file:bucci.dev.freestyle.TimerActivity.java

private void manageRecreatingActivity(Bundle savedInstanceState) {
    if (isTimerResumedFromNotification()) {
        if (DEBUG)
            Log.d(TAG, "Timer resumed from notification");
        if (getIntent().getStringExtra(START_PAUSE_STATE_PARAM).equals(PLAY_BUTTON_START_STATE))
            setPlayButtonState(PLAY_BUTTON_START_STATE);
        else//  www.  ja v  a 2  s.com
            setPlayButtonState(PLAY_BUTTON_PAUSE_STATE);

        setTimer(getIntent().getLongExtra(TIME_LEFT_PARAM, 0));
        timeLeft = getIntent().getLongExtra(TIME_LEFT_PARAM, 0);
        getIntent().removeExtra(START_PAUSE_STATE_PARAM);
    } else {
        if (savedInstanceState == null || savedInstanceState.getLong(TIME_LEFT_PARAM) == 0) {
            if (DEBUG)
                Log.d(TAG, "Timer set to start time");
            setTimer(startTime);
        } else {
            if (DEBUG)
                Log.d(TAG, "Timer set to savedTime");
            long savedTimeLeft = savedInstanceState.getLong(TIME_LEFT_PARAM);
            if (savedTimeLeft > 0) {
                timeLeft = savedTimeLeft;
                setTimer(savedTimeLeft);
            }
        }

        if (savedInstanceState != null) {
            if (savedInstanceState.getString(START_PAUSE_STATE_PARAM) != null) {
                if (savedInstanceState.getString(START_PAUSE_STATE_PARAM).equals(PLAY_BUTTON_START_STATE))
                    setPlayButtonState(PLAY_BUTTON_START_STATE);
                else
                    setPlayButtonState(PLAY_BUTTON_PAUSE_STATE);
            }

            if (savedInstanceState.getBoolean(SHOW_EXTRA_ROUND_BUTTON_PARAM))
                showExtraRoundButton();
        }
    }
}