Java Code Examples for android.os.bundle#getBoolean()

The following examples show how to use android.os.bundle#getBoolean() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RobotInfoActivity.java    From imsdk-android with MIT License 6 votes vote down vote up
private void injectExtras_() {

        Bundle extras_ = getIntent().getExtras();
        if (extras_ != null) {
            if (extras_.containsKey(ROBOT_ID_EXTRA)) {
                jid = extras_.getString(ROBOT_ID_EXTRA);
                robotId = QtalkStringUtils.parseLocalpart(jid);
            }
            if (extras_.containsKey(MSG_TYPE_EXTRA)) {
                msgType = extras_.getString(MSG_TYPE_EXTRA);
            }
            if (extras_.containsKey(CONTENT_EXTRA)) {
                content = extras_.getString(CONTENT_EXTRA);
            }
            if (extras_.containsKey(IS_HIDEN_EXTRA)) {
                isHiden = extras_.getBoolean(IS_HIDEN_EXTRA);
            }
        }
    }
 
Example 2
Source File: PushSyncTaskFragment.java    From PADListener with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
	MyLog.entry();

	final ElementToPush element = ElementToPush.valueOf(resultData.getString(PushSyncService.RECEIVER_ELEMENT_NAME));
	final boolean isSuccess = resultData.getBoolean(PushSyncService.RECEIVER_SUCCESS_NAME);
	final String errorMessage = resultData.getString(PushSyncService.RECEIVER_MESSAGE_NAME);

	if (isSuccess) {
		pushModel.incrementElementsPushed(element);
	} else {
		pushModel.incrementElementsError(element, errorMessage);
	}
	notifyCallBacks();

	MyLog.exit();
}
 
Example 3
Source File: PhotoFragment.java    From PowerFileExplorer with GNU General Public License v3.0 6 votes vote down vote up
@Override
   public void onViewStateRestored(final Bundle bundle) {
	Log.d(TAG, "onViewStateRestored " + bundle +", size " + mListOfMedia.size());
	if (bundle != null && bundle instanceof Bundle) {
		SLIDESHOW = bundle.getBoolean("SLIDESHOW", false);
		hidden = bundle.getBoolean("hidden", false);
		final ArrayList<String> lm = bundle.getStringArrayList("mListOfMedia");
		if (lm != null && lm.size() > 0) {
			mListOfMedia.clear();// = new ArrayList<>();
			for (String st : lm) {
				mListOfMedia.add(new File(st));
			}
		}
		sizeMediaFiles = mListOfMedia.size();
		thumbnailSize = bundle.getInt("thumbnailSize", 54);
		pageSelected = bundle.getInt("pageSelected", pageSelected);

		super.onViewStateRestored(bundle);
	} else {
		super.onViewStateRestored(bundle);
	}
	hideThumbnails(hidden);
	
	runSlideshow.run();
}
 
Example 4
Source File: PullToRefreshBase.java    From SwipeMenuAndRefresh with Apache License 2.0 6 votes vote down vote up
@Override
protected final void onRestoreInstanceState(Parcelable state) {
	if (state instanceof Bundle) {
		Bundle bundle = (Bundle) state;

		setMode(Mode.mapIntToValue(bundle.getInt(STATE_MODE, 0)));
		mCurrentMode = Mode.mapIntToValue(bundle.getInt(STATE_CURRENT_MODE, 0));

		mScrollingWhileRefreshingEnabled = bundle.getBoolean(STATE_SCROLLING_REFRESHING_ENABLED, false);
		mShowViewWhileRefreshing = bundle.getBoolean(STATE_SHOW_REFRESHING_VIEW, true);

		// Let super Restore Itself
		super.onRestoreInstanceState(bundle.getParcelable(STATE_SUPER));

		State viewState = State.mapIntToValue(bundle.getInt(STATE_STATE, 0));
		if (viewState == State.REFRESHING || viewState == State.MANUAL_REFRESHING) {
			setState(viewState, true);
		}

		// Now let derivative classes restore their state
		onPtrRestoreInstanceState(bundle);
		return;
	}

	super.onRestoreInstanceState(state);
}
 
Example 5
Source File: DocumentsContract.java    From FireFiles with Apache License 2.0 6 votes vote down vote up
public static boolean isChildDocument(ContentProviderClient client, Uri parentDocumentUri,
                                      Uri childDocumentUri) throws RemoteException {

    final Bundle in = new Bundle();
    in.putParcelable(DocumentsContract.EXTRA_URI, parentDocumentUri);
    in.putParcelable(DocumentsContract.EXTRA_TARGET_URI, childDocumentUri);

    final Bundle out = client.call(METHOD_IS_CHILD_DOCUMENT, null, in);
    if (out == null) {
        throw new RemoteException("Failed to get a reponse from isChildDocument query.");
    }
    if (!out.containsKey(DocumentsContract.EXTRA_RESULT)) {
        throw new RemoteException("Response did not include result field..");
    }
    return out.getBoolean(DocumentsContract.EXTRA_RESULT);
}
 
Example 6
Source File: BottomDialog.java    From BottomDialog with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        mLayoutRes = savedInstanceState.getInt(KEY_LAYOUT_RES);
        mHeight = savedInstanceState.getInt(KEY_HEIGHT);
        mDimAmount = savedInstanceState.getFloat(KEY_DIM);
        mIsCancelOutside = savedInstanceState.getBoolean(KEY_CANCEL_OUTSIDE);
    }
}
 
Example 7
Source File: PackageInstallerSession.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void dispatchSessionFinished(int returnCode, String msg, Bundle extras) {
    final IPackageInstallObserver2 observer;
    final String packageName;
    synchronized (mLock) {
        mFinalStatus = returnCode;
        mFinalMessage = msg;

        observer = mRemoteObserver;
        packageName = mPackageName;
    }

    if (observer != null) {
        // Execute observer.onPackageInstalled on different tread as we don't want callers
        // inside the system server have to worry about catching the callbacks while they are
        // calling into the session
        final SomeArgs args = SomeArgs.obtain();
        args.arg1 = packageName;
        args.arg2 = msg;
        args.arg3 = extras;
        args.arg4 = observer;
        args.argi1 = returnCode;

        mHandler.obtainMessage(MSG_ON_PACKAGE_INSTALLED, args).sendToTarget();
    }

    final boolean success = (returnCode == PackageManager.INSTALL_SUCCEEDED);

    // Send broadcast to default launcher only if it's a new install
    final boolean isNewInstall = extras == null || !extras.getBoolean(Intent.EXTRA_REPLACING);
    if (success && isNewInstall) {
        mPm.sendSessionCommitBroadcast(generateInfo(), userId);
    }

    mCallback.onSessionFinished(this, success);
}
 
Example 8
Source File: ApplicationList.java    From LauncherTV with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	Intent intent = getIntent();
	Bundle args = intent.getExtras();

	if (args != null) {
		if (args.containsKey(APPLICATION_NUMBER))
			mApplication = args.getInt(APPLICATION_NUMBER);
		if (args.containsKey(VIEW_TYPE))
			mViewType = args.getInt(VIEW_TYPE);
	}

	setContentView(mViewType == VIEW_LIST ?
			R.layout.listview :
			R.layout.gridview);

	mListView = (AbsListView) findViewById(R.id.list);
	mApplicationLoader.execute();

	View v;
	if ((args != null) && (args.containsKey(SHOW_DELETE))) {
		if (!args.getBoolean(SHOW_DELETE)) {
			if ((v = findViewById(R.id.bottom_panel)) != null)
				v.setVisibility(View.GONE);
		}
	}
	if ((v = findViewById(R.id.delete)) != null)
		v.setOnClickListener(this);
	if ((v = findViewById(R.id.cancel)) != null)
		v.setOnClickListener(this);
}
 
Example 9
Source File: SearchViewExample.java    From SearchPreference with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
        savedInstanceSearchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY);
        savedInstanceSearchEnabled = savedInstanceState.getBoolean(KEY_SEARCH_ENABLED);
    }

    prefsFragment = new PrefsFragment();
    getSupportFragmentManager().beginTransaction()
            .replace(android.R.id.content, prefsFragment).commit();
}
 
Example 10
Source File: FilterOtherFragment.java    From simpletask-android with GNU General Public License v3.0 5 votes vote down vote up
public boolean getHideCompleted() {
    Bundle arguments = getArguments();
    if (cbHideCompleted == null) {
        return arguments.getBoolean(Query.INTENT_HIDE_COMPLETED_FILTER, false);
    } else {
        return !cbHideCompleted.isChecked();
    }
}
 
Example 11
Source File: DebugActivity.java    From WindowView with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_debug);

    tiltSensor = new TiltSensor(this, true);

    windowView1 = (DebugWindowView) findViewById(R.id.windowView1);
    windowView2 = (DebugWindowView) findViewById(R.id.windowView2);

    // use one TiltSensor to drive both WindowViews
    windowView1.attachTiltTracking(tiltSensor);
    windowView2.attachTiltTracking(tiltSensor);

    View.OnClickListener onClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            resetTiltSensorOrientationOrigin();
        }
    };
    windowView1.setOnClickListener(onClickListener);
    windowView2.setOnClickListener(onClickListener);

    if (null != savedInstanceState && savedInstanceState.containsKey(ORIENTATION)
            && savedInstanceState.containsKey(DEBUG_TILT)
            && savedInstanceState.containsKey(DEBUG_IMAGE)) {
        //noinspection ResourceType
        setRequestedOrientation(savedInstanceState.getInt(ORIENTATION));
        debugTilt = savedInstanceState.getBoolean(DEBUG_TILT);
        debugImage = savedInstanceState.getBoolean(DEBUG_IMAGE);

        windowView1.setDebugEnabled(debugTilt, debugImage);
        windowView2.setDebugEnabled(debugTilt, debugImage);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // default
        debugTilt = false;
        debugImage = false;
    }
}
 
Example 12
Source File: MainActivity.java    From BiliRoaming with GNU General Public License v3.0 5 votes vote down vote up
private static boolean isTaiChiModuleActive(Context context) {
    ContentResolver contentResolver = context.getContentResolver();
    Uri uri = Uri.parse("content://me.weishu.exposed.CP/");

    try {
        Bundle result = contentResolver.call(uri, "active", null, null);
        return result.getBoolean("active", false);
    } catch (Exception e) {
        return false;
    }
}
 
Example 13
Source File: AddEditTaskActivity.java    From AndroidProjects with MIT License 5 votes vote down vote up
@Override
protected void initializeData(Bundle savedInstanceState) {

    String taskId = getIntent().getStringExtra(AddEditTaskFragment.ARGUMENT_EDIT_TASK_ID);

    setToolbarTitle(taskId);

    if (addEditTaskFragment == null) {
        addEditTaskFragment = AddEditTaskFragment.newInstance();

        if (getIntent().hasExtra(AddEditTaskFragment.ARGUMENT_EDIT_TASK_ID)) {
            Bundle bundle = new Bundle();
            bundle.putString(AddEditTaskFragment.ARGUMENT_EDIT_TASK_ID, taskId);
            addEditTaskFragment.setArguments(bundle);
        }

        ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), addEditTaskFragment, R.id.contentFrame);
    }

    boolean shouldLoadDataFromRepo = true;

    // Prevent the presenter from loading data from the repository if this is a config change.
    if (savedInstanceState != null) {
        // Data might not have loaded when the config change happen, so we saved the state.
        shouldLoadDataFromRepo = savedInstanceState.getBoolean(SHOULD_LOAD_DATA_FROM_REPO_KEY);
    }

    // Create the presenter
    mAddEditTaskPresenter = new AddEditTaskPresenter(
            taskId,
            Injection.provideTasksRepository(getApplicationContext()),
            addEditTaskFragment,
            shouldLoadDataFromRepo);
}
 
Example 14
Source File: HomeTimelineFragment.java    From catnut with MIT License 5 votes vote down vote up
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
	String selection = mSelection;
	boolean search = args.getBoolean(SEARCH_TWEET);
	if (search) {
		if (!TextUtils.isEmpty(mCurFilter)) {
			selection = new StringBuilder(mSelection)
					.append(" and ").append(Status.columnText)
					.append(" like ").append(CatnutUtils.like(mCurFilter))
					.toString();
		} else {
			search = false;
		}
	}
	int limit = args.getInt(TAG, getFetchSize());
	return CatnutUtils.getCursorLoader(
			getActivity(),
			CatnutProvider.parse(Status.MULTIPLE),
			PROJECTION,
			selection,
			null,
			Status.TABLE + " as s",
			"inner join " + User.TABLE + " as u on s.uid=u._id",
			"s." + BaseColumns._ID + " desc",
			search ? null : String.valueOf(limit)
	);
}
 
Example 15
Source File: PartFileActivity.java    From aMuleRemote with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mApp = (AmuleRemoteApplication) getApplication();
    this.setContentView(R.layout.act_partfile);
    
    Intent i = getIntent();
    if (i != null) {
        Bundle b = i.getExtras();
        if (b != null) {
            mHash = b.getByteArray(BUNDLE_PARAM_HASH);
        }
    }
    
    mBar = getSupportActionBar();
    mBar.setDisplayHomeAsUpEnabled(true);
    mBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    
    
    mTabDetails = mBar.newTab();
    mTabDetails.setText(R.string.partfile_tab_details);
    mTabDetails.setTabListener(new TabListener<PartFileDetailsFragment>(this, "details", PartFileDetailsFragment.class, mHash));
    
    mBar.addTab(mTabDetails);
    
    mTabSourceNames = mBar.newTab();
    mTabSourceNames.setText(R.string.partfile_tab_sources);
    mTabSourceNames.setTabListener(new TabListener<PartFileSourceNamesFragment>(this, "names", PartFileSourceNamesFragment.class, mHash));
    mBar.addTab(mTabSourceNames);
    
    mTabComments = mBar.newTab();
    mTabComments.setText(R.string.partfile_tab_comments); 
    mTabComments.setTabListener(new TabListener<PartFileCommentsFragment>(this, "comments", PartFileCommentsFragment.class, mHash));
    mBar.addTab(mTabComments);

    
    if (savedInstanceState != null) {
        String selectedTab = savedInstanceState.getString(BUNDLE_SELECTED_TAB);
        if (selectedTab == null) {
            mBar.selectTab(mTabDetails);
        } else if (selectedTab.equals("names")) {
            mBar.selectTab(mTabSourceNames);
        } else if (selectedTab.equals("comments")) {
            if (mBar.getTabCount() == 3) {
                mBar.selectTab(mTabComments);
            }
        }
        mNeedsRefresh = savedInstanceState.getBoolean(BUNDLE_NEEDS_REFRESH, true);
    }


    ButterKnife.inject(this);
    mFab.setTag("PLAY");

    mFab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mFab.getTag().equals("PAUSE")) {
                if (DEBUG) Log.d(TAG, "PartFileActivity.mFab.onClick: Pausing parftile");
                doPartFileAction(ECPartFileAction.PAUSE);
            } else {
                if (DEBUG) Log.d(TAG, "PartFileActivity.mFab.onClick: Resuming parftile");
                doPartFileAction(ECPartFileAction.RESUME);
            }
        }
    });
    
    
    AdView adView = (AdView)this.findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("TEST_DEVICE_ID")
            .build();
    adView.loadAd(adRequest);


}
 
Example 16
Source File: AssistantActivity.java    From Linphone4Android with GNU General Public License v3.0 4 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
	}

	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;
}
 
Example 17
Source File: KVUtils.java    From letv with Apache License 2.0 4 votes vote down vote up
public static boolean get(Bundle bundle, String key, boolean defaultValue) {
    if (bundle == null || TextUtils.empty(key) || !bundle.containsKey(key)) {
        return defaultValue;
    }
    return bundle.getBoolean(key);
}
 
Example 18
Source File: FragmentUserManga.java    From Pixiv-Shaft with MIT License 4 votes vote down vote up
@Override
public void initBundle(Bundle bundle) {
    userID = bundle.getInt(Params.USER_ID);
    showToolbar = bundle.getBoolean(Params.FLAG);
}
 
Example 19
Source File: EventsPrefsActivity.java    From PhoneProfilesPlus with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    GlobalGUIRoutines.setTheme(this, false, true/*, false*/, false);
    //GlobalGUIRoutines.setLanguage(this);

    super.onCreate(savedInstanceState);

    //PPApplication.logE("EventsPrefsActivity.onCreate", "xxx");

    setContentView(R.layout.activity_preferences);
    setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.ppp_app_name)));

    toolbar = findViewById(R.id.activity_preferences_toolbar);
    setSupportActionBar(toolbar);

    if (getSupportActionBar() != null) {
        getSupportActionBar().setHomeButtonEnabled(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setElevation(0/*GlobalGUIRoutines.dpToPx(1)*/);
    }

    event_id = getIntent().getLongExtra(PPApplication.EXTRA_EVENT_ID, 0L);
    old_event_status = getIntent().getIntExtra(PPApplication.EXTRA_EVENT_STATUS, -1);
    newEventMode = getIntent().getIntExtra(EditorProfilesActivity.EXTRA_NEW_EVENT_MODE, EditorEventListFragment.EDIT_MODE_UNDEFINED);
    predefinedEventIndex = getIntent().getIntExtra(EditorProfilesActivity.EXTRA_PREDEFINED_EVENT_INDEX, 0);

    if (getIntent().getBooleanExtra(EditorProfilesActivity.EXTRA_FROM_RED_TEXT_PREFERENCES_NOTIFICATION, false)) {
        // check if profile exists in db
        DataWrapper dataWrapper = new DataWrapper(getApplicationContext(), false, 0, false);
        if (dataWrapper.getEventById(event_id) == null) {
            PPApplication.showToast(getApplicationContext(),
                    getString(R.string.event_preferences_event_not_found),
                    Toast.LENGTH_SHORT);
            super.finish();
            return;
        }
    }

    EventsPrefsFragment preferenceFragment = new EventsPrefsActivity.EventsPrefsRoot();

    if (savedInstanceState == null) {
        loadPreferences(newEventMode, predefinedEventIndex);

        getSupportFragmentManager()
                .beginTransaction()
                .replace(R.id.activity_preferences_settings, preferenceFragment)
                .commit();
    }
    else {
        event_id = savedInstanceState.getLong("event_id", 0);
        old_event_status = savedInstanceState.getInt("old_event_status", -1);
        newEventMode = savedInstanceState.getInt("newEventMode", EditorProfileListFragment.EDIT_MODE_UNDEFINED);
        predefinedEventIndex = savedInstanceState.getInt("predefinedEventIndex", 0);

        showSaveMenu = savedInstanceState.getBoolean("showSaveMenu", false);
    }
}
 
Example 20
Source File: AuthenticatorActivity.java    From Cirrus_depricated with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 
 * @param savedInstanceState        Saved activity state, as in {{@link #onCreate(Bundle)}
 */
private void initAuthorizationPreFragment(Bundle savedInstanceState) {
    
    /// step 0 - get UI elements in layout
    mOAuth2Check = (CheckBox) findViewById(R.id.oauth_onOff_check);
    mOAuthAuthEndpointText = (TextView)findViewById(R.id.oAuthEntryPoint_1);
    mOAuthTokenEndpointText = (TextView)findViewById(R.id.oAuthEntryPoint_2);
    mUsernameInput = (EditText) findViewById(R.id.account_username);
    mPasswordInput = (EditText) findViewById(R.id.account_password);
    mPasswordInput.setTypeface(mUsernameInput.getTypeface());
    mAuthStatusView = (TextView) findViewById(R.id.auth_status_text); 
    
    /// step 1 - load and process relevant inputs (resources, intent, savedInstanceState)
    String presetUserName = null;
    boolean isPasswordExposed = false;
    if (savedInstanceState == null) {
        if (mAccount != null) {
            presetUserName = mAccount.name.substring(0, mAccount.name.lastIndexOf('@'));
        }
        
    } else {
        isPasswordExposed = savedInstanceState.getBoolean(KEY_PASSWORD_EXPOSED, false);
        mAuthStatusText = savedInstanceState.getInt(KEY_AUTH_STATUS_TEXT);
        mAuthStatusIcon = savedInstanceState.getInt(KEY_AUTH_STATUS_ICON);
        mAuthToken = savedInstanceState.getString(KEY_AUTH_TOKEN);
    }
    
    /// step 2 - set properties of UI elements (text, visibility, enabled...)
    mOAuth2Check.setChecked(
            AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType())
                .equals(mAuthTokenType));
    if (presetUserName != null) {
        mUsernameInput.setText(presetUserName);
    }
    if (mAction != ACTION_CREATE) {
        mUsernameInput.setEnabled(false);
        mUsernameInput.setFocusable(false);
    }
    mPasswordInput.setText(""); // clean password to avoid social hacking
    if (isPasswordExposed) {
        showPassword();
    }
    updateAuthenticationPreFragmentVisibility();
    showAuthStatus();
    mOkButton.setEnabled(mServerIsValid);

    
    /// step 3 - bind listeners
    // bindings for password input field
    mPasswordInput.setOnFocusChangeListener(this);
    mPasswordInput.setImeOptions(EditorInfo.IME_ACTION_DONE);
    mPasswordInput.setOnEditorActionListener(this);
    mPasswordInput.setOnTouchListener(new RightDrawableOnTouchListener() {
        @Override
        public boolean onDrawableTouch(final MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_UP) {
                AuthenticatorActivity.this.onViewPasswordClick();
            }
            return true;
        }
    });
    
}