List of usage examples for android.widget TextView setSelected
@Override public void setSelected(boolean selected)
From source file:yjbo.yy.ynewsrecycle.mainutil.PSFirst.java
private void unSelect(View tab) { if (tab != null) { TextView tab_title = (TextView) tab.findViewById(R.id.psts_tab_title); if (tab_title != null) { tab_title.setSelected(false); //LogUtils.i("--select----"); // setTextColor(mTabTextColor); tab_title.setTextColor(Color.parseColor("#666666")); tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize); // TextPaint tp = tab_title.getPaint(); // tp.setFakeBoldText(false); }// www. j av a2 s. c o m if (isCustomTabs) ((CustomTabProvider) mPager.getAdapter()).tabUnselected(tab); } }
From source file:net.yaly.ViewPagerDoubleIndicator.java
private void select(View tab) { if (tab != null) { TextView tab_title = (TextView) tab.findViewById(R.id.vpdi_tab_title); if (tab_title != null) { tab_title.setSelected(true); tab_title.setTextColor(mTabTextColor); }//from w ww . ja v a 2s .c o m if (isCustomTabs) ((CustomTabProvider) mPager.getAdapter()).tabSelected(tab); } }
From source file:net.yaly.ViewPagerDoubleIndicator.java
private void unSelect(View tab) { if (tab != null) { TextView tab_title = (TextView) tab.findViewById(R.id.vpdi_tab_title); if (tab_title != null) { tab_title.setSelected(false); if (mTabTextColorUnSelected != null) { tab_title.setTextColor(mTabTextColorUnSelected); }// w w w . j a va2 s . c o m } if (isCustomTabs) ((CustomTabProvider) mPager.getAdapter()).tabUnselected(tab); } }
From source file:com.cw.litenote.note.NoteUi.java
/** * Set picture view listeners/*w ww. j a v a2 s . c o m*/ * @param act * @param pager * @param strPicture * @param linkUri * @param viewGroup */ private void setPictureView_listeners(final AppCompatActivity act, final ViewPager pager, final String strPicture, final String linkUri, ViewGroup viewGroup) { System.out.println("NoteUi / setPictureView_listeners"); Button picView_back_button = (Button) (viewGroup.findViewById(R.id.image_view_back)); Button picView_viewMode_button = (Button) (viewGroup.findViewById(R.id.image_view_mode)); Button picView_previous_button = (Button) (viewGroup.findViewById(R.id.image_view_previous)); Button picView_next_button = (Button) (viewGroup.findViewById(R.id.image_view_next)); Button mVideoPlayButton = (Button) (viewGroup.findViewById(R.id.video_view_play_video)); final TextView videoView_currPosition = (TextView) (viewGroup.findViewById(R.id.video_current_pos)); SeekBar videoView_seekBar = (SeekBar) (viewGroup.findViewById(R.id.video_seek_bar)); // Set video play button listener if (UtilVideo.hasVideoExtension(strPicture, act)) { mVideoPlayButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { System.out.println("NoteUi / setPictureView_listeners / mVideoPlayButton / getVideoState() = " + UtilVideo.getVideoState()); if ((BackgroundAudioService.mMediaPlayer != null) && (Audio_manager.getPlayerState() != Audio_manager.PLAYER_AT_STOP) && (UtilVideo.getVideoState() != UtilVideo.VIDEO_AT_PLAY)) { // Dialog: confirm to disable audio or not AlertDialog.Builder builder = new AlertDialog.Builder(act); builder.setTitle(R.string.title_playing_audio).setMessage(R.string.message_continue_or_stop) .setPositiveButton(R.string.btn_Stop, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Audio_manager.stopAudioPlayer(); UtilVideo.changeVideoState(); UtilVideo.playOrPauseVideo(pager, strPicture); } }).setNegativeButton(R.string.btn_Continue, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { UtilVideo.changeVideoState(); UtilVideo.playOrPauseVideo(pager, strPicture); } }).show(); } else { UtilVideo.changeVideoState(); UtilVideo.playOrPauseVideo(pager, strPicture); updateVideoPlayButtonState(pager, getFocus_notePos()); } } }); } else if (Util.isYouTubeLink(linkUri)) { mVideoPlayButton.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_media_play, 0, 0, 0); mVideoPlayButton.setVisibility(View.VISIBLE); // set listener for running YouTube mVideoPlayButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { System.out.println( "NoteUi / _setPictureView_listeners / onClick to play YouTube / linkUri = " + linkUri); // apply native YouTube // Util.openLink_YouTube(act, linkUri); // apply YouTube DATA API for note view Intent intent = new Intent(act, YouTubePlayerAct.class); act.startActivityForResult(intent, Util.YOUTUBE_LINK_INTENT); } }); } else if (Util.isEmptyString(strPicture) && linkUri.startsWith("http") && !UtilImage.hasImageExtension(linkUri, act) && //filter: some link has image extension Note.isViewAllMode()) { // set listener for running browser if (viewGroup != null) { CustomWebView linkWebView = ((CustomWebView) viewGroup.findViewById(R.id.link_web_view)); linkWebView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(linkUri)); act.startActivity(i); } return true; } }); } } // view mode // picture only if (Note.isPictureMode()) { // image: view back picView_back_button.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_menu_back /*android.R.drawable.ic_menu_revert*/, 0, 0, 0); // click to finish Note_view_pager picView_back_button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { // remove current link web view int position = getFocus_notePos(); String tagPictureStr = "current" + position + "pictureView"; ViewGroup pictureGroup = (ViewGroup) pager.findViewWithTag(tagPictureStr); if (pictureGroup != null) { CustomWebView linkWebView = ((CustomWebView) pictureGroup.findViewById(R.id.link_web_view)); CustomWebView.pauseWebView(linkWebView); CustomWebView.blankWebView(linkWebView); } // set not full screen Util.setFullScreen_noImmersive(act); // back to view all mode Note.setViewAllMode(); Note.setOutline(act); } }); // image: view mode picView_viewMode_button.setCompoundDrawablesWithIntrinsicBounds(android.R.drawable.ic_menu_view, 0, 0, 0); // click to select view mode picView_viewMode_button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { TextView audio_title_text_view = (TextView) act.findViewById(R.id.pager_audio_title); audio_title_text_view.setSelected(false); //Creating the instance of PopupMenu popup = new PopupMenu(act, view); //Inflating the Popup using xml file popup.getMenuInflater().inflate(R.menu.pop_up_menu, popup.getMenu()); //registering popup with OnMenuItemClickListener popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.view_all: Note.setViewAllMode(); Note.setOutline(act); break; case R.id.view_picture: Note.setPictureMode(); Note.setOutline(act); break; case R.id.view_text: Note.setTextMode(); Note.setOutline(act); break; } return true; } }); popup.setOnDismissListener(new PopupMenu.OnDismissListener() { @Override public void onDismiss(PopupMenu menu) { TextView audio_title_text_view = (TextView) act.findViewById(R.id.pager_audio_title); if (BackgroundAudioService.mMediaPlayer != null) { if (BackgroundAudioService.mMediaPlayer.isPlaying()) { AudioUi_note.showAudioName(act); audio_title_text_view.setSelected(true); } } else audio_title_text_view.setSelected(false); } }); popup.show();//showing pop up menu, will show status bar // for transient popup cancel_UI_callbacks(); Note_adapter.picUI_primary = new NoteUi(act, pager, pager.getCurrentItem()); Note_adapter.picUI_primary.tempShow_picViewUI(5005, strPicture); } }); // image: previous button picView_previous_button.setCompoundDrawablesWithIntrinsicBounds(android.R.drawable.ic_media_previous, 0, 0, 0); // click to previous picView_previous_button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { setFocus_notePos(getFocus_notePos() - 1); pager.setCurrentItem(pager.getCurrentItem() - 1); } }); // image: next button picView_next_button.setCompoundDrawablesWithIntrinsicBounds(android.R.drawable.ic_media_next, 0, 0, 0); // click to next picView_next_button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { setFocus_notePos(getFocus_notePos() + 1); pager.setCurrentItem(pager.getCurrentItem() + 1); } }); } // video view: apply media control customization or not if (Note.isPictureMode() || Note.isViewAllMode()) { if (!UtilVideo.hasMediaControlWidget) { // set video seek bar listener videoView_seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { // onStartTrackingTouch @Override public void onStartTrackingTouch(SeekBar seekBar) { System.out.println("NoteUi / _onStartTrackingTouch"); if ((UtilVideo.mVideoPlayer == null) && (UtilVideo.mVideoView != null)) { if (Build.VERSION.SDK_INT >= 16) UtilVideo.mVideoView.setBackground(null); else UtilVideo.mVideoView.setBackgroundDrawable(null); UtilVideo.mVideoView.setVisibility(View.VISIBLE); UtilVideo.mVideoPlayer = new VideoPlayer(act, pager, strPicture); UtilVideo.mVideoView.seekTo(UtilVideo.mPlayVideoPosition); } } // onProgressChanged @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { System.out.println("NoteUi / _onProgressChanged"); if (fromUser) { // show progress change int currentPos = videoFileLength_inMilliSeconds * progress / (seekBar.getMax() + 1); // update current play time videoView_currPosition.setText(Util.getTimeFormatString(currentPos)); //add below to keep showing seek bar if (Note.isPictureMode()) show_picViewUI_previous_next(true, mPosition); showSeekBarProgress = true; if (handler != null) handler.removeCallbacks(runnableHideUi); tempShow_picViewUI(3001, strPicture); // for 3 seconds, _onProgressChanged } } // onStopTrackingTouch @Override public void onStopTrackingTouch(SeekBar seekBar) { System.out.println("NoteUi / _onStopTrackingTouch"); if (UtilVideo.mVideoView != null) { int mPlayVideoPosition = (int) (((float) (videoFileLength_inMilliSeconds / 100)) * seekBar.getProgress()); if (UtilVideo.mVideoPlayer != null) UtilVideo.mVideoView.seekTo(mPlayVideoPosition); if (handler != null) handler.removeCallbacks(runnableHideUi); tempShow_picViewUI(3002, strPicture); // for 3 seconds, _onProgressChanged } } }); } } }
From source file:busradar.madison.StopDialog.java
StopDialog(final Context ctx, final int stopid, final int lat, final int lon) { super(ctx);//from w w w. j a va 2s .c o m this.stopid = stopid; // getWindow().requestFeature(Window.FEATURE_LEFT_ICON); getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); final String name = DB.getStopName(stopid); setTitle(name); routes = get_time_urls(StopDialog.this.stopid); // getWindow().setLayout(LayoutParams.FILL_PARENT, // LayoutParams.FILL_PARENT); setContentView(new RelativeLayout(ctx) { { addView(new TextView(ctx) { { setId(stop_num_id); setText(Html.fromHtml(String.format( "[<a href='http://www.cityofmadison.com/metro/BusStopDepartures/StopID/%04d.pdf'>%04d</a>]", stopid, stopid))); setPadding(0, 0, 5, 0); this.setMovementMethod(LinkMovementMethod.getInstance()); } }, new RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT) { { addRule(ALIGN_PARENT_RIGHT); } }); addView(new ImageView(ctx) { boolean enabled; @Override public void setEnabled(boolean e) { enabled = e; setImageResource(e ? R.drawable.love_enabled : R.drawable.love_disabled); if (e) { G.favorites.add_favorite_stop(stopid, name, lat, lon); Toast.makeText(ctx, "Added stop to Favorites", Toast.LENGTH_SHORT).show(); } else { G.favorites.remove_favorite_stop(stopid); Toast.makeText(ctx, "Removed stop from Favorites", Toast.LENGTH_SHORT).show(); } } { enabled = G.favorites.is_stop_favorite(stopid); setImageResource(enabled ? R.drawable.love_enabled : R.drawable.love_disabled); setPadding(0, 0, 10, 0); setOnClickListener(new OnClickListener() { public void onClick(View v) { setEnabled(!enabled); } }); } }, new RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT) { { addRule(LEFT_OF, stop_num_id); setMargins(0, -3, 0, 0); } }); addView(cur_loading_text = new TextView(ctx) { { setText("Loading..."); setPadding(5, 0, 0, 0); } }); addView(new HorizontalScrollView(ctx) { { setId(route_list_id); setHorizontalScrollBarEnabled(false); addView(new LinearLayout(ctx) { float text_size; Button cur_button; { int last_route = -1; for (int i = 0; i < routes.length; i++) { final RouteURL route = routes[i]; if (route.route == last_route) continue; last_route = route.route; addView(new Button(ctx) { public void setEnabled(boolean e) { if (e) { setBackgroundColor(0xff000000 | G.route_points[route.route].color); setTextSize(TypedValue.COMPLEX_UNIT_PX, text_size * 1.5f); } else { setBackgroundColor(0x90000000 | G.route_points[route.route].color); setTextSize(TypedValue.COMPLEX_UNIT_PX, text_size); } } { setText(G.route_points[route.route].name); setTextColor(0xffffffff); setTypeface(Typeface.DEFAULT_BOLD); text_size = getTextSize(); if (G.active_route == route.route) { setEnabled(true); cur_button = this; } else setEnabled(false); final Button b = this; setOnClickListener(new OnClickListener() { public void onClick(View v) { if (cur_button != null) { cur_button.setEnabled(false); } if (cur_button == b) { cur_button.setEnabled(false); cur_button = null; selected_route = null; update_time_display(); } else { cur_button = b; cur_button.setEnabled(true); selected_route = route; update_time_display(); } } }); } }); } } }); } }, new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) { { addRule(RelativeLayout.BELOW, stop_num_id); addRule(RelativeLayout.CENTER_HORIZONTAL); } }); addView(status_text = new TextView(ctx) { { setText(""); } }, new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) { { addRule(RelativeLayout.BELOW, route_list_id); addRule(RelativeLayout.CENTER_HORIZONTAL); } }); addView(list_view = new ListView(ctx) { { setId(time_list_id); setVerticalScrollBarEnabled(false); setAdapter(times_adapter = new BaseAdapter() { public View getView(final int position, View convertView, ViewGroup parent) { CellView v; if (convertView == null) v = new CellView(ctx); else v = (CellView) convertView; RouteTime rt = curr_times.get(position); v.setBackgroundColor(G.route_points[rt.route].color | 0xff000000); v.route_textview.setText(G.route_points[rt.route].name); if (rt.dir != null) v.dir_textview.setText("to " + rt.dir); v.time_textview.setText(rt.time); return v; } public int getCount() { return curr_times.size(); } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } }); } }, new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT) { { addRule(RelativeLayout.BELOW, route_list_id); } }); } }); TextView title = (TextView) findViewById(android.R.id.title); title.setEllipsize(TextUtils.TruncateAt.MARQUEE); title.setSelected(true); title.setTextColor(0xffffffff); title.setMarqueeRepeatLimit(-1); // getWindow().set, value) // getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, // android.R.drawable.ic_dialog_info); // title.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.CENTER_VERTICAL); if (G.active_route >= 0) for (int i = 0; i < routes.length; i++) if (routes[i].route == G.active_route) { selected_route = routes[i]; RouteURL[] rnew = new RouteURL[routes.length]; rnew[0] = selected_route; for (int j = 0, k = 1; j < routes.length; j++) if (j != i) rnew[k++] = routes[j]; routes = rnew; break; } update_time_display(); }
From source file:com.easemob.easeui.widget.viewpagerindicator.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { if (i == selectedPosition) { View v = tabsContainer.getChildAt(i); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextColor(selectedTabTextColor); if (oldTab != null) { oldTab.setSelected(false); ((TextView) oldTab).setTextColor(tabTextColor); }/* w w w. ja v a2 s . c om*/ oldTab = tab; tab.setSelected(true); } } } }
From source file:ru.adios.budgeter.widgets.DataTableLayout.java
private void selectOrderByColumn(TextView col) { if (selectedColumn != null) { selectedColumn.setSelected(false); selectedColumn.invalidate();/* ww w . java2s. c o m*/ } col.setSelected(true); col.invalidate(); selectedColumn = col; }
From source file:com.duy.pascal.ui.editor.BaseEditorActivity.java
private void addCustomTab() { mTabLayout.setCustomTabView(new SmartTabLayout.TabProvider() { @Override/*from w w w .j a v a2 s . c om*/ public View createTabView(ViewGroup container, final int position, PagerAdapter adapter) { LayoutInflater inflater = LayoutInflater.from(BaseEditorActivity.this); View view = inflater.inflate(R.layout.item_tab_file, container, false); View close = view.findViewById(R.id.img_close); close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { removePage(position); } }); TextView txtTitle = view.findViewById(R.id.txt_name); txtTitle.setText(adapter.getPageTitle(position)); txtTitle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mViewPager.setCurrentItem(position); } }); if (position == mViewPager.getCurrentItem()) { txtTitle.setSelected(true); } return view; } }); }
From source file:com.pinthecloud.item.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabSwitch && i != startTab ? tabDeactivateTextColor : tabTextColor); if (textAllCaps) { tab.setAllCaps(true);/*ww w .j a v a2 s . c om*/ } } else if (v instanceof ImageButton) { ImageButton tab = (ImageButton) v; tab.setSelected(tabSwitch && i == startTab ? true : false); } else { v.setSelected(tabSwitch && i == startTab ? true : false); } } }
From source file:com.audiokernel.euphonyrmt.MainMenuActivity.java
private TextView initializeTextView() { final LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); final TextView textView = (TextView) inflater.inflate(R.layout.actionbar_title, null); textView.setFocusable(true);//from w w w . j a v a 2 s.co m textView.setFocusableInTouchMode(true); textView.setSelected(true); textView.requestFocus(); return textView; }