예제 #1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.specialcodedialog);

    app = (MyApp) this.getApplication();

    codeField = (EditText) this.findViewById(R.id.SpecialCodeField);
    okButton = (ImageButton) this.findViewById(R.id.specialCodeOkButton);
    okButton.setOnClickListener(this);
    cancelButton = (ImageButton) this.findViewById(R.id.specialCodeCancelButton);
    cancelButton.setOnClickListener(this);
    failText = (TextView) findViewById(R.id.SpecialCodeFail);

    codeField.setTextColor(this.getResources().getColor(R.color.dark_blue));
    codeField.setTextSize(TEXT_CODE_SIZE);

    failText.setTypeface(app.getTextFont());
    failText.setTextColor(this.getResources().getColor(R.color.dark_blue));
    failText.setTextSize(TEXT_FAIL_SIZE);
    failText.setText(DEFAULT_TEXT_FAIL);

    app = (MyApp) this.getApplication();
    currentPlayer = app.getCurrentPlayer();
  }
예제 #2
0
 @Override
 public void onClick(View v) {
   if (v.equals(okButton)) {
     String code = codeField.getText().toString();
     HashMap<String, String> dataMap = new HashMap<String, String>();
     dataMap.put("special_code", code);
     dataMap.put("facebook_id", app.getFacebookId());
     String postData = NetworkUtil.createPostData(dataMap);
     NetworkThreadUtil.getRawData(
         app.getConfig().get(USE_SPECIAL_CODE_URL).toString(), postData, this);
   } else if (v.equals(cancelButton)) {
     this.setResult(Activity.RESULT_CANCELED);
     this.finish();
   }
 }
예제 #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.newspaperdialog);

    app = (MyApp) this.getApplication();

    closeButton = (ImageButton) findViewById(R.id.newspaperCloseButton);
    closeButton.setOnClickListener(this);
    newspaperImage = (ImageView) findViewById(R.id.newspaperImage);

    URL newurl = null;
    try {
      newurl = new URL(app.getConfig().get(GET_NEWSPAPER_URL).toString());
    } catch (MalformedURLException e) {
      e.printStackTrace();
    }

    try {
      mIcon_val = BitmapFactory.decodeStream(newurl.openConnection().getInputStream());
    } catch (IOException e) {
      e.printStackTrace();
    }
    newspaperImage.setImageBitmap(mIcon_val);
  }