Android Open Source - PocketLantern P L Size Activity






From Project

Back to project page PocketLantern.

License

The source code is released under:

GNU General Public License

If you think the Android project PocketLantern 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.pl;
//from  w  w  w .java  2 s .c om
import cc.co.techzealous.pl.utils.PLConstants;
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;

public class PLSizeActivity extends Activity {

  private Button buttonCancel;
  private Button buttonOk;
  private SeekBar seekBarSize;
  private SharedPreferences prefs;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sizeactivity);
    
    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    buttonCancel = (Button) findViewById(R.id.buttonSizeCancel);
    buttonOk = (Button) findViewById(R.id.buttonSizeOk);
    seekBarSize = (SeekBar) findViewById(R.id.seekBar1);
    
    seekBarSize.setMax(prefs.getInt(PLConstants.PREF_POSY, 160) * 2);
    seekBarSize.setProgress(prefs.getInt(PLConstants.PREF_SIZE, PLConstants.DEFAULT_SIZE));
    
    buttonCancel.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        finish();
      }
    });
    
    buttonOk.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        int size = seekBarSize.getProgress();
        if(size <= 0) {size = 1;}
        prefs.edit().putInt(PLConstants.PREF_SIZE, size).commit();
        finish();
      }
    });
  }
}




Java Source Code List

cc.co.techzealous.pl.MainActivity.java
cc.co.techzealous.pl.PLEulaActivity.java
cc.co.techzealous.pl.PLPreferenceActivity.java
cc.co.techzealous.pl.PLSizeActivity.java
cc.co.techzealous.pl.utils.MyView.java
cc.co.techzealous.pl.utils.PLConstants.java