Android Open Source - libgdx-lwp-template Template L W P Settings






From Project

Back to project page libgdx-lwp-template.

License

The source code is released under:

Copyright (c) 2013, madpew All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redis...

If you think the Android project libgdx-lwp-template 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 org.example.lwp.template;
/*from w w  w .  j  a va  2 s.  co  m*/
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.SeekBar;

public class TemplateLWPSettings extends Activity {
  @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.settings);
        
        //SharedPreferences settings = this.getSharedPreferences("templatelwpSettings", MODE_PRIVATE);
        //setCheckbox(R.id.checkUseAF, settings.getBoolean("chkUseAF",true));
        //setCheckbox(R.id.checkShowLogo, settings.getBoolean("chkShowLogo",true));
        
        ((Button)findViewById(R.id.linkButton)).setOnClickListener(
            new OnClickListener() {
              public void onClick(View arg)
              {
                onLinkButtonClick();
              }
            });
    }
    
    public void setCheckbox(int id, boolean value){
      CheckBox tmp = (CheckBox) findViewById(id);
      tmp.setChecked(value);
    }
    
    public void setSlider(int id, float value){
      SeekBar tmp = (SeekBar) findViewById(id);
      tmp.setProgress((int)(value*255));
    }
    
    public boolean getCheckbox(int id){
      CheckBox tmp = (CheckBox) findViewById(id);
      return tmp.isChecked();
    }
    
    public float getSlider(int id){
      SeekBar tmp = (SeekBar) findViewById(id);
      return (tmp.getProgress())/255f;
    }
    
    
  public void onStop(){
      super.onStop();
        SharedPreferences settings = getSharedPreferences("templatelwpSettings", MODE_PRIVATE);
        SharedPreferences.Editor editor = settings.edit();
        
        //editor.putBoolean("xxx", getCheckbox(R.id.xxx));
        //TemplateLWPMain.xxx = getCheckbox(R.id.xxx);
        editor.commit();
    }
  
  public void onLinkButtonClick(){
    Uri uri = Uri.parse(getString(R.string.lblLinkContent));
     Intent intent = new Intent(Intent.ACTION_VIEW, uri);
     startActivity(intent);
  }
}




Java Source Code List

org.example.lwp.template.LandscapeLauncher.java
org.example.lwp.template.MainScreen.java
org.example.lwp.template.PortraitLauncher.java
org.example.lwp.template.TemplateDaydream.java
org.example.lwp.template.TemplateLWPSettings.java
org.example.lwp.template.TemplateLiveWallpaper.java
org.example.lwp.template.TemplateMain.java