Example usage for android.widget TextView getVisibility

List of usage examples for android.widget TextView getVisibility

Introduction

In this page you can find the example usage for android.widget TextView getVisibility.

Prototype

@ViewDebug.ExportedProperty(mapping = { @ViewDebug.IntToString(from = VISIBLE, to = "VISIBLE"),
        @ViewDebug.IntToString(from = INVISIBLE, to = "INVISIBLE"),
        @ViewDebug.IntToString(from = GONE, to = "GONE") })
@Visibility
public int getVisibility() 

Source Link

Document

Returns the visibility status for this view.

Usage

From source file:android.support.test.testapp.PickersActivity.java

private void updateTextInUi(String text, TextView textView) {
    if (null == textView) {
        return;//from  ww  w.  java  2  s .  c  o  m
    }

    if (View.INVISIBLE == textView.getVisibility()) {
        textView.setVisibility(View.VISIBLE);
    }

    textView.setText(text);
}

From source file:com.timothy.android.api.fragment.LeftFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.left_list, null);
    title = (TextView) view.findViewById(R.id.indexTV);
    int branchIndex = SPUtil.getIntegerFromSP(SPUtil.CURRENT_BRANCH_INDEX, sp);
    if (branchIndex != -1 && branchNames != null) {
        title.setText(branchNames[branchIndex - 1]);
    }/*  w ww  .  j  av  a 2s  .  c o  m*/
    title.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            TextView tv = (TextView) arg0;
            if (view.getVisibility() == View.VISIBLE && tv.getVisibility() == View.VISIBLE) {
                if (branchNames != null && branchNames.length > 0) {
                    tv.getTop();
                    int y = tv.getBottom() * 3 / 2;
                    int x = tv.getLeft();
                    //                  int x = activity.getWindowManager().getDefaultDisplay().getWidth() / 4;
                    showPopupWindow(x, y);
                }
            }
        }
    });
    return view;
}

From source file:fr.unix_experience.owncloud_sms.activities.remote_account.RestoreMessagesActivity.java

public void onProgressUpdate(Integer value) {
    TextView tv_progress = (TextView) findViewById(R.id.tv_progress_value);
    if (tv_progress.getVisibility() == View.INVISIBLE) {
        tv_progress.setVisibility(View.VISIBLE);
    }/*from   w  ww .  ja v  a  2  s . co m*/

    tv_progress.setText(value.toString() + " " + getString(R.string.x_messages_restored));
}

From source file:com.aqnote.app.wifianalyzer.wifi.ConnectionViewTest.java

@Test
public void testConnectionVisibleWithConnectionInformation() throws Exception {
    // setup/*from ww w .  j a v a  2  s . c o m*/
    WiFiAdditional wiFiAdditional = new WiFiAdditional(StringUtils.EMPTY, "IPADDRESS", 11);
    WiFiDetail connection = withConnection(wiFiAdditional);
    when(wiFiData.getConnection()).thenReturn(connection);
    when(wiFiData.getWiFiDetails(settings.getWiFiBand(), settings.getSortBy()))
            .thenReturn(new ArrayList<WiFiDetail>());
    // execute
    fixture.update(wiFiData);
    // validate
    View view = mainActivity.findViewById(R.id.connection);
    assertEquals(View.VISIBLE, view.getVisibility());

    TextView ipAddressView = (TextView) view.findViewById(R.id.ipAddress);
    assertEquals(View.VISIBLE, ipAddressView.getVisibility());
    assertEquals(wiFiAdditional.getIPAddress(), ipAddressView.getText().toString());

    TextView linkSpeedView = (TextView) view.findViewById(R.id.linkSpeed);
    assertEquals(View.VISIBLE, linkSpeedView.getVisibility());
    assertEquals(wiFiAdditional.getLinkSpeed() + WifiInfo.LINK_SPEED_UNITS, linkSpeedView.getText().toString());

    verify(wiFiData).getConnection();
    verify(accessPointsDetail).setView(mainActivity.getResources(), view, connection, false);
}

From source file:com.aqnote.app.wifianalyzer.about.AboutActivityTest.java

@Test
public void testApplicationName() throws Exception {
    // setup/*from   w  w w  . j  a va 2  s . c o  m*/
    String expectedName = fixture.getString(R.string.app_name);
    if (isDevelopmentMode) {
        expectedName += " " + MainActivity.WI_FI_ANALYZER_BETA;
    }
    // execute
    TextView actual = (TextView) fixture.findViewById(R.id.about_app_name);
    // validate
    assertNotNull(actual);
    assertEquals(View.VISIBLE, actual.getVisibility());
    assertEquals(expectedName, actual.getText());
}

From source file:com.aqnote.app.wifianalyzer.about.AboutActivityTest.java

@Test
public void testPackageName() throws Exception {
    // setup/*from www. ja  va2s.  co m*/
    String expectedName = StringUtils.EMPTY;
    int expectedVisibility = View.GONE;
    if (isDevelopmentMode) {
        expectedName = fixture.getPackageName();
        expectedVisibility = View.VISIBLE;
    }
    // execute
    TextView actual = (TextView) fixture.findViewById(R.id.about_package_name);
    // validate
    assertNotNull(actual);
    assertEquals(expectedVisibility, actual.getVisibility());
    assertEquals(expectedName, actual.getText());
}

From source file:kr.co.generic.wifianalyzer.wifi.ConnectionViewTest.java

@Test
public void testConnectionWithInvalidLinkSpeed() throws Exception {
    // setup/*w  ww  . ja v  a 2  s . co m*/
    WiFiConnection wiFiConnection = new WiFiConnection(SSID, BSSID, IP_ADDRESS,
            WiFiConnection.LINK_SPEED_INVALID);
    WiFiDetail connection = withConnection(new WiFiAdditional(StringUtils.EMPTY, wiFiConnection));
    withConnectionInformation(connection);
    withAccessPointDetailView(connection);
    // execute
    fixture.update(wiFiData);
    // validate
    View view = mainActivity.findViewById(R.id.connection);
    TextView linkSpeedView = (TextView) view.findViewById(R.id.linkSpeed);
    assertEquals(View.GONE, linkSpeedView.getVisibility());
}

From source file:com.vrem.wifianalyzer.wifi.accesspoint.ConnectionViewTest.java

@Test
public void testConnectionWithInvalidLinkSpeed() throws Exception {
    // setup/*from w  ww  . ja  v a2 s. c o  m*/
    WiFiConnection wiFiConnection = new WiFiConnection(SSID, BSSID, IP_ADDRESS,
            WiFiConnection.LINK_SPEED_INVALID);
    WiFiDetail connection = withConnection(new WiFiAdditional(StringUtils.EMPTY, wiFiConnection));
    when(settings.getConnectionViewType()).thenReturn(ConnectionViewType.COMPLETE);
    withConnectionInformation(connection);
    withAccessPointDetailView(connection, ConnectionViewType.COMPLETE.getAccessPointViewType());
    // execute
    fixture.update(wiFiData);
    // validate
    View view = mainActivity.findViewById(R.id.connection);
    TextView linkSpeedView = (TextView) view.findViewById(R.id.linkSpeed);
    assertEquals(View.GONE, linkSpeedView.getVisibility());
}

From source file:kr.co.generic.wifianalyzer.wifi.ConnectionViewTest.java

@Test
public void testConnectionWithConnectionInformation() throws Exception {
    // setup//ww  w . j  av  a 2 s .co m
    WiFiAdditional wiFiAdditional = withWiFiAdditional();
    WiFiDetail connection = withConnection(wiFiAdditional);
    withConnectionInformation(connection);
    withAccessPointDetailView(connection);
    // execute
    fixture.update(wiFiData);
    // validate
    WiFiConnection wiFiConnection = wiFiAdditional.getWiFiConnection();
    View view = mainActivity.findViewById(R.id.connection);
    assertEquals(wiFiConnection.getIpAddress(),
            ((TextView) view.findViewById(R.id.ipAddress)).getText().toString());
    TextView linkSpeedView = (TextView) view.findViewById(R.id.linkSpeed);
    assertEquals(View.VISIBLE, linkSpeedView.getVisibility());
    assertEquals(wiFiConnection.getLinkSpeed() + WifiInfo.LINK_SPEED_UNITS, linkSpeedView.getText().toString());
}

From source file:com.vrem.wifianalyzer.wifi.accesspoint.ConnectionViewTest.java

@Test
public void testConnectionWithConnectionInformation() throws Exception {
    // setup// ww  w.  ja  va 2 s  .  c o  m
    WiFiAdditional wiFiAdditional = withWiFiAdditional();
    WiFiDetail connection = withConnection(wiFiAdditional);
    when(settings.getConnectionViewType()).thenReturn(ConnectionViewType.COMPLETE);
    withConnectionInformation(connection);
    withAccessPointDetailView(connection, ConnectionViewType.COMPLETE.getAccessPointViewType());
    // execute
    fixture.update(wiFiData);
    // validate
    WiFiConnection wiFiConnection = wiFiAdditional.getWiFiConnection();
    View view = mainActivity.findViewById(R.id.connection);
    assertEquals(wiFiConnection.getIpAddress(),
            ((TextView) view.findViewById(R.id.ipAddress)).getText().toString());
    TextView linkSpeedView = (TextView) view.findViewById(R.id.linkSpeed);
    assertEquals(View.VISIBLE, linkSpeedView.getVisibility());
    assertEquals(wiFiConnection.getLinkSpeed() + WifiInfo.LINK_SPEED_UNITS, linkSpeedView.getText().toString());
}