@SuppressWarnings("deprecation")
  @Override
  public void onBindView(View view) {
    super.onBindView(view);
    try {
      // mette la seekbar nella nuova view che gli assegniamo
      ViewParent oldContainer = mSeekBar.getParent();
      ViewGroup newContainer = (ViewGroup) view.findViewById(R.id.seekBarPrefBarContainer);

      if (oldContainer != newContainer) {
        // rimuove la seekbar dalla vecchia view
        if (oldContainer != null) {
          ((ViewGroup) oldContainer).removeView(mSeekBar);
        }
        // rimuove la seekbar esistente (può non essercene una) e aggiunge la nostra
        newContainer.removeAllViews();
        newContainer.addView(
            mSeekBar, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
      }
    } catch (Exception ex) {
      Log.e(TAG, "Error binding view: " + ex.toString());
    }
    // se la dipendenza è falsa dall'inizio, disabilita la seekbar
    if (view != null && !view.isEnabled()) {
      mSeekBar.setEnabled(false);
    }
    updateView(view);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    this.inflater = inflater;
    if (diseaseview != null) container.removeAllViews();
    diseaseview = inflater.inflate(R.layout.fragment_symptomdisease, container, false);
    InitWidth(diseaseview);

    lcontent = (LinearLayout) diseaseview.findViewById(R.id.lcontainer);
    btjianjie = (Button) diseaseview.findViewById(R.id.jianjie);
    btdescription = (Button) diseaseview.findViewById(R.id.description);
    btjianjie.setEnabled(true);
    btdescription.setEnabled(true);
    btjianjie.setOnClickListener(this);
    btdescription.setOnClickListener(this);

    if (data.getType() == Constants.ZHENGZHUANG) {
      btdescription.setText("¿ÉÄܼ²²¡");
    } else {
      btdescription.setText("°éËæÖ¢×´");
    }
    onjianjie();

    return diseaseview;
  }
Example #3
1
  @Override
  public void onBindView(View view) {
    super.onBindView(view);

    try {
      // move our seekbar to the new view we've been given
      ViewParent oldContainer = mSeekBar.getParent();
      ViewGroup newContainer = (ViewGroup) view.findViewById(R.id.seekBarPrefBarContainer);

      if (oldContainer != newContainer) {
        // remove the seekbar from the old view
        if (oldContainer != null) {
          ((ViewGroup) oldContainer).removeView(mSeekBar);
        }
        // remove the existing seekbar (there may not be one) and add ours
        newContainer.removeAllViews();
        newContainer.addView(
            mSeekBar, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
      }
    } catch (Exception ex) {
      Log.e(TAG, "Error binding view: " + ex.toString());
    }

    // if dependency is false from the beginning, disable the seek bar
    if (view != null && !view.isEnabled()) {
      mSeekBar.setEnabled(false);
    }

    updateView(view);
  }
  private void listAll() {
    ViewGroup root = mList;
    root.removeAllViews();

    // 列出所有已经安装的插件
    Collection<PluginDescriptor> plugins = PluginLoader.getPlugins();
    Iterator<PluginDescriptor> itr = plugins.iterator();
    while (itr.hasNext()) {
      final PluginDescriptor pluginDescriptor = itr.next();
      Button button = new Button(this);
      button.setPadding(10, 10, 10, 10);
      button.setText("插件id:" + pluginDescriptor.getPackageName() + ",点击查看");
      button.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View v) {
              Intent intent = new Intent(PluginListActivity.this, PluginDetailActivity.class);
              intent.putExtra("plugin_id", pluginDescriptor.getPackageName());
              startActivity(intent);
            }
          });

      LayoutParams layoutParam =
          new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
      layoutParam.topMargin = 10;
      layoutParam.bottomMargin = 10;
      layoutParam.gravity = Gravity.LEFT;
      root.addView(button, layoutParam);
    }
  }
Example #5
0
 /**
  * remove all views
  *
  * @param viewGroup
  */
 public static void removeAllViews(ViewGroup viewGroup) {
   if (viewGroup != null) {
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
       if (viewGroup.isInLayout()) {
         viewGroup.removeAllViewsInLayout();
       } else {
         viewGroup.removeAllViews();
       }
     } else {
       viewGroup.removeAllViews();
     }
   }
 }
        @Override
        public void onVideoDataReceived(SubscriberKit subscriber) {

          mSubscriber.setStyle(
              BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL);
          ViewGroup frame = mCallback.getSubscribtionFrame();
          frame.removeAllViews();
          RelativeLayout.LayoutParams params =
              new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
          frame.removeAllViews();
          View subscriberView = mSubscriber.getView();
          frame.removeView(subscriberView);
          frame.addView(subscriberView, params);
        }
  public void loadQuiz() {
    if (this.quiz == null) {
      this.quiz = new Quiz();
      this.quiz.load(
          quizContent,
          prefs.getString(PrefsActivity.PREF_LANGUAGE, Locale.getDefault().getLanguage()));
    }
    if (this.isOnResultsPage) {
      this.showResults();
    } else {
      // determine availability
      if (this.quiz.getAvailability() == Quiz.AVAILABILITY_ALWAYS) {
        this.showQuestion();
      } else if (this.quiz.getAvailability() == Quiz.AVAILABILITY_SECTION) {

        // check to see if all previous section activities have been completed

        DbHelper db = DbHelper.getInstance(getActivity());
        long userId = db.getUserId(SessionManager.getUsername(getActivity()));
        boolean completed = db.isPreviousSectionActivitiesCompleted(course, activity, userId);

        if (completed) {
          this.showQuestion();
        } else {
          ViewGroup vg = (ViewGroup) getView().findViewById(activity.getActId());
          vg.removeAllViews();
          vg.addView(View.inflate(getView().getContext(), R.layout.widget_quiz_unavailable, null));

          TextView tv = (TextView) getView().findViewById(R.id.quiz_unavailable);
          tv.setText(R.string.widget_quiz_unavailable_section);
        }
      } else if (this.quiz.getAvailability() == Quiz.AVAILABILITY_COURSE) {
        // check to see if all previous course activities have been completed
        DbHelper db = DbHelper.getInstance(getActivity());
        long userId = db.getUserId(SessionManager.getUsername(getActivity()));
        boolean completed = db.isPreviousCourseActivitiesCompleted(course, activity, userId);

        if (completed) {
          this.showQuestion();
        } else {
          ViewGroup vg = (ViewGroup) getView().findViewById(activity.getActId());
          vg.removeAllViews();
          vg.addView(View.inflate(getView().getContext(), R.layout.widget_quiz_unavailable, null));

          TextView tv = (TextView) getView().findViewById(R.id.quiz_unavailable);
          tv.setText(R.string.widget_quiz_unavailable_course);
        }
      }
    }
  }
Example #8
0
 public void release() {
   if (DBG) {
     Log.d(LCAT, "Releasing: " + this);
   }
   View nv = getNativeView();
   if (nv != null) {
     if (nv instanceof ViewGroup) {
       ViewGroup vg = (ViewGroup) nv;
       if (DBG) {
         Log.d(LCAT, "Group has: " + vg.getChildCount());
       }
       if (!(vg instanceof AdapterView<?>)) {
         vg.removeAllViews();
       }
     }
     Drawable d = nv.getBackground();
     if (d != null) {
       nv.setBackgroundDrawable(null);
       d.setCallback(null);
       if (d instanceof TiBackgroundDrawable) {
         ((TiBackgroundDrawable) d).releaseDelegate();
       }
       d = null;
     }
     nativeView = null;
     if (proxy != null) {
       proxy.setModelListener(null);
     }
   }
 }
 /**
  * 装填图片数据
  *
  * @param imageUrlList
  * @param imageCycleViewListener
  */
 public void setImageResources(
     ArrayList<FindBean> infoList, ImageCycleViewListener imageCycleViewListener) {
   // 清除所有子视图
   mGroup.removeAllViews();
   // 图片广告数量
   final int imageCount = infoList.size();
   mImageViews = new ImageView[imageCount];
   for (int i = 0; i < imageCount; i++) {
     mImageView = new ImageView(mContext);
     int imageParams = (int) (mScale * 20 + 0.5f); // XP与DP转换,适应不同分辨率
     int imagePadding = (int) (mScale * 5 + 0.5f);
     LinearLayout.LayoutParams layout =
         new LinearLayout.LayoutParams(
             android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
             android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
     layout.setMargins(3, 0, 3, 0);
     mImageView.setLayoutParams(layout);
     // mImageView.setPadding(imagePadding, imagePadding, imagePadding, imagePadding);
     mImageViews[i] = mImageView;
     if (i == 0) {
       mImageViews[i].setBackgroundResource(R.drawable.icon_point_pre);
     } else {
       mImageViews[i].setBackgroundResource(R.drawable.icon_point);
     }
     mGroup.addView(mImageViews[i]);
   }
   mAdvAdapter = new ImageCycleAdapter(mContext, infoList, imageCycleViewListener);
   mBannerPager.setAdapter(mAdvAdapter);
   startImageTimerTask();
 }
 private void fillChildView(ViewGroup viewParent) {
   viewParent.removeAllViews();
   for (int i = 0; i < list.size(); i++) {
     View view = getView(i);
     viewParent.addView(view);
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTheme(mThemeId);

    ViewGroup root = (ViewGroup) findViewById(android.R.id.content);
    View content = root.getChildAt(0);
    LinearLayout toolbarContainer = (LinearLayout) View.inflate(this, R.layout.activity_pref, null);

    root.removeAllViews();
    toolbarContainer.addView(content);
    root.addView(toolbarContainer);

    mToolBar = (Toolbar) toolbarContainer.findViewById(R.id.toolbar);

    mToolBar = (Toolbar) toolbarContainer.findViewById(R.id.toolbar);
    mToolBar.setTitle(getTitle());
    mToolBar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
    mToolBar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
          }
        });
  }
  private void viewChange(PropertyChangeEvent event) {
    if (!(event instanceof ViewChangeEvent) || !event.getNewValue().equals(Skeleton.TYPE_APP)) {
      return;
    }

    ViewChangeEvent changeEvent = (ViewChangeEvent) event;
    ViewGroup viewGroup = (ViewGroup) changeEvent.getView();
    viewGroup.removeAllViews();

    LocalAccount account = changeEvent.getAccount();
    View contentView = getContentView(account);
    viewGroup.addView(contentView);

    View llHeaderBase = context.findViewById(R.id.llHeaderBase);
    llHeaderBase.setVisibility(View.VISIBLE);
    View llHeaderMessage = context.findViewById(R.id.llHeaderMessage);
    llHeaderMessage.setVisibility(View.GONE);

    TextView tvTitle = (TextView) context.findViewById(R.id.tvTitle);
    tvTitle.setText(R.string.title_tab_app);

    ImageButton ibProfileImage = (ImageButton) context.findViewById(R.id.ibProfileImage);
    ibProfileImage.setVisibility(View.VISIBLE);
    ImageButton ibGroup = (ImageButton) context.findViewById(R.id.ibGroup);
    ibGroup.setVisibility(View.GONE);
    ImageButton ibEdit = (ImageButton) context.findViewById(R.id.ibEdit);
    ibEdit.setVisibility(View.VISIBLE);
    ibEdit.setOnClickListener(new HomePageEditStatusClickListener(context));
  }
  @Override
  protected void performTraversal(
      final ViewGroup containerView,
      final TraversalState traversalState,
      final Flow.Direction direction,
      final Flow.TraversalCallback callback) {

    final PathContext context;
    final PathContext oldPath;
    if (containerView.getChildCount() > 0) {
      oldPath = PathContext.get(containerView.getChildAt(0).getContext());
    } else {
      oldPath = PathContext.root(containerView.getContext());
    }

    Path to = traversalState.toPath();

    View newView;
    context = PathContext.create(oldPath, to, contextFactory);
    int layout = getLayout(to);
    newView =
        LayoutInflater.from(context).cloneInContext(context).inflate(layout, containerView, false);

    View fromView = null;
    if (traversalState.fromPath() != null) {
      fromView = containerView.getChildAt(0);
      traversalState.saveViewState(fromView);
    }
    traversalState.restoreViewState(newView);

    if (fromView == null || direction == REPLACE) {
      containerView.removeAllViews();
      containerView.addView(newView);
      oldPath.destroyNotIn(context, contextFactory);
      callback.onTraversalCompleted();
    } else {
      containerView.addView(newView);
      final View finalFromView = fromView;
      Utils.waitForMeasure(
          newView,
          new Utils.OnMeasuredCallback() {
            @Override
            public void onMeasured(View view, int width, int height) {
              runAnimation(
                  containerView,
                  finalFromView,
                  view,
                  direction,
                  new Flow.TraversalCallback() {
                    @Override
                    public void onTraversalCompleted() {
                      containerView.removeView(finalFromView);
                      oldPath.destroyNotIn(context, contextFactory);
                      callback.onTraversalCompleted();
                    }
                  });
            }
          });
    }
  }
Example #14
0
 /**
  * 装填图片数据
  *
  * @param imageUrlList
  * @param imageCycleViewListener
  */
 public void setImageResources(
     ArrayList<String> imageUrlList, ImageCycleViewListener imageCycleViewListener) {
   // 清除所有子视图
   mGroup.removeAllViews();
   // 图片广告数量
   final int imageCount = imageUrlList.size();
   mImageViews = new ImageView[imageCount];
   for (int i = 0; i < imageCount; i++) {
     mImageView = new ImageView(mContext);
     int imageParams = (int) (mScale * 20 + 0.5f); // XP与DP转换,适应不同分辨率
     int imagePadding = (int) (mScale * 5 + 0.5f);
     mImageView.setLayoutParams(new LayoutParams(imageParams, imageParams));
     mImageView.setPadding(imagePadding, imagePadding, imagePadding, imagePadding);
     mImageViews[i] = mImageView;
     if (i == 0) {
       mImageViews[i].setBackgroundResource(R.drawable.banner_dian_focus);
     } else {
       mImageViews[i].setBackgroundResource(R.drawable.banner_dian_blur);
     }
     mGroup.addView(mImageViews[i]);
   }
   mAdvAdapter = new ImageCycleAdapter(mContext, imageUrlList, imageCycleViewListener);
   mAdvPager.setAdapter(mAdvAdapter);
   startImageTimerTask();
 }
Example #15
0
  public static void recursiveRecycle(View root) {
    if (root == null) return;

    root.setBackgroundDrawable(null);

    if (root instanceof ViewGroup) {
      ViewGroup group = (ViewGroup) root;
      int count = group.getChildCount();
      for (int i = 0; i < count; i++) {
        recursiveRecycle(group.getChildAt(i));
      }

      if (!(root instanceof AdapterView)) {
        group.removeAllViews();
      }
    }

    if (root instanceof ImageView) {
      ((ImageView) root).setImageDrawable(null);
    }

    root = null;

    return;
  }
  public void setupPrimarykey(
      CrmFileFieldDesc primarykeyCffd,
      List<BibleHelper.BibleFieldCode> bibleDesc,
      boolean isReadonly) {
    mPrimarykeyRow.setVisibility(View.VISIBLE);
    mPrimarykeyLabel.setText(primarykeyCffd.fieldName);
    if (!isReadonly) {
      mPrimarykeyButton.setOnClickListener(
          new BibleClickListener(new BibleCode(primarykeyCffd.fieldLinkBible), -1));
    }

    mPrimarykeyFieldsGroup.removeAllViews();
    LayoutInflater inflater = mActivity.getLayoutInflater();
    for (BibleHelper.BibleFieldCode bfc : bibleDesc) {
      if (bfc.recordType != BibleHelper.RecordType.BIBLE_ENTRY) {
        continue;
      }
      if (bfc.fieldType == null) {
        continue;
      }

      View v = inflater.inflate(R.layout.xpressfile_view_row_static, null);
      v.setTag(bfc.fieldCode);
      ((TextView) v.findViewById(R.id.crm_label)).setText(bfc.fieldName);
      mPrimarykeyFieldsGroup.addView(v);
    }
  }
 public void refresh() {
   recipes.removeAllViews();
   for (Suggestion s : recipe.getSuggestedWith()) {
     recipes.addView(createRecipeEntry(s));
   }
   recipes.invalidate();
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    container.removeAllViews();
    View rootView = inflater.inflate(R.layout.fragment_grades, container, false);
    listView = (ExpandableListView) rootView.findViewById(R.id.listView);

    // Header DETAILS
    TextView fullName = (TextView) rootView.findViewById(R.id.NameAtGradesHeader);
    TextView AEM = (TextView) rootView.findViewById(R.id.aemAtGradesHeader);
    TextView totalDetails = (TextView) rootView.findViewById(R.id.totalDetails);

    fullName.setText(
        eGramFunctions.properCase(up.getSurName()) + " " + eGramFunctions.properCase(up.getName()));
    AEM.setText(up.getAEM());
    totalDetails.setText(
        getString(R.string.MOTitle)
            + up.getMO()
            + " "
            + getString(R.string.DMTitle)
            + upDB.TotalDM(ProfileID)
            + " "
            + getString(R.string.ECTSTitle)
            + up.getTotalECTS());

    createData();
    listView.setAdapter(adapter);

    return rootView;
  }
Example #19
0
  /*
   * (non-Javadoc)
   *
   * @see com.google.android.maps.MapActivity#onCreate(android.os.Bundle)
   */
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);
    container.removeAllViews();

    View view = inflater.inflate(R.layout.map, container, false);

    mMap = (UserOverlayMapFragment) getFragmentManager().findFragmentById(R.id.map_fragment);
    mMap.setGeoPointLocationListener(this);
    setUiHandler();

    mAccuracy = (TextView) view.findViewById(R.id.tvAccuracy);
    mDistance = (TextView) view.findViewById(R.id.tvDistance);
    mSettings = getActivity().getSharedPreferences(Settings.SETTINGS, Context.MODE_WORLD_WRITEABLE);

    view.findViewById(R.id.my_location).setOnClickListener(this);
    view.findViewById(R.id.mark_my_location).setOnClickListener(this);
    view.findViewById(R.id.show_both).setOnClickListener(this);
    view.findViewById(R.id.parking_timer).setOnClickListener(this);
    view.findViewById(R.id.directions).setOnClickListener(this);

    this.mMap.setBuiltInZoomControls(true);
    return view;
  }
  private void rebuildComplicationsList() {
    ViewGroup complicationsContainer = (ViewGroup) mRootView.findViewById(R.id.complications_list);
    complicationsContainer.removeAllViews();

    LayoutInflater inflater = LayoutInflater.from(getActivity());

    for (int i = 0; i < PREF_KEYS.length; i++) {
      final String prefKey = PREF_KEYS[i];

      ViewGroup itemContainer =
          (ViewGroup)
              inflater.inflate(R.layout.config_complications_item, complicationsContainer, false);
      final CheckedTextView titleView =
          (CheckedTextView) itemContainer.findViewById(android.R.id.text1);
      final View checkmarkView = itemContainer.findViewById(R.id.checkmark);

      titleView.setText(PREF_TITLE_IDS[i]);
      boolean isPrefOn = mSharedPreferences.getBoolean(prefKey, false);

      checkmarkView.setVisibility(isPrefOn ? View.VISIBLE : View.INVISIBLE);
      titleView.setChecked(isPrefOn);

      itemContainer.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              boolean isPrefOn = mSharedPreferences.getBoolean(prefKey, false);
              mSharedPreferences.edit().putBoolean(prefKey, !isPrefOn).apply();
              rebuildComplicationsList();
            }
          });

      complicationsContainer.addView(itemContainer);
    }
  }
  /**
   * 设置加载界面
   *
   * @param rootView 你所要放置的加载动画的根布局
   */
  public static void setAutoLoadingView(ViewGroup rootView) {
    if (rootView != null) {
      AutoLoadingUtil.rootView = rootView;
      view =
          LayoutInflater.from(rootView.getContext()).inflate(R.layout.autoloading, rootView, false);
      saveView = new ArrayList<View>();

      ImageView image = (ImageView) view.findViewById(R.id.imageView_autoLoading);
      image.setBackgroundResource(R.anim.autoloading);
      AnimationDrawable anim = (AnimationDrawable) image.getBackground();
      anim.start();
      rootView.setOnHierarchyChangeListener(
          new OnHierarchyChangeListener() {

            @Override
            public void onChildViewRemoved(View parent, View child) {
              // TODO Auto-generated method stub
              saveView.add(child);
            }

            @Override
            public void onChildViewAdded(View parent, View child) {
              // TODO Auto-generated method stub

            }
          });
      rootView.removeAllViews();
      rootView.addView(view);
      view.bringToFront();
    }
  }
  @Override
  public void onBindView(View view) {
    super.onBindView(view);

    try {
      // move our slider to the new view we've been given
      ViewParent oldContainer = slider.getParent();
      ViewGroup newContainer = (ViewGroup) view.findViewById(R.id.sliderPreferenceSliderContainer);

      if (oldContainer != newContainer) {
        // remove the slider from the old view
        if (oldContainer != null) {
          ((ViewGroup) oldContainer).removeView(slider);
        }
        // remove the existing slider (there may not be one) and add
        // ours
        newContainer.removeAllViews();
        newContainer.addView(
            slider, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
      }
    } catch (Exception ex) {
      Log.e(TAG, "Error binding view: " + ex.toString());
    }

    // If parent is disabled, disable the slider.
    if (view != null && !view.isEnabled()) {
      slider.setEnabled(false);
    }

    updateView(view);
  }
Example #23
0
  @Override
  public void removeAllViews() {
    super.removeAllViews();

    expanded.clear();
    contained.clear();
  }
Example #24
0
 @Nullable
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   if (dialog == null) {
     dialog = new CustomProgressDialog(this.getActivity(), "正在加载中");
   }
   if (view == null) {
     view = inflater.inflate(R.layout.simg_fragment, null);
   }
   // 缓存的rootView需要判断是否已经被加过parent,如果有parent需要从parent删除,要不然会发生这个rootview已经有parent的错误。
   ViewGroup parent = (ViewGroup) view.getParent();
   if (parent != null) {
     parent.removeAllViews();
   }
   if (customAdapter == null) {
     customAdapter = new CustomFragmentPagerAdapter(getFragmentManager());
   }
   if (mViewPager == null) {
     mViewPager = (android.support.v4.view.ViewPager) view.findViewById(R.id.id_viewPager);
   }
   dateutils = DateUtils.getInstance();
   isPrepared = true;
   lazyLoad();
   return view;
 }
 public void onAnimationEnd(Animator animation) {
   mDetailContent.removeAllViews();
   setDetailRecord(null);
   mClosingDetail = false;
   if (mDetailCallback != null) {
     mDetailCallback.onDetailChanged(false);
   }
 };
Example #26
0
 private void initContentView(int layoutResId) {
   ViewGroup viewGroup = (ViewGroup) findViewById(android.R.id.content);
   viewGroup.removeAllViews();
   parentLinearLayout = new LinearLayout(this);
   parentLinearLayout.setOrientation(LinearLayout.VERTICAL);
   viewGroup.addView(parentLinearLayout);
   LayoutInflater.from(this).inflate(layoutResId, parentLinearLayout, true);
 }
Example #27
0
 /** Clear the current list of users, then add them back in with the current sort criteria */
 private void resort() {
   if (updating.compareAndSet(false, true)) { // if not updating, set to true and resort
     list.removeAllViews();
     userCnt = 0;
     DataHelper.start(this, sortOrder);
     updating.set(false); // no longer updating
   }
 }
Example #28
0
 /** Draws all buttons. */
 private void drawButtons() {
   layout.removeAllViews();
   Log.i("Player", bList.size() + " boutons");
   for (VirtualButton b : bList) {
     Helper.setLayoutPosition(this, b, b.getPosX(), b.getPosY());
     layout.addView(b);
   }
 }
  /** Attaches the menu drawer to the window. */
  private void attachToDecor() {
    ViewGroup decorView = (ViewGroup) mActivity.getWindow().getDecorView();
    ViewGroup decorChild = (ViewGroup) decorView.getChildAt(0);

    decorView.removeAllViews();
    decorView.addView(mMenuDrawer, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    mContentContainer.addView(decorChild, decorChild.getLayoutParams());
  }
Example #30
0
  public static void startLocalActivity(
      final ActivityGroup activityGroup,
      final Intent intent,
      final String identifier,
      final int regionId,
      final int anim) {
    final LocalActivityManager activityManager = activityGroup.getLocalActivityManager();
    final View paneView = activityManager.startActivity(identifier, intent).getDecorView();

    final ViewParent parent = paneView.getParent();
    if ((parent != null) && (parent instanceof ViewGroup)) {
      throw new IllegalStateException("should not happen - currently we don't recycle activities");
    }

    final ViewGroup region = (ViewGroup) activityGroup.findViewById(regionId);
    if ((anim != ANIM_NONE) && (region instanceof ViewSwitcher)) {
      final ViewSwitcher animator = (ViewSwitcher) region;

      if (anim == ANIM_NEXT) {
        animator.setInAnimation(activityGroup, R.anim.sl_next_in);
        animator.setOutAnimation(activityGroup, R.anim.sl_next_out);
      } else {
        animator.setInAnimation(activityGroup, R.anim.sl_previous_in);
        animator.setOutAnimation(activityGroup, R.anim.sl_previous_out);
      }

      final int numChilds = animator.getChildCount();
      if (numChilds == 0) {
        animator.addView(
            paneView,
            0,
            new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
      } else if (numChilds == 1) {
        animator.addView(
            paneView,
            1,
            new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
        animator.showNext();
      } else {
        animator.removeViewAt(0);
        animator.addView(
            paneView,
            1,
            new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
        animator.showNext();
      }
    } else {
      region.removeAllViews();
      region.addView(
          paneView,
          new ViewGroup.LayoutParams(
              ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
    }
  }