Android Open Source - Do-not-get-annoyed Settings Fragment






From Project

Back to project page Do-not-get-annoyed.

License

The source code is released under:

Apache License

If you think the Android project Do-not-get-annoyed 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 mn100013d.pmu;
// w  w w .  j  av a 2 s  .  c  om
import mn100013d.pmu.data.GameSettingsEditor;
import mn100013d.pmu.exceptions.PlayerNotRegisteredException;
import mn100013d.pmu.services.FragmentProvider;
import mn100013d.pmu.services.SoundService;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.OvershootInterpolator;
import android.widget.ImageView;
import android.widget.SeekBar;

public class SettingsFragment extends Fragment {

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_settings, container, false);
    final GameSettingsEditor gsEditor = new GameSettingsEditor(getActivity());
    
    ImageView save_settings = (ImageView)rootView.findViewById(R.id.bt_settings_save);
    final SeekBar music_volume = (SeekBar)rootView.findViewById(R.id.volume_level);
    final SeekBar sensitivity = (SeekBar)rootView.findViewById(R.id.sensitivity_level);
    
    music_volume.setProgress(gsEditor.getVolume());
    sensitivity.setProgress(gsEditor.getSensitivity());
    save_settings.setOnClickListener(new View.OnClickListener() {
      
      @Override
      public void onClick(View v) {
        
        gsEditor.setMusicVolume(music_volume.getProgress());
        gsEditor.setSensitivity(sensitivity.getProgress());
        try {
          SoundService.getInstance().play(SoundService.CLICK_SOUND, false);
        } catch (PlayerNotRegisteredException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        FragmentProvider.getInstance().back();
      }
      
    });
    return rootView;
  }
  
  @Override
  public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
    Animation anim = null;
    if (enter)
      anim = AnimationUtils.loadAnimation(getActivity(),
          R.anim.slide_in_left);
    else {
      anim = AnimationUtils.loadAnimation(getActivity(),
          R.anim.slide_out_right);
    }
    anim.setInterpolator(new OvershootInterpolator(3f));
    return anim;
  }

}




Java Source Code List

mn100013d.pmu.BeginingActivity.java
mn100013d.pmu.GameTypeFragment.java
mn100013d.pmu.NewGameActivity.java
mn100013d.pmu.NewGameFragment.java
mn100013d.pmu.PauseFragment.java
mn100013d.pmu.PauseGameFragment.java
mn100013d.pmu.ScoresFragment.java
mn100013d.pmu.SettingsFragment.java
mn100013d.pmu.StartActivity.java
mn100013d.pmu.StartGameFragment.java
mn100013d.pmu.controllers.GameController.java
mn100013d.pmu.data.GameDataDbHelper.java
mn100013d.pmu.data.GameSettingsEditor.java
mn100013d.pmu.data.GameTableContract.java
mn100013d.pmu.exceptions.ContextNotSetException.java
mn100013d.pmu.exceptions.GameExceptions.java
mn100013d.pmu.exceptions.PlayerNotRegisteredException.java
mn100013d.pmu.models.Board.java
mn100013d.pmu.models.CPUGamePlayer.java
mn100013d.pmu.models.Color.java
mn100013d.pmu.models.Dice.java
mn100013d.pmu.models.Field.java
mn100013d.pmu.models.FinishField.java
mn100013d.pmu.models.GamePlayer.java
mn100013d.pmu.models.HomeField.java
mn100013d.pmu.models.HumanGamePlayer.java
mn100013d.pmu.models.PathField.java
mn100013d.pmu.models.Pawn.java
mn100013d.pmu.models.Result.java
mn100013d.pmu.services.FragmentProvider.java
mn100013d.pmu.services.GamePlayerFactory.java
mn100013d.pmu.services.PopupService.java
mn100013d.pmu.services.Randomizer.java
mn100013d.pmu.services.ShakeDetector.java
mn100013d.pmu.services.SoundService.java