Android Open Source - WhiteSnowfallLiveWallpaper_Android Snow Fall Size Activity






From Project

Back to project page WhiteSnowfallLiveWallpaper_Android.

License

The source code is released under:

GNU General Public License

If you think the Android project WhiteSnowfallLiveWallpaper_Android 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 cc.co.techzealous.snowfall;
/* ww  w. ja  v  a 2s . com*/
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import cc.co.techzealous.snowfall.utils.SnowFallConstants;

public class SnowFallSizeActivity extends Activity {

  private SharedPreferences prefs;
  private Button buttonOk;
  private Button buttonCancel;
  private SeekBar seekBarSize;
  private TextView textViewCurrentValue;
  private TextView textViewLabel;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.amount);
    
    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    buttonOk = (Button) findViewById(R.id.buttonOkAmount);
    buttonCancel = (Button) findViewById(R.id.buttonCancelAmount);
    seekBarSize = (SeekBar) findViewById(R.id.seekBarAmount);
    textViewCurrentValue = (TextView) findViewById(R.id.textViewCurrentValue);
    textViewLabel = (TextView) findViewById(R.id.textViewLabel);
    
    seekBarSize.setMax(3);
    seekBarSize.setProgress(prefs.getInt(SnowFallConstants.PREF_SNOW_SIZE, SnowFallConstants.PREF_DEFAULT_SIZE));
    textViewLabel.setText(getResources().getString(R.string.size_of_snow));
    textViewCurrentValue.setText(String.valueOf(prefs.getInt(SnowFallConstants.PREF_SNOW_SIZE, SnowFallConstants.PREF_DEFAULT_SIZE)));
    
    seekBarSize.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
      @Override
      public void onStopTrackingTouch(SeekBar seekBar) {
        
      }
      
      @Override
      public void onStartTrackingTouch(SeekBar seekBar) {
        
      }
      
      @Override
      public void onProgressChanged(SeekBar seekBar, int progress,
          boolean fromUser) {
        textViewCurrentValue.setText(String.valueOf(progress + 1));
      }
    });
    
    buttonOk.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        prefs.edit().putInt(SnowFallConstants.PREF_SNOW_SIZE, seekBarSize.getProgress() + 1).commit();
        finish();
      }
    });
    
    buttonCancel.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        finish();
      }
    });
  }
}




Java Source Code List

cc.co.techzealous.snowfall.SnowFallAmountActivity.java
cc.co.techzealous.snowfall.SnowFallBackImageActivity.java
cc.co.techzealous.snowfall.SnowFallEula.java
cc.co.techzealous.snowfall.SnowFallFpsActivity.java
cc.co.techzealous.snowfall.SnowFallPreferenceActivity.java
cc.co.techzealous.snowfall.SnowFallService.java
cc.co.techzealous.snowfall.SnowFallSizeActivity.java
cc.co.techzealous.snowfall.SnowFallSpeedActivity.java
cc.co.techzealous.snowfall.utils.SnowFallConstants.java
cc.co.techzealous.snowfall.utils.Snowflake.java