private void textSwiter() { textSwitcher.setFactory(new ViewSwitcher.ViewFactory() { @Override public View makeView() { return (TextView) LayoutInflater.from(CreateActivity.this).inflate(R.layout.item_textswitcher, null); } }); Observable.interval(1, 1, TimeUnit.SECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer<Long>() { @Override public void accept(Long aLong) throws Exception { textSwitcher.setText("随机数 : " + aLong); } }); }
public void initViews() { flRootView = (FrameLayout) activity.findViewById(R.id.play_root); isBg = (ImageSwitcher) activity.findViewById(R.id.play_bg); isBg.setFactory(new ViewSwitcher.ViewFactory() { @Override public View makeView() { ImageView view = new ImageView(activity); view.setLayoutParams(new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); view.setScaleType(ImageView.ScaleType.CENTER_CROP); return view; } }); }
private void initViews() { albumView = (ImageSwitcher) view.findViewById(R.id.play_album_is); albumView.setFactory(new ViewSwitcher.ViewFactory() { @Override public View makeView() { ImageView imageView = new ImageView(getActivity()); imageView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); imageView.setScaleType(ImageView.ScaleType.FIT_CENTER); int pad = (int) getActivity().getResources().getDimension(R.dimen.play_album_padding); imageView.setPadding(pad, pad, pad, pad); return imageView; } }); DisplayMetrics metrics = Utils.getMetrics(getActivity()); //专辑图片直径 int size = metrics.widthPixels * 2 / 3; albumPictureController = new AlbumPictureController(getActivity(), albumView, size); }
@Override protected void initViews(Bundle savedInstanceState) { setDisplayHomeAsUpEnabled(true); tvVersion = (TextView) findViewById(R.id.tv_app_version); tvVersion.setText("v" + BuildConfig.VERSION_NAME); imageSwitcher = (ImageSwitcher) findViewById(R.id.imageSwitcher); imageSwitcher.setFactory(new ViewSwitcher.ViewFactory() { @Override public View makeView() { ImageView imageView = new ImageView(AboutActivity.this); imageView.setScaleType(ImageView.ScaleType.FIT_XY); return imageView; } }); imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.zoom_in)); imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.zoom_out)); }
@Override public void onBackPressed() { Log.v(L.TAG, "SimplyDoActivity.onBackPressed() called"); ViewSwitcher viewSwitch = (ViewSwitcher)findViewById(R.id.ListsItemsSwitcher); int displayed = viewSwitch.getDisplayedChild(); if(displayed == 0) { super.onBackPressed(); } else { setTitle(R.string.app_name); viewSwitch.showPrevious(); dataViewer.setSelectedList(null); itemPropertiesAdapter.notifyDataSetChanged(); } }
@Override public boolean onPrepareOptionsMenu(Menu menu) { Log.v(L.TAG, "SimplyDoActivity.onPrepareOptionsMenu() called"); menu.clear(); ViewSwitcher viewSwitch = (ViewSwitcher)findViewById(R.id.ListsItemsSwitcher); boolean isItemDisplay = viewSwitch.getDisplayedChild() != 0; if(isItemDisplay) { MenuItem deleteInactiveMI = menu.add(Menu.NONE, DELETE_INACTIVE, Menu.NONE, "Delete Inactive"); deleteInactiveMI.setIcon(android.R.drawable.ic_menu_delete); } MenuItem settingsMI = menu.add(Menu.NONE, SETTINGS, Menu.NONE, "Settings"); settingsMI.setIcon(android.R.drawable.ic_menu_preferences); if(isItemDisplay) { MenuItem sortNowMI = menu.add(Menu.NONE, SORT_NOW, Menu.NONE, "Sort Now"); sortNowMI.setIcon(android.R.drawable.ic_menu_sort_by_size); } return true; }
private void listSelected(ListDesc list, boolean animate) { //Log.v(L.TAG, "SimplyDoActivity.listSelected() called on list " + list.getId()); setTitle(list.getLabel()); dataViewer.setSelectedList(list); itemListSorter.sort(dataViewer.getItemData()); itemPropertiesAdapter.notifyDataSetChanged(); ViewSwitcher viewSwitch = (ViewSwitcher)findViewById(R.id.ListsItemsSwitcher); if(animate) { viewSwitch.showNext(); } else { viewSwitch.reset(); viewSwitch.setAnimateFirstView(false); viewSwitch.setDisplayedChild(1); } }
public PinView(Context context, PinListener listener, String pin, int layoutId) { this.context = context; this.listener = listener; this.confirmPin = pin == null; this.pin1 = pin; LayoutInflater layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = layoutInflater.inflate(layoutId, null); for (int id : buttons) { v.findViewById(id).setOnClickListener(this); } result = (TextView)v.findViewById(R.id.result1); switcher = (ViewSwitcher)v.findViewById(R.id.switcher); switcher.setInAnimation(inFromRightAnimation()); switcher.setOutAnimation(outToLeftAnimation()); try { digest = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } this.vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); }
/** * Hides the Options Menu and uses a ViewSwitcher to quick turn the exisiting TextView with the * Flow's name into an EditText for the user to rename. * * @param cardPosition position of cardview in adapter * @param cardViewClicked the cardview view object clicked */ private void renameFlow(final int cardPosition, final View cardViewClicked) { menuState = AppConstants.MENU_ITEMS_HIDE; invalidateOptionsMenu(); final ViewSwitcher switcher = (ViewSwitcher) cardViewClicked.findViewById(R.id.hub_rename_switcher); final EditText rename = (EditText) switcher.findViewById(R.id.hub_item_flow_rename); AppUtils.setNameInputFilters(rename); rename.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (rename.hasFocus()) { showEditPopupWindow(rename, cardViewClicked, switcher, cardPosition); } } }); switcher.showNext(); rename.requestFocus(); /* Forces keyboard */ }
public AbsImageListViewItem(Context context, int layoutID, int imageviewID, int switcherID, ScrollSpeedAdapter adapter) { super(context); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(layoutID, this, true); mImageView = (ImageView) findViewById(imageviewID); mSwitcher = (ViewSwitcher) findViewById(switcherID); mHolder = new AsyncLoader.CoverViewHolder(); mHolder.coverLoadable = this; mHolder.mAdapter = adapter; mHolder.imageDimension = new Pair<>(0,0); mCoverDone = false; if ( null != mImageView && null != mSwitcher) { mSwitcher.setOutAnimation(null); mSwitcher.setInAnimation(null); mImageView.setImageDrawable(null); mSwitcher.setDisplayedChild(0); mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_out)); mSwitcher.setInAnimation(AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_in)); } }
private void setupPassageSection(Devotional dev, View view) { TextView verses = (TextView) view.findViewById(R.id.dev_passage_verses); verses.setText(dev.getPassages()); this.passages = passageDb.readPassages(dev.getGuid()); passageContent = (TextSwitcher) view.findViewById(R.id.dev_passage_content); passageContent.setFactory(new ViewSwitcher.ViewFactory() { public View makeView() { TextView myText = new TextView(ShowDevotionalActivity.this); return myText; } }); Animation in = AnimationUtils.loadAnimation(this, android.R.anim.fade_in); passageContent.setInAnimation(in); Spinner transSelector = (Spinner) view.findViewById(R.id.dev_passage_translation_selector); ArrayAdapter<Translation> transSelAdapter = new ArrayAdapter<>(this, android.R.layout .simple_spinner_item, Translation.values()); transSelAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); transSelector.setAdapter(transSelAdapter); transSelector.setOnItemSelectedListener(this); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { root = (ViewSwitcher) inflater.inflate(R.layout.fragment_network, container, false); messages = (TextView) root.findViewById(R.id.loading_text); final View autoConnect = root.findViewById(R.id.auto_connect); // Auto connect service unavailable for manual calculations if (wifiNetwork.getScanResult() == null) autoConnect.setVisibility(View.GONE); else { final int level = wifiNetwork.getLevel(); } if (passwordList != null) displayResults(); return root; }
@Override protected void initView() { getWindow().addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD); getWindow().addFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED); setUI(); SwipeUnLockLayout swipeUnLockLayout = (SwipeUnLockLayout) findViewById( R.id.slide_layout); swipeUnLockLayout.setOnSwipeListener(this); mViewSwitcher = (ViewSwitcher) findViewById(R.id.lock_view_switcher); mTitle = (TextView) findViewById(R.id.lock_view_gank_title); TextView mLockViewDate = (TextView) findViewById(R.id.lock_view_date); final String lockDateText = DateUtil.getLockDateText(); mLockViewDate.setText(lockDateText); mImg = (ImageView) findViewById(R.id.lock_view_img); url = PreferenceUtil.getString("url"); if (url.isEmpty()) { mImg.setImageResource(R.drawable.test_image); } else { getBitmap(); } mImg.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mViewSwitcher.showNext(); } }); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.request, container, false); switcherLoad = (ViewSwitcher) rootView.findViewById(R.id.viewSwitcherLoadingMain); FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab_rq); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { confirmSelection(); } }); if (taskList.getStatus() == AsyncTask.Status.PENDING) { // My AsyncTask has not started yet taskList.execute(); } if (taskList.getStatus() == AsyncTask.Status.FINISHED) { // My AsyncTask is done and onPostExecute was called new AsyncWorkerList().execute(); } return rootView; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.welcome_to_summoner_rift); ButterKnife.bind(this); mProcessTv.setInAnimation(this, R.anim.bottom_in); mProcessTv.setOutAnimation(this, R.anim.top_out); mProcessTv.setFactory(new ViewSwitcher.ViewFactory() { @Override public TextView makeView() { TextView textView = (TextView) LayoutInflater.from(WelcomeToSummonerRift.this) .inflate(R.layout.progress_text, null); return textView; } }); }
private void initPromptSwitcher() { promptTextSwitcher.setFactory(new ViewSwitcher.ViewFactory() { @Override public View makeView() { TextView textView = new TextView(getActivity()); int padding = getResources().getDimensionPixelOffset(R.dimen.prompt_padding); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.MATCH_PARENT); params.gravity = Gravity.CENTER; textView.setLayoutParams(params); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.exam_small_text)); textView.setPadding(padding, padding, padding, padding); textView.setMovementMethod(new ScrollingMovementMethod()); textView.setVerticalScrollBarEnabled(true); return textView; } }); }
private void loadViews() { mMyLocButton = (ImageView) findViewById(R.id.my_loc); mMyLocButton.setOnClickListener(this); mStartButton = (ImageView) findViewById(R.id.start); mStartButton.setOnClickListener(this); mViewSwitcher = (ViewSwitcher) findViewById(R.id.view_switcher); mViewSwitcher.setOnClickListener(this); mBigDistanceView = (TextView) findViewById(R.id.big_distance_view); mSmallDistanceView = (TextView) findViewById(R.id.small_distance_view); mTimeSpanView = (TextView) findViewById(R.id.time_span_view); mAverageSpeedView = (TextView) findViewById(R.id.avr_speed_view); findViewById(R.id.route).setOnClickListener(this); findViewById(R.id.settings).setOnClickListener(this); findViewById(R.id.zoom_in).setOnClickListener(this); findViewById(R.id.zoom_out).setOnClickListener(this); }
@Test public void configurationChangeReturnsToAddCardView() { BraintreeUnitTestHttpClient httpClient = new BraintreeUnitTestHttpClient() .configuration(new TestConfigurationBuilder().build()); setup(httpClient); assertThat(mAddCardView).isVisible(); assertEquals(1, ((ViewSwitcher) mActivity.findViewById(R.id.bt_loading_view_switcher)) .getDisplayedChild()); assertThat(mEditCardView).isGone(); assertThat(mEnrollmentCardView).isGone(); triggerConfigurationChange(httpClient); assertThat(mAddCardView).isVisible(); assertEquals(1, ((ViewSwitcher) mActivity.findViewById(R.id.bt_loading_view_switcher)) .getDisplayedChild()); assertThat(mEditCardView).isGone(); assertThat(mEnrollmentCardView).isGone(); }
@Test public void configurationChangeReturnsToEditCardView() { BraintreeUnitTestHttpClient httpClient = new BraintreeUnitTestHttpClient() .configuration(new TestConfigurationBuilder() .creditCards(getSupportedCardConfiguration()) .build()); setup(httpClient); setText(mAddCardView, R.id.bt_card_form_card_number, VISA); assertThat(mEditCardView).isVisible(); assertThat(mAddCardView).isGone(); assertEquals(1, ((ViewSwitcher) mActivity.findViewById(R.id.bt_loading_view_switcher)) .getDisplayedChild()); assertThat(mEnrollmentCardView).isGone(); triggerConfigurationChange(httpClient); assertThat(mEditCardView).isVisible(); assertThat(mAddCardView).isGone(); assertEquals(1, ((ViewSwitcher) mActivity.findViewById(R.id.bt_loading_view_switcher)) .getDisplayedChild()); assertThat(mEnrollmentCardView).isGone(); }
@Test public void addingACardRemainsOnEditCardView() { setup(new BraintreeUnitTestHttpClient().configuration(new TestConfigurationBuilder() .creditCards(getSupportedCardConfiguration()) .build())); setText(mAddCardView, R.id.bt_card_form_card_number, VISA); mAddCardView.findViewById(R.id.bt_button).performClick(); setText(mEditCardView, R.id.bt_card_form_expiration, ExpirationDate.VALID_EXPIRATION); mEditCardView.findViewById(R.id.bt_button).performClick(); assertThat(mEditCardView).isVisible(); assertThat(mEditCardView.findViewById(R.id.bt_animated_button_loading_indicator)).isVisible(); assertThat(mEditCardView.findViewById(R.id.bt_button)).isGone(); assertEquals(1, ((ViewSwitcher) mActivity.findViewById(R.id.bt_loading_view_switcher)) .getDisplayedChild()); assertThat(mAddCardView).isGone(); assertThat(mEnrollmentCardView).isGone(); }
/** * Hides the Options Menu and uses a ViewSwitcher to quick turn the exisiting TextView with the * Flow's name into an EditText for the user to rename. * * @param cardPosition position of cardview in adapter * @param cardViewClicked the cardview view object clicked */ private void renameFlow(final int cardPosition, final View cardViewClicked) { menuState = AppConstants.MENU_ITEMS_HIDE; invalidateOptionsMenu(); final ViewSwitcher switcher = (ViewSwitcher) cardViewClicked.findViewById(R.id.hub_rename_switcher); final EditText rename = (EditText) switcher.findViewById(R.id.hub_item_flow_rename); AppUtils.setNameInputFilters(rename); rename.setOnFocusChangeListener(new View.OnFocusChangeListener() { @RequiresApi(api = Build.VERSION_CODES.KITKAT) @Override public void onFocusChange(View v, boolean hasFocus) { if (rename.hasFocus()) { showEditPopupWindow(rename, cardViewClicked, switcher, cardPosition); } } }); switcher.showNext(); rename.requestFocus(); /* Forces keyboard */ }
@Override public void editListName(View _View, ShoppingList _ShoppingList, ViewSwitcher _ViewSwitcher) { ImageView cancelView; ImageView submitView; EditText editText; cancelView = (ImageView) _View.findViewById(R.id.expandable_list_view_edit_cancel); submitView = (ImageView) _View.findViewById(R.id.expandable_list_view_edit_submit); editText = (EditText) _View.findViewById(R.id.expandable_list_view_list_edit_name); cancelView.setOnClickListener(new OnCancelClickListenerWithData(_ViewSwitcher)); submitView.setOnClickListener(new OnSubmitClickListenerWithChildData(mContext, _ViewSwitcher, editText, _ShoppingList.mUUID)); editText.setText(_ShoppingList.mName); _ViewSwitcher.showNext(); }
private void initViews(Context context) { //与梦想列表同布局 inflate(context, R.layout.common_empty_xlistview_layout, this); llContainerView = (LinearLayout)findViewById(R.id.ll_contaner_view); vsLayout = (ViewSwitcher)findViewById(R.id.vs_view_switcher); emptyLayout = (EmptyLayout)findViewById(R.id.empty_layout_4_loading); emptyLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { emptyLayout.setErrorType(EmptyLayout.NETWORK_LOADING); onRefresh(); } }); xListView = (XListView) findViewById(R.id.activity_searchfriends_data_listview); xListView.setXListViewListener(this); }
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final View view = getLayoutInflater(savedInstanceState) .inflate(R.layout.fragment_web, container, false); mFullscreenView = (ViewGroup) view.findViewById(R.id.fullscreen); mScrollViewContent = (ViewGroup) view.findViewById(R.id.scroll_view_content); mScrollView = (NestedScrollView) view.findViewById(R.id.nested_scroll_view); mControls = (ViewSwitcher) view.findViewById(R.id.control_switcher); mWebView = (WebView) view.findViewById(R.id.web_view); mButtonRefresh = (ImageButton) view.findViewById(R.id.button_refresh); mButtonNext = view.findViewById(R.id.button_next); mButtonNext.setEnabled(false); mEditText = (EditText) view.findViewById(R.id.edittext); setUpWebControls(view); setUpWebView(view); return view; }
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { if (isNewInstance()) { mFragmentView = inflater.inflate(R.layout.fragment_web, container, false); mFullscreenView = (ViewGroup) mFragmentView.findViewById(R.id.fullscreen); mScrollViewContent = (ViewGroup) mFragmentView.findViewById(R.id.scroll_view_content); mScrollView = (NestedScrollView) mFragmentView.findViewById(R.id.nested_scroll_view); mControls = (ViewSwitcher) mFragmentView.findViewById(R.id.control_switcher); mWebView = (WebView) mFragmentView.findViewById(R.id.web_view); mButtonRefresh = (ImageButton) mFragmentView.findViewById(R.id.button_refresh); mButtonMore = mFragmentView.findViewById(R.id.button_more); mButtonNext = mFragmentView.findViewById(R.id.button_next); mButtonNext.setEnabled(false); mEditText = (EditText) mFragmentView.findViewById(R.id.edittext); setUpWebControls(mFragmentView); setUpWebView(mFragmentView); } return mFragmentView; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_activities, container, false); viewSwitcher = (ViewSwitcher) v.findViewById(R.id.viewSwitcher); recyclerView = (RecyclerView) v.findViewById(R.id.recyclerView); swipeRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipeRefreshLayout); swipeRefreshLayout.setOnRefreshListener(this); adapter = new ActivitiesAdapter(getActivity()); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setAdapter(adapter); recyclerView.addItemDecoration(new DividerDecoration(getActivity()).setPaddingLeft(getResources().getDimensionPixelSize(R.dimen.list_image_padding))); RestAdapter restAdapter = Utils.getRestAdapter(getActivity()); api = restAdapter.create(ActivityService.class); api.getActivities(this); return v; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //making the app full screen this.requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main_menu); menuViewSwitcher = (ViewSwitcher) findViewById(R.id.mainMenuViewSwitcher); gameSizeSpinner = (Spinner) findViewById(R.id.newGameMenuGameSizeSpinner); //At this point picture has not been chosen yet, so the PLAY button has to be disabled. playButton = (Button) findViewById(R.id.playButton); playButton.setEnabled(false); }
private void initViews() { board = (ViewSwitcher) findViewById(R.id.switcher); Typeface tf = ThisApplication.getFontResource(R.string.font_oem1); TextView tv = (TextView) findViewById(R.id.txtAppName); tv.setTypeface(tf); tf = ThisApplication.getFontResource(R.string.font_oem2); tv = getFrontPage(); tv.setMovementMethod(LinkMovementMethod.getInstance()); tv.setTypeface(tf); tv = getBackPage(); tv.setMovementMethod(LinkMovementMethod.getInstance()); tv.setTypeface(tf); toolbar = new Toolbar((ViewGroup) findViewById(R.id.toolbar)); }
private void updateAnimation() { View view = getView(); if (view == null) { return; } ViewSwitcher viewSwitcher = (ViewSwitcher) view; if (viewSwitcher.getInAnimation() != mInAnimation || mInAnimation == null) { if (mInAnimation == null) { mInAnimation = AnimationFactory.pushDownIn(); } if (viewSwitcher instanceof TextSwitcher) { mInAnimation.setAnimationListener(mTextViewInAnimationListener); } mInAnimation.setDuration(mInDuration); viewSwitcher.setInAnimation(mInAnimation); } if (viewSwitcher.getOutAnimation() != mOutAnimation || mOutAnimation == null) { if (mOutAnimation == null) { mOutAnimation = AnimationFactory.pushDownOut(); } mOutAnimation.setDuration(mOutDuration); viewSwitcher.setOutAnimation(mOutAnimation); } }
public a(Context paramContext, x paramx, String paramString, cu paramcu) { if (paramx.eG) { this.eg = null; } else { this.eg = new ViewSwitcher(paramContext); this.eg.setMinimumWidth(paramx.widthPixels); this.eg.setMinimumHeight(paramx.heightPixels); this.eg.setVisibility(4); } this.em = paramx; this.adUnitId = paramString; this.eh = paramContext; this.ei = new h(g.a(paramcu.iJ, paramContext)); this.ej = paramcu; }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mLoadingSwitcher = (ViewSwitcher) view.findViewById(R.id.loading_switcher); mLoadingView = (LottieAnimationView) view.findViewById(R.id.loading_anim); mRecyclerView = (RecyclerView) view.findViewById(android.R.id.list); mRecyclerView.addItemDecoration(new DividerDecoration(getContext())); mAdapter = new MyIOAdapter(getContext(), this); mRecyclerView.setAdapter(mAdapter); mRecyclerView.setLayoutManager( new StickyHeadersLinearLayoutManager<MyIOAdapter>(getContext())); mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { mScrolled = true; recyclerView.removeOnScrollListener(this); } }); View header = view.findViewById(R.id.header_anim); if (header instanceof ImageView) { AnimatedVectorDrawable avd = (AnimatedVectorDrawable) ContextCompat.getDrawable( getContext(), R.drawable.avd_header_my_io); ((ImageView) header).setImageDrawable(avd); avd.start(); } }
private void initView() { mViewSwitcher = (ViewSwitcher)findViewById(R.id.imagedialog_view_switcher); mViewSwitcher.setOnTouchListener(touchListener); btn_preview = (Button)findViewById(R.id.imagedialog_preview_button); btn_preview.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String imgURL = getIntent().getStringExtra("img_url"); UIHelper.showImageZoomDialog(v.getContext(), imgURL); finish(); } }); mImage = (ImageView)findViewById(R.id.imagedialog_image); mImage.setOnTouchListener(touchListener); }
public void setContent(Fragment content) { Fragment last = mCurrentContent; mCurrentContent = content; FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction(); if (last != null) ft.replace(R.id.content, mCurrentContent); else ft.add(R.id.content, mCurrentContent); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); if (mContainer instanceof ViewSwitcher) { ViewSwitcher switcher = (ViewSwitcher)mContainer; if (mContent != switcher.getCurrentView()) switcher.showNext(); } ft.commit(); }
@Override protected void bindItemView(View convertView, Context context, Cursor cursor) { final ToasterModel toaster = new ToasterModel(); toaster.loadFromCursor(cursor); final ViewHolder holder = (ViewHolder) convertView.getTag(); holder.txtName.setText(toaster.name); holder.txtJob.setText(toaster.jobDescription); Picasso.with(context).load(toaster.imageUrl) .error(R.drawable.toaster_backup).transform(mToasterTrans) .into(holder.imgToaster); Picasso.with(context).load(toaster.imageUrl) .error(R.drawable.toaster_backup).transform(mHumanTrans) .into(holder.imgHuman); // Reseting the view our switcher is showing. switchWithoutAnimation(holder.switcher); holder.switcher.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((ViewSwitcher) v).showNext(); } }); }
private void initView() { mViewSwitcher = (ViewSwitcher) findViewById(R.id.imagedialog_view_switcher); mViewSwitcher.setOnTouchListener(touchListener); btn_preview = (Button) findViewById(R.id.imagedialog_preview_button); btn_preview.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String imgURL = getIntent().getStringExtra("img_url"); UIHelper.showImageZoomDialog(v.getContext(), imgURL); finish(); } }); mImage = (ImageView) findViewById(R.id.imagedialog_image); mImage.setOnTouchListener(touchListener); }