Пример #1
0
  @Override
  public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.edit_api);
    mEditRestBaseURL = (EditText) findViewById(R.id.rest_base_url);
    mEditAuthType = (RadioGroup) findViewById(R.id.auth_type);
    mButtonOAuth = (RadioButton) findViewById(R.id.oauth);
    mButtonxAuth = (RadioButton) findViewById(R.id.xauth);
    mButtonBasic = (RadioButton) findViewById(R.id.basic);
    mButtonTwipOMode = (RadioButton) findViewById(R.id.twip_o);
    mAdvancedAPIConfigLabel = (TextView) findViewById(R.id.advanced_api_config_label);
    mSaveButton = (Button) findViewById(R.id.save);
    Bundle bundle = savedInstanceState == null ? getIntent().getExtras() : savedInstanceState;
    if (bundle == null) {
      bundle = new Bundle();
    }
    mRestBaseURL = bundle.getString(Accounts.REST_BASE_URL);
    mSigningRESTBaseURL = bundle.getString(Accounts.SIGNING_REST_BASE_URL);
    mOAuthBaseURL = bundle.getString(Accounts.OAUTH_BASE_URL);
    mSigningOAuthBaseURL = bundle.getString(Accounts.SIGNING_OAUTH_BASE_URL);

    mAuthType = bundle.getInt(Accounts.AUTH_TYPE);
    mEditAuthType.setOnCheckedChangeListener(this);
    mAdvancedAPIConfigLabel.setOnClickListener(this);
    mSaveButton.setOnClickListener(this);
    mRestBaseURL = PrivateConstants.API_PROXY;
    mEditRestBaseURL.setText(mRestBaseURL != null ? mRestBaseURL : DEFAULT_REST_BASE_URL);

    mButtonOAuth.setChecked(mAuthType == Accounts.AUTH_TYPE_OAUTH);
    mButtonxAuth.setChecked(mAuthType == Accounts.AUTH_TYPE_XAUTH);
    mButtonBasic.setChecked(mAuthType == Accounts.AUTH_TYPE_BASIC);
    mButtonTwipOMode.setChecked(mAuthType == Accounts.AUTH_TYPE_TWIP_O_MODE);
  }
Пример #2
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
   final Fragment fragment = Fragment.instantiate(this, LicenseFragment.class.getName());
   ft.replace(android.R.id.content, fragment);
   ft.commit();
 }
Пример #3
0
 @Override
 public void onSaveInstanceState(final Bundle outState) {
   saveEditedText();
   outState.putString(Accounts.REST_BASE_URL, mRestBaseURL);
   outState.putString(Accounts.SIGNING_REST_BASE_URL, mSigningRESTBaseURL);
   outState.putString(Accounts.OAUTH_BASE_URL, mOAuthBaseURL);
   outState.putString(Accounts.SIGNING_OAUTH_BASE_URL, mSigningOAuthBaseURL);
   outState.putInt(Accounts.AUTH_TYPE, mAuthType);
   super.onSaveInstanceState(outState);
 }