Java Code Examples for android.view.ViewGroup

The following are top voted examples for showing how to use android.view.ViewGroup. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: ceji_android   File: ReadingActivity.java   View source code 7 votes vote down vote up
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);
}
 
Example 2
Project: RNLearn_Project1   File: ReactFindViewUtil.java   View source code 7 votes vote down vote up
/**
 * 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;
}
 
Example 3
Project: Renrentou   File: CitySelectFragment.java   View source code 6 votes vote down vote up
@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;
}
 
Example 4
Project: inventum   File: DiscoverFragment.java   View source code 6 votes vote down vote up
@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;
}
 
Example 5
Project: cat-is-a-dog   File: FollowingHabitsListAdapter.java   View source code 6 votes vote down vote up
/**
 * 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;
}
 
Example 6
Project: conductor-attacher   File: SimpleDialogController.java   View source code 6 votes vote down vote up
@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);
}
 
Example 7
Project: Linphone4Android   File: CreateAccountActivationFragment.java   View source code 6 votes vote down vote up
@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;
}
 
Example 8
Project: BrotherWeather   File: PhotoAdapter.java   View source code 6 votes vote down vote up
@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;
  }
}
 
Example 9
Project: Trivia-Knowledge   File: GeoAdapter.java   View source code 6 votes vote down vote up
@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;
}
 
Example 10
Project: QianXun   File: RecyclerHomepagerAdapter.java   View source code 6 votes vote down vote up
@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;
    }

}
 
Example 11
Project: argus-android   File: ForgotPasswordProvider.java   View source code 6 votes vote down vote up
@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");
    }
}
 
Example 12
Project: ceji_android   File: MyNoteActvity.java   View source code 6 votes vote down vote up
@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;

}
 
Example 13
Project: DragPhotoView   File: SingleDragDetector.java   View source code 6 votes vote down vote up
/**
 * 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;
}
 
Example 14
Project: boohee_v5.6   File: MQEmotionKeyboardLayout.java   View source code 6 votes vote down vote up
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;
}
 
Example 15
Project: chaosflix-leanback   File: CardPresenter.java   View source code 6 votes vote down vote up
@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);
}
 
Example 16
Project: VirtualLocation   File: PreciseLocationActivity.java   View source code 6 votes vote down vote up
/**
 * 使组件变回原有形状
 * @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();
}
 
Example 17
Project: Kids-Portal-Android   File: Fragment_Pass.java   View source code 6 votes vote down vote up
@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;
}
 
Example 18
Project: YCBanner   File: SecondActivity.java   View source code 5 votes vote down vote up
@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;
}
 
Example 19
Project: GitHub   File: HomeFragment.java   View source code 5 votes vote down vote up
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
  }
}
 
Example 20
Project: CoordinatorLayoutExample-master   File: EmptyWrapper.java   View source code 5 votes vote down vote up
@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);
}
 
Example 21
Project: atlas   File: ActivityGroupDelegate.java   View source code 5 votes vote down vote up
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));
}
 
Example 22
Project: BBSSDK-for-Android   File: EmptyView.java   View source code 5 votes vote down vote up
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);
}
 
Example 23
Project: eazycore   File: BaseFragment.java   View source code 5 votes vote down vote up
@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;
}
 
Example 24
Project: okwallet   File: PeerListFragment.java   View source code 5 votes vote down vote up
@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;
}
 
Example 25
Project: Android-DFU-App   File: FileBrowserAppsAdapter.java   View source code 5 votes vote down vote up
@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;
}
 
Example 26
Project: firebase-chat-android-architecture-components   File: ProfileActivity.java   View source code 5 votes vote down vote up
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());
}
 
Example 27
Project: phonk   File: LicenseActivity.java   View source code 5 votes vote down vote up
@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;
}
 
Example 28
Project: RecyclerviewExpand   File: MainActivity.java   View source code 5 votes vote down vote up
public MainViewHolder(ViewGroup itemView) {
    super(itemView);
    contactNameTV = ((TextView) itemView.findViewById(R.id.contactName));
    infos = ((TextView) itemView.findViewById(R.id.infos));

    itemView.setOnClickListener(this);
}
 
Example 29
Project: LQRWeChat   File: PopupWindowUtils.java   View source code 5 votes vote down vote up
/**
 * 得到在屏幕中间的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);
}
 
Example 30
Project: Hotspot-master-devp   File: AbstractWheelTextAdapter.java   View source code 5 votes vote down vote up
@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;
}
 
Example 31
Project: Guanajoven   File: IdiomasAdicionalesDialogFragment.java   View source code 5 votes vote down vote up
@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;
}
 
Example 32
Project: miaosou   File: ComicReadFragment.java   View source code 5 votes vote down vote up
@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;
}
 
Example 33
Project: ticker_up   File: PerfActivity.java   View source code 5 votes vote down vote up
@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));
}
 
Example 34
Project: Shared-Route   File: TaskViewAdapter.java   View source code 5 votes vote down vote up
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;
}
 
Example 35
Project: Runnest   File: ProfileFragment.java   View source code 5 votes vote down vote up
@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;
}
 
Example 36
Project: JD-Test   File: BottomNavigationBar.java   View source code 5 votes vote down vote up
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);
    }
}
 
Example 37
Project: AndroidOpen   File: HotCityGridAdapter.java   View source code 5 votes vote down vote up
@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;
}
 
Example 38
Project: SimpleRatingBar   File: PartialView.java   View source code 5 votes vote down vote up
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();
}
 
Example 39
Project: file.io-app   File: MaterialIn.java   View source code 5 votes vote down vote up
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);
    }
}
 
Example 40
Project: DMS   File: MealFragment.java   View source code 5 votes vote down vote up
@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;
}