Android Open Source - WhiteSnowfallLiveWallpaper_Android Snow Fall Fps 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  .j ava  2 s.  co  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 SnowFallFpsActivity extends Activity {

  private SharedPreferences prefs;
  private Button buttonOk;
  private Button buttonCancel;
  private SeekBar seekBarFps;
  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);
    seekBarFps = (SeekBar) findViewById(R.id.seekBarAmount);
    textViewCurrentValue = (TextView) findViewById(R.id.textViewCurrentValue);
    textViewLabel = (TextView) findViewById(R.id.textViewLabel);
    
    seekBarFps.setMax(70);
    seekBarFps.setProgress(prefs.getInt(SnowFallConstants.PREF_FPS, SnowFallConstants.PREF_DEFAULT_FPS));
    textViewLabel.setText(getResources().getString(R.string.fps));
    textViewCurrentValue.setText(String.valueOf(prefs.getInt(SnowFallConstants.PREF_FPS, SnowFallConstants.PREF_DEFAULT_FPS)));
    
    seekBarFps.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 + 30));
      }
    });
    
    buttonOk.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        prefs.edit().putInt(SnowFallConstants.PREF_SNOW_SPEED, seekBarFps.getProgress() + 30).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