Пример #1
0
  @Override
  public boolean onTouch(View v, MotionEvent event) {
    if (v.equals(win_control))
      if (isView) {

        if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {

          // 来电事件

          if (sp.getString("end" + C.EVENT_CALL, "")
              .equals(PropertiesUtils.GetEventInfo(C.EVENT_CALL, MSSService.this)[1])) {

            stopAnimation();
          }

          // 锁屏事件

          if (sp.getString("end" + C.EVENT_LOCKSCREEN, "")
              .equals(PropertiesUtils.GetEventInfo(C.EVENT_LOCKSCREEN, MSSService.this)[1])) {

            stopAnimation();
          }

          // 信息事件

          if (sp.getString("end" + C.EVENT_SMS, "")
              .equals(PropertiesUtils.GetEventInfo(C.EVENT_SMS, MSSService.this)[1])) {

            stopAnimation();
          }
          // 充电事件

          if (sp.getString("end" + C.EVENT_CHARGING, "")
              .equals(PropertiesUtils.GetEventInfo(C.EVENT_CHARGING, MSSService.this)[1])) {

            stopAnimation();
          }
        }
      }
    return true;
  }
Пример #2
0
  /**
   * 得到对应动画接口实现类的类名
   *
   * @param name
   * @return 类名
   * @deprecated
   */
  private String GetAnimationClassName(String name) {

    if (name.equals(PropertiesUtils.getAnimationInfo(MSSService.this)[C.ANIMATION_BUBBLE])) {

      return "BubbleAnimationProcess";
    } else if (name.equals(
        PropertiesUtils.getAnimationInfo(MSSService.this)[C.ANIMATION_STARSHINE])) {

      return "StarshineAnimationProcess";
    } else if (name.equals(
        PropertiesUtils.getAnimationInfo(MSSService.this)[C.ANIMATION_PICTUREWALL])) {

      // 幻灯片动画不需要让动画继续进行
      // 每次重新开始即可
      return null;
    } else if (name.equals(PropertiesUtils.getAnimationInfo(MSSService.this)[C.ANIMATION_RAIN])) {

      return "RainAnimationProcess";
    }

    return null;
  }
Пример #3
0
  /**
   * 实例一个动画 其中,存放动画的sharePreference的name为事件的name+动画的name
   *
   * @param name 动画名字
   * @param event 事件
   * @return AnimationProcess
   * @deprecated
   */
  private AnimationProcess instanceAnimation(String name, int event) {

    AnimationProcess animationP = null;
    if (name.equals(PropertiesUtils.getAnimationInfo(this)[C.ANIMATION_BUBBLE])) {

      animationP =
          new BubbleAnimationProcess(
              MSSService.this,
              sp.getString("start" + event, "")
                  + PropertiesUtils.getAnimationInfo(this)[C.ANIMATION_BUBBLE]);

    } else if (name.equals(PropertiesUtils.getAnimationInfo(this)[C.ANIMATION_STARSHINE])) {

      animationP =
          new StarshineAnimationProcess(
              MSSService.this,
              sp.getString("start" + event, "")
                  + PropertiesUtils.getAnimationInfo(this)[C.ANIMATION_STARSHINE]);

    } else if (name.equals(PropertiesUtils.getAnimationInfo(this)[C.ANIMATION_PICTUREWALL])) {
      animationP =
          new PictureWallAnimationProcess(
              MSSService.this,
              sp.getString("start" + event, "")
                  + PropertiesUtils.getAnimationInfo(this)[C.ANIMATION_PICTUREWALL]);
    } else if (name.equals(PropertiesUtils.getAnimationInfo(this)[C.ANIMATION_RAIN])) {

      animationP =
          new RainAnimationProcess(
              MSSService.this,
              sp.getString("start" + event, "")
                  + PropertiesUtils.getAnimationInfo(this)[C.ANIMATION_RAIN]);
    }

    return animationP;
  }
Пример #4
0
  /** 加载事件信息,包括(是否有此事件,以及该事件的动画) */
  public void loadEvent() {

    // 清理SparseArray
    sa_IsEvent.clear();
    sa_Animation.clear();

    if (sp_userinfo.getString("UserVersionInfo", "").equals("OfficialVersion")
        || sp_userinfo.getString("UserVersionInfo", "").equals("TrialVersion")
        || sp_userinfo.getString("UserVersionInfo", "").equals(C.VERSION_FREE)) {

      // 来电事件 MSSValue.EVENT_CALL
      if (sp.getString("start" + C.EVENT_CALL, "")
              .equals(PropertiesUtils.GetEventInfo(C.EVENT_CALL, MSSService.this)[0])
          && sp.getString("state" + C.EVENT_CALL, "").equals(getString(R.string.action_started))) {

        sa_IsEvent.put(C.EVENT_CALL, true);
        sa_Animation.put(
            C.EVENT_CALL,
            AnimationConvert.convertAnimation(
                sp.getString("animation" + C.EVENT_CALL, ""), getApplicationContext()));
      } else {

        sa_IsEvent.put(C.EVENT_CALL, false);
        sa_Animation.put(C.EVENT_CALL, C.ANIMATION_BUBBLE);
      }

      // 锁屏事件 MSSValue.EVENT_LOCKSCREEN
      if (sp.getString("start" + C.EVENT_LOCKSCREEN, "")
              .equals(PropertiesUtils.GetEventInfo(C.EVENT_LOCKSCREEN, MSSService.this)[0])
          && sp.getString("state" + C.EVENT_LOCKSCREEN, "")
              .equals(getString(R.string.action_started))) {

        sa_IsEvent.put(C.EVENT_LOCKSCREEN, true);
        sa_Animation.put(
            C.EVENT_LOCKSCREEN,
            AnimationConvert.convertAnimation(
                sp.getString("animation" + C.EVENT_LOCKSCREEN, ""), getApplicationContext()));
      } else {

        sa_IsEvent.put(C.EVENT_LOCKSCREEN, false);
        sa_Animation.put(C.EVENT_LOCKSCREEN, C.ANIMATION_BUBBLE);
      }

      // 信息事件 MSSValue.EVENT_SMS
      if (sp.getString("start" + C.EVENT_SMS, "")
              .equals(PropertiesUtils.GetEventInfo(C.EVENT_SMS, MSSService.this)[0])
          && sp.getString("state" + C.EVENT_SMS, "").equals(getString(R.string.action_started))) {

        sa_IsEvent.put(C.EVENT_SMS, true);
        sa_Animation.put(
            C.EVENT_SMS,
            AnimationConvert.convertAnimation(
                sp.getString("animation" + C.EVENT_SMS, ""), getApplicationContext()));
      } else {

        sa_IsEvent.put(C.EVENT_SMS, false);
        sa_Animation.put(C.EVENT_SMS, C.ANIMATION_BUBBLE);
      }

      // 充电事件 MSSValue.EVENT_CHARING
      if (sp.getString("start" + C.EVENT_CHARGING, "")
              .equals(PropertiesUtils.GetEventInfo(C.EVENT_CHARGING, MSSService.this)[0])
          && sp.getString("state" + C.EVENT_CHARGING, "")
              .equals(getString(R.string.action_started))) {
        sa_IsEvent.put(C.EVENT_CHARGING, true);
        sa_Animation.put(
            C.EVENT_CHARGING,
            AnimationConvert.convertAnimation(
                sp.getString("animation" + C.EVENT_CHARGING, ""), getApplicationContext()));

      } else {
        sa_IsEvent.put(C.EVENT_CHARGING, false);
        sa_Animation.put(C.EVENT_CHARGING, C.ANIMATION_BUBBLE);
      }

      MyLog.i(
          TAG,
          "EVENT_CALL  " + sa_IsEvent.get(C.EVENT_CALL) + "  " + sa_Animation.get(C.EVENT_CALL));
      MyLog.i(
          TAG,
          "EVENT_LOCKSCREEN  "
              + sa_IsEvent.get(C.EVENT_LOCKSCREEN)
              + "  "
              + sa_Animation.get(C.EVENT_LOCKSCREEN));
      MyLog.i(
          TAG,
          "EVENT_SMS   " + sa_IsEvent.get(C.EVENT_SMS) + "   " + sa_Animation.get(C.EVENT_SMS));
      MyLog.i(
          TAG,
          "EVENT_CHARING   "
              + sa_IsEvent.get(C.EVENT_CHARGING)
              + "   "
              + sa_Animation.get(C.EVENT_CHARGING));
    }
  }
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      LayoutInflater inflater = LayoutInflater.from(getActivity());
      convertView = inflater.inflate(R.layout.gv_mss, parent, false);
      ImageView img = (ImageView) convertView.findViewById(R.id.img_gv);
      Button button = (Button) convertView.findViewById(R.id.bt_gv);
      switch (position) {
        case 0:
          button.setText(PropertiesUtils.getAnimationInfo(getActivity())[C.ANIMATION_BUBBLE]);
          img.setImageResource(R.drawable.preview_bubble);
          break;
        case 1:
          button.setText(PropertiesUtils.getAnimationInfo(getActivity())[C.ANIMATION_STARSHINE]);
          img.setImageResource(R.drawable.preview_starshine);
          break;
        case 2:
          button.setText(PropertiesUtils.getAnimationInfo(getActivity())[C.ANIMATION_PICTUREWALL]);
          img.setImageResource(R.drawable.preview_picturewall);
          break;
        case 3:
          button.setText(PropertiesUtils.getAnimationInfo(getActivity())[C.ANIMATION_RAIN]);
          img.setImageResource(R.drawable.preview_rain);
          break;
        case 4:
          button.setText(PropertiesUtils.getAnimationInfo(getActivity())[C.ANIMATION_SNOW]);
          img.setImageResource(R.drawable.preview_snow);
          break;
        default:
          break;
      }
      img.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Intent it = new Intent();
              Bundle b = new Bundle();
              switch (position) {
                case 0:
                  b.putInt("animation", C.ANIMATION_BUBBLE);
                  break;
                case 1:
                  b.putInt("animation", C.ANIMATION_STARSHINE);
                  break;
                case 2:
                  b.putInt("animation", C.ANIMATION_PICTUREWALL);
                  break;
                case 3:
                  b.putInt("animation", C.ANIMATION_RAIN);
                  break;
                case 4:
                  b.putInt("animation", C.ANIMATION_SNOW);
                  break;
                default:
                  break;
              }
              Log.i(TAG, "" + position);
              it.putExtras(b);
              it.setClass(getActivity(), PreviewAnimation.class);
              getActivity().startActivity(it);
            }
          });

      return convertView;
    }