Android Open Source - Do-not-get-annoyed Popup Service






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.services;
// www. j a v  a2s  . c  o  m
import mn100013d.pmu.R;
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.RelativeLayout;

public abstract class PopupService {

  public static final int NEW_GAME = 1;
  public static final int GAME_PAUSE = 2;
  public static final int SETTINGS = 3;
  public static final int PLEASE_WAIT = 4;
  private View view;
  private Context context;
  private View popup;
  
  public PopupService(int name, View view, Context context) {
    RelativeLayout popup = new RelativeLayout(context);
    View menu = null;
    switch (name){
    case NEW_GAME:
       menu = ((Activity) context).getLayoutInflater().inflate(
          R.layout.fragment_gametype, null);
      break;
    case GAME_PAUSE:
      menu = ((Activity) context).getLayoutInflater().inflate(
          R.layout.pausegamelayout, null);
      break;
    case SETTINGS:
      menu = ((Activity) context).getLayoutInflater().inflate(
          R.layout.fragment_settings, null);
      break;
    case PLEASE_WAIT:
      menu = ((Activity) context).getLayoutInflater().inflate(
          R.layout.pleasewaitlayout, null);
      
      break;
    }
    
    popup.addView(menu);
    this.popup = popup;
    this.view = view;
    this.context = context;
  }
  

  public void show() {
    ((RelativeLayout) view).addView(popup);
    RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) popup
        .getLayoutParams();
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT,
        RelativeLayout.TRUE);
    popup.setLayoutParams(layoutParams);
    if (setHideOnOutsideClick()){
      view.setOnClickListener(new View.OnClickListener() {
        
        @Override
        public void onClick(View v) {
          hide();
        }
      });
    }
    
    onShow();
    
  }
  public void hide() {
    
    ((RelativeLayout) view).removeView(popup);
    onHide();
  }
  public abstract void onHide();
  public abstract void onShow();
  public abstract Boolean setHideOnOutsideClick();
}




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