Ejemplo n.º 1
0
        @Override
        public void onClick(View v) {
          switch (v.getId()) {
            case R.id.menu00:
              SESceneManager.getInstance()
                  .removeMessage(HomeScene.MSG_TYPE_SHOW_WALL_LONG_CLICK_DIALOG);
              SESceneManager.getInstance()
                  .handleMessage(HomeScene.MSG_TYPE_SHOW_WALL_LONG_CLICK_DIALOG, null);
              break;
            case R.id.menu01:
              HomeUtils.gotoSettingsActivity();
              break;
            case R.id.menu02:
              Intent intentSetting = new Intent();
              intentSetting.setAction("android.settings.SETTINGS");
              intentSetting.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
              HomeManager.getInstance().startActivity(intentSetting);
              break;
            case R.id.menu03:
              Intent intentAppMgr = new Intent();
              intentAppMgr.setClassName(
                  "com.android.settings",
                  "com.android.settings.Settings$ManageApplicationsActivity");
              intentAppMgr.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
              HomeManager.getInstance().startActivity(intentAppMgr);
              break;

            default:
              break;
          }

          OptionMenu.this.dismiss();
        }
Ejemplo n.º 2
0
 public void changeTheme(ThemeInfo themeInfo) {
   if (mCurrentThemeInfo != null && mModelObjectsManager != null) {
     mCurrentThemeInfo = themeInfo;
     mCurrentThemeInfo.initFromXML(getContext());
     HomeUtils.staticUsingTheme(getContext(), themeInfo.mThemeName);
     SESceneManager.getInstance().removeMessage(HomeScene.MSG_TYPE_UPDATE_SCENE);
     SESceneManager.getInstance().handleMessage(HomeScene.MSG_TYPE_UPDATE_SCENE, themeInfo);
     checkSceneRotation(themeInfo);
   }
 }
Ejemplo n.º 3
0
 public void clearFPSView() {
   if (mFPSView != null) {
     mWorkSpace.removeView(mFPSView);
     SESceneManager.getInstance().clearFPSView();
     mFPSView = null;
   }
 }
Ejemplo n.º 4
0
 public void debug(boolean enable) {
   HomeUtils.DEBUG = enable;
   File file = new File(HomeUtils.get3DHomePath() + File.separator + ".debug");
   if (enable) {
     if (!file.exists()) {
       try {
         file.createNewFile();
       } catch (IOException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
       }
     }
     Toast.makeText(HomeManager.getInstance().getContext(), "Open debug!!!", Toast.LENGTH_SHORT)
         .show();
     SELoadResThread.getInstance().process(mDetectMemoryTask, 10000);
   } else {
     if (file.exists()) {
       file.delete();
     }
     Toast.makeText(HomeManager.getInstance().getContext(), "Close debug!!!", Toast.LENGTH_SHORT)
         .show();
     SELoadResThread.getInstance().cancel(mDetectMemoryTask);
   }
   SESceneManager.setDebug_JNI(enable);
 }
Ejemplo n.º 5
0
 public void showFPSView() {
   if (mFPSView == null) {
     mFPSView = new TextView(getContext());
     mFPSView.setTextColor(Color.RED);
     mWorkSpace.addView(mFPSView);
     SESceneManager.getInstance().setFPSView(mFPSView);
   }
 }
Ejemplo n.º 6
0
 private static void gotoProductDetailActivity(String productId) {
   IntentUtil.startProductDetailActivity(
       SESceneManager.getInstance().getGLActivity(),
       productId,
       0,
       null,
       Utils.isScreenOrientationPortrait());
 }
Ejemplo n.º 7
0
 public void init(Context context) {
   File file = new File(HomeUtils.get3DHomePath() + File.separator + ".debug");
   if (file.exists()) {
     HomeUtils.DEBUG = true;
   }
   System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
   SESceneManager.getInstance().initEngine(context);
   SESceneManager.getInstance().enableLight(true);
   SESceneManager.setDebug_JNI(HomeUtils.DEBUG);
   createOrUpgradeDB();
   LauncherModel.getInstance().loadAllData(false);
   mTimeCallBacks = new ArrayList<TimeChangeCallBack>();
   mAppWidgetManager = AppWidgetManager.getInstance(context);
   mAppIconBackgroundType = SettingsActivity.getAppIconBackgroundType(getContext());
   mShowAppShef = SettingsActivity.getShowShelfSetting(getContext());
   mShowDeskObjectShef = SettingsActivity.getShowDeskObjectShelfSetting(getContext());
   mShowAllIndicator = SettingsActivity.isEnableWallIndicator(getContext());
   mShowHelpDialog = !SettingsActivity.getHelpStatus(getContext());
   mCurSceneOrientation = SceneOrientation.AUTO_PORT;
 }
Ejemplo n.º 8
0
 public void removeTimeCallBack(final TimeChangeCallBack callBack) {
   SESceneManager.getInstance()
       .runInUIThread(
           new Runnable() {
             public void run() {
               if (callBack != null) {
                 mTimeCallBacks.remove(callBack);
               }
             }
           });
 }
Ejemplo n.º 9
0
 public void addTimeCallBack(final TimeChangeCallBack callBack) {
   SESceneManager.getInstance()
       .runInUIThread(
           new Runnable() {
             public void run() {
               if (!mTimeCallBacks.contains(callBack)) {
                 mTimeCallBacks.add(callBack);
                 callBack.onTimeChanged();
               }
             }
           });
 }
Ejemplo n.º 10
0
 public ObjectInfo() {
   mIndex = 0;
   mSlotType = -1;
   mShaderType = 0;
   mObjectSlot = new ObjectSlot();
   mIsNativeObject = false;
   mVesselIndex = 0;
   mContext = SESceneManager.getInstance().getContext();
   mContentResolver = mContext.getContentResolver();
   mActionStatus = ACTION_CAN_CHANGE_BIND;
   mID = -1;
   mFaceColor = -1;
 }
Ejemplo n.º 11
0
  public boolean startActivityForResult(final Intent intent, final int requestCode) {
    SESceneManager.getInstance()
        .runInUIThread(
            new Runnable() {
              public void run() {
                try {
                  SESceneManager.getInstance()
                      .getGLActivity()
                      .startActivityForResult(intent, requestCode);
                } catch (Exception e) {

                }
              }
            });
    return true;
  }
Ejemplo n.º 12
0
  public boolean startActivity(final Intent intent) {
    mIntent = intent;
    SESceneManager.getInstance()
        .runInUIThread(
            new Runnable() {
              public void run() {
                if (mIntent != null) {
                  try {
                    getContext().startActivity(mIntent);
                  } catch (Exception e) {

                  }
                }
              }
            });
    return true;
  }
Ejemplo n.º 13
0
 public static boolean isExistingProductId(String productId) {
   boolean existing = false;
   final String whereProductId = ModelColumns.PRODUCT_ID + "=?";
   Cursor cursor =
       SESceneManager.getInstance()
           .getGLActivity()
           .getContentResolver()
           .query(
               ModelColumns.CONTENT_URI,
               new String[] {ModelColumns.OBJECT_NAME},
               whereProductId,
               new String[] {productId},
               null);
   if (cursor != null && cursor.getCount() > 0) {
     existing = true;
   }
   if (cursor != null) {
     cursor.close();
   }
   return existing;
 }
Ejemplo n.º 14
0
 private int getRequestedOrientation() {
   if (SESceneManager.getInstance().getGLActivity() == null) {
     return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
   }
   return SESceneManager.getInstance().getGLActivity().getRequestedOrientation();
 }
Ejemplo n.º 15
0
 private void setRequestedOrientation(int requestedOrientation) {
   if (SESceneManager.getInstance().getGLActivity() != null) {
     SESceneManager.getInstance().getGLActivity().setRequestedOrientation(requestedOrientation);
   }
 }
Ejemplo n.º 16
0
  public OptionMenu(Context context) {
    super(context, null, R.style.OptionMenuWindow);

    FrameLayout view =
        (FrameLayout)
            SESceneManager.getInstance()
                .getGLActivity()
                .getLayoutInflater()
                .inflate(R.layout.option_menu_pop, null);
    String[] menuStrings = context.getResources().getStringArray(R.array.menus);
    mMenu0 = (TextView) view.findViewById(R.id.menu00);
    mMenu0.setText(menuStrings[0]);
    mMenu0.setOnClickListener(mClickListener);
    mMenu1 = (TextView) view.findViewById(R.id.menu01);
    mMenu1.setOnClickListener(mClickListener);
    mMenu1.setText(menuStrings[1]);
    mMenu2 = (TextView) view.findViewById(R.id.menu02);
    mMenu2.setOnClickListener(mClickListener);
    mMenu2.setText(menuStrings[2]);
    mMenu3 = (TextView) view.findViewById(R.id.menu03);
    mMenu3.setOnClickListener(mClickListener);
    mMenu3.setText(menuStrings[3]);

    view.setOnKeyListener(mOnKeyListener);
    view.setFocusableInTouchMode(true);
    setContentView(view);

    setFocusable(true);
    setTouchable(true);
    setOutsideTouchable(true);
    setWidth(LayoutParams.WRAP_CONTENT);
    setHeight(LayoutParams.WRAP_CONTENT);

    setAnimationStyle(R.style.option_menu_anim_style);

    mAnimation0 = new Rotate3d(180, 0, mMenu0);
    mAnimation0.setDuration(700);
    mAnimation0.setFillAfter(false);
    mAnimation0.setInterpolator(new AccelerateInterpolator());
    mListener0 = new RotateListener(mMenu0);
    mAnimation0.setAnimationListener(mListener0);

    mAnimation1 = new Rotate3d(180, 0, mMenu1);
    mAnimation1.setDuration(700);
    mAnimation1.setFillAfter(false);
    mAnimation1.setInterpolator(new AccelerateInterpolator());
    mListener1 = new RotateListener(mMenu1);
    mAnimation1.setAnimationListener(mListener1);

    mAnimation2 = new Rotate3d(180, 0, mMenu2);
    mAnimation2.setDuration(700);
    mAnimation2.setFillAfter(false);
    mAnimation2.setInterpolator(new AccelerateInterpolator());
    mListener2 = new RotateListener(mMenu2);
    mAnimation2.setAnimationListener(mListener2);

    mAnimation3 = new Rotate3d(180, 0, mMenu3);
    mAnimation3.setDuration(700);
    mAnimation3.setFillAfter(false);
    mAnimation3.setInterpolator(new AccelerateInterpolator());
    mListener3 = new RotateListener(mMenu3);
    mAnimation3.setAnimationListener(mListener3);

    // 只有设置背景后点击空白区Window才能消失(即点击无背景区Window消失)
    ColorDrawable cd = new ColorDrawable(Color.TRANSPARENT);
    setBackgroundDrawable(cd);
  }