@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.legal); TextView legal=(TextView)findViewById(R.id.legal); legal.setText( GoogleApiAvailability .getInstance() .getOpenSourceSoftwareLicenseInfo(this)); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.legal); TextView legal=(TextView)findViewById(R.id.legal); legal.setText( GoogleApiAvailability .getInstance() .getOpenSourceSoftwareLicenseInfo(this)); } }
@Test public void setOpenSourceSoftwareLicenseInfo() { //Given mock open source license info final String expected = "Mock open source license info"; final ShadowGoogleApiAvailability shadowGoogleApiAvailability = Shadows.shadowOf(GoogleApiAvailability.getInstance()); shadowGoogleApiAvailability.setOpenSourceSoftwareLicenseInfo(expected); //When getting the actual value final String actual = GoogleApiAvailability.getInstance() .getOpenSourceSoftwareLicenseInfo(roboContext); //Then verify that its not null, not empty, and equal to the expected value assertThat(actual) .isEqualTo(expected); }
public void viewGoogleLicenses(View myview) { try { if (!appended) { final String googleLicense = GoogleApiAvailability.getInstance().getOpenSourceSoftwareLicenseInfo(getApplicationContext()); if (googleLicense != null) { String whiteheader = "<font size=-2 color=white><pre>"; String whitefooter = "</font></pre>"; WebView textview = (WebView) findViewById(R.id.webView); textview.setBackgroundColor(Color.TRANSPARENT); textview.getSettings().setJavaScriptEnabled(false); textview.loadDataWithBaseURL("", whiteheader + googleLicense + whitefooter, "text/html", "UTF-8", ""); appended = true; findViewById(R.id.googlelicenses).setVisibility(View.INVISIBLE); findViewById(R.id.webView).setVisibility(View.VISIBLE); } else { UserError.Log.d(TAG, "Nullpointer getting Google License: errorcode:" + GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getApplicationContext())); findViewById(R.id.googlelicenses).setVisibility(View.INVISIBLE); } } } catch (Exception e) { // meh } }
public void viewGoogleLicenses(View myview) { try { if (!appended) { final String googleLicense = GoogleApiAvailability.getInstance().getOpenSourceSoftwareLicenseInfo(getApplicationContext()); if (googleLicense != null) { String whiteheader = "<font size=-2 color=white><pre>"; String whitefooter = "</font></pre>"; WebView textview = (WebView) findViewById(R.id.webView); textview.setBackgroundColor(Color.TRANSPARENT); textview.getSettings().setJavaScriptEnabled(false); textview.loadDataWithBaseURL("", whiteheader + googleLicense + whitefooter, "text/html", "UTF-8", ""); appended = true; findViewById(R.id.googlelicenses).setVisibility(View.INVISIBLE); findViewById(R.id.webView).setVisibility(View.VISIBLE); } else { UserError.Log.d(TAG, "Nullpointer getting Google License: errorcode:" + GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getApplicationContext())); findViewById(R.id.googlelicenses).setVisibility(View.INVISIBLE); } } } catch (Exception e) { // meh } }