@Override public void onResume() { super.onResume(); if (mShakeListener != null) { mShakeListener.resume(); } }
@Override public void onPause() { super.onPause(); if (mShakeListener != null) { mShakeListener.pause(); } }
@Override protected View createLoadedView() { mStellarMap = new StellarMap(UIUtils.getContext()); // 设置pading值 mStellarMap.setInnerPadding(20, 20, 20, 20); // 横向和纵向有几行几列 mStellarMap.setRegularity(6, 9); mStellarMap.setAdapter(new StellarMapAdapter()); mShakeListener = new ShakeListener(UIUtils.getContext()); mShakeListener.setOnShakeListener( new ShakeListener.OnShakeListener() { @Override public void onShake() { int currentGroup = mStellarMap.getCurrentGroup(); mStellarMap.setGroup((currentGroup + 1) % 2, true); } }); // 第一个参数是从0组开始,第二个参数是否开启动画 mStellarMap.setGroup(0, true); mStellarMap.setBackgroundResource(R.drawable.grid_item_bg_normal); return mStellarMap; }