List of usage examples for android.app LocalActivityManager LocalActivityManager
public LocalActivityManager(Activity parent, boolean singleMode)
From source file:com.custom.music.MusicBrowserActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(TAG, ">>> onCreate", Log.APP); setContentView(R.layout.main);//from w w w . ja va 2s . c o m setVolumeControlStream(AudioManager.STREAM_MUSIC); mToken = MusicUtils.bindToService(this, this); mHasMenukey = ViewConfiguration.get(this).hasPermanentMenuKey(); mActivityManager = new LocalActivityManager(this, false); mActivityManager.dispatchCreate(savedInstanceState); mTabHost = getTabHost(); initTab(); mCurrentTab = MusicUtils.getIntPref(this, SAVE_TAB, ARTIST_INDEX); Log.i(TAG, "onCreate mCurrentTab: " + mCurrentTab, Log.APP); if ((mCurrentTab < 0) || (mCurrentTab >= mTabCount)) { mCurrentTab = ARTIST_INDEX; } /// M: reset the defalt tab value if (mCurrentTab == ARTIST_INDEX) { mTabHost.setCurrentTab(ALBUM_INDEX); } mTabHost.setOnTabChangedListener(this); initPager(); mViewPager = (ViewPager) findViewById(R.id.viewpage); mViewPager.setAdapter(new MusicPagerAdapter()); mViewPager.setOnPageChangeListener(this); //add by zjw categories = (TextView) findViewById(R.id.categorisetab); categories.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { showPupopMenu(categories); } }); IntentFilter f = new IntentFilter(); f.addAction(MusicUtils.SDCARD_STATUS_UPDATE); registerReceiver(mSdcardstatustListener, f); createFakeMenu(); /// M: Init search button click listener in nowplaying. // initSearchButton(); Log.i(TAG, "onCreate >>>", Log.APP); }
From source file:com.example.tabstemplate.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate"); setContentView(R.layout.main);//from w ww . j a v a 2 s. c o m mActivityManager = new LocalActivityManager(this, false); mActivityManager.dispatchCreate(savedInstanceState); mTabHost = getTabHost(); initTab(); mCurrentTab = TAB0_INDEX; Log.d(TAG, "onCreate mCurrentTab:" + mCurrentTab); mTabHost.setOnTabChangedListener(this); initPager(); mViewPager = (ViewPager) findViewById(R.id.viewpage); mViewPager.setAdapter(new MusicPagerAdapter()); mViewPager.setOnPageChangeListener(this); }
From source file:org.zywx.wbpalmstar.plugin.uexiconlist.EUExIconList.java
/** * @param jsonData/*from w w w . j a v a2 s . c o m*/ * @return */ private String openIconList(final String jsonData) { String errorMsg = ""; if (!isIconListOpened) { ((Activity) mContext).runOnUiThread(new Runnable() { @Override public void run() { Rect outRect = new Rect(); ((Activity) mContext).getWindow().getDecorView().getWindowVisibleDisplayFrame(outRect); try { JSONObject json = new JSONObject(); json.put(JK_WIDGET_PATH, mWWidgetData.getWidgetPath()); json.put(JK_WIDGET_TYPE, mWWidgetData.m_wgtType); Intent intent = new Intent(mContext, IconListActivity.class); intent.putExtra(WIDGET_INFO, json.toString()); intent.putExtra(ITEM_INFO, jsonData); if (mgr == null) { mgr = new LocalActivityManager((Activity) mContext, false); mgr.dispatchCreate(null); } Window window = mgr.startActivity(IconListActivity.TAG, intent); View marketDecorView = window.getDecorView(); if (IconListOption.isFollowWebRoll()) { AbsoluteLayout.LayoutParams lp = new AbsoluteLayout.LayoutParams( (int) UIConfig.getWidth(), (int) UIConfig.getHight(), (int) UIConfig.getX(), (int) UIConfig.getY()); ViewGroup viewGroup = (ViewGroup) marketDecorView.getParent(); if (viewGroup != null) { viewGroup.removeView(marketDecorView); } addViewToWebView(marketDecorView, lp, IconListActivity.TAG); } else { RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( (int) UIConfig.getWidth(), (int) UIConfig.getHight()); lp.leftMargin = (int) UIConfig.getX(); lp.topMargin = (int) UIConfig.getY(); addViewToCurrentWindow(marketDecorView, lp); } isIconListOpened = true; mIconListActivity = (IconListActivity) mgr.getActivity(IconListActivity.TAG); mIconListActivity.initView(EUExIconList.this); } catch (JSONException e) { e.printStackTrace(); } }// end run() }); } // end if else { errorMsg = ERROR_MSG_ALREADY_OPEN; } return errorMsg; }
From source file:org.zywx.wbpalmstar.plugin.uexiconlist.EUExIconList.java
public void close(String[] parm) { LogUtils.logDebug(true, "into close"); if (isIconListOpened) { isIconListOpened = false;//w w w.j av a 2s . c o m ((Activity) mContext).runOnUiThread(new Runnable() { @Override public void run() { if (mgr == null) { mgr = new LocalActivityManager((Activity) mContext, false); mgr.dispatchCreate(null); } View decorView = mIconListActivity.getWindow().getDecorView(); decorView.setVisibility(View.GONE); if (IconListOption.isFollowWebRoll()) { removeViewFromWebView(IconListActivity.TAG); } else { removeViewFromCurrentWindow(decorView); } mgr.destroyActivity(IconListActivity.TAG, true); mIconListActivity = null; } }); } mEuExIconListHandler.send2Callback(WHAT_CB_CLOSE, null); }