Android Open Source - ParticlePlay Temperature






From Project

Back to project page ParticlePlay.

License

The source code is released under:

GNU General Public License

If you think the Android project ParticlePlay 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.droidinteractive.particleplay.game;
/*/*from   w  w w .  j a v a  2s.c o  m*/
 * Copyright (c) 2010 Ragdoll Games
 * Copyright (c) 2010-2014 Droid Interactive
 * 
 * This file is part of Particle Play.
 * 
 * Particle Play is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Particle Play is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Particle Play. If not, see <http://www.gnu.org/licenses/>.
 */
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView;

import com.droidinteractive.particleplay.MainActivity;
import com.droidinteractive.particleplay.R;
import com.droidinteractive.particleplay.preferences.Preferences;

public class Temperature extends LinearLayout{
  
  //private MainActivity activity;
  
  private ImageView temp_icon;
  private TextView temp_text;
  private SeekBar temperature_slider;
  //private int weather = 0;
  private int wR, wG, wB;
  
  public Temperature(Context context, AttributeSet attrs)
  {
    super(context, attrs);
  }
  
  public void setActivity(MainActivity act)
  {
    //activity = act;
  }
  
  @Override
  protected void onFinishInflate()
  {
    temp_icon = (ImageView) findViewById(R.id.temp_icon);
    temp_text = (TextView) findViewById(R.id.temp_text);
    temperature_slider = (SeekBar) findViewById(R.id.temperature_slider);
    
    temp_icon.setImageResource(R.drawable.temperature);
    temperature_slider.setMax(255);
    temperature_slider.setProgress(Preferences.sharedPreferences.getInt("atmoshpere_temp", 100));
    temp_text.setText(String.valueOf(temperature_slider.getProgress()));
    
    temperature_slider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
      
      @Override
      public void onStopTrackingTouch(SeekBar seekBar) {
        
      }
      
      @Override
      public void onStartTrackingTouch(SeekBar seekBar) {
      }
      
      @Override
      public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
        
        temp_text.setText(String.valueOf(temperature_slider.getProgress()));
        Preferences.setAtmosphereTemp((char) Preferences.sharedPreferences.getInt("atmoshpere_temp", progress));
        Preferences.setBackgroundColor((char) Preferences.sharedPreferences.getInt("background_red", wR), (char) Preferences.sharedPreferences.getInt("background_green", wG), (char) Preferences.sharedPreferences.getInt("background_blue", wB));
        
      }
    });
  }

}




Java Source Code List

com.droidinteractive.colorpicker.ColorPickerBox.java
com.droidinteractive.colorpicker.ColorPickerDialog.java
com.droidinteractive.colorpicker.widget.ColorPickerPreferenceWidgetView.java
com.droidinteractive.colorpicker.widget.ColorPickerPreference.java
com.droidinteractive.particleplay.FixMeActivity.java
com.droidinteractive.particleplay.Globals.java
com.droidinteractive.particleplay.LoadStateActivity.java
com.droidinteractive.particleplay.MainActivity.java
com.droidinteractive.particleplay.MenuActivity.java
com.droidinteractive.particleplay.SaveStateActivity.java
com.droidinteractive.particleplay.SplashActivity.java
com.droidinteractive.particleplay.custom.CustomElementActivity.java
com.droidinteractive.particleplay.custom.CustomElementAdvancedActivity.java
com.droidinteractive.particleplay.custom.CustomElementBasicActivity.java
com.droidinteractive.particleplay.custom.CustomElementManagerActivity.java
com.droidinteractive.particleplay.custom.CustomElementManager.java
com.droidinteractive.particleplay.custom.CustomElement.java
com.droidinteractive.particleplay.game.ActionItem.java
com.droidinteractive.particleplay.game.Control.java
com.droidinteractive.particleplay.game.CustomElementManager.java
com.droidinteractive.particleplay.game.FileManager.java
com.droidinteractive.particleplay.game.MenuBar.java
com.droidinteractive.particleplay.game.PopupWindows.java
com.droidinteractive.particleplay.game.QuickAction.java
com.droidinteractive.particleplay.game.SandView.java
com.droidinteractive.particleplay.game.SaveManager.java
com.droidinteractive.particleplay.game.Temperature.java
com.droidinteractive.particleplay.preferences.AlphaPatternDrawable.java
com.droidinteractive.particleplay.preferences.ColorPickerDialogPref.java
com.droidinteractive.particleplay.preferences.ColorPickerPanelView.java
com.droidinteractive.particleplay.preferences.ColorPickerPreference.java
com.droidinteractive.particleplay.preferences.ColorPickerView.java
com.droidinteractive.particleplay.preferences.PreferencesActivity.java
com.droidinteractive.particleplay.preferences.Preferences.java
com.droidinteractive.particleplay.preferences.SeekBarPreference.java
com.droidinteractive.slidingdrawer.OnDrawerCloseListener.java
com.droidinteractive.slidingdrawer.OnDrawerOpenListener.java
com.droidinteractive.slidingdrawer.OnDrawerScrollListener.java
com.droidinteractive.slidingdrawer.SlidingDrawer.java