Ejemplo n.º 1
0
  private void dataupdate() {
    String[] dataset = new String[16];
    dataset[0] = pref.readConfig("service", "service名");
    dataset[1] = pref.readConfig("user_id", "user_id名");
    dataset[2] = pref.readConfig("mailadd", "mailadd");
    dataset[3] = pref.readConfig("chbn", true) ? "1" : "0";
    dataset[4] = pref.readConfig("chbb", true) ? "1" : "0";
    dataset[5] = pref.readConfig("chbs", true) ? "1" : "0";
    dataset[6] = pref.readConfig("chbk", true) ? "1" : "0";
    dataset[7] = String.valueOf(pref.readConfig("seekbar", 8));
    dataset[8] = pref.readConfig("pass", hashMapDB.get("pass").toString());
    dataset[9] = pref.readConfig("passhint", hashMapDB.get("passhint").toString());
    dataset[10] = hashMapDB.get("gene_id1").toString();
    dataset[11] = hashMapDB.get("gene_id2").toString();
    dataset[12] = hashMapDB.get("gene_id3").toString();
    dataset[13] = "0";
    dataset[14] = "1";
    dataset[15] = pref.readConfig("spinner", "0");
    for (String s : dataset) {
      Log.e("aaaaaaaaa", s + "");
      Log.e("bbbbbbbb", "" + pref.readConfig("id", "0"));
    }

    dbC.updateServiceInfo(Integer.parseInt(pref.readConfig("id", "999")), dataset);
  }
Ejemplo n.º 2
0
 // todo 初期値文字を変える
 private void dataupdate() {
   String[] dataset = new String[16];
   dataset[0] = pref.readConfig("service", "service名");
   dataset[1] = pref.readConfig("user_id", "user_id名");
   dataset[2] = pref.readConfig("mailadd", "mailadd");
   dataset[3] = pref.readConfig("chbn", true) ? "1" : "0";
   dataset[4] = pref.readConfig("chbb", true) ? "1" : "0";
   dataset[5] = pref.readConfig("chbs", true) ? "1" : "0";
   dataset[6] = pref.readConfig("chbk", true) ? "1" : "0";
   dataset[7] = String.valueOf(pref.readConfig("seekbar", 8));
   dataset[8] = pref.readConfig("fixed_pass", fixed_pass);
   dataset[9] = pref.readConfig("pass_hint", passHint);
   dataset[10] = String.valueOf(userInfoId1);
   dataset[11] = String.valueOf(userInfoId2);
   dataset[12] = String.valueOf(userInfoId3);
   dataset[13] = "0";
   dataset[14] = "1";
   dataset[15] = pref.readConfig("spinner", "0");
   for (String s : dataset) {
     Log.e("aaaaaaaaa", s + "");
     Log.e("bbbbbbbb", "" + pref.readConfig("id", "0"));
   }
   dbC.updateServiceInfo(Integer.parseInt(pref.readConfig("id", "999")), dataset);
 }
Ejemplo n.º 3
0
 private void datainsert() {
   String[] dataset = new String[16];
   dataset[0] = pref.readConfig("service", "service名");
   dataset[1] = pref.readConfig("user_id", "user_id名");
   dataset[2] = pref.readConfig("mailadd", "service名");
   dataset[3] = pref.readConfig("chbn", true) ? "1" : "0";
   dataset[4] = pref.readConfig("chbb", true) ? "1" : "0";
   dataset[5] = pref.readConfig("chbs", true) ? "1" : "0";
   dataset[6] = pref.readConfig("chbk", true) ? "1" : "0";
   dataset[7] = String.valueOf(pref.readConfig("seekbar", 8));
   dataset[8] = pref.readConfig("fixed_pass", fixed_pass);
   dataset[9] = pref.readConfig("pass_hint", passHint);
   dataset[10] = String.valueOf(userInfoId1);
   dataset[11] = String.valueOf(userInfoId2);
   dataset[12] = String.valueOf(userInfoId3);
   dataset[13] = "0";
   dataset[14] = "1";
   dataset[15] = pref.readConfig("spinner", "0");
   dbC.insertServiceInfo(dataset);
 }
Ejemplo n.º 4
0
  @Override
  public void onClick(View v) {
    if (!ClickTimerEvent.isClickEvent()) return;
    if (v == btnInsert) {
      // 「登録」ボタン ⇒インサート処理
      if (pref.readConfig("id", "0").equals("0")) {
        datainsert();
      } else {
        dataupdate();
      }

      Intent intent = new Intent(GenePass.this, PassList2.class);
      intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      startActivity(intent);
    } else if (v == btnRegene) {
      // 「ReGene」ボタン ⇒もう一度パスワード作る
      poolString.init();
      makePass();
    }
  }
Ejemplo n.º 5
0
  /**
   * debug **************************** private final String DB_NAME = "pg.db"; //データベース名 private
   * final int DB_VERSION = 1; //データベースのバージョン //テーブル名 private static final String[] DB_TABLE =
   * {"service_info", "user_info"}; private static DatabaseHelper dbHelper; //DBヘルパー
   *
   * <p>/******************************
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_re_regist_pass);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    dbC = new DatabaseC(PassList2.getDbHelper());

    /**
     * debug***************************** String[] dbColTable = { "(_id INTEGER PRIMARY KEY
     * AUTOINCREMENT," + " service TEXT UNIQUE NOT NULL," + " user_id TEXT NOT NULL," + "
     * mail_address TEXT NOT NULL," + " char_num INTEGER NOT NULL," + " char_uppercase INTEGER NOT
     * NULL," + " char_lowercase INTEGER NOT NULL," + " char_symbol INTEGER NOT NULL," + "
     * num_of_char INTEGER NOT NULL," + " generated_datetime TEXT NOT NULL," + " updated_datetime
     * TEXT NOT NULL," + " fixed_pass TEXT NOT NULL," + " pass_hint TEXT NOT NULL," + " gene_id1
     * INTEGER NOT NULL," + " gene_id2 INTEGER NOT NULL," + " gene_id3 INTEGER NOT NULL," + "
     * gene_id4 INTEGER NOT NULL," + " algorithm INTEGER NOT NULL," + " delete_flag INTEGER NOT
     * NULL)",
     *
     * <p>"(_id INTEGER PRIMARY KEY AUTOINCREMENT," + " info_name TEXT UNIQUE NOT NULL," + " value
     * TEXT NOT NULL," + " category INTEGER NOT NULL," + " delete_flag INTEGER NOT NULL," + "
     * useless_flag INTEGER NOT NULL)" }; dbHelper = new DatabaseHelper(this, DB_NAME, DB_VERSION,
     * DB_TABLE, dbColTable); /******************************* //データベース準備 dbC = new
     * DatabaseC(dbHelper); // Cursor cursor = dbC.readServiceInfoAll(); // cursorLog(cursor); //
     * cursor.close(); /**debug****************************
     */
    // cursorLog(dbC.readServiceInfoAll());
    // cursorLog(dbC.readUserInfoAll());
    //        String[] str2 = new String[]{"姓", "jouge", "2"};
    //        dbC.insertUserInfo(str2);
    //        str2 = new String[]{"名", "sayuu", "3"};
    //        dbC.insertUserInfo(str2);
    //
    //        dbC.insertMasterPass(1234);
    //
    //        str2 = new String[]{"生年月日", "19900801", "1"};
    //        dbC.insertUserInfo(str2);
    /** **************************** */
    pref = new PreferenceC(this);
    hashMapDB = new HashMap<>();

    /** DBからService名の読み込み */
    Cursor cursor = dbC.readServiceInfoAll();
    boolean cPlace = cursor.moveToFirst();

    mServiceName = new String[cursor.getCount()];
    int i = 0;

    while (cPlace) {
      mServiceName[i] = cursor.getString(1);
      cPlace = cursor.moveToNext();
      i++;
    }
    cursor.close();

    // 前のページから飛んできたSIDをセット

    //        Intent intent_rrp = getIntent();
    Bundle extrasID = getIntent().getExtras();
    if (extrasID != null) {
      exID = extrasID.getString("SID");
    } else {
      exID = "";
    }
    //        if(intent_rrp != null){
    //            exID = intent_rrp.getStringExtra("SID");
    //        }
    /////////////////////////////// 一時対比
    if (exID.length() > 0) {

      // readDB();
      //            dbC = new DatabaseC(PassList2.getDbHelper());
      pref.writeConfig("id", "1");
      /*
                  Cursor cursor = dbC.readServiceInfo(exID);
                  cursor.moveToFirst();
                  service = cursor.getString(1);
                  userid = cursor.getString(2);
                  mail = cursor.getString(3);
                  password = cursor.getString(11);
      */

    } else {
      pref.writeConfig("id", "0");
    }

    String readId = pref.readConfig("id", "0");

    if (!readId.equals("0")) {

      // DBデータをセットする
      setDB2hash();
      // 「新規」ではなく「編集」の時は次のページでパスを表示する為にコンフィグを渡す
      pref.writeConfig("PassKeep", true);

    } else {
      // データがなかったらここでプリファレンスの値を入れちゃう 以下ハッシュマップでとる プリファレンスはページ受け渡し
      hashMapDB.put("id", "0");
      hashMapDB.put("user_id", "");
      hashMapDB.put("service", "");
      hashMapDB.put("mailadd", "");
      hashMapDB.put("pass", "");
      hashMapDB.put("passhint", "");
      if (pref.readConfig("chbn", true)) {
        hashMapDB.put("char_num", "1");
      } else {
        hashMapDB.put("char_num", "0");
      }
      if (pref.readConfig("chbb", true)) {
        hashMapDB.put("char_uppercase", "1");
      } else {
        hashMapDB.put("char_uppercase", "0");
      }
      if (pref.readConfig("chbs", true)) {
        hashMapDB.put("char_lowercase", "1");
      } else {
        hashMapDB.put("char_lowercase", "0");
      }
      if (pref.readConfig("chbk", true)) {
        hashMapDB.put("char_symbol", "1");
      } else {
        hashMapDB.put("char_symbol", "0");
      }
      hashMapDB.put("num_of_char", String.valueOf(pref.readConfig("seekbar", 8)));
      hashMapDB.put("spinner", "0");
    }

    setDB2userInfo();

    rrptxvservice = (AutoCompleteTextView) findViewById(R.id.rrptxvservice);
    if (arrayService != null) {
      rrptxvservice.setAdapter(createAdapter(arrayService));
    } else {

    }
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append(getResources().getString(R.string.service));
    //        rrptxvservice.setHint(stringBuilder.toString());
    rrptxvservice.setThreshold(0);
    rrptxvservice.setText(hashMapDB.get("service").toString());

    rrptxvid = (AutoCompleteTextView) findViewById(R.id.rrptxvid);
    if (arrayid != null) {
      rrptxvid.setAdapter(createAdapter(arrayid));
    } else {

    }
    stringBuilder = new StringBuilder();
    stringBuilder.append(getResources().getString(R.string.id));
    //        rrptxvid.setHint(stringBuilder.toString());
    rrptxvid.setThreshold(0);
    rrptxvid.setText(hashMapDB.get("user_id").toString());

    rrptxvaddress = (AutoCompleteTextView) findViewById(R.id.rrptxvaddress);
    if (arrayadd != null) {
      rrptxvaddress.setAdapter(createAdapter(arrayadd));
    } else {

    }
    stringBuilder = new StringBuilder();
    stringBuilder.append(getResources().getString(R.string.address));
    // stringBuilder.append(getResources().getString(R.string.mei));
    //        rrptxvaddress.setHint(stringBuilder.toString());
    rrptxvaddress.setThreshold(0);
    rrptxvaddress.setText(hashMapDB.get("mailadd").toString());

    /**
     * *************************************** 今井追加 入力後ソフトキーボードを非表示にするや~つ
     * ***************************************
     */
    // EnterKey押下時にソフトキーボードを非表示にする。
    rrptxvaddress.setOnKeyListener(
        new View.OnKeyListener() {
          @Override
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            // EnterKeyが押されたか判定
            if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) {
              InputMethodManager imputMethodManager =
                  (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
              imputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), 0);
            }
            return false;
          }
        });
    /** 今井追加ここまで*************************************************** */

    /*rrplayout1 = (LinearLayout) findViewById(R.id.rrplayout1);
    //データがなかったらパスは表示させない
    if (hashMapDB.get("id").toString().equals("")) {
        //パスワードのとこのレイアウト
        rrplayout1.setVisibility(View.GONE);
    } else {
        //パスワードのテキストビュー
        rrptxvpass = (TextView) findViewById(R.id.rrptxvpass);
        rrptxvpass.setText(hashMapDB.get("pass").toString());
    }*/

    // パスワードのテキストビュー
    rrptxvpass = (TextView) findViewById(R.id.rrptxvpass);
    rrptxvpass.setText(hashMapDB.get("pass").toString());

    // チェックボックスに値をセット
    rrpchbnum = (CheckBox) findViewById(R.id.rrpchbnum);
    if (hashMapDB.get("char_num").toString().equals("0")) {
      rrpchbnum.setChecked(false);
    } else {
      rrpchbnum.setChecked(true);
    }
    rrpchbb = (CheckBox) findViewById(R.id.rrpchbb);
    if (hashMapDB.get("char_uppercase").toString().equals("0")) {
      rrpchbb.setChecked(false);
    } else {
      rrpchbb.setChecked(true);
    }
    rrpchbs = (CheckBox) findViewById(R.id.rrpchbs);
    if (hashMapDB.get("char_lowercase").toString().equals("0")) {
      rrpchbs.setChecked(false);
    } else {
      rrpchbs.setChecked(true);
    }
    rrpchbk = (CheckBox) findViewById(R.id.rrpchbk);
    if (hashMapDB.get("char_symbol").toString().equals("0")) {
      rrpchbk.setChecked(false);
    } else {
      rrpchbk.setChecked(true);
    }

    rrpskb = (SeekBar) findViewById(R.id.rrpskb);
    rrpskb.setMax(12);
    rrpskb.setProgress(Integer.parseInt(hashMapDB.get("num_of_char").toString()) - 4);
    rrpskb.setOnSeekBarChangeListener(this);

    // 文字数を表示させる
    rrptxvpasslength = (TextView) findViewById(R.id.rrptxvpasslength);
    StringBuilder stb = new StringBuilder();
    stb.append(getResources().getString(R.string.passlengthbef));
    stb.append(hashMapDB.get("num_of_char"));
    stb.append(getResources().getString(R.string.passlengthaft));
    rrptxvpasslength.setText(stb.toString());

    /*        rrpspn = (Spinner) findViewById(R.id.rrpspn);
    String[] spnstr = {getResources().getString(R.string.month1),
            getResources().getString(R.string.month3),
            getResources().getString(R.string.month6)};
    rrpspn.setAdapter(createAdapter(spnstr));
    rrpspn.setSelection(Integer.parseInt(hashMapDB.get("spinner")));*/

    rrpbtnNext = (Button) findViewById(R.id.rrpbtnNext);
    rrpbtnNext.setOnClickListener(this);
    rrpbtnRegist = (Button) findViewById(R.id.rrpbtnRegist);
    rrpbtnRegist.setOnClickListener(this);

    // EditTextの外枠(TIL)にErrorヒントを表示させる
    rrpTilServicename = (TextInputLayout) findViewById(R.id.rrpTilServicename);
    rrpTilServicename.setError("サービス名は入力必須項目です。"); // show error
    rrpTilServicename.setError(null); // hide error

    rrptxvservice = (AutoCompleteTextView) findViewById(R.id.rrptxvservice);

    rrptxvservice.addTextChangedListener(new PGTextWatcher(rrpTilServicename));

    rrpchbb.setOnCheckedChangeListener(this);
    rrpchbs.setOnCheckedChangeListener(this);
    rrpchbk.setOnCheckedChangeListener(this);
    rrpchbnum.setOnCheckedChangeListener(this);

    writePref();
  }
Ejemplo n.º 6
0
  @Override
  public void onClick(View v) {
    if (!validateServiceName()) {
      toast("サービス名は入力必須項目です。");
      return;
    }
    if (!ClickTimerEvent.isClickEvent()) return;
    switch (v.getId()) {
      case R.id.rrpbtnNext:
        if (!reRegist) {
          // パスワードを非表示
          rrptxvpass.setVisibility(View.GONE);

          // パスワード生成設定を表示
          LinearLayout rrplayout2 = (LinearLayout) findViewById(R.id.rrplayout2);
          LinearLayout rrplayout3 = (LinearLayout) findViewById(R.id.rrplayout3);
          rrplayout2.setVisibility(View.VISIBLE);
          rrplayout3.setVisibility(View.VISIBLE);

          rrpbtnNext.setText(getString(R.string.next));

          reRegist = true;
        } else {
          // サービス名がかぶっている、新規(idが0)の場合
          for (int i = 0; i < mServiceName.length; i++) {
            if (rrptxvservice.getText().toString().equals(mServiceName[i])
                && pref.readConfig("id", "0").equals("0")) {
              Toast.makeText(ReRegistPass.this, "過去に同じサービス名で登録されています。", Toast.LENGTH_SHORT).show();
              return;
            }
          }
          createSendData();
          // ネクストボタン 登録やページ遷移
          Intent intent = new Intent(ReRegistPass.this, GenePass.class);
          startActivity(intent);
          this.finish();
        }
        break;

      case R.id.rrpbtnRegist:
        // サービス名がかぶっている、新規(idが0)の場合
        for (int i = 0; i < mServiceName.length; i++) {
          if (rrptxvservice.getText().toString().equals(mServiceName[i])
              && pref.readConfig("id", "0").equals("0")) {
            Toast.makeText(ReRegistPass.this, "過去に同じサービス名で登録されています。", Toast.LENGTH_SHORT).show();
            return;
          }
        }
        createSendData();
        dataupdate();
        this.finish();
        break;
    }

    /*if (rrpbtnNext == v) {
        //サービス名がかぶっている、新規(idが0)の場合
        if (checkServiceName(rrptxvservice.getText().toString()) &&
                pref.readConfig("id", "0").equals("0")) {
            Toast.makeText(this, getText(R.string.errServiceInfo), Toast.LENGTH_SHORT).show();
            return;
        }
        createSendData();
        //ネクストボタン 登録やページ遷移
        Intent intent = new Intent(ReRegistPass.this, GenePass.class);
        startActivity(intent);
    }*/
  }
Ejemplo n.º 7
0
  /**
   * debug **************************** private final String DB_NAME = "pg.db"; //データベース名 private
   * final int DB_VERSION = 1; //データベースのバージョン //テーブル名 private static final String[] DB_TABLE =
   * {"service_info", "user_info"}; private static DatabaseHelper dbHelper; //DBヘルパー
   *
   * <p>/******************************
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gene_pass);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    /**
     * debug***************************** String[] dbColTable = { "(_id INTEGER PRIMARY KEY
     * AUTOINCREMENT," + " service TEXT UNIQUE NOT NULL," + " user_id TEXT NOT NULL," + "
     * mail_address TEXT NOT NULL," + " char_num INTEGER NOT NULL," + " char_uppercase INTEGER NOT
     * NULL," + " char_lowercase INTEGER NOT NULL," + " char_symbol INTEGER NOT NULL," + "
     * num_of_char INTEGER NOT NULL," + " generated_datetime TEXT NOT NULL," + " updated_datetime
     * TEXT NOT NULL," + " fixed_pass TEXT NOT NULL," + " pass_hint TEXT NOT NULL," + " gene_id1
     * INTEGER NOT NULL," + " gene_id2 INTEGER NOT NULL," + " gene_id3 INTEGER NOT NULL," + "
     * gene_id4 INTEGER NOT NULL," + " algorithm INTEGER NOT NULL," + " delete_flag INTEGER NOT
     * NULL)",
     *
     * <p>"(_id INTEGER PRIMARY KEY AUTOINCREMENT," + " info_name TEXT UNIQUE NOT NULL," + " value
     * TEXT NOT NULL," + " category INTEGER NOT NULL," + " delete_flag INTEGER NOT NULL," + "
     * useless_flag INTEGER NOT NULL)" }; dbHelper = new DatabaseHelper(this, DB_NAME, DB_VERSION,
     * DB_TABLE, dbColTable); /******************************
     */
    //        dbC = new DatabaseC(dbHelper);

    dbC = new DatabaseC(PassList2.getDbHelper());

    poolString = new PoolString();

    pref = new PreferenceC(this);

    passKpGp = pref.readConfig("pass", "");
    chbb = pref.readConfig("chbb", true);
    chbs = pref.readConfig("chbs", true);
    chbk = pref.readConfig("chbk", true);
    chbnum = pref.readConfig("chbn", true);
    seekbarP = pref.readConfig("seekbar", 8) - 4;

    gp_txv_pass = (TextView) findViewById(R.id.gp_txv_pass);
    gp_txv_hint = (TextView) findViewById(R.id.gp_txv_hint);

    txvSheep = (TextView) findViewById(R.id.gp_txv_sheep);
    txvPass = (TextView) findViewById(R.id.gp_txv_pass);
    txvHint = (TextView) findViewById(R.id.gp_txv_hint);

    btnInsert = (Button) findViewById(R.id.pg_btn_insert);
    btnInsert.setOnClickListener(this);

    btnRegene = (Button) findViewById(R.id.pg_btn_regene);
    btnRegene.setOnClickListener(this);

    makePass();
    /*//もし新規の場合はmakePass()に流れる
    if(!pref.readConfig("PassKeep", false)){
        makePass();
    }else{
    //もし編集から流れてきた場合は以前のパスを一旦表示する。
        String tmp_service = pref.readConfig("service", "");
        String tmp_passhint = pref.readConfig("passhint", "");
        txvSheep.setText(tmp_service + " の\n 現在のパスワード");
        gp_txv_pass.setText(passKpGp);
        gp_txv_hint.setText(tmp_passhint);
    }*/

  }
Ejemplo n.º 8
0
 private String setComment() {
   StringBuilder stb = new StringBuilder();
   stb.append(pref.readConfig("service", ""));
   stb.append(getText(R.string.pg_comment));
   return stb.toString();
 }