<commit_before>/*
 * Copyright 2011 <NAME>
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

/**
 * 
 */
package uk.ac.cam.cl.passgori.app;

import uk.ac.cam.cl.passgori.PasswordStoreException;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.Toast;

/**
 * An activity for showing and editing Passgori configurations.
 * 
 * @author <NAME>
 * 
 */
public class PassgoriConfigurationEditorActivity extends AbstractLoadingActivity {

  public enum MODE {
    NEW_USER("newUser"), EXISTING_REMOTE("haveRemote"), CONFIGURE("configure");
    public final String string;

    private MODE(String str) {
      this.string = str;
    }
  }

  /**
   * The configurations object.
   */
  private PassgoriConfiguration mConfigs;

  private TextView mUsernameField;
  private TextView mServerField;
  private TextView mPortField;
  private TextView mPrefixField;
  private Button mCreateButton;

  private TextView mPasswordField;

  private CheckBox mUseRemoteStoreCheck;
  private MODE mode;

  @Override
  public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.configuration);

    String action = getIntent().getAction();
    if (MODE.EXISTING_REMOTE.equals(action)) {
      mode = MODE.EXISTING_REMOTE;
    } else if (MODE.NEW_USER.equals(action)) {
      mode = MODE.NEW_USER;
    } else if (MODE.CONFIGURE.equals(action)) {
      mode = MODE.CONFIGURE;
    } else {
      mode = MODE.CONFIGURE;
    }

    mUsernameField = (TextView) findViewById(R.id.passgoriUsername);
    mPasswordField = (TextView) findViewById(R.id.passgoriPassword);
    mUseRemoteStoreCheck = (CheckBox) findViewById(R.id.useRemoteCheckbox);
    mServerField = (TextView) findViewById(R.id.passgoriServer);
    mPortField = (TextView) findViewById(R.id.passgoriPort);
    mPrefixField = (TextView) findViewById(R.id.passgoriServerPrefix);
    mCreateButton = (Button) findViewById(R.id.createButton);<commit_msg>Do comparision on strings no enums...<commit_after>/*
 * Copyright 2011 <NAME>
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

/**
 * 
 */
package uk.ac.cam.cl.passgori.app;

import uk.ac.cam.cl.passgori.PasswordStoreException;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.Toast;

/**
 * An activity for showing and editing Passgori configurations.
 * 
 * @author <NAME>
 * 
 */
public class PassgoriConfigurationEditorActivity extends AbstractLoadingActivity {

  public enum MODE {
    NEW_USER("newUser"), EXISTING_REMOTE("haveRemote"), CONFIGURE("configure");
    public final String string;

    private MODE(String str) {
      this.string = str;
    }
  }

  /**
   * The configurations object.
   */
  private PassgoriConfiguration mConfigs;

  private TextView mUsernameField;
  private TextView mServerField;
  private TextView mPortField;
  private TextView mPrefixField;
  private Button mCreateButton;

  private TextView mPasswordField;

  private CheckBox mUseRemoteStoreCheck;
  private MODE mode;

  @Override
  public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.configuration);

    String action = getIntent().getAction();
    if (MODE.EXISTING_REMOTE.string.equals(action)) {
      mode = MODE.EXISTING_REMOTE;
    } else if (MODE.NEW_USER.string.equals(action)) {
      mode = MODE.NEW_USER;
    } else if (MODE.CONFIGURE.string.equals(action)) {
      mode = MODE.CONFIGURE;
    } else {
      mode = MODE.CONFIGURE;
    }

    mUsernameField = (TextView) findViewById(R.id.passgoriUsername);
    mPasswordField = (TextView) findViewById(R.id.passgoriPassword);
    mUseRemoteStoreCheck = (CheckBox) findViewById(R.id.useRemoteCheckbox);
    mServerField = (TextView) findViewById(R.id.passgoriServer);
    mPortField = (TextView) findViewById(R.id.passgoriPort);
    mPrefixField = (TextView) findViewById(R.id.passgoriServerPrefix);
    mCreateButton = (Button) findViewById(R.id.createButton);
{'fraction_non_alphanumeric': 0.09693974529557119, 'fraction_numerical': 0.003041246911233606, 'mean_word_length': 4.088974854932302, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7393813', 'n_tokens_mistral': 1567, 'n_tokens_neox': 1492, 'n_words': 422}