public static void initializeRatingBar( @NonNull final Geocache cache, final View parentView, @Nullable final OnRatingChangeListener changeListener) { if (GCVote.isVotingPossible(cache)) { final RatingBar ratingBar = ButterKnife.findById(parentView, R.id.gcvoteRating); final TextView label = ButterKnife.findById(parentView, R.id.gcvoteLabel); ratingBar.setVisibility(View.VISIBLE); label.setVisibility(View.VISIBLE); ratingBar.setOnRatingBarChangeListener( new OnRatingBarChangeListener() { @Override public void onRatingChanged( final RatingBar ratingBar, final float stars, final boolean fromUser) { // 0.5 is not a valid rating, therefore we must limit final float rating = GCVote.isValidRating(stars) ? stars : 0; if (rating < stars) { ratingBar.setRating(rating); } label.setText(GCVote.getDescription(rating)); if (changeListener != null) { changeListener.onRatingChanged(rating); } } }); ratingBar.setRating(cache.getMyVote()); } }
@Override public View getView(int i, View view, ViewGroup viewGroup) { View v = view; if (v == null) { v = layoutInflater.inflate(R.layout.history_item, viewGroup, false); } v.setTag(i); final CheckBox cbHistory = (CheckBox) v.findViewById(R.id.cbHistory); cbHistory.setTag(i); v.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { cbHistory.setChecked(!cbHistory.isChecked()); if (cbHistory.isChecked()) { checkedModelsIDs.add(getItemId(Integer.parseInt(cbHistory.getTag().toString()))); } else { checkedModelsIDs.remove(getItemId(Integer.parseInt(cbHistory.getTag().toString()))); } } }); TripModel tripModel = tripModelList.get(i); TextView tvDate = ButterKnife.findById(v, R.id.tvDate); TextView tvMark = ButterKnife.findById(v, R.id.tvMark); TextView tvType = ButterKnife.findById(v, R.id.tvType); tvDate.setText(simpleDateFormat.format(tripModel.getFinishTime())); tvMark.setText(String.format(Double.toString(tripModel.getMark()))); tvType.setText(tripModel.getTripType().toString()); return v; }
@Test public void injectingKnownPackagesIsNoOp() { ButterKnife.bind(new Activity()); assertThat(ButterKnife.INJECTORS).isEmpty(); ButterKnife.bind(new Object(), new Activity()); assertThat(ButterKnife.INJECTORS).isEmpty(); }
@Override public View getView(int i, View convertView, ViewGroup viewGroup) { View view = convertView; ViewHolder holder; if (view == null) { view = inflater.inflate(layoutId, null); holder = new ViewHolder(); holder.nameView = ButterKnife.findById(view, nameTextViewId); holder.albumView = ButterKnife.findById(view, albumTextViewId); holder.image = ButterKnife.findById(view, imageViewId); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } Track track = data.get(i); if (track == null || track.getName() == null || track.getAlbum() == null) throw new IllegalArgumentException("Track in adapter was incorrect. Track => " + track); String imageUrl = track.getImageUrl(); if (imageUrl != null && imageUrl.length() > 0) Picasso.with(context).load(imageUrl).into(holder.image); else Picasso.with(context).load(R.drawable.no_image_available).into(holder.image); holder.nameView.setText(track.getName()); holder.albumView.setText(track.getAlbum()); return view; }
public CommentView(View itemView) { super(itemView); // get the subviews comment = findById(itemView, R.id.comment); vote = ButterKnife.findById(itemView, R.id.voting); senderInfo = ButterKnife.findById(itemView, R.id.sender_info); kFav = ButterKnife.findById(itemView, R.id.kfav); }
@Override public void setContentView(int layoutResID) { super.setContentView(layoutResID); ButterKnife.inject(this); mToolbar = ButterKnife.findById(this, R.id.common_toolbar); if (mToolbar != null) { setSupportActionBar(mToolbar); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } }
@Test public void shouldPutRandomNumberInAmountAfterButtonClick() { // given double value = 100.0; given(randomAmount.getAmount()).willReturn(value); Button button = ButterKnife.findById(fragment.getView(), R.id.random); // when button.performClick(); // then EditText amount = ButterKnife.findById(fragment.getView(), R.id.amount); ANDROID.assertThat(amount).hasTextString(String.valueOf(value)); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_daily_forecast); ButterKnife.bind(this); Intent intent = getIntent(); mLocation = intent.getStringExtra(getString(R.string.location_name)); Parcelable[] parcelables = intent.getParcelableArrayExtra(MainActivity.DAILY_FORECAST); mDays = Arrays.copyOf(parcelables, parcelables.length, Day[].class); mLocationLabel.setText(String.valueOf(mLocation)); DayAdapter adapter = new DayAdapter(this, mDays); mListView.setAdapter(adapter); mListView.setEmptyView(mEmptyTextView); mListView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String dayOfTheWeek = mDays[position].getDayOfTheWeek(); String conditions = mDays[position].getSummary(); String highTemp = mDays[position].getTemperatureMax() + ""; String lowTemp = mDays[position].getTemperatureMin() + ""; String message = String.format( "%s - High: %s, Low: %s, and %s", dayOfTheWeek, highTemp, lowTemp, conditions); Toast.makeText(DailyForecastActivity.this, message, Toast.LENGTH_LONG).show(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ButterKnife.bind(this); getSupportActionBar().hide(); final ViewPagerAdapter adap = new ViewPagerAdapter(getSupportFragmentManager()); viewpager.setAdapter(adap); viewpager.addOnPageChangeListener( new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled( int position, float positionOffset, int positionOffsetPixels) {} @Override public void onPageSelected(int position) { updateTotal(position, PIC_LINKS.length); } @Override public void onPageScrollStateChanged(int state) {} }); updateTotal(0, PIC_LINKS.length); }
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getArguments().getString("title")); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.dialog_minutes, null, false); ButterKnife.bind(this, view); numberPicker.setMinValue(0); numberPicker.setMaxValue(300); numberPicker.setValue(getArguments().getInt("minutes")); builder.setView(view); builder.setPositiveButton( getArguments().getString("positiveBtn"), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { numberPicker.clearFocus(); int minutes = numberPicker.getValue(); callback.onDialogMinutesPositiveClick(getArguments().getInt("dialogId"), minutes); } }); Dialog dialog = builder.create(); dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); return dialog; }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // получаем плавающую кнопку из активити FloatingActionButton fab = ButterKnife.findById(getActivity(), R.id.fab); // получаем параметры Layout fab приведенные к родителю CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); // выставляем привязку якоря к appBarLayout params.setAnchorId(R.id.appbar_layout); // выставляем anchorGravity params.anchorGravity = Gravity.BOTTOM | Gravity.RIGHT; fab.setLayoutParams(params); // меняем иконку плавающей кнопки fab.setImageResource(R.drawable.ic_mode_edit_24dp); /* fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //создаем и вешаем новый обработчик на fab //выбираем действие для fab в зависимости от текущего режима if (sCurrentFunctionality.equals(FUNCTIONALITY_PROFILE_VIEW)) { setupFuncionality(FUNCTIONALITY_PROFILE_EDIT); } else { setupFuncionality(FUNCTIONALITY_PROFILE_VIEW); } } });*/ }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_reminder_view); ButterKnife.inject(this); activityContext = this; initValues(); initViews(); mMapEngine = MapEngine.getInstance(this); mMapEngine.init( new OnEngineInitListener() { @Override public void onEngineInitializationCompleted(Error error) { Log.i(TAG, "onEngineInitializationCompleted"); Log.i(TAG, "error : " + error); if (error == Error.NONE) { placesList = new ArrayList<Place>(); mLocationACTV.addTextChangedListener(mTextWatcher); mLocationACTV.setOnItemClickListener(new PlaceAdapterItemClickedListener()); } } }); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_auto_load, container, false); ButterKnife.inject(this, view); return view; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_editor); ButterKnife.bind(this); setSupportActionBar(editorToolbar); editorToolbar.setNavigationIcon(R.mipmap.ic_back); editorToolbar.setTitleTextColor(getResources().getColor(R.color.white)); editorToolbar.setNavigationOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); Intent intent = getIntent(); List<Editor> list = new ArrayList<Editor>(); Bundle bundle = new Bundle(); bundle = intent.getBundleExtra("EditorList"); list = bundle.getParcelableArrayList("EditorList"); EditorListFragment editorListFragment = new EditorListFragment(); editorListFragment.setData(list); getSupportFragmentManager() .beginTransaction() .replace(R.id.editor_fragment_container, editorListFragment) .commit(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(MainActivity.this, "Fab Clicked!", Toast.LENGTH_LONG).show(); } }); switchAnimation.setOnClickListener(this); reset.setOnClickListener(this); resetAndPlay.setOnClickListener(this); changePosAndPlay.setOnClickListener(this); new Handler(Looper.getMainLooper()) .postDelayed( new Runnable() { @Override public void run() { showIntro(fab, INTRO_CARD); } }, 2400); }
@Override public View onCreateView( LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.fragment_buffer, container, false); ButterKnife.bind(this, layout); return layout; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); mProgressBar.setVisibility(View.INVISIBLE); mRefreshView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { getForecast(latitude, longitude); } }); mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); mLocationRequest = LocationRequest.create() .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY) .setInterval(10 * 1000) .setFastestInterval(1 * 1000); }
@Override protected void onFinishInflate() { super.onFinishInflate(); ButterKnife.inject(this); setText(mText); setLeftIcon(mLeftIcon); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = super.onCreateView(inflater, container, savedInstanceState); ButterKnife.bind(this, rootView); return rootView; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_search, container, false); ButterKnife.bind(this, rootView); presenter = new SearchPresenterImpl(this); ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar); ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); searchView.onActionViewExpanded(); searchView.requestFocus(); searchView.setOnQueryTextListener( new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { presenter.begin(query); return true; } @Override public boolean onQueryTextChange(String newText) { return false; } }); return rootView; }
@Override public void finish() { super.finish(); ButterKnife.reset(this); BaseAppManager.getInstance().removeActivity(this); overridePendingTransition(R.anim.right_in, R.anim.right_out); }
@SuppressWarnings("deprecation") @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_scroll, container, false); ButterKnife.inject(this, rootView); initRollInformation(rootView); setOnclickListener(); WindowManager wm = getActivity().getWindowManager(); width = wm.getDefaultDisplay().getWidth(); // int leftMargin = width / 3; // int caculateW = width - leftMargin; int dpW = ScreenUtil.dp2px(getActivity(), 100); int _width = (width - dpW) / mRow; // If we do this we need to uncomment the container on the xml layout createListBuddiesLayoutDinamically(rootView); // mImagesLeft.addAll(Arrays.asList(ImagesUrls.imageUrls_left)); // mImagesRight.addAll(Arrays.asList(ImagesUrls.imageUrls_right)); initData(_width); // mListBuddies.setOnItemClickListener(this); return rootView; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_log, container, false); ButterKnife.bind(this, view); create(); SpinnerAdapter mSpinnerAdapter1 = ArrayAdapter.createFromResource( getActivity(), R.array.log_types, android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(mSpinnerAdapter1); spinner.setSelection(logDetailLevel - 1); spinner.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { // burası ilk sefer boşa çalışmalı if (spinnerCountdown > 0) { spinnerCountdown--; return; } // detay seviyesi değiştirildiyse logları baştan yükle switch (position) { case 0: { if (logDetailLevel != 1) { logDetailLevel = 1; refreshLogs(); } break; } case 1: { if (logDetailLevel != 2) { logDetailLevel = 2; refreshLogs(); } break; } case 2: { if (logDetailLevel != 3) { logDetailLevel = 3; refreshLogs(); } break; } } } @Override public void onNothingSelected(AdapterView<?> parent) {} }); return view; }
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); // getActionBar().hide(); mProgressBar.setVisibility(View.INVISIBLE); mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); // final double langitude = -79.3941133 ; // final double latitude = 43.730804 ; mRefreshImageView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { getForecast(mLatitude, mLongitude); } }); getForecast(mLatitude, mLongitude); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_main, container, false); ButterKnife.bind(MainActivityFragment.this, view); return view; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ButterKnife.bind(this); setSupportActionBar(mToolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_settings, container); unbinder = ButterKnife.bind(this, view); etDate.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { DatePickerFragment newFragment = new DatePickerFragment(); newFragment.setTargetFragment(SettingsFragment.this, 300); newFragment.show(getFragmentManager(), "datePicker"); } }); btnSave.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { SettingsListener listener = (SettingsListener) getActivity(); Settings settings = new Settings(); settings.setBegin(etDate.getText().toString()); settings.setSort((spinner).getSelectedItem().toString()); settings.setArts(cbArts.isChecked()); settings.setFashion(cbFashion.isChecked()); settings.setSports(cbSports.isChecked()); listener.onFinishEditDialog(settings); dismiss(); } }); return view; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(setLayout()); ButterKnife.bind(this); init(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main3); ButterKnife.bind(this); initWindow(); initView(); setAllClick(); pager.addOnPageChangeListener( new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled( int position, float positionOffset, int positionOffsetPixels) {} @Override public void onPageSelected(int position) { select1.setImageResource(R.drawable.page_indicator_unfocused); select2.setImageResource(R.drawable.page_indicator_unfocused); if (position == 0) { select1.setImageResource(R.drawable.page_indicator_focused); } else { select2.setImageResource(R.drawable.page_indicator_focused); } } @Override public void onPageScrollStateChanged(int state) {} }); }
public KomoditasHolder( final int pPosition, final LayoutInflater pLayoutInflater, final ViewGroup pContainer) { mView = pLayoutInflater.inflate(R.layout.row_komoditas, pContainer, false); mSharedPreferencesUtils = SharedPreferencesUtils.getInstance(SiKerang.getContext()); ButterKnife.bind(this, mView); initComponents(pPosition); }