Пример #1
0
  /**
   * 获得属于桌面的应用的应用包名称
   *
   * @return 返回包含所有包名的字符串列表
   * @deprecated
   */
  public List<String> getHomes() {
    List<String> names = new ArrayList<String>();
    PackageManager packageManager = this.getPackageManager();
    // 属性
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    List<ResolveInfo> resolveInfo =
        packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
    for (ResolveInfo ri : resolveInfo) {
      names.add(ri.activityInfo.packageName);
    }

    for (int i = 0; i < names.size(); i++) {
      MyLog.i(TAG, "getHomes=" + names.get(i));
    }
    return names;
  }
Пример #2
0
    @Override
    public void onReceive(Context context, Intent intent) {

      if (intent.getStringExtra("msg").equals("call_ring")) {

        if (sa_IsEvent.get(C.EVENT_CALL)) {

          startAnimation(sa_Animation.get(C.EVENT_CALL), C.EVENT_CALL);
        }

      } else if (intent.getStringExtra("msg").equals("call_start")) {

        if (sa_IsEvent.get(C.EVENT_CALL)) {

          startAnimation(sa_Animation.get(C.EVENT_CALL), C.EVENT_CALL);
        }
      } else if (intent.getStringExtra("msg").equals("call_stop")) {

        stopAnimation();

      } else if (intent.getStringExtra("msg").equals("sms")) {

        if (sa_IsEvent.get(C.EVENT_SMS)) {

          startAnimation(sa_Animation.get(C.EVENT_SMS), C.EVENT_SMS);
        }

      } else if (intent.getStringExtra("msg").equals("wifi")) {

        if (!isWifi) {
          isWifi = true;
          MyLog.i(TAG, "WiFi is connected!");
          Message msg = mHandler.obtainMessage();
          msg.what = HANDLER_ISWIFI;
          mHandler.sendMessageDelayed(msg, 5000);
        }
      }
    }
Пример #3
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));
    }
  }