예제 #1
1
  @Override
  public void onCreate() {

    super.onCreate();

    sp = getSharedPreferences("date", 0);
    sp_setting = PreferenceManager.getDefaultSharedPreferences(this);
    sp_userinfo = getSharedPreferences("userinfo", 0);
    C.FRAME = Integer.parseInt(sp_setting.getString("Frame", "60"));
    Wm = (WindowManager) getApplication().getSystemService(Context.WINDOW_SERVICE);
    wmParams = new WindowManager.LayoutParams();
    wmParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
    // 设置悬浮窗为全屏
    wmParams.flags = 1280;
    wmParams.format = PixelFormat.RGBA_8888;
    wmParams.alpha = 0.8f;
    wmParams.gravity = Gravity.LEFT | Gravity.BOTTOM;
    wmParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
    wmParams.height = ViewGroup.LayoutParams.MATCH_PARENT;

    Wm_control = (WindowManager) getApplication().getSystemService(Context.WINDOW_SERVICE);
    wmParams_control = new WindowManager.LayoutParams();
    wmParams_control.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
    wmParams_control.format = PixelFormat.RGB_888;
    wmParams_control.flags =
        WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
            | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
            | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
    wmParams_control.alpha = 0;
    wmParams_control.width = 0;
    wmParams_control.height = 0;
    win_control = new View(this);
    Wm_control.addView(win_control, wmParams_control);

    // 注册系统广播
    sr = new ScreenReceiver();
    sr.registerScreenActionReceiver(MSSService.this);
    registerBattery();

    // 注册自己程序的广播
    IntentFilter inf = new IntentFilter();
    inf.addAction("com.jiusg.mainscreenshow");
    mssr = new MSSReceiver();
    registerReceiver(mssr, inf);

    sa_IsEvent = new SparseBooleanArray();
    sa_Animation = new SparseArray<Integer>();
    animManage = new AnimationManage(Wm, wmParams, getApplicationContext());

    isView = false;

    mHandler = new MssHandler();

    imageCache = new ImageCache(getApplicationContext());

    AVAnalytics.onEvent(MSSService.this, "Server Create", TAG);

    startService(new Intent(this, MSSLiveWallpaper.class));
  }
예제 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // 跟踪统计应用的打开情况
    AVAnalytics.trackAppOpened(getIntent());
  }
예제 #3
0
  @Override
  public void onCreate() {

    super.onCreate();

    AVOSCloud.initialize(this, EXTRA_APP_KEY, EXTRA_MASTER_KEY);
    AVAnalytics.enableCrashReport(this, true);
    AVOSCloud.setLastModifyEnabled(true);
    AVOSCloud.setDebugLogEnabled(true);

    messageHandler = new MessageHandler();

    user = this.getSharedPreferences(EXTRA_USER, MODE_PRIVATE);
    settings = this.getSharedPreferences(EXTRA_SETTINGS, MODE_PRIVATE);
    call = this.getSharedPreferences(EXTRA_CALL, MODE_PRIVATE);
    record = this.getSharedPreferences(EXTRA_RECORDS, MODE_PRIVATE);

    userEditor = user.edit();
    settingsEditor = settings.edit();
    callEditor = call.edit();
    recordEditor = record.edit();

    if (rtcEngine != null) {
      rtcEngine.enableNetworkTest();
    }
  }
예제 #4
0
  /**
   * 开始一个动画 强行开始,立即停止当前动画并开始
   *
   * @param anim 动画
   * @param event 事件
   */
  public void startAnimation(int anim, int event) {

    // 首先是对isView的判断
    // 如果true,将其停止掉
    // 如果false,在开始动画
    // 其次查找animationL中有没有对应的动画
    // 如果有直接拿出来运行,如果没有,创建一个并保存

    // 省电模式中如果低电量状态则不执行任何动画
    if (C.BATTER_STATUS != C.BATTER_LOWER_POWER) {

      // 停止动画
      stopAnimation();

      if (!isView) {

        AVAnalytics.onEvent(
            MSSService.this, "Start Animation", sp.getString("animation" + event, ""));
        animManage.startAnimation(anim, event);
        isView = true;
      }
    }
  }
예제 #5
0
 @Override
 protected void onPause() {
   super.onPause();
   AVAnalytics.onPause(this);
 }