// Setup @Override protected void onCreate(Bundle savedInstanceState) { // Log.v("SDL", "onCreate()"); super.onCreate(savedInstanceState); // So we can call stuff from static callbacks mSingleton = this; // Set up the surface mSurface = new SDLSurface(getApplication()); // Make sure this variable is initialized here! mExitCalledFromJava = false; if (Build.VERSION.SDK_INT >= 12) { mJoystickHandler = new SDLJoystickHandler_API12(); } else { mJoystickHandler = new SDLJoystickHandler(); } mLayout = new AbsoluteLayout(this); mLayout.addView(mSurface); setContentView(mLayout); }
/** Gets the system message to be displayed at the top of the page on all views */ @Exported public String getSystemMessage() { if (owner.getSystemMessage() != null && !owner.getSystemMessage().isEmpty()) { this.systemmessage = owner.getSystemMessage(); } return systemmessage; }
@Override public View getChildView( int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { ViewGroup item; if (convertView != null && convertView.getId() == R.id.child_item) { // We can reuse the view item = (ViewGroup) convertView; } else { // We create a new View item = (ViewGroup) inflater.inflate(R.layout.child_item_layout, parent, false); } ChildClass child = (ChildClass) getChild(groupPosition, childPosition); TextView nameView = (TextView) item.findViewById(R.id.child_name); nameView.setText(child.getName()); TextView sizeView = (TextView) item.findViewById(R.id.child_text); sizeView.setText(child.getText()); return item; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout containing a title and body text. ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.estadistica_view, container, false); int idEstadistica = this.mPageNumber; // Titulo y descripcion de estadistica TextView tituloEstadistica = (TextView) rootView.findViewById(R.id.TxtTituloEstadistica); TextView descEstadistica = (TextView) rootView.findViewById(R.id.TxtDescEstadistica); tituloEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getTitulo()); descEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getDescripcion()); rootView.addView( new EstadisticaViewLayout(Utilidades.getAppContext()) .getView(RelacionEstadisticas.getRelacion().get(idEstadistica))); // } // catch (Exception e) // { // Toast.makeText(Utilidades.getAppContext(), "error: " + e.getLocalizedMessage(), // Toast.LENGTH_LONG).show(); // Log.e("ERROR", e.getLocalizedMessage()); // } // Set the title view to show the page number. /*((TextView) rootView.findViewById(android.R.id.text1)).setText( getString(R.string.title_template_step, mPageNumber + 1));*/ return rootView; }
/** Deletes this view. */ public synchronized void doDoDelete(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { requirePOST(); checkPermission(DELETE); owner.deleteView(this); rsp.sendRedirect2(req.getContextPath() + "/" + owner.getUrl()); }
/** Renames this view. */ public void rename(String newName) throws Failure, FormException { if (name.equals(newName)) return; // noop checkGoodName(newName); if (owner.getView(newName) != null) throw new FormException(Messages.Hudson_ViewAlreadyExists(newName), "name"); String oldName = name; name = newName; owner.onViewRenamed(this, oldName, newName); }
void checkFocus() { final T adapter = getAdapter(); final boolean empty = adapter == null || adapter.getCount() == 0; final boolean focusable = !empty || isInFilterMode(); super.setFocusableInTouchMode(focusable && mDesiredFocusableInTouchModeState); super.setFocusable(focusable && mDesiredFocusableState); if (mEmptyView != null) { updateEmptyStatus(adapter == null || adapter.isEmpty()); } }
@Test(expected = RuntimeException.class) public void checkedClick_shouldThrowIfViewIsNotVisible() throws Exception { ViewGroup grandParent = new LinearLayout(null); ViewGroup parent = new LinearLayout(null); grandParent.addView(parent); parent.addView(view); grandParent.setVisibility(View.GONE); shadowOf(view).checkedPerformClick(); }
/** @Method: openPopupwin @Description: popupwindow�����ü���Ӧ */ private void openPopupwin() { LayoutInflater mLayoutInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); ViewGroup menuView = (ViewGroup) mLayoutInflater.inflate(R.layout.gridview_popx, null, true); menuGrid = (GridView) menuView.findViewById(R.id.popgridview); menuGrid.setAdapter(getMenuAdapter(menu_name_array, menu_image_array)); // menuGrid�����ò��� menuGrid.requestFocus(); // ����popupwindow���������Ϣ menuGrid.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { menuPopupWindow.dismiss(); if (arg2 == 0) { // �ϴ� albumPopupwin(); } else if (arg2 == 1) // �༭ { Intent intent = new Intent(LocalImageView.this, PictureEditActivity.class); intent.putExtra("photopath", photoPath); startActivity(intent); } else if (arg2 == 2) // ɾ�� { sureToDelete(); } } }); // ���㵽��gridview�ϣ�������Ҫ����˴��ļ����¼����������ֲ���Ӧ�����¼������ menuGrid.setOnKeyListener( new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_MENU: if (menuPopupWindow != null && menuPopupWindow.isShowing()) { menuPopupWindow.dismiss(); } break; } System.out.println("menuGridfdsfdsfdfd"); return true; } }); // ��ʾpopupwindow menuPopupWindow = new PopupWindow(menuView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true); menuPopupWindow.setBackgroundDrawable(new BitmapDrawable()); menuPopupWindow.setAnimationStyle(R.style.PopupAnimation); menuPopupWindow.showAtLocation( findViewById(R.id.filpperparent), Gravity.BOTTOM | Gravity.BOTTOM, 0, 0); menuPopupWindow.update(); }
private static void destroyResources(View view) { view.destroyHardwareResources(); if (view instanceof ViewGroup) { ViewGroup group = (ViewGroup) view; int count = group.getChildCount(); for (int i = 0; i < count; i++) { destroyResources(group.getChildAt(i)); } } }
@Test public void shouldKnowIfThisOrAncestorsAreVisible() throws Exception { assertTrue(shadowOf(view).derivedIsVisible()); ViewGroup grandParent = new LinearLayout(null); ViewGroup parent = new LinearLayout(null); grandParent.addView(parent); parent.addView(view); grandParent.setVisibility(View.GONE); assertFalse(shadowOf(view).derivedIsVisible()); }
public void setDrawerContentView(int layout_id) { LayoutInflater inflater = LayoutInflater.from(this); rightSideAppScreenView = inflater.inflate(layout_id, null); mAttachedViewID = rightSideAppScreenView.getId(); mHeaderRelativeLayout = (RelativeLayout)rightSideAppScreenView.findViewById(R.id.navigation_header); mTitleTextView = (TextView)mHeaderRelativeLayout.findViewById(R.id.tv_header_title); mSubtitleTextView = (TextView)mHeaderRelativeLayout.findViewById(R.id.tv_header_subtitle); mHeaderImageView = (ImageView)mHeaderRelativeLayout.findViewById(R.id.iv_header_icon); mTimeTrackerTextView = (TextView) mHeaderRelativeLayout.findViewById(R.id.menu_header_time_tracker); mTimerLayout = (LinearLayout)mHeaderRelativeLayout.findViewById(R.id.timer_layout); mSubtitleTextView.setOnClickListener(this); mTimeTrackerTextView.setOnClickListener(this); mTimerLayout.setOnClickListener(this); ViewGroup tabBar = (ViewGroup) rightSideAppScreenView.findViewById(mAttachedViewID); btnSlide = (ImageButton) tabBar.findViewById(R.id.bt_slider); btnSlide.setVisibility(View.VISIBLE); mSliderClickListener = new ClickListenerForScrolling(mSliderView, leftSideListView, menuOut); btnSlide.setOnClickListener(mSliderClickListener); mHomeBtnLayout = (LinearLayout)mHeaderRelativeLayout.findViewById(R.id.home_layout); if(mHomeBtnLayout!= null) { mHomeBtnLayout.setOnClickListener(mSliderClickListener); } View[] children = new View[] { leftSideListView, rightSideAppScreenView }; int scrollToViewIdx = 1; mSliderView.initViews(children, scrollToViewIdx, new SizeCallbackForMenu(btnSlide)); setSubTitle(AppConfig.getAppConfigInstance(this).getUserName()); setTitle(getResources().getString(R.string.app_title)); displayHeaderMenuBar(); //If learn mode is active, the titlebar color must be changed. if (AppConfig.getAppConfigInstance(this).getDeviceSynched()) mPresenter.checkLearnMode(this, rightSideAppScreenView, mSubtitleTextView); }
public void save() throws IOException { // persistence is a part of the owner // due to initialization timing issue, it can be null when this method is called if (owner != null) { owner.save(); } }
@Override public Object instantiateItem(ViewGroup container, int position) { BasePager pager = mPagerList.get(position); container.addView(pager.mRootView); // pager.initData();// 初始化数据.... 不要放在此处初始化数据, 否则会预加载下一个页面 return pager.mRootView; }
@Override public void scrollTo(int x, int y) { super.scrollTo(x, y); mScrollX = x; mViewBehind.scrollBehindTo(mContent, x, y); ((SlidingMenu) getParent()).manageLayers(getPercentOpen()); }
/** Backward-compatible way of getting {@code getOwner().getItemGroup()} */ public ItemGroup<? extends TopLevelItem> getOwnerItemGroup() { try { return owner.getItemGroup(); } catch (AbstractMethodError e) { return Jenkins.getInstance(); } }
private void flipPage(final boolean forward) { if (!current.isFirstPage()) flipStarted = true; this.previousDirection = this.forward; this.forward = forward; if (!forward) decreasePageNo(); int nextPageIndex = forward ? currentPageIndex + 1 : currentPageIndex; System.out.println("debug flip"); if (currentPageIndex == -1 && forward) { // we are first timer currentPageIndex++; container.addView(current, pageViewLayoutParamsFront); slideToNextPageAsynchronized(); } else if (nextPageIndex > 0) { if (current.isLastPage() && forward) { finishActivity(); } slideToNextPageAsynchronized(); } else { if (pageIndexView.isHasUpdate()) { this.reload(); return; } else { finishActivity(); } } System.out.println("debug flip done"); }
public static View create(StaplerRequest req, StaplerResponse rsp, ViewGroup owner) throws FormException, IOException, ServletException { String requestContentType = req.getContentType(); if (requestContentType == null) throw new Failure("No Content-Type header set"); boolean isXmlSubmission = requestContentType.startsWith("application/xml") || requestContentType.startsWith("text/xml"); String name = req.getParameter("name"); checkGoodName(name); if (owner.getView(name) != null) throw new FormException(Messages.Hudson_ViewAlreadyExists(name), "name"); String mode = req.getParameter("mode"); if (mode == null || mode.length() == 0) { if (isXmlSubmission) { View v; v = createViewFromXML(name, req.getInputStream()); v.owner = owner; rsp.setStatus(HttpServletResponse.SC_OK); return v; } else throw new FormException(Messages.View_MissingMode(), "mode"); } // create a view View v = all().findByName(mode).newInstance(req, req.getSubmittedForm()); v.owner = owner; // redirect to the config screen rsp.sendRedirect2(req.getContextPath() + '/' + v.getUrl() + v.getPostConstructLandingPage()); return v; }
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // Draw the shadow canvas.drawOval(mShadowBounds, mShadowPaint); // TODO 0 Slices String label = ""; // if(mData.size() > 0) label = mData.get(mCurrentItem).mLabel; // else // label = NO_DATA_SLICE; // Draw the label text if (getShowText()) { canvas.drawText(label, mTextX, mTextY, mTextPaint); } // If the API level is less than 11, we can't rely on the view animation system to // do the scrolling animation. Need to tick it here and call postInvalidate() until the // scrolling is done. if (Build.VERSION.SDK_INT < 11) { tickScrollAnimation(); if (!mScroller.isFinished()) { postInvalidate(); } } }
private void FullSwipeTrigger() { Log.d("FUll Swipe trigger call", "Works**********************" + mDismissAnimationRefCount); old_mDownView = mDownView; int width; if (SwipeType == Single || SwipeType == Dismiss) { width = textwidth; if (SwipeType == Dismiss) ++mDismissAnimationRefCount; } else { width = largewidth; } mDownView .animate() .translationX(-width) .setDuration(300) .setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); moptionsDisplay = true; stagged_position = temp_position; mDownView_parent_txt1.setOnTouchListener(new touchClass()); // if(SwipeType==Double) // mDownView_parent_txt2.setOnTouchListener(new // touchClass()); } @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); } }); }
/** Dismisses the SuperCardToast without an animation. */ public void dismissImmediately() { ManagerSuperCardToast.getInstance().remove(this); if (mHandler != null) { mHandler.removeCallbacks(mHideRunnable); mHandler.removeCallbacks(mHideWithAnimationRunnable); mHandler = null; } if (mToastView != null && mViewGroup != null) { mViewGroup.removeView(mToastView); if (mOnDismissListener != null) { mOnDismissListener.onDismiss(getView()); } mToastView = null; } else { Log.e(TAG, ERROR_VIEWCONTAINERNULL); } }
public View getView(int position, View convertView, ViewGroup parent) { final View view = (convertView != null) ? convertView : LayoutInflater.from(parent.getContext()) .inflate(R.layout.bookmark_item, parent, false); final ImageView imageView = (ImageView) view.findViewById(R.id.bookmark_item_icon); final TextView textView = (TextView) view.findViewById(R.id.bookmark_item_text); final TextView bookTitleView = (TextView) view.findViewById(R.id.bookmark_item_booktitle); final Bookmark bookmark = getItem(position); if (bookmark == null) { imageView.setVisibility(View.VISIBLE); imageView.setImageResource(R.drawable.ic_list_plus); textView.setText(ZLResource.resource("bookmarksView").getResource("new").getValue()); bookTitleView.setVisibility(View.GONE); } else { imageView.setVisibility(View.GONE); textView.setText(bookmark.getText()); if (myCurrentBook) { bookTitleView.setVisibility(View.GONE); } else { bookTitleView.setVisibility(View.VISIBLE); bookTitleView.setText(bookmark.getBookTitle()); } } return view; }
private void initValue(Activity activity) { this.activity = activity; leftMenuItems = new ArrayList<ResideMenuItem>(); rightMenuItems = new ArrayList<ResideMenuItem>(); ignoredViews = new ArrayList<View>(); viewDecor = (ViewGroup) activity.getWindow().getDecorView(); viewActivity = new TouchDisableView(this.activity); View mContent = viewDecor.getChildAt(0); viewDecor.removeViewAt(0); viewActivity.setContent(mContent); addView(viewActivity); ViewGroup parent = (ViewGroup) scrollViewLeftMenu.getParent(); parent.removeView(scrollViewLeftMenu); parent.removeView(scrollViewRightMenu); }
@Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); // Draw the margin drawable if needed. mViewBehind.drawShadow(mContent, canvas); mViewBehind.drawFade(mContent, canvas, getPercentOpen()); mViewBehind.drawSelector(mContent, canvas, getPercentOpen()); }
@Override public HomeListAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()) .inflate(R.layout.listview_homemenu, viewGroup, false); ViewHolder vh = new ViewHolder(view); return vh; }
@Override public void run() { if (mViewGroup != null) { mViewGroup.postInvalidate(); } }
@Override protected void onFinishInflate() { final int childCount = getChildCount(); if (childCount > 2) { throw new IllegalStateException("PtrFrameLayout only can host 2 elements"); } else if (childCount == 2) { if (mHeaderId != 0 && mHeaderView == null) { mHeaderView = findViewById(mHeaderId); } if (mContainerId != 0 && mContent == null) { mContent = findViewById(mContainerId); } // not specify header or content if (mContent == null || mHeaderView == null) { View child1 = getChildAt(0); View child2 = getChildAt(1); if (child1 instanceof PtrUIHandler) { mHeaderView = child1; mContent = child2; } else if (child2 instanceof PtrUIHandler) { mHeaderView = child2; mContent = child1; } else { // both are not specified if (mContent == null && mHeaderView == null) { mHeaderView = child1; mContent = child2; } // only one is specified else { if (mHeaderView == null) { mHeaderView = mContent == child1 ? child2 : child1; } else { mContent = mHeaderView == child1 ? child2 : child1; } } } } } else if (childCount == 1) { mContent = getChildAt(0); } else { TextView errorView = new TextView(getContext()); errorView.setClickable(true); errorView.setTextColor(0xffff6600); errorView.setGravity(Gravity.CENTER); errorView.setTextSize(20); errorView.setText( "The content view in PtrFrameLayout is empty. Do you forget to specify its id in xml layout file?"); mContent = errorView; addView(mContent); } if (mHeaderView != null) { mHeaderView.bringToFront(); } super.onFinishInflate(); }
/** package* */ void toggleWordWrap() { ViewGroup vSrc = this.mWordWrap ? this.mWordWrapView : this.mNoWordWrapView; ViewGroup vDst = this.mWordWrap ? this.mNoWordWrapView : this.mWordWrapView; ViewGroup vSrcParent = this.mWordWrap ? this.mWordWrapView : (ViewGroup) this.mNoWordWrapView.getChildAt(0); ViewGroup vDstParent = this.mWordWrap ? (ViewGroup) this.mNoWordWrapView.getChildAt(0) : this.mWordWrapView; vSrc.setVisibility(View.GONE); vSrcParent.removeView(this.mEditor); vDstParent.addView(this.mEditor); vDst.setVisibility(View.VISIBLE); vDst.scrollTo(0, 0); this.mWordWrap = !this.mWordWrap; }
@Override public void removeView(View view) { super.removeView(view); final int typeView = (Integer) view.getTag(R.id.tag_type_view); if (typeView != TableAdapter.IGNORE_ITEM_VIEW_TYPE) { recycler.addRecycledView(view, typeView); } }
public void dismiss() { if (isShowing() && mPopupView != null) { WindowManagerImpl wm = WindowManagerImpl.getDefault(); wm.removeView(mPopupView); if (mPopupView != mContentView && (mPopupView instanceof ViewGroup)) ((ViewGroup) mPopupView).removeView(mContentView); mIsShowing = false; } }