Java Code Examples for android.view.ViewParent

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 2

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 3

From project ActionBarCompat, under directory /ActionBarCompat/src/sk/m217/actionbarcompat/.

Source file: ActionBarCompatHoneycomb.java

  22 
vote

public static void setHomeButtonEnabled(Activity activity,boolean enabled){
  View v=activity.findViewById(android.R.id.home);
  if (v != null) {
    ViewParent vp=v.getParent();
    if (vp != null && vp instanceof FrameLayout) {
      ((FrameLayout)vp).setEnabled(enabled);
      ((FrameLayout)vp).setClickable(enabled);
    }
  }
}
 

Example 4

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 5

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 6

From project andlytics, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 7

From project android-tether, under directory /android-misc-widgets/src/org/miscwidgets/widget/.

Source file: Panel.java

  22 
vote

@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  ViewParent parent=getParent();
  if (parent != null && parent instanceof FrameLayout) {
    mBringToFront=true;
  }
}
 

Example 8

From project androidquery, under directory /src/com/androidquery/.

Source file: AbstractAQuery.java

  22 
vote

/** 
 * Return a new AQuery object that uses the found parent as a root. If no parent with matching id is found, operating view will be null and isExist() will return false.
 * @param id the parent id
 * @return new AQuery object
 */
public T parent(int id){
  View node=view;
  View result=null;
  while (node != null) {
    if (node.getId() == id) {
      result=node;
      break;
    }
    ViewParent p=node.getParent();
    if (!(p instanceof View))     break;
    node=(View)p;
  }
  return create(result);
}
 

Example 9

From project androidZenWriter, under directory /library/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 10

From project Android_1, under directory /LeftNavBarExample/LeftNavBarLibrary/src/com/example/google/tv/leftnavbar/.

Source file: TitleBarView.java

  22 
vote

private static void removeFromParent(View view){
  if (view == null) {
    return;
  }
  ViewParent parent=view.getParent();
  if (parent != null) {
    ((ViewGroup)parent).removeView(view);
  }
}
 

Example 11

From project android_7, under directory /src/org/immopoly/android/widget/.

Source file: ViewPager.java

  22 
vote

ItemInfo infoForAnyChild(View child){
  ViewParent parent;
  while ((parent=child.getParent()) != this) {
    if (parent == null || !(parent instanceof View)) {
      return null;
    }
    child=(View)parent;
  }
  return infoForChild(child);
}
 

Example 12

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: Profiler.java

  22 
vote

static void profileViewCreate(Window win,String tag){
  if (false) {
    ViewParent p=(ViewParent)win.getDecorView();
    while (p instanceof View) {
      p=((View)p).getParent();
    }
  }
}
 

Example 13

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/.

Source file: AnySoftKeyboard.java

  22 
vote

@Override public void setInputView(View view){
  super.setInputView(view);
  ViewParent parent=view.getParent();
  if (parent instanceof View) {
    ((View)parent).setBackgroundResource(R.drawable.ask_wallpaper);
  }
 else {
    Log.w(TAG,"*** It seams that the InputView parent is not a View!! This is very strange.");
  }
}
 

Example 14

From project appdriver, under directory /android/src/com/google/android/testing/nativedriver/server/.

Source file: ViewHierarchyAnalyzer.java

  22 
vote

/** 
 * Tests if the first  {@code View} is the same as, or somewhere inside the{@code View} hierarchy of, the second {@code View}.
 */
public boolean viewIsSameOrDescendant(View child,View parent){
  Preconditions.checkNotNull(child);
  Preconditions.checkNotNull(parent);
  if (child == parent) {
    return true;
  }
  ViewParent middleParent=getViewParent(child);
  while ((middleParent != null) && (middleParent != parent)) {
    middleParent=getViewParent(middleParent);
  }
  return middleParent == parent;
}
 

Example 15

From project Barcamp-Bangalore-Android-App, under directory /slidingmenu/library/src/com/slidingmenu/lib/.

Source file: CustomViewAbove.java

  22 
vote

ItemInfo infoForAnyChild(View child){
  ViewParent parent;
  while ((parent=child.getParent()) != this) {
    if (parent == null || !(parent instanceof View)) {
      return null;
    }
    child=(View)parent;
  }
  return infoForChild(child);
}
 

Example 16

From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/.

Source file: EditObjectList.java

  22 
vote

/** 
 * Find the first ancestor that has the ID R.id.row. This  will be the complete row View. Use the TAG on that to get the physical row number.
 * @param v		View to search from
 * @return		The row view.
 */
private Integer getViewRow(View v){
  View pv=v;
  while (pv.getId() != R.id.row) {
    ViewParent p=pv.getParent();
    if (!(p instanceof View))     throw new RuntimeException("Could not find row view in view ancestors");
    pv=(View)p;
  }
  Object o=ViewTagger.getTag(pv,R.id.TAG_POSITION);
  if (o == null)   throw new RuntimeException("A view with the tag R.id.row was found, but it is not the view for the row");
  return (Integer)o;
}
 

Example 17

From project BreizhCamp-android, under directory /src/org/breizhjug/breizhcamp/view/.

Source file: CustomGallery.java

  22 
vote

/** 
 * Return the screen's index where a view has been added to.
 * @param v
 * @return
 */
public int getScreenForView(View v){
  int result=-1;
  if (v != null) {
    ViewParent vp=v.getParent();
    int count=getChildCount();
    for (int i=0; i < count; i++) {
      if (vp == getChildAt(i)) {
        return i;
      }
    }
  }
  return result;
}
 

Example 18

From project Common-Sense-Net-2, under directory /AndroidBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 19

From project cow, under directory /libs/ActionBarSherlock/library/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 20

From project cw-omnibus, under directory /external/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 21

From project DeskSMS, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 22

From project dmix, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 23

From project dreamDroid, under directory /libraries/ABS/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 24

From project examples_2, under directory /SearchView/actionbarsherlock-lib/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 25

From project farebot, under directory /libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 26

From project finch, under directory /libs/JakeWharton-ActionBarSherlock-2eabf25/library/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 27

From project GnucashMobile, under directory /com_actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 28

From project Google-Tasks-Client, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 29

From project Hax-Launcher, under directory /src/com/t3hh4xx0r/haxlauncher/.

Source file: FocusHelper.java

  22 
vote

/** 
 * Private helper to get the parent TabHost in the view hiearchy.
 */
private static TabHost findTabHostParent(View v){
  ViewParent p=v.getParent();
  while (p != null && !(p instanceof TabHost)) {
    p=p.getParent();
  }
  return (TabHost)p;
}
 

Example 30

From project HeLauncher, under directory /src/com/handlerexploit/launcher_reloaded/.

Source file: Workspace.java

  22 
vote

public int getScreenForView(View v){
  int result=-1;
  if (v != null) {
    ViewParent vp=v.getParent();
    int count=getChildCount();
    for (int i=0; i < count; i++) {
      if (vp == getChildAt(i)) {
        return i;
      }
    }
  }
  return result;
}
 

Example 31

From project HSR-Timetable, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 32

From project iosched_3, under directory /libprojects/abs/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 33

From project IRC-Client, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 34

From project Juggernaut_SystemUI, under directory /src/com/android/systemui/statusbar/.

Source file: StatusBarView.java

  22 
vote

/** 
 * Gets the left position of v in this view.  Throws if v is not a child of this.
 */
private int getViewOffset(View v){
  int offset=0;
  while (v != this) {
    offset+=v.getLeft();
    ViewParent p=v.getParent();
    if (v instanceof View) {
      v=(View)p;
    }
 else {
      throw new RuntimeException(v + " is not a child of " + this);
    }
  }
  return offset;
}
 

Example 35

From project MensaUPB, under directory /libs/ActionbarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 36

From project mWater-Android-App, under directory /android/actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 37

From project MyHeath-Android, under directory /actionbarlib/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 38

From project onebusaway-android, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 39

From project open311-android, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 40

From project opensudoku, under directory /OpenSudoku/src/cz/romario/opensudoku/gui/.

Source file: SeekBarPreference.java

  22 
vote

@Override protected void onBindDialogView(View view){
  super.onBindDialogView(view);
  mValueLabel=(TextView)view.findViewById(R.id.value);
  SeekBar seekBar=mSeekBar;
  seekBar.setProgress(getValue() - mMin);
  updateValueLabel(seekBar.getProgress());
  ViewParent oldParent=seekBar.getParent();
  if (oldParent != view) {
    if (oldParent != null) {
      ((ViewGroup)oldParent).removeView(seekBar);
    }
    onAddSeekBarToDialogView(view,seekBar);
  }
}
 

Example 41

From project opensudoku-blackberry, under directory /opensudoku/src/net/bmagro/blackberry/opensudoku/gui/.

Source file: SeekBarPreference.java

  22 
vote

@Override protected void onBindDialogView(View view){
  super.onBindDialogView(view);
  mValueLabel=(TextView)view.findViewById(R.id.value);
  SeekBar seekBar=mSeekBar;
  seekBar.setProgress(getValue() - mMin);
  updateValueLabel(seekBar.getProgress());
  ViewParent oldParent=seekBar.getParent();
  if (oldParent != view) {
    if (oldParent != null) {
      ((ViewGroup)oldParent).removeView(seekBar);
    }
    onAddSeekBarToDialogView(view,seekBar);
  }
}
 

Example 42

From project OpenTripPlanner-for-Android, under directory /src/org/miscwidgets/widget/.

Source file: Panel.java

  22 
vote

@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  ViewParent parent=getParent();
  if (parent != null && parent instanceof FrameLayout) {
    mBringToFront=true;
  }
}
 

Example 43

From project packages_apps_Phone_1, under directory /src/com/android/phone/.

Source file: Profiler.java

  22 
vote

static void profileViewCreate(Window win,String tag){
  if (false) {
    ViewParent p=(ViewParent)win.getDecorView();
    while (p instanceof View) {
      p=((View)p).getParent();
    }
  }
}
 

Example 44

From project platform_frameworks_support, under directory /v4/java/android/support/v4/view/.

Source file: PagerTitleStrip.java

  22 
vote

@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  final ViewParent parent=getParent();
  if (!(parent instanceof ViewPager)) {
    throw new IllegalStateException("PagerTitleStrip must be a direct child of a ViewPager.");
  }
  final ViewPager pager=(ViewPager)parent;
  final PagerAdapter adapter=pager.getAdapter();
  pager.setInternalPageChangeListener(mPageListener);
  pager.setOnAdapterChangeListener(mPageListener);
  mPager=pager;
  updateAdapter(null,adapter);
}
 

Example 45

From project platform_packages_apps_browser, under directory /src/com/android/browser/view/.

Source file: ScrollerView.java

  22 
vote

/** 
 * Return true if child is an descendant of parent, (or equal to the parent).
 */
private boolean isViewDescendantOf(View child,View parent){
  if (child == parent) {
    return true;
  }
  final ViewParent theParent=child.getParent();
  return (theParent instanceof ViewGroup) && isViewDescendantOf((View)theParent,parent);
}
 

Example 46

From project platform_packages_apps_contacts, under directory /src/com/android/contacts/editor/.

Source file: EditorAnimator.java

  22 
vote

private static void getViewsBelowOfRecursive(List<View> result,ViewGroup container,int index){
  for (int i=index; i < container.getChildCount(); i++) {
    result.add(container.getChildAt(i));
  }
  final ViewParent parent=container.getParent();
  if (parent instanceof LinearLayout) {
    final LinearLayout parentLayout=(LinearLayout)parent;
    if (parentLayout.getOrientation() == LinearLayout.VERTICAL) {
      int containerIndex=parentLayout.indexOfChild(container);
      getViewsBelowOfRecursive(result,parentLayout,containerIndex + 1);
    }
  }
}
 

Example 47

From project platform_packages_apps_CytownPhone, under directory /src/com/android/phone/.

Source file: Profiler.java

  22 
vote

static void profileViewCreate(Window win,String tag){
  if (false) {
    ViewParent p=(ViewParent)win.getDecorView();
    while (p instanceof View) {
      p=((View)p).getParent();
    }
  }
}
 

Example 48

From project platform_packages_apps_launcher, under directory /src/com/android/launcher/.

Source file: Workspace.java

  22 
vote

public int getScreenForView(View v){
  int result=-1;
  if (v != null) {
    ViewParent vp=v.getParent();
    int count=getChildCount();
    for (int i=0; i < count; i++) {
      if (vp == getChildAt(i)) {
        return i;
      }
    }
  }
  return result;
}
 

Example 49

From project platform_packages_apps_phone, under directory /src/com/android/phone/.

Source file: Profiler.java

  22 
vote

static void profileViewCreate(Window win,String tag){
  if (false) {
    ViewParent p=(ViewParent)win.getDecorView();
    while (p instanceof View) {
      p=((View)p).getParent();
    }
  }
}
 

Example 50

From project RA_Launcher, under directory /src/com/android/ra/launcher/.

Source file: Workspace.java

  22 
vote

public int getScreenForView(View v){
  int result=-1;
  if (v != null) {
    ViewParent vp=v.getParent();
    int count=getChildCount();
    for (int i=0; i < count; i++) {
      if (vp == getChildAt(i)) {
        return i;
      }
    }
  }
  return result;
}
 

Example 51

From project RebeLauncher, under directory /src/com/dirtypepper/rebelauncher/.

Source file: Workspace.java

  22 
vote

public int getScreenForView(View v){
  int result=-1;
  if (v != null) {
    ViewParent vp=v.getParent();
    int count=getChildCount();
    for (int i=0; i < count; i++) {
      if (vp == getChildAt(i)) {
        return i;
      }
    }
  }
  return result;
}
 

Example 52

From project Schedule, under directory /libs/android/sherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 53

From project SeriesGuide, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 54

From project shoppinglist, under directory /ShoppingList/src/org/openintents/shopping/ui/widget/backport/.

Source file: ListPopupWindow.java

  22 
vote

private void removePromptView(){
  if (mPromptView != null) {
    final ViewParent parent=mPromptView.getParent();
    if (parent instanceof ViewGroup) {
      final ViewGroup group=(ViewGroup)parent;
      group.removeView(mPromptView);
    }
  }
}
 

Example 55

From project SMSSync, under directory /abslib/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 56

From project Something-Awful-Android, under directory /application/src/com/ferg/awfulapp/widget/.

Source file: AwfulViewPager.java

  22 
vote

ItemInfo infoForAnyChild(View child){
  ViewParent parent;
  while ((parent=child.getParent()) != this) {
    if (parent == null || !(parent instanceof View)) {
      return null;
    }
    child=(View)parent;
  }
  return infoForChild(child);
}
 

Example 57

From project The-Reverse-Recipe-Book, under directory /actionbarsherlock4.0/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 58

From project Traktoid, under directory /Traktoid/src/com/florianmski/tracktoid/widgets/.

Source file: Panel.java

  22 
vote

@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  ViewParent parent=getParent();
  if (parent != null && parent instanceof FrameLayout) {
    mBringToFront=true;
  }
}
 

Example 59

From project twidere, under directory /src/com/robobunny/.

Source file: SeekBarPreference.java

  22 
vote

@Override public void onBindView(final View view){
  super.onBindView(view);
  final ViewParent oldContainer=mSeekBar.getParent();
  final ViewGroup newContainer=(ViewGroup)view.findViewById(R.id.seekBarPrefBarContainer);
  if (oldContainer != newContainer) {
    if (oldContainer != null) {
      ((ViewGroup)oldContainer).removeView(mSeekBar);
    }
    newContainer.removeAllViews();
    newContainer.addView(mSeekBar,ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
  }
  updateView(view);
}
 

Example 60

From project Unibeer, under directory /libs/sherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 61

From project Ushahidi_Android, under directory /Libraries/abs/src/android/support/v4/view/.

Source file: PagerTitleStrip.java

  22 
vote

@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  final ViewParent parent=getParent();
  if (!(parent instanceof ViewPager)) {
    throw new IllegalStateException("PagerTitleStrip must be a direct child of a ViewPager.");
  }
  final ViewPager pager=(ViewPager)parent;
  final PagerAdapter adapter=pager.getAdapter();
  pager.setInternalPageChangeListener(mPageListener);
  pager.setOnAdapterChangeListener(mPageListener);
  mPager=pager;
  updateAdapter(null,adapter);
}
 

Example 62

From project vanilla, under directory /src/android/support/v4/view/.

Source file: ViewPager.java

  22 
vote

ItemInfo infoForAnyChild(View child){
  ViewParent parent;
  while ((parent=child.getParent()) != this) {
    if (parent == null || !(parent instanceof View)) {
      return null;
    }
    child=(View)parent;
  }
  return infoForChild(child);
}
 

Example 63

From project Wifileaks, under directory /WifiLeaks/ABS/library/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 64

From project XTrade, under directory /sherlock-bar/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 65

From project Yaaic, under directory /libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: ActionBarView.java

  22 
vote

@Override protected void onFinishInflate(){
  super.onFinishInflate();
  addView(mHomeLayout);
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    final ViewParent parent=mCustomNavView.getParent();
    if (parent != this) {
      if (parent instanceof ViewGroup) {
        ((ViewGroup)parent).removeView(mCustomNavView);
      }
      addView(mCustomNavView);
    }
  }
}
 

Example 66

From project android-pulltorefresh, under directory /library/src/com/handmark/pulltorefresh/library/.

Source file: PullToRefreshAdapterViewBase.java

  21 
vote

/** 
 * Sets the Empty View to be used by the Adapter View. We need it handle it ourselves so that we can Pull-to-Refresh when the Empty View is shown. Please note, you do <strong>not</strong> usually need to call this method yourself. Calling setEmptyView on the AdapterView will automatically call this method and set everything up. This includes when the Android Framework automatically sets the Empty View based on it's ID.
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView){
  FrameLayout refreshableViewWrapper=getRefreshableViewWrapper();
  if (null != mEmptyView) {
    refreshableViewWrapper.removeView(mEmptyView);
  }
  if (null != newEmptyView) {
    newEmptyView.setClickable(true);
    ViewParent newEmptyViewParent=newEmptyView.getParent();
    if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
      ((ViewGroup)newEmptyViewParent).removeView(newEmptyView);
    }
    refreshableViewWrapper.addView(newEmptyView,ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
    if (mRefreshableView instanceof EmptyViewMethodAccessor) {
      ((EmptyViewMethodAccessor)mRefreshableView).setEmptyViewInternal(newEmptyView);
    }
 else {
      mRefreshableView.setEmptyView(newEmptyView);
    }
    mEmptyView=newEmptyView;
  }
}
 

Example 67

From project android-thaiime, under directory /latinime/src/com/android/inputmethod/deprecated/.

Source file: VoiceProxy.java

  21 
vote

public void switchToRecognitionStatusView(final Configuration configuration){
  if (!VOICE_INSTALLED) {
    return;
  }
  mHandler.post(new Runnable(){
    @Override public void run(){
      mRecognizing=true;
      mVoiceInput.newView();
      View v=mVoiceInput.getView();
      ViewParent p=v.getParent();
      if (p != null && p instanceof ViewGroup) {
        ((ViewGroup)p).removeView(v);
      }
      View keyboardView=KeyboardSwitcher.getInstance().getKeyboardView();
      if (keyboardView != null) {
        View popupLayout=v.findViewById(R.id.popup_layout);
        final int displayHeight=mService.getResources().getDisplayMetrics().heightPixels;
        final int currentHeight=popupLayout.getLayoutParams().height;
        final int keyboardHeight=keyboardView.getHeight();
        if (mMinimumVoiceRecognitionViewHeightPixel > keyboardHeight || mMinimumVoiceRecognitionViewHeightPixel > currentHeight) {
          popupLayout.getLayoutParams().height=mMinimumVoiceRecognitionViewHeightPixel;
        }
 else         if (keyboardHeight > currentHeight || keyboardHeight > (displayHeight / RECOGNITIONVIEW_HEIGHT_THRESHOLD_RATIO)) {
          popupLayout.getLayoutParams().height=keyboardHeight;
        }
      }
      mService.setInputView(v);
      mService.updateInputViewShown();
      if (configuration != null) {
        mVoiceInput.onConfigurationChanged(configuration);
      }
    }
  }
);
}
 

Example 68

From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/deprecated/.

Source file: VoiceProxy.java

  21 
vote

public void switchToRecognitionStatusView(final Configuration configuration){
  if (!VOICE_INSTALLED) {
    return;
  }
  mHandler.post(new Runnable(){
    @Override public void run(){
      mRecognizing=true;
      mVoiceInput.newView();
      View v=mVoiceInput.getView();
      ViewParent p=v.getParent();
      if (p != null && p instanceof ViewGroup) {
        ((ViewGroup)p).removeView(v);
      }
      View keyboardView=KeyboardSwitcher.getInstance().getKeyboardView();
      if (keyboardView != null) {
        View popupLayout=v.findViewById(R.id.popup_layout);
        final int displayHeight=mService.getResources().getDisplayMetrics().heightPixels;
        final int currentHeight=popupLayout.getLayoutParams().height;
        final int keyboardHeight=keyboardView.getHeight();
        if (mMinimumVoiceRecognitionViewHeightPixel > keyboardHeight || mMinimumVoiceRecognitionViewHeightPixel > currentHeight) {
          popupLayout.getLayoutParams().height=mMinimumVoiceRecognitionViewHeightPixel;
        }
 else         if (keyboardHeight > currentHeight || keyboardHeight > (displayHeight / RECOGNITIONVIEW_HEIGHT_THRESHOLD_RATIO)) {
          popupLayout.getLayoutParams().height=keyboardHeight;
        }
      }
      mService.setInputView(v);
      mService.updateInputViewShown();
      if (configuration != null) {
        mVoiceInput.onConfigurationChanged(configuration);
      }
    }
  }
);
}
 

Example 69

From project AquaNotesTest, under directory /src/com/google/android/apps/iosched/ui/widget/.

Source file: Workspace.java

  21 
vote

/** 
 * If one of our descendant views decides that it could be focused now, only pass that along if it's on the current screen. This happens when live folders requery, and if they're off screen, they end up calling requestFocus, which pulls it on screen.
 */
@Override public void focusableViewAvailable(View focused){
  View current=getScreenAt(mCurrentScreen);
  View v=focused;
  ViewParent parent;
  while (true) {
    if (v == current) {
      super.focusableViewAvailable(focused);
      return;
    }
    if (v == this) {
      return;
    }
    parent=v.getParent();
    if (parent instanceof View) {
      v=(View)v.getParent();
    }
 else {
      return;
    }
  }
}
 

Example 70

From project be.norio.twunch.android, under directory /src/be/norio/twunch/android/ui/fragment/map/.

Source file: ActivityHostFragment.java

  21 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  Intent intent=new Intent(getActivity(),getActivityClass());
  final Window w=getLocalActivityManager().startActivity(ACTIVITY_TAG,intent);
  final View wd=w != null ? w.getDecorView() : null;
  if (wd != null) {
    ViewParent parent=wd.getParent();
    if (parent != null) {
      ViewGroup v=(ViewGroup)parent;
      v.removeView(wd);
    }
    wd.setVisibility(View.VISIBLE);
    wd.setFocusableInTouchMode(true);
    if (wd instanceof ViewGroup) {
      ((ViewGroup)wd).setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
    }
  }
  return wd;
}
 

Example 71

From project conference-mobile-app, under directory /android-app/src/com/google/android/apps/iosched/ui/widget/.

Source file: Workspace.java

  21 
vote

/** 
 * If one of our descendant views decides that it could be focused now, only pass that along if it's on the current screen. This happens when live folders requery, and if they're off screen, they end up calling requestFocus, which pulls it on screen.
 */
@Override public void focusableViewAvailable(View focused){
  View current=getScreenAt(mCurrentScreen);
  View v=focused;
  ViewParent parent;
  while (true) {
    if (v == current) {
      super.focusableViewAvailable(focused);
      return;
    }
    if (v == this) {
      return;
    }
    parent=v.getParent();
    if (parent instanceof View) {
      v=(View)v.getParent();
    }
 else {
      return;
    }
  }
}
 

Example 72

From project dcnyc10-android, under directory /android/src/com/lullabot/android/apps/iosched/ui/widget/.

Source file: Workspace.java

  21 
vote

/** 
 * If one of our descendant views decides that it could be focused now, only pass that along if it's on the current screen. This happens when live folders requery, and if they're off screen, they end up calling requestFocus, which pulls it on screen.
 */
@Override public void focusableViewAvailable(View focused){
  View current=getScreenAt(mCurrentScreen);
  View v=focused;
  ViewParent parent;
  while (true) {
    if (v == current) {
      super.focusableViewAvailable(focused);
      return;
    }
    if (v == this) {
      return;
    }
    parent=v.getParent();
    if (parent instanceof View) {
      v=(View)v.getParent();
    }
 else {
      return;
    }
  }
}
 

Example 73

From project devoxx-france-android-in-fine, under directory /src/com/infine/android/devoxx/ui/widget/.

Source file: Workspace.java

  21 
vote

/** 
 * If one of our descendant views decides that it could be focused now, only pass that along if it's on the current screen. This happens when live folders requery, and if they're off screen, they end up calling requestFocus, which pulls it on screen.
 */
@Override public void focusableViewAvailable(View focused){
  View current=getScreenAt(mCurrentScreen);
  View v=focused;
  ViewParent parent;
  while (true) {
    if (v == current) {
      super.focusableViewAvailable(focused);
      return;
    }
    if (v == this) {
      return;
    }
    parent=v.getParent();
    if (parent instanceof View) {
      v=(View)v.getParent();
    }
 else {
      return;
    }
  }
}
 

Example 74

From project friendica-for-android, under directory /libpulltorefresh/src/com/handmark/pulltorefresh/library/.

Source file: PullToRefreshAdapterViewBase.java

  21 
vote

/** 
 * Sets the Empty View to be used by the Adapter View. We need it handle it ourselves so that we can Pull-to-Refresh when the Empty View is shown. Please note, you do <strong>not</strong> usually need to call this method yourself. Calling setEmptyView on the AdapterView will automatically call this method and set everything up. This includes when the Android Framework automatically sets the Empty View based on it's ID.
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView){
  if (null != mEmptyView) {
    mRefreshableViewHolder.removeView(mEmptyView);
  }
  if (null != newEmptyView) {
    newEmptyView.setClickable(true);
    ViewParent newEmptyViewParent=newEmptyView.getParent();
    if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
      ((ViewGroup)newEmptyViewParent).removeView(newEmptyView);
    }
    mRefreshableViewHolder.addView(newEmptyView,ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.FILL_PARENT);
    if (mRefreshableView instanceof EmptyViewMethodAccessor) {
      ((EmptyViewMethodAccessor)mRefreshableView).setEmptyViewInternal(newEmptyView);
    }
 else {
      mRefreshableView.setEmptyView(newEmptyView);
    }
  }
}
 

Example 75

From project gddsched2, under directory /trunk/android/src/com/google/android/apps/iosched2/ui/widget/.

Source file: Workspace.java

  21 
vote

/** 
 * If one of our descendant views decides that it could be focused now, only pass that along if it's on the current screen. This happens when live folders requery, and if they're off screen, they end up calling requestFocus, which pulls it on screen.
 */
@Override public void focusableViewAvailable(View focused){
  View current=getScreenAt(mCurrentScreen);
  View v=focused;
  ViewParent parent;
  while (true) {
    if (v == current) {
      super.focusableViewAvailable(focused);
      return;
    }
    if (v == this) {
      return;
    }
    parent=v.getParent();
    if (parent instanceof View) {
      v=(View)v.getParent();
    }
 else {
      return;
    }
  }
}
 

Example 76

From project Gingerbread-Keyboard, under directory /src/com/android/inputmethod/latin/.

Source file: LatinIME.java

  21 
vote

private void switchToRecognitionStatusView(){
  final boolean configChanged=mConfigurationChanging;
  mHandler.post(new Runnable(){
    public void run(){
      setCandidatesViewShown(false);
      mRecognizing=true;
      View v=mVoiceInput.getView();
      ViewParent p=v.getParent();
      if (p != null && p instanceof ViewGroup) {
        ((ViewGroup)v.getParent()).removeView(v);
      }
      setInputView(v);
      updateInputViewShown();
      if (configChanged) {
        mVoiceInput.onConfigurationChanged();
      }
    }
  }
);
}
 

Example 77

From project ICS_LatinIME_QHD, under directory /java/src/com/android/inputmethod/deprecated/.

Source file: VoiceProxy.java

  21 
vote

public void switchToRecognitionStatusView(final Configuration configuration){
  if (!VOICE_INSTALLED) {
    return;
  }
  mHandler.post(new Runnable(){
    @Override public void run(){
      mRecognizing=true;
      mVoiceInput.newView();
      View v=mVoiceInput.getView();
      ViewParent p=v.getParent();
      if (p != null && p instanceof ViewGroup) {
        ((ViewGroup)p).removeView(v);
      }
      View keyboardView=KeyboardSwitcher.getInstance().getKeyboardView();
      if (keyboardView != null) {
        View popupLayout=v.findViewById(R.id.popup_layout);
        final int displayHeight=mService.getResources().getDisplayMetrics().heightPixels;
        final int currentHeight=popupLayout.getLayoutParams().height;
        final int keyboardHeight=keyboardView.getHeight();
        if (mMinimumVoiceRecognitionViewHeightPixel > keyboardHeight || mMinimumVoiceRecognitionViewHeightPixel > currentHeight) {
          popupLayout.getLayoutParams().height=mMinimumVoiceRecognitionViewHeightPixel;
        }
 else         if (keyboardHeight > currentHeight || keyboardHeight > (displayHeight / RECOGNITIONVIEW_HEIGHT_THRESHOLD_RATIO)) {
          popupLayout.getLayoutParams().height=keyboardHeight;
        }
      }
      mService.setInputView(v);
      mService.updateInputViewShown();
      if (configuration != null) {
        mVoiceInput.onConfigurationChanged(configuration);
      }
    }
  }
);
}
 

Example 78

From project iosched, under directory /android/src/com/google/android/apps/iosched/ui/widget/.

Source file: Workspace.java

  21 
vote

/** 
 * If one of our descendant views decides that it could be focused now, only pass that along if it's on the current screen. This happens when live folders requery, and if they're off screen, they end up calling requestFocus, which pulls it on screen.
 */
@Override public void focusableViewAvailable(View focused){
  View current=getScreenAt(mCurrentScreen);
  View v=focused;
  ViewParent parent;
  while (true) {
    if (v == current) {
      super.focusableViewAvailable(focused);
      return;
    }
    if (v == this) {
      return;
    }
    parent=v.getParent();
    if (parent instanceof View) {
      v=(View)v.getParent();
    }
 else {
      return;
    }
  }
}
 

Example 79

From project iosched2011, under directory /android/src/com/google/android/apps/iosched/ui/widget/.

Source file: Workspace.java

  21 
vote

/** 
 * If one of our descendant views decides that it could be focused now, only pass that along if it's on the current screen. This happens when live folders requery, and if they're off screen, they end up calling requestFocus, which pulls it on screen.
 */
@Override public void focusableViewAvailable(View focused){
  View current=getScreenAt(mCurrentScreen);
  View v=focused;
  ViewParent parent;
  while (true) {
    if (v == current) {
      super.focusableViewAvailable(focused);
      return;
    }
    if (v == this) {
      return;
    }
    parent=v.getParent();
    if (parent instanceof View) {
      v=(View)v.getParent();
    }
 else {
      return;
    }
  }
}
 

Example 80

From project iosched_2, under directory /android/src/com/google/android/apps/iosched/ui/widget/.

Source file: Workspace.java

  21 
vote

/** 
 * If one of our descendant views decides that it could be focused now, only pass that along if it's on the current screen. This happens when live folders requery, and if they're off screen, they end up calling requestFocus, which pulls it on screen.
 */
@Override public void focusableViewAvailable(View focused){
  View current=getScreenAt(mCurrentScreen);
  View v=focused;
  ViewParent parent;
  while (true) {
    if (v == current) {
      super.focusableViewAvailable(focused);
      return;
    }
    if (v == this) {
      return;
    }
    parent=v.getParent();
    if (parent instanceof View) {
      v=(View)v.getParent();
    }
 else {
      return;
    }
  }
}
 

Example 81

From project Jota-Text-Editor, under directory /src/jp/sblo/pandora/jota/text/.

Source file: TextView.java

  21 
vote

private boolean isPositionVisible(){
  if (mIsDragging) {
    return true;
  }
  if (isInBatchEditMode()) {
    return false;
  }
  final int extendedPaddingTop=getExtendedPaddingTop();
  final int extendedPaddingBottom=getExtendedPaddingBottom();
  final int compoundPaddingLeft=getCompoundPaddingLeft();
  final int compoundPaddingRight=getCompoundPaddingRight();
  final TextView hostView=TextView.this;
  final int left=0;
  final int right=hostView.getWidth();
  final int top=0;
  final int bottom=hostView.getHeight();
  if (mTempRect == null) {
    mTempRect=new Rect();
  }
  final Rect clip=mTempRect;
  clip.left=left + compoundPaddingLeft;
  clip.top=top + extendedPaddingTop;
  clip.right=right - compoundPaddingRight;
  clip.bottom=bottom - extendedPaddingBottom;
  final ViewParent parent=hostView.getParent();
  if (parent == null || !parent.getChildVisibleRect(hostView,clip,null)) {
    return false;
  }
  final int[] coords=mTempCoords;
  hostView.getLocationInWindow(coords);
  final int posX=coords[0] + mPositionX + (int)mHotspotX;
  final int posY=coords[1] + mPositionY + (int)mHotspotY;
  return posX >= clip.left && posX <= clip.right && posY >= clip.top && posY <= clip.bottom;
}
 

Example 82

From project mobilis, under directory /MobilisXHunt/MobilisXHunt_Android/src/de/tudresden/inf/rn/mobilis/android/xhunt/ui/.

Source file: SeekBarPreference.java

  21 
vote

@Override public void onBindView(View view){
  super.onBindView(view);
  try {
    ViewParent oldContainer=mSeekBar.getParent();
    ViewGroup newContainer=(ViewGroup)view.findViewById(R.id.seekBarPrefBarContainer);
    if (oldContainer != newContainer) {
      if (oldContainer != null)       ((ViewGroup)oldContainer).removeView(mSeekBar);
      newContainer.removeAllViews();
      newContainer.addView(mSeekBar,ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
    }
  }
 catch (  Exception e) {
    Log.e(TAG,"Error binding view: " + e.toString());
  }
  updateView(view);
}
 

Example 83

From project platform_frameworks_ex, under directory /chips/src/com/android/ex/chips/.

Source file: RecipientEditTextView.java

  21 
vote

@Override public void onSizeChanged(int width,int height,int oldw,int oldh){
  super.onSizeChanged(width,height,oldw,oldh);
  if (width != 0 && height != 0) {
    if (mPendingChipsCount > 0) {
      postHandlePendingChips();
    }
 else {
      checkChipWidths();
    }
  }
  if (mScrollView == null && !mTriedGettingScrollView) {
    ViewParent parent=getParent();
    while (parent != null && !(parent instanceof ScrollView)) {
      parent=parent.getParent();
    }
    if (parent != null) {
      mScrollView=(ScrollView)parent;
    }
    mTriedGettingScrollView=true;
  }
}
 

Example 84

From project UDJ-Android-Client, under directory /src/org/klnusbaum/udj/PullToRefresh/.

Source file: PullToRefreshAdapterViewBase.java

  21 
vote

/** 
 * Sets the Empty View to be used by the Adapter View. We need it handle it ourselves so that we can Pull-to-Refresh when the Empty View is shown. Please note, you do <strong>not</strong> usually need to call this method yourself. Calling setEmptyView on the AdapterView will automatically call this method and set everything up. This includes when the Android Framework automatically sets the Empty View based on it's ID.
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView){
  if (null != mEmptyView) {
    mRefreshableViewHolder.removeView(mEmptyView);
  }
  if (null != newEmptyView) {
    newEmptyView.setClickable(true);
    ViewParent newEmptyViewParent=newEmptyView.getParent();
    if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
      ((ViewGroup)newEmptyViewParent).removeView(newEmptyView);
    }
    mRefreshableViewHolder.addView(newEmptyView,ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.FILL_PARENT);
    if (mRefreshableView instanceof EmptyViewMethodAccessor) {
      ((EmptyViewMethodAccessor)mRefreshableView).setEmptyViewInternal(newEmptyView);
    }
 else {
      mRefreshableView.setEmptyView(newEmptyView);
    }
  }
}
 

Example 85

From project maven-android-plugin-samples, under directory /apidemos-android-10/application/src/main/java/com/example/android/apis/graphics/.

Source file: PictureLayout.java

  19 
vote

@Override public ViewParent invalidateChildInParent(int[] location,Rect dirty){
  location[0]=getLeft();
  location[1]=getTop();
  dirty.set(0,0,getWidth(),getHeight());
  return getParent();
}