Android Open Source - CirclesLiveWallpaper_Android Circles Count Activity






From Project

Back to project page CirclesLiveWallpaper_Android.

License

The source code is released under:

GNU General Public License

If you think the Android project CirclesLiveWallpaper_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 com.blogspot.techzealous.circleslivewallpaper;
//from  ww w. j a  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 com.blogspot.techzealous.circleslivewallpaper.utils.CirclesConstants;

public class CirclesCountActivity extends Activity {

  private TextView textViewCurrentCount;
  private SeekBar seekBarNumberOfCircles;
  private Button buttonOk;
  private Button buttonCancel;
  private SharedPreferences prefs;
  
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.circlescount);
    
    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    textViewCurrentCount = (TextView) findViewById(R.id.textViewCurrentNumber);
    seekBarNumberOfCircles = (SeekBar) findViewById(R.id.seekBarNumberOfCircles);
    buttonOk = (Button) findViewById(R.id.buttonCountOk);
    buttonCancel = (Button) findViewById(R.id.buttonCountCancel);
    
    seekBarNumberOfCircles.setProgress(prefs.getInt(CirclesConstants.PREF_CIRCLE_COUNT, 4));
    seekBarNumberOfCircles.setKeyProgressIncrement(1);
    seekBarNumberOfCircles.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) {
        textViewCurrentCount.setText(String.valueOf(progress));
      }
    });
    
    textViewCurrentCount.setText(getResources().getString(R.string.settings_numberofcirlces) + " " + String.valueOf(prefs.getInt(CirclesConstants.PREF_CIRCLE_COUNT, 4)));
    
    buttonOk.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        prefs.edit().putInt(CirclesConstants.PREF_CIRCLE_COUNT, seekBarNumberOfCircles.getProgress()).commit();
        finish();
      }
    });
    
    buttonCancel.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        finish();
      }
    });
  }
}




Java Source Code List

com.blogspot.techzealous.circleslivewallpaper.CirclesBackColorActivity.java
com.blogspot.techzealous.circleslivewallpaper.CirclesCountActivity.java
com.blogspot.techzealous.circleslivewallpaper.CirclesEula.java
com.blogspot.techzealous.circleslivewallpaper.CirclesPreferenceActivity.java
com.blogspot.techzealous.circleslivewallpaper.CirclesService.java
com.blogspot.techzealous.circleslivewallpaper.CirclesSpeedActivity.java
com.blogspot.techzealous.circleslivewallpaper.utils.CirclesConstants.java
com.blogspot.techzealous.circleslivewallpaper.utils.MyCircle.java