This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MainActivity extends Activity { | |
| @Override protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_main); | |
| SpannableString spannable = new SpannableString("aasdfasasdfasdfasdf span span"); | |
| spannable.setSpan( | |
| new LineBackgroundSpan() { | |
| @Override public void drawBackground(Canvas c, Paint p, int left, int right, int top, int baseline, int bottom, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyApplication extends Application { | |
| Override public void onCreate(){ | |
| super.onCreate(); | |
| Stetho.initializeWithDefaults(this); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class StethoUtils { | |
| private StethoUtils() { | |
| // no instance | |
| } | |
| public static void init(Context context) { | |
| // no-op | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyApplication extends Application { | |
| @Override public void onCreate(){ | |
| super.onCreate(); | |
| StethoUtils.init(this); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class StethoUtils { | |
| private StethoUtils() { | |
| // no instance | |
| } | |
| public static void init(Context context) { | |
| Stetho.initializeWithDefaults(context); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Thread thread = new Thread(new Runnable() { | |
| @Override public void run() { | |
| // your long task | |
| textView.setText("Task 4 Result"); //update view | |
| } | |
| }); | |
| thread.start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test public void shouldReturnPredictionsSuccessfully() throws Exception { | |
| String queryToAutoComplete = "berlin"; | |
| PendingResult<AutocompletePredictionBuffer> result = | |
| Places.GeoDataApi.getAutocompletePredictions(apiClient, queryToAutoComplete, null, null); | |
| AutocompletePredictionBuffer predictions = result.await(3, SECONDS); | |
| Status status = predictions.getStatus(); | |
| assertThat(status.isSuccess()).isTrue(); | |
| // more assertions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @RunWith(AndroidJUnit4.class) | |
| public class GooglePlacesApiTest { | |
| private GoogleApiClient apiClient; | |
| @Before public void setup() throws InterruptedException { | |
| Context context = InstrumentationRegistery.getContext(); | |
| final CountDownLatch latch = new CountDownLatch(1); | |
| apiClient = new GoogleApiClient.Builder(context) | |
| .addApi(Places.GEO_DATA_API) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @RunWith(AndroidJUnit4.class) | |
| public class GooglePlacesApiTest { | |
| GoogleApiClient apiClient; | |
| @Before public void setup() throws InterruptedException { | |
| Context context = InstrumentationRegistery.getContext(); | |
| apiClient = new GoogleApiClient.Builder(context) | |
| .addApi(Places.GEO_DATA_API) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Account { | |
| private void save(String value) { | |
| DiskPersistent.getInstance().save(value); | |
| } | |
| } |
NewerOlder