Android Open Source - InfoWallpaper Enter String Dialog






From Project

Back to project page InfoWallpaper.

License

The source code is released under:

MIT License

If you think the Android project InfoWallpaper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.andreashedin.general;
/*from ww w.j a  v  a 2  s .  co  m*/
import com.andreashedin.infowallpaper.R;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.view.View.OnClickListener;

public class EnterStringDialog extends Dialog implements OnClickListener {

  public interface StringEnteredListener {
    void enteredString(String string);
  }
  
  StringEnteredListener mListener;
  String mDefaultString;
  String mTitle;
  EditText mInput;
  
  public EnterStringDialog(Context context, StringEnteredListener listener, String title, String defaultString) {
    super(context);
    
    mListener = listener;
    mTitle = title;
    mDefaultString = defaultString;
  }
  
  @Override
  public void onBackPressed() {
    cancel();
  }

  protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.enter_string);
        
        mInput = (EditText)findViewById(R.id.stringInput);
        mInput.setText(mDefaultString);
        
        Button b = (Button) findViewById(R.id.enterStringDone);
        b.setOnClickListener(this);
        b = (Button) findViewById(R.id.enterStringCancel);
        b.setOnClickListener(this);
        
        setTitle(mTitle);
  }

  @Override
  public void onClick(View view) {
    if(view.getId() == R.id.enterStringDone) {
      mListener.enteredString(mInput.getText().toString());
      dismiss();
    }
    else
      cancel();
  }
}




Java Source Code List

com.andreashedin.general.ColorPickerDialog.java
com.andreashedin.general.CustomizeInfoDialog.java
com.andreashedin.general.EnterStringDialog.java
com.andreashedin.general.PickItemDialog.java
com.andreashedin.general.PositionInfosDialog.java
com.andreashedin.general.SelectConfigurationDialog.java
com.andreashedin.general.TextSizeDialog.java
com.andreashedin.general.WeatherSettingsDialog.java
com.andreashedin.infowallpaper.Background.java
com.andreashedin.infowallpaper.BatteryDataCollector.java
com.andreashedin.infowallpaper.ColorHandler.java
com.andreashedin.infowallpaper.ConfigHandler.java
com.andreashedin.infowallpaper.CurrentSongDataCollector.java
com.andreashedin.infowallpaper.DataCollector.java
com.andreashedin.infowallpaper.DateTimeDataCollector.java
com.andreashedin.infowallpaper.DisplayValuePair.java
com.andreashedin.infowallpaper.InfoData.java
com.andreashedin.infowallpaper.InfoItem.java
com.andreashedin.infowallpaper.LiveInfoSettings.java
com.andreashedin.infowallpaper.LiveInfoWallpaper.java
com.andreashedin.infowallpaper.PhoneStatusDataCollector.java
com.andreashedin.infowallpaper.Phone.java
com.andreashedin.infowallpaper.SaveLoadData.java
com.andreashedin.infowallpaper.Screen.java
com.andreashedin.infowallpaper.WeatherDataCollector.java
com.andreashedin.infowallpaper.WeatherHandler.java