public ArrayList<TextView> getFilteredTextViews() { ArrayList<TextView> textViewList = solo.getCurrentViews(TextView.class); ArrayList<TextView> filteredTextViewList = new ArrayList<TextView>(); for (TextView textview : textViewList ) { if (textview != null && textview.isShown()) { filteredTextViewList .add(view); } } return filteredTextViewList; }
public void click_button1 (View view){ TextView textview=(TextView)parent.findViewById(R.id.textView1); if(!textview.isShown()) //Check if the view is currently visible or not. textview.setVisibility(View.VISIBLE); else textview.setVisibility(View.INVISIBLE); }
@Override public void onClick(View view) { if (answer.isShown()) { answer.setVisibility(GONE); }else { answer.setVisibility(View.VISIBLE); } } });
private void ButtonInstructionOnCheck(final ToggleButton button, final TextView textView, final String string){ textView.setText(string); button.setOnCheckedChangeListener(new OnCheckedChangeListener(){ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if(textView.isShown() == false){ textView.setVisibility(View.VISIBLE); }else if(textView.isShown() == true){ textView.setVisibility(View.INVISIBLE); } } }); }
public int lightViewAnimate(View v, MotionEvent event){ int index = ViewsUtil.computeDirection(event.getX(), event.getY(), v.getHeight(), v.getWidth()); if (index == Global.ERR){ for (int i = 0;i <mLightNum ;i++){ if(mLightView[i].isShown())animate(mLightView[i],offAnim_noraml_hide[i],View.GONE); } } else if (mLightView[index].isShown()) { animate(mLightView[index], offAnim[index], View.GONE); // mOutLightView[index].setVisibility(View.VISIBLE); // animate(mOutLightView[index], outAnim[index], View.GONE); } return index; }
private void showSeekTextView(int seekPos, int totalDuration) { if (!mTextView.isShown()) { mTextView.setVisibility(VISIBLE); } mTextView.setText(String.format(getResources().getString(R.string.seekTime), Util.stringForTime(seekPos), Util.stringForTime(totalDuration))); }
public class MainActivity extends Activity { private Handler h; TextView txt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); txt=(TextView)findViewById(R.id.txt); Runnable r=new Runnable(){ @Override public void run() { // TODO Auto-generated method stub Log.e("bf", "fd"); h.postDelayed(this, 500); if (txt.isShown()){ txt.setVisibility(View.INVISIBLE); } else{ txt.setVisibility(View.VISIBLE); } } }; h=new Handler(); h.post(r); } }
paragraphmore.setVisibility(paragraphmore.isShown() ? View.GONE : View.VISIBLE );
public boolean HideLightView(float x, float y, float width, float height) { int index = ViewsUtil.computeDirection(x, y, (int) height, (int) width); for (int i =0;i<mLightNum;i++){ if (i == index )continue; if(mLightView[i].isShown()) animate(mLightView[i],offAnim_noraml_hide[i],View.GONE); } viewsWraper.setVisibility(View.GONE); return true; }
public boolean ShowLightView(float x, float y, float width, float height, String text) { boolean mLightShow = false; viewsWraper.setVisibility(View.VISIBLE); for (int i = 0; i < 4; ++i) { mLightShow |= mLightView[i].isShown(); } int index = ViewsUtil.computeDirection(x, y, (int) height, (int) width); int[] follow = {1,3,0,2}; if (index!= -1 && !mLightShow) { animate(mLightView[index],showAnim[index],View.VISIBLE); String showText = " "; if(StringUtil.isAllLetter(text)){ if(text.length() > follow[index]) showText = (String) text.subSequence(follow[index], follow[index]+1); } else { showText = text; } mLightView[index].setText(showText); } return true; }
if (txt.isShown() ) { txt.setVisibility(View.INVISIBLE);
@Test public void testUI() { Activity activity = activityTestRule.getActivity(); assertNotNull(activity.findViewById(R.id.text_hello)); TextView helloView = activity.findViewById(R.id.text_hello); assertTrue(helloView.isShown()); assertEquals("Hello World!", helloView.getText()); assertEquals(InstrumentationRegistry.getTargetContext().getString(R.string.hello_world), helloView.getText()); assertNull(activity.findViewById(android.R.id.button1)); }
@Override protected void onFinishInflate() { mProgressBar = findViewById(R.id.progress_bar); mListView = findViewById(R.id.list); mEmptyView = findViewById(R.id.tv_error); updateVisibility(); mListView.setOnItemClickListener((parent, view, position, id) -> mPresenter.insertTopicCategory(mCategoryList.get(position))); setOnClickListener(v -> { if (mEmptyView.isShown()) { mPresenter.loadTopicCategory(this); updateVisibility(); } }); super.onFinishInflate(); }
@Override public void onWindowFocusChanged(final boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (hasFocus){ Logger.d(TAG, "onResume: "+(isShown(ly_a))); Logger.d(TAG, "onResume: "+(isShown(ly_a))); Logger.d(TAG, "onResume: "+(isShown(tv_valid))); Logger.d(TAG, "onResume: "+(tv_invalid.isShown())); } }
@Override protected void onResume() { super.onResume(); Logger.d(TAG, "onCreate: "+(tv_unrepeat.getVisibility()== VISIBLE)); Logger.d(TAG, "onCreate: "+(tv_repeat.getVisibility()== VISIBLE)); Logger.d(TAG, "onCreate: "+(tv_valid.getVisibility()== VISIBLE)); Logger.d(TAG, "onCreate: "+(tv_invalid.getVisibility()== VISIBLE)); Logger.d(TAG, "onResume: "+(isShown(ly_a))); Logger.d(TAG, "onResume: "+(isShown(ly_a))); Logger.d(TAG, "onResume: "+(isShown(tv_valid))); Logger.d(TAG, "onResume: "+(tv_invalid.isShown())); } static final int VISIBILITY_MASK = 0x0000000C;