List of usage examples for android.view View getParent
public final ViewParent getParent()
From source file:com.univ.helsinki.app.MainActivity.java
/** * Handling of Splash screen/* ww w . j a va 2 s. co m*/ */ private void activateSplashScreen(final View view) { // UP to DOWN Animation final float direction = -1; final float yDelta = (getScreenHeight() - (2 * view.getHeight())); final Animation animation = new TranslateAnimation(0, 0, 0, yDelta * direction); animation.setDuration(1500); animation.setAnimationListener(new AnimationListener() { public void onAnimationStart(Animation animation) { getActionBar().show(); } public void onAnimationRepeat(Animation animation) { } public void onAnimationEnd(Animation animation) { view.setVisibility(View.GONE); showTitle(); View titleView = getWindow().findViewById(android.R.id.title); if (titleView != null) { ViewParent parent = titleView.getParent(); if (parent != null && (parent instanceof View)) { View parentView = (View) parent; parentView.setVisibility(View.VISIBLE); } } } }); view.startAnimation(animation); }
From source file:com.acceleratedio.pac_n_zoom.AnimActivity.java
public void disableClipOnParents(View v) { if (v.getParent() == null) return;// ww w . j a v a2 s .c o m if (v instanceof ViewGroup) { ((ViewGroup) v).setClipChildren(false); ((ViewGroup) v).setClipToPadding(false); } if (v.getParent() instanceof View) disableClipOnParents((View) v.getParent()); }
From source file:com.geoffreybuttercrumbs.arewethereyet.DrawerFragment.java
@Override public void onClick(View v) { SharedPreferences prefs = getActivity().getSharedPreferences("AreWeThereYet", Context.MODE_WORLD_WRITEABLE); Intent intent = getActivity().getIntent(); intent.setClass(getActivity(), ZonePicker.class); ZonePicker sfa = (ZonePicker) getActivity(); switch (((View) v.getParent()).getId()) { case R.id.group_pinned: intent.putExtra(RADIUS, prefs.getInt(SAVED_RADIUS_KEY + v.findViewById(R.id.saveCB).getTag(), 2000)); intent.putExtra(LOC, retrieveSaved((Integer) v.findViewById(R.id.saveCB).getTag())); getActivity().setResult(Activity.RESULT_OK, intent); sfa.setNewAlarmZone(intent.getExtras()); sfa.showContent();//from w w w. j a v a 2 s .co m break; case R.id.group_recent: intent.putExtra(RADIUS, prefs.getInt(POINT_RADIUS_KEY + v.findViewById(R.id.saveCB).getTag(), 2000)); intent.putExtra(LOC, retrieveRecent((Integer) v.findViewById(R.id.saveCB).getTag())); getActivity().setResult(Activity.RESULT_OK, intent); sfa.setNewAlarmZone(intent.getExtras()); sfa.showContent(); break; } }
From source file:com.ntsync.android.sync.activities.ShopActivity.java
public void handleBuy(View view) { int position = getListView().getPositionForView((View) view.getParent()); Price price = (Price) getListView().getItemAtPosition(position); if (price != null) { String description = getOrderText(price); PayPalPayment payment = new PayPalPayment(price.getPrice(), price.getCurrency(), description); Intent intent = new Intent(this, PaymentActivity.class); if (Constants.USE_RELEASE_CONFIG) { intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, PAYPAL_RELEASE_CLIENTID); intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, "markus@grieder.me"); } else {// www.j a v a 2 s. co m // sandbox: use PaymentActivity.ENVIRONMENT_SANDBOX intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, PaymentActivity.ENVIRONMENT_SANDBOX); intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, PAYPAL_SANDBOX_CLIENTID); intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, "markus-facilitator@grieder.me"); } // Direct Credit is only possible with a UK/Canada PayPal-Account intent.putExtra(PaymentActivity.EXTRA_SKIP_CREDIT_CARD, true); // Provide a payerId that uniquely identifies a user within the // scope of your system, such as an email address or user ID. intent.putExtra(PaymentActivity.EXTRA_PAYER_ID, accountName); intent.putExtra(PaymentActivity.EXTRA_PAYMENT, payment); selectedPriceId = price.getPriceId(); startActivityForResult(intent, 0); } }
From source file:com.todoroo.astrid.adapter.TaskAdapter.java
private ViewHolder getTagFromCheckBox(View v) { return (ViewHolder) ((View) v.getParent()).getTag(); }
From source file:com.taobao.weex.ui.view.WXCirclePageAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { View pageView = null; try {/*from w w w . ja v a 2 s.co m*/ pageView = shadow.get(position); if (WXEnvironment.isApkDebugable()) { WXLogUtils.d("onPageSelected >>>> instantiateItem >>>>> position:" + position + ",position % getRealCount()" + position % getRealCount()); } if (pageView.getParent() == null) { container.addView(pageView); } else { ((ViewGroup) pageView.getParent()).removeView(pageView); container.addView(pageView); } } catch (Exception e) { WXLogUtils.e("[CirclePageAdapter] instantiateItem: ", e); } return pageView; }
From source file:com.android.calendar.selectcalendars.SelectSyncedCalendarsMultiAccountAdapter.java
@Override protected void bindChildView(View view, Context context, Cursor cursor, boolean isLastChild) { final long id = cursor.getLong(ID_COLUMN); String name = cursor.getString(NAME_COLUMN); String owner = cursor.getString(OWNER_COLUMN); final String accountName = cursor.getString(ACCOUNT_COLUMN); final String accountType = cursor.getString(ACCOUNT_TYPE_COLUMN); int color = Utils.getDisplayColorFromColor(cursor.getInt(COLOR_COLUMN)); final View colorSquare = view.findViewById(R.id.color); colorSquare.setEnabled(mCache.hasColors(accountName, accountType)); colorSquare.setBackgroundColor(color); final View delegateParent = (View) colorSquare.getParent(); delegateParent.post(new Runnable() { @Override// w ww . j av a 2 s. co m public void run() { final Rect r = new Rect(); colorSquare.getHitRect(r); r.top -= mColorViewTouchAreaIncrease; r.bottom += mColorViewTouchAreaIncrease; r.left -= mColorViewTouchAreaIncrease; r.right += mColorViewTouchAreaIncrease; delegateParent.setTouchDelegate(new TouchDelegate(r, colorSquare)); } }); colorSquare.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!mCache.hasColors(accountName, accountType)) { return; } if (mColorPickerDialog == null) { mColorPickerDialog = CalendarColorPickerDialog.newInstance(id, mIsTablet); } else { mColorPickerDialog.setCalendarId(id); } mFragmentManager.executePendingTransactions(); if (!mColorPickerDialog.isAdded()) { mColorPickerDialog.show(mFragmentManager, COLOR_PICKER_DIALOG_TAG); } } }); if (mIsDuplicateName.containsKey(name) && mIsDuplicateName.get(name) && !name.equalsIgnoreCase(owner)) { name = new StringBuilder(name).append(Utils.OPEN_EMAIL_MARKER).append(owner) .append(Utils.CLOSE_EMAIL_MARKER).toString(); } setText(view, R.id.calendar, name); // First see if the user has already changed the state of this calendar Boolean sync = mCalendarChanges.get(id); if (sync == null) { sync = cursor.getInt(SYNCED_COLUMN) == 1; mCalendarInitialStates.put(id, sync); } CheckBox button = (CheckBox) view.findViewById(R.id.sync); button.setChecked(sync); setText(view, R.id.status, sync ? mSyncedText : mNotSyncedText); view.setTag(TAG_ID_CALENDAR_ID, id); view.setTag(TAG_ID_SYNC_CHECKBOX, button); view.setOnClickListener(this); }
From source file:com.android.contacts.common.ContactPhotoManager.java
private static boolean isChildView(View parent, View potentialChild) { return potentialChild.getParent() != null && (potentialChild.getParent() == parent || (potentialChild.getParent() instanceof ViewGroup && isChildView(parent, (ViewGroup) potentialChild.getParent()))); }
From source file:com.nikolak.weatherapp.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container); //swipeLayout.setOnRefreshListener(this); settings = this.getSharedPreferences(PREFS_NAME, 0); buildGoogleApiClient();//w ww.j ava2 s. c o m ScrollView mainScroll = (ScrollView) findViewById(R.id.mainScrollView); hourLIst = (ListView) findViewById(R.id.twoDayList); hourLIst.setAdapter(new HourListAdapter(this, forecast.hourly.getHourData())); weekList = (ListView) findViewById(R.id.weekList); weekList.setAdapter(new WeekListAdapter(this, forecast.daily.getDayData())); // Assign current weather card elements to variables currentIcon = (ImageView) findViewById(R.id.currentIcon); currentDescription = (TextView) findViewById(R.id.currentDescription); currentFeelsLike = (TextView) findViewById(R.id.currentFeelsLike); currentWind = (TextView) findViewById(R.id.currentWind); currentHumidity = (TextView) findViewById(R.id.currentHumidity); currentTemperature = (TextView) findViewById(R.id.currentTemperature); currentLow = (TextView) findViewById(R.id.currentLow); currentHigh = (TextView) findViewById(R.id.currentHigh); // Assign next hour/day card elements to variables nextHourDesc = (TextView) findViewById(R.id.nextHourDesc); nextDayDesc = (TextView) findViewById(R.id.nextDayDesc); // Add on touch listeners to allow scrolling of the lists inside scrollview mainScroll.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { findViewById(R.id.twoDayList).getParent().requestDisallowInterceptTouchEvent(false); return false; } }); hourLIst.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { v.getParent().requestDisallowInterceptTouchEvent(true); return false; } }); weekList.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { v.getParent().requestDisallowInterceptTouchEvent(true); return false; } }); }
From source file:android.support.transition.ChangeTransform.java
private void captureValues(TransitionValues transitionValues) { View view = transitionValues.view; if (view.getVisibility() == View.GONE) { return;/*from w ww . ja v a 2 s .c o m*/ } transitionValues.values.put(PROPNAME_PARENT, view.getParent()); Transforms transforms = new Transforms(view); transitionValues.values.put(PROPNAME_TRANSFORMS, transforms); Matrix matrix = view.getMatrix(); if (matrix == null || matrix.isIdentity()) { matrix = null; } else { matrix = new Matrix(matrix); } transitionValues.values.put(PROPNAME_MATRIX, matrix); if (mReparent) { Matrix parentMatrix = new Matrix(); ViewGroup parent = (ViewGroup) view.getParent(); ViewUtils.transformMatrixToGlobal(parent, parentMatrix); parentMatrix.preTranslate(-parent.getScrollX(), -parent.getScrollY()); transitionValues.values.put(PROPNAME_PARENT_MATRIX, parentMatrix); transitionValues.values.put(PROPNAME_INTERMEDIATE_MATRIX, view.getTag(R.id.transition_transform)); transitionValues.values.put(PROPNAME_INTERMEDIATE_PARENT_MATRIX, view.getTag(R.id.parent_matrix)); } }