Java 类android.view.ViewGroup 实例源码

项目:ceji_android    文件:ReadingActivity.java   
public void showChapter() {
    // TODO init draw tab
    ViewGroup drawerTabs = (ViewGroup) findViewById(R.id.drawer_tab);
    drawerTabs.getChildAt(0).setSelected(true);

    Book book = readingFragment.getBook();
    BookView bookView = readingFragment.getBookView();

    List<List<Content>> chapters = book.getChapters();
    List<CharSequence> chapterStr = new ArrayList<>();
    for (List<Content> contents : chapters) {
        Content firstContent = contents.get(0);
        int pageNumber = bookView.getPageNumberFor(firstContent);

        chapterStr.add(firstContent.getText() + " --- " + pageNumber);
    }
    mDrawerList.setAdapter(new ArrayAdapter<>(this,
            R.layout.drawer_list_item, chapterStr));
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

    mDrawerLayout.openDrawer(GravityCompat.START, true);
}
项目:RNLearn_Project1    文件:ReactFindViewUtil.java   
/**
 * Finds a view that is tagged with {@param nativeId} as its nativeID prop
 * under the {@param root} view hierarchy. Returns the view if found, null otherwise.
 * @param root root of the view hierarchy from which to find the view
 */
public static @Nullable View findView(View root, String nativeId) {
  String tag = getNativeId(root);
  if (tag != null && tag.equals(nativeId)) {
    return root;
  }

  if (root instanceof ViewGroup) {
    ViewGroup viewGroup = (ViewGroup) root;
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
      View view = findView(viewGroup.getChildAt(i), nativeId);
      if (view != null) {
        return view;
      }
    }
  }

  return null;
}
项目:Renrentou    文件:CitySelectFragment.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    if(convertView == null){
        LayoutInflater inflater = getActivity().getLayoutInflater();
        convertView = inflater.inflate(R.layout.item_city, null);
        holder = new ViewHolder();
        holder.text = (TextView) convertView.findViewById(R.id.text);
        holder.root = convertView.findViewById(R.id.root);
        convertView.setTag(holder);
    }else{
        holder = (ViewHolder) convertView.getTag();
    }

    County county = getItem(position);
    holder.text.setText(county.getAreaName());
    if(county.getAreaId().equals(currentCounty.getAreaId())){
        holder.root.setBackgroundResource(R.color.commonF1B73F);
        holder.text.setTextColor(getResources().getColor(R.color.white));
    }else{
        holder.root.setBackgroundResource(R.drawable.city_item_select);
        holder.text.setTextColor(getResources().getColor(R.color.commonTextColor));
    }
    return convertView;
}
项目:inventum    文件:DiscoverFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_discover, container, false);
    unbinder = ButterKnife.bind(this, v);
    mType = DiscoverResultFragment.TYPE_MOVIES;

    mGenresList = new HashSet<>();
    mGenresValuesList = new HashSet<>();
    checkedGenres = new boolean[] {
            false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false
    };
    ratingSeekBar.setOnSeekBarChangeListener(this);

    final List<String> sort = Arrays.asList(getResources().getStringArray(R.array.sort));
    ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), R.layout.spinner_item, sort);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    sortSpinner.setAdapter(adapter);
    sortSpinner.setOnItemSelectedListener(this);

    return v;
}
项目:cat-is-a-dog    文件:FollowingHabitsListAdapter.java   
/**
 * Instantiate a child view containing the user you following's habit and their individual completion status
 * @param groupPosition
 * @param childPosition
 * @param isExpanded
 * @param convertView
 * @param parent
 * @return
 */
@Override
public View getChildView(int groupPosition, int childPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    Habit habit = (Habit) getChild(groupPosition, childPosition);

    if(convertView == null) {
        convertView = mInflater.inflate(R.layout.item_following_habit, parent, false);
    }

    TextView titleView = (TextView) convertView.findViewById(R.id.following_habit_title);
    titleView.setText(habit.getTitle());

    ImageView indicatorView = (ImageView) convertView.findViewById(R.id.following_habit_indicator);

    if (habit.getStatus() != null) {
        indicatorView.setColorFilter(habit.getStatus().getColor());
    }

    return convertView;
}
项目:conductor-attacher    文件:SimpleDialogController.java   
@NonNull
@Override
protected DialogView onCreateDialogView(@NonNull LayoutInflater inflater,
    @NonNull ViewGroup container) {
  return new DialogViewBuilder()
      .title("I'm TITLE")
      .message("I'm MESSAGE")
      .stackButtons(true)
      .positiveButton("Push an OpaqueController", new OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
          getRouter().pushController(
              RouterTransaction.with(new OpaqueController(getUseAttacher()))
                  .pushChangeHandler(getChangeHandler(OpaqueController.getRemoveFromViewOnPush()))
                  .popChangeHandler(getChangeHandler(OpaqueController.getRemoveFromViewOnPush()))
          );
        }
      }).build(inflater, container);
}
项目:Linphone4Android    文件:CreateAccountActivationFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.assistant_account_creation_email_activation, container, false);

    accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc()
            , LinphonePreferences.instance().getXmlrpcUrl());
    accountCreator.setDomain(getResources().getString(R.string.default_domain));
    accountCreator.setListener(this);

    username = getArguments().getString("Username");
    password = getArguments().getString("Password");

    accountCreator.setUsername(username);
    accountCreator.setPassword(password);

    email = (TextView) view.findViewById(R.id.send_email);
    email.setText(getArguments().getString("Email"));

    checkAccount = (Button) view.findViewById(R.id.assistant_check);
    checkAccount.setOnClickListener(this);
    return view;
}
项目:BrotherWeather    文件:PhotoAdapter.java   
@Override public Object instantiateItem(ViewGroup container, int position) {
  if (position == getCount() - 1) {
    View inflate = View.inflate(context, R.layout.add_more_view, null);
    container.addView(inflate);
    if (onClickListener != null) {
      inflate.findViewById(R.id.btn_add).setOnClickListener(onClickListener);
    }
    return inflate;
  } else {
    PhotoView photoView = new PhotoView(context);
    //ViewGroup.LayoutParams layoutParams = photoView.getLayoutParams();
    container.addView(photoView);
    Glide.with(context).load(gankioDatas.get(position).getUrl()).into(photoView);
    return photoView;
  }
}
项目:Trivia-Knowledge    文件:GeoAdapter.java   
@NonNull
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;
    MyViewHolder holder = null;
    if (row == null) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = inflater.inflate(R.layout.gv_geo_grid_view,null, true);
        holder = new MyViewHolder(row);
        row.setTag(holder);
    } else {
        holder = (MyViewHolder) row.getTag();
    }


    Typeface typeface = Typeface.createFromAsset(context.getAssets(), "fonts/grobold.ttf");
    holder.mQueNo.setTypeface(typeface);
    //holder.mtext.setTypeface(typeface);

    holder.imageView.setImageResource(img[position]);
    holder.mQueNo.setText(s[position]);
    //holder.mtext.setText(strings[position]);

    return row;
}
项目:QianXun    文件:RecyclerHomepagerAdapter.java   
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    //根据item类别加载不同ViewHolder
    if(viewType==0){
        View view = LayoutInflater.from(mContext).inflate(R.layout.recycler_item_small, parent, false);
        //这个布局就是一个imageview用来显示图片
        MyViewHolder holder = new MyViewHolder(view);
        //给布局设置点击和长点击监听
        view.setOnClickListener(this);
        return holder;
    }else{
        MyViewHolder2 holder2=new MyViewHolder2(LayoutInflater.from(mContext).inflate(R.layout.recycler_test, parent,
                false));
        //这个布局就是一个textview用来显示页数
        return holder2;
    }

}
项目:argus-android    文件:ForgotPasswordProvider.java   
@Override
protected View inflateView(ViewGroup parentView) {
    if (context == null)
        return null;

    getValidationEngine().addEmailValidation(new RegexValidation(
                    Patterns.EMAIL_ADDRESS.pattern(), context.getString(R.string.invalid_email)));

    if (context != null) {
        View forgotPasswordView = LayoutInflater.from(context)
                .inflate(R.layout.forgot_password, parentView, false);

        emailInput = (EditText) forgotPasswordView.findViewById(R.id.email);
        applyTheme(forgotPasswordView);

        return forgotPasswordView;
    } else {
        throw new RuntimeException("Context cannot be null");
    }
}
项目:ceji_android    文件:MyNoteActvity.java   
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View convertView = null;
    ViewHolder holder;
    if (convertView == null) {
        convertView = inflater.inflate(R.layout.item_mynote_details, parent, false);
        holder = new ViewHolder(convertView);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    holder.min_title = (TextView) convertView.findViewById(R.id.min_title);
    holder.min_title_content = (TextView) convertView.findViewById(R.id.min_title_content);
    holder.booke_content = (TextView) convertView.findViewById(R.id.booke_content);
    holder.note_content = (TextView) convertView.findViewById(R.id.note_content);
    holder.note_time = (TextView) convertView.findViewById(R.id.note_time);
    holder.delete_note_icon = (ImageView) convertView.findViewById(R.id.delete_note_icon);
    holder.detail_note_icon = (ImageView) convertView.findViewById(R.id.detail_note_icon);

    return holder;

}
项目:DragPhotoView    文件:SingleDragDetector.java   
/**
 * Clean-up the resources attached to this object. This needs to be called when the zoomLayout is
 * no longer used. A good example is from {@link android.view.View#onDetachedFromWindow()} or
 * from {@link android.app.Activity#onDestroy()}. This is automatically called if you are using
 * {@link DragPhotoView}.
 */
public void cleanup() {
    if (null == zoomLayout) {
        return; // cleanup already done
    }

    final ViewGroup view = zoomLayout.get();

    if (null != view) {
        // Remove the zoomLayout's reference to this
        view.setOnTouchListener(null);
    }

    if (null != gestureDetector) {
        gestureDetector = null;
    }

    // Finally, clear zoomLayout
    zoomLayout = null;
}
项目:boohee_v5.6    文件:MQEmotionKeyboardLayout.java   
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = View.inflate(MQEmotionKeyboardLayout.this.getContext(), R.layout
                .mq_item_emotion_keyboard, null);
    }
    ImageView iconIv = (ImageView) convertView;
    if (position == getCount() - 1) {
        iconIv.setImageResource(R.drawable.mq_emoji_delete);
        iconIv.setVisibility(0);
    } else {
        String key = (String) this.mDatas.get(position);
        if (TextUtils.isEmpty(key)) {
            iconIv.setVisibility(4);
        } else {
            iconIv.setImageResource(MQEmotionUtil.getImgByName(key));
            iconIv.setVisibility(0);
        }
    }
    return convertView;
}
项目:chaosflix-leanback    文件:CardPresenter.java   
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    sDefaultBackgroundColor = parent.getResources().getColor(R.color.default_background);
    sSelectedBackgroundColor = parent.getResources().getColor(R.color.selected_background);
    mDefaultCardImage = parent.getResources().getDrawable(R.drawable.default_background);

    ImageCardView cardView = new ImageCardView(parent.getContext()) {
        @Override
        public void setSelected(boolean selected) {
            updateCardBackgroundColor(this, selected);
            super.setSelected(selected);
        }
    };

    cardView.setFocusable(true);
    cardView.setFocusableInTouchMode(true);
    updateCardBackgroundColor(cardView, false);
    return new ViewHolder(cardView);
}
项目:VirtualLocation    文件:PreciseLocationActivity.java   
/**
 * 使组件变回原有形状
 * @param view
 */
private void repaintView(final View view){
    AnimatorSet set = new AnimatorSet();

    ValueAnimator animator = ValueAnimator.ofFloat(width, 0);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float value = (Float) animation.getAnimatedValue();
            ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mBeginLocation
                    .getLayoutParams();
            params.leftMargin = (int) value;
            params.rightMargin = (int) value;
            view.setLayoutParams(params);
        }
    });

    ObjectAnimator animator2 = ObjectAnimator.ofFloat(view,
            "scaleX", 0.5f, 1f);
    set.setDuration(1000);
    set.setInterpolator(new AccelerateDecelerateInterpolator());
    set.playTogether(animator, animator2);
    set.start();
}
项目:Kids-Portal-Android    文件:Fragment_Pass.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_lists, container, false);

    setHasOptionsMenu(true);

    sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());

    listBar = (TextView) getActivity().findViewById(R.id.listBar);
    listView = (ListView)rootView.findViewById(R.id.list);
    viewPager = (class_CustomViewPager) getActivity().findViewById(R.id.viewpager);

    try {
        mahEncryptor = MAHEncryptor.newInstance(sharedPref.getString("saved_key", ""));
    } catch (Exception e) {
        e.printStackTrace();
        Snackbar.make(listView, R.string.toast_error, Snackbar.LENGTH_SHORT).show();
    }

    //calling Notes_DbAdapter
    db = new DbAdapter_Pass(getActivity());
    db.open();

    return rootView;
}
项目:YCBanner    文件:SecondActivity.java   
@Override
public View getView(ViewGroup container, int position) {
    ImageView view = new ImageView(container.getContext());
    view.setScaleType(ImageView.ScaleType.CENTER_CROP);
    view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    view.setImageResource(imgs[position]);
    return view;
}
项目:GitHub    文件:HomeFragment.java   
private void renderShowData(HomeViewState state) {
  TransitionManager.beginDelayedTransition((ViewGroup) getView());
  loadingView.setVisibility(View.GONE);
  errorView.setVisibility(View.GONE);
  swipeRefreshLayout.setVisibility(View.VISIBLE);
  boolean changed = adapter.setLoadingNextPage(state.isLoadingNextPage());
  if (changed && state.isLoadingNextPage()) {
    // scroll to the end of the list so that the user sees the load more progress bar
    recyclerView.smoothScrollToPosition(adapter.getItemCount());
  }
  adapter.setItems(state.getData());

  boolean pullToRefreshFinished = swipeRefreshLayout.isRefreshing()
      && !state.isLoadingPullToRefresh()
      && state.getPullToRefreshError() == null;
  if (pullToRefreshFinished) {
    // Swipe to refresh finished successfully so scroll to the top of the list (to see inserted items)
    recyclerView.smoothScrollToPosition(0);
  }

  swipeRefreshLayout.setRefreshing(state.isLoadingPullToRefresh());

  if (state.getNextPageError() != null) {
    Snackbar.make(getView(), R.string.error_unknown, Snackbar.LENGTH_LONG)
        .show(); // TODO callback
  }

  if (state.getPullToRefreshError() != null) {
    Snackbar.make(getView(), R.string.error_unknown, Snackbar.LENGTH_LONG)
        .show(); // TODO callback
  }
}
项目:CoordinatorLayoutExample-master    文件:EmptyWrapper.java   
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    if (isEmpty()) {
        RecyclerView.ViewHolder holder;
        if (mEmptyView != null) {
            holder = BaseRecyclerHolder.createViewHolder(mEmptyView);
        } else {
            holder = BaseRecyclerHolder.createViewHolder(parent.getContext(), parent,
                    mEmptyLayoutId);
        }
        return holder;
    }
    return mInnerAdapter.onCreateViewHolder(parent, viewType);
}
项目:atlas    文件:ActivityGroupDelegate.java   
private void performLaunchChildActivity(ViewGroup container,String key,Intent intent ){
    if(intent==null){
        Log.e("ActivityGroupDelegate","intent is null stop performLaunchChildActivity");
        return ;
    }
    mLocalActivityManager.startActivity(key,intent);
    container.addView(
            mLocalActivityManager.getActivity(key)
                    .getWindow().getDecorView(),
            new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT));
}
项目:BBSSDK-for-Android    文件:EmptyView.java   
private void init(Context context) {
    tvEmpty = new TextView(context);
    int tvEmptySize = getResources().getDimensionPixelSize(ResHelper.getResId(context, "dimen", "bbs_empty_view_txt_size"));
    tvEmpty.setTextSize(TypedValue.COMPLEX_UNIT_PX, tvEmptySize);
    int padding = ResHelper.dipToPx(context, 10);
    tvEmpty.setPadding(padding, padding, padding, padding);
    int tvEmptyColor = getResources().getColor(ResHelper.getColorRes(context, "bbs_empty_view_txt_color"));
    tvEmpty.setTextColor(tvEmptyColor);
    tvEmpty.setId(ResHelper.getIdRes(context, "tvEmpty"));

    ivEmpty = new ImageView(context);
    ivEmpty.setScaleType(ImageView.ScaleType.CENTER);

    LayoutParams rlp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rlp.addRule(CENTER_IN_PARENT, TRUE);
    addView(tvEmpty, rlp);

    rlp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rlp.addRule(CENTER_HORIZONTAL, TRUE);
    rlp.addRule(ABOVE, tvEmpty.getId());
    addView(ivEmpty, rlp);

    OnClickListener ocl = new OnClickListener() {
        public void onClick(View view) {
            tvEmpty.setClickable(false);
            ivEmpty.setClickable(false);
            if (onRefreshClickListener != null) {
                onRefreshClickListener.onClick(view);
            }
        }
    };
    tvEmpty.setClickable(false);
    ivEmpty.setClickable(false);
    tvEmpty.setOnClickListener(ocl);
    ivEmpty.setOnClickListener(ocl);
}
项目:eazycore    文件:BaseFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    preInitLayout();
    rootView = LayoutInflater.from(getContext()).inflate(getLayoutId(), container, false);
    unbinder = ButterKnife.bind(this, rootView);
    return rootView;
}
项目:okwallet    文件:PeerListFragment.java   
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.peer_list_fragment, container, false);

    viewGroup = (ViewAnimator) view.findViewById(R.id.peer_list_group);

    recyclerView = (RecyclerView) view.findViewById(R.id.peer_list);
    recyclerView.setLayoutManager(new LinearLayoutManager(activity));
    recyclerView.setAdapter(adapter);
    recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));

    return view;
}
项目:Android-DFU-App    文件:FileBrowserAppsAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
    if (view == null) {
        view = mInflater.inflate(R.layout.app_file_browser_item, parent, false);
    }

    final TextView item = (TextView) view;
    item.setText(mResources.getStringArray(R.array.dfu_app_file_browser)[position]);
    item.getCompoundDrawablesRelative()[0].setLevel(position);
    return view;
}
项目:firebase-chat-android-architecture-components    文件:ProfileActivity.java   
private void setupGoogleLogin() {
    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .enableAutoManage(this, this)
            .addApi(Auth.GOOGLE_SIGN_IN_API,
                    new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                            .requestEmail()
                            .requestIdToken(getString(R.string.default_web_client_id))
                            .build())
            .build();
    mSignInUi = (ViewGroup) findViewById(R.id.sign_in_ui);

    binding.setGoogleCallback(() -> launchSignInIntent());
}
项目:phonk    文件:LicenseActivity.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    if (convertView == null) {
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.license_view, parent, false);
    }
    TextView txtTitle = (TextView) convertView.findViewById(R.id.license_title);
    final TextView txtText = (TextView) convertView.findViewById(R.id.license_body);

    final License license = getItem(position);
    txtTitle.setText(license.title);
    txtText.setText(license.body);

    txtText.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (!license.showing) {
                txtText.setEllipsize(null);
                txtText.setMaxLines(Integer.MAX_VALUE);
            }
            else {
                txtText.setEllipsize(TextUtils.TruncateAt.END);
                txtText.setMaxLines(3);
            }

            license.showing = !license.showing;
        }
    });

    return convertView;
}
项目:RecyclerviewExpand    文件:MainActivity.java   
public MainViewHolder(ViewGroup itemView) {
    super(itemView);
    contactNameTV = ((TextView) itemView.findViewById(R.id.contactName));
    infos = ((TextView) itemView.findViewById(R.id.infos));

    itemView.setOnClickListener(this);
}
项目:LQRWeChat    文件:PopupWindowUtils.java   
/**
 * 得到在屏幕中间的popupwindow并显示(宽高都是包裹视图)
 *
 * @param contentView popupwindow要显示的视图
 * @param parentView  参考视图
 * @return
 */
public static PopupWindow getPopupWindowInCenter(View contentView, View parentView) {
    //        int width = ViewGroup.LayoutParams.MATCH_PARENT;
    int width = ViewGroup.LayoutParams.WRAP_CONTENT;
    int height = ViewGroup.LayoutParams.WRAP_CONTENT;

    return getPopupWindowInCenter(contentView, width, height, parentView);
}
项目:Hotspot-master-devp    文件:AbstractWheelTextAdapter.java   
@Override
   public View getEmptyItem(View convertView, ViewGroup parent) {
       if (convertView == null) {
           convertView = getView(emptyItemResourceId, parent);
       }
       if (emptyItemResourceId == TEXT_VIEW_ITEM_RESOURCE && convertView instanceof TextView) {
           configureTextView((TextView)convertView);
       }

       return convertView;
}
项目:Guanajoven    文件:IdiomasAdicionalesDialogFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_idiomas_adicionales, null);

    datosIdiomas = new ArrayList<>();
    idiomas = new ArrayList<>();

    recyclerViewIdiomas = (RecyclerView) v.findViewById(R.id.rv_idiomas);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
    recyclerViewIdiomas.setLayoutManager(linearLayoutManager);

    llenarLista();

    btnAceptar = (Button) v.findViewById(R.id.btn_aceptar_idiomas);
    btnCancelar = (Button) v.findViewById(R.id.btn_cancelar_idiomas);

    btnAceptar.setOnClickListener((View) -> {
        int idiomasSeleccionados = recyclerViewIdiomaAdicionalAdapter.getSeleccionados().size();

        for (int i = 0; i < idiomasSeleccionados; i++) {
            FragmentManager fragmentManager = getActivity().getFragmentManager();
            IdiomasAdicionalesPorcentajesFragment porcentajesFragment = new IdiomasAdicionalesPorcentajesFragment();
            porcentajesFragment.setIdiomaAdicional(recyclerViewIdiomaAdicionalAdapter.getSeleccionados().get(i));
            porcentajesFragment.show(fragmentManager, null);
        }

        this.getDialog().dismiss();

    });

    btnCancelar.setOnClickListener((View) -> {
        this.dismiss();
    });

    return v;
}
项目:miaosou    文件:ComicReadFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    //Log.d("onCeatedView",currentPage+"-onCeatedView");

    View view = inflater.inflate(R.layout.comic_photo_view,container,false);
    comicPhotoView = (PhotoView) view.findViewById(R.id.pv_comic_read);
    llLoadingProgress = (LinearLayout) view.findViewById(R.id.ll_loading_progress);
    llLoadingFailed = (LinearLayout) view.findViewById(R.id.ll_loading_failed);
    btLoadingFailed = (Button) view.findViewById(R.id.bt_loading_fail);
    tvLoadingCurrentPage = (TextView) view.findViewById(R.id.tv_loading_currentpage);
    pbLoadingProgress = (RoundProgressBarWithNumber) view.findViewById(R.id.pb_loading_progress);
    return view;
}
项目:ticker_up    文件:PerfActivity.java   
@Override
public TickerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    if (inflater == null) {
        inflater = LayoutInflater.from(parent.getContext());
    }

    return new TickerViewHolder(inflater.inflate(R.layout.row_perf, parent, false));
}
项目:Shared-Route    文件:TaskViewAdapter.java   
public View getView(final int position, View view, ViewGroup viewGroup) {
    ViewHolder viewHolder = null;
    listItem item = listItems.get(position);
    if (view == null){
        view = LayoutInflater.from(mContext).inflate(R.layout.content_task_view,null);
        viewHolder = new ViewHolder(view);
        view.setTag(viewHolder);
    }
    else{
        viewHolder = (ViewHolder) view.getTag();
    }
    Log.e("???0",String.valueOf(count++));

    String fetchTime =listItems.get(position).FetchTime;
    String sendTime = listItems.get(position).SendTime;
    int index1 = fetchTime.indexOf('日');
    fetchTime = fetchTime.substring(0,index1+1)+'\n'+fetchTime.substring(index1+1);
    int index2 = sendTime.indexOf('日');
    sendTime = sendTime.substring(0,index2+1)+'\n'+sendTime.substring(index2+1);

    viewHolder.expressType.setText(listItems.get(position).TaskKindID);
    viewHolder.expressSize.setText(listItems.get(position).Remark);
    viewHolder.inTimeStamp.setText(fetchTime);
    viewHolder.inLocation.setText(listItems.get(position).FetchLocation);
    viewHolder.outTimeStamp.setText(sendTime);
    viewHolder.outLocation.setText(listItems.get(position).SendLocation);
    viewHolder.price.setText(String.valueOf(listItems.get(position).Money)+"元");
    viewHolder.name.setText(listItems.get(position).PublisherName);
    viewHolder.checkBox.setChecked(listItems.get(position).isCheckBoxElected());
    viewHolder.checkBox.setOnClickListener(new View.OnClickListener() {//说实话,这样监听不太好,每次滑动getView的时候都要重新new一个监听,但是必须获取ChechView所在的那个Item的position,所以只能卸载getView函数内部
        @Override
        public void onClick(View v) {//等于说对于那10个左右的ChechBox,其绑定的监听在不断的改变
            ((listItem)getItem(position)).setCheckBoxElected(((CheckBox)v).isChecked());
            notifyDataSetChanged();
        }
    });
    return view;
}
项目:Runnest    文件:ProfileFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    final View view =  inflater.inflate(R.layout.fragment_profile, container, false);

    if (name == null || email == null) {
        // Handle case current user profile
        User user = ((AppRunnest) getActivity().getApplicationContext()).getUser();
        setUserStatistics(user.getName(), user.getEmail(), view);
        String profilePictureUrl = user.getPhotoUrl();
        firebaseHelper.setOrUpdateProfilePicUrl(user.getEmail(), profilePictureUrl);
        setProfileImage(profilePictureUrl, view);
        view.findViewById(R.id.challenge_schedule_buttons).setVisibility(View.GONE);
    } else {
        // Handle case other user profile
        setUserStatistics(name, email, view);
        view.findViewById(R.id.challenge_schedule_buttons).setVisibility(View.VISIBLE);

        firebaseHelper.getProfilePicUrl(email, new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                if (dataSnapshot.exists()) {
                    String url = (String) dataSnapshot.getValue();
                    setProfileImage(url, view);
                } else {
                    setProfileImage("", view);
                }
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {
                throw databaseError.toException();
            }
        });

        setButtonsListeners(view);
    }
    return view;
}
项目:JD-Test    文件:BottomNavigationBar.java   
private void setFab(FloatingActionButton fab, @FabBehaviour int fabBehaviour) {
    ViewGroup.LayoutParams layoutParams = fab.getLayoutParams();
    if (layoutParams != null && layoutParams instanceof CoordinatorLayout.LayoutParams) {
        CoordinatorLayout.LayoutParams coLayoutParams = (CoordinatorLayout.LayoutParams) layoutParams;
        BottomNavBarFabBehaviour bottomNavBarFabBehaviour = new BottomNavBarFabBehaviour();
        coLayoutParams.setBehavior(bottomNavBarFabBehaviour);
    }
}
项目:AndroidOpen    文件:HotCityGridAdapter.java   
@Override
public View getView(int position, View view, ViewGroup parent) {
    HotCityViewHolder holder;
    if (view == null) {
        view = LayoutInflater.from(mContext).inflate(R.layout.item_hot_city_gridview, parent, false);
        holder = new HotCityViewHolder();
        holder.name = (TextView) view.findViewById(R.id.tv_hot_city_name);
        view.setTag(holder);
    } else {
        holder = (HotCityViewHolder) view.getTag();
    }
    holder.name.setText(mCities.get(position));
    return view;
}
项目:SimpleRatingBar    文件:PartialView.java   
private void init() {
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
            mStarWidth == 0 ? LayoutParams.WRAP_CONTENT : mStarWidth,
            mStarHeight == 0 ? LayoutParams.WRAP_CONTENT : mStarHeight);

    mFilledView = new ImageView(getContext());
    mFilledView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    addView(mFilledView, params);

    mEmptyView = new ImageView(getContext());
    mEmptyView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    addView(mEmptyView, params);

    setEmpty();
}
项目:file.io-app    文件:MaterialIn.java   
private static void initAnimation(View view, int offsetX, int offsetY, int delayDir, int slideDir) {
    if (offsetX < 0) {
        offsetX = 0;
    }
    if (offsetY < 0) {
        offsetY = 0;
    }
    if (view instanceof ViewGroup && ((ViewGroup) view).getChildCount() > 0 &&
            !MATERIAL_IN_BLOCK.equals(view.getTag()) &&
            !MATERIAL_IN_BLOCK_WITHOUT_SLIDE.equals(view.getTag())) {
        ViewGroup viewGroup = (ViewGroup) view;
        int viewHeight = viewGroup.getHeight();
        for (int i = 0; i < viewGroup.getChildCount(); i++) {
            View child = viewGroup.getChildAt(i);
            int nextOffsetX = offsetX + ((delayDir == Gravity.RIGHT) ? child.getLeft() :
                    (delayDir == Gravity.LEFT ? viewHeight - child.getRight() : 0));
            int nextOffsetY = offsetY + ((delayDir == Gravity.BOTTOM) ? child.getTop() :
                    (delayDir == Gravity.TOP ? viewHeight - child.getBottom() : 0));
            initAnimation(child, nextOffsetX, nextOffsetY, delayDir, slideDir);
        }
    } else {
        final Resources res = view.getResources();
        int slideTranslation = res.getDimensionPixelSize(R.dimen.material_in_anim_slide_offset);
        if (MATERIAL_IN_BLOCK_WITHOUT_SLIDE.equals(view.getTag())) {
            slideTranslation = 0;
        }
        int multY = 0;
        if (slideDir == Gravity.TOP) {
            multY = 1;
        } else if (slideDir == Gravity.BOTTOM) {
            multY = -1;
        }
        int multX = 0;
        if (slideDir == Gravity.LEFT) {
            multX = 1;
        } else if (slideDir == Gravity.RIGHT) {
            multX = -1;
        }
        int delayOffset = delayDir == Gravity.TOP || delayDir == Gravity.BOTTOM ? offsetY : offsetX;
        float delayDenominator = res.getDimension(R.dimen.material_in_delay_denominator);
        long delay = (long) (delayOffset / delayDenominator);
        startAnimators(view, slideTranslation * multX, slideTranslation * multY, delay);
    }
}
项目:DMS    文件:MealFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_meal, container, false);
    init(view);

    return view;
}