Android Open Source - WhiteSnowfallLiveWallpaper_Android Snow Fall Amount 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;
/* w ww .  j  a  v a 2 s . c  o  m*/
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 SnowFallAmountActivity extends Activity {

  private SharedPreferences prefs;
  private Button buttonOk;
  private Button buttonCancel;
  private SeekBar seekBarAmount;
  private TextView textViewCurrentValue;
  
  @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);
    seekBarAmount = (SeekBar) findViewById(R.id.seekBarAmount);
    textViewCurrentValue = (TextView) findViewById(R.id.textViewCurrentValue);
    
    seekBarAmount.setMax(190);
    seekBarAmount.setProgress(prefs.getInt(SnowFallConstants.PREF_SNOW_AMOUNT, SnowFallConstants.PREF_DEFAULT_AMOUNT));
    textViewCurrentValue.setText(String.valueOf(prefs.getInt(SnowFallConstants.PREF_SNOW_AMOUNT, SnowFallConstants.PREF_DEFAULT_AMOUNT)));
    
    seekBarAmount.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 + 10));
      }
    });
    
    buttonOk.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        prefs.edit().putInt(SnowFallConstants.PREF_SNOW_AMOUNT, seekBarAmount.getProgress() + 10).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