This file contains 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
/** | |
* As we use app compat it seems Solo#setNavigationDrawer is not doing well (drawer does not open, but the button is clicked) | |
* Same result for clickOnView(getView(android.R.id.home)) | |
* | |
* This code opens the navigation drawer on the main thread | |
* Be aware : you need to provide your DrawerLayout id (you can do it in params) | |
*/ | |
public void openCompatNavigationDrawer() { | |
getInstrumentation().runOnMainSync(new Runnable() { | |
@Override |
This file contains 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
testCompile testDependencies.junit | |
testCompile testDependencies.hamcrest | |
//Provides AndroidJUnitRunner | |
androidTestCompile (testDependencies.runner) { | |
exclude group: 'com.android.support', module: 'appcompat' | |
exclude group: 'com.android.support', module: 'support-v4' | |
exclude module: 'recyclerview-v7' | |
exclude module: 'support-annotations' | |
} |
This file contains 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
private Location getLocation(){ | |
long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10L; | |
long MIN_TIME_BW_UPDATES = 1; | |
Location location; | |
try { | |
mLocationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE); | |
boolean isGPSEnabled = mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); |
This file contains 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 AppDataCleaner { | |
public static void clearApplicationData(Context context) { | |
File cache = new File(context.getFilesDir().getAbsolutePath()); | |
File appDir = new File(cache.getParent()); | |
if (appDir != null && appDir.exists()) { | |
String[] children = appDir.list(); | |
for (String s : children) { | |
if (s.equals("shared_prefs")) { | |
clearSharedPreferences(new File(appDir, s), context); |
This file contains 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
@doc """ | |
Pipe operator. | |
This operator introduces the expression on the left-hand side as | |
the first argument to the function call on the right-hand side. | |
## Examples | |
iex> [1, [2], 3] |> List.flatten() | |
[1, 2, 3] | |
The example above is the same as calling `List.flatten([1, [2], 3])`. | |
The `|>` operator is mostly useful when there is a desire to execute a series | |
of operations resembling a pipeline: |
This file contains 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
@doc """ | |
Breaks a pipeline expression into a list. | |
The AST for a pipeline (a sequence of applications of `|>`) is similar to the | |
AST of a sequence of binary operators or function applications: the top-level | |
expression is the right-most `:|>` (which is the last one to be executed), and | |
its left-hand and right-hand sides are its arguments: | |
quote do: 100 |> div(5) |> div(2) | |
#=> {:|>, _, [arg1, arg2]} | |
In the example above, the `|>` pipe is the right-most pipe; `arg1` is the AST | |
for `100 |> div(5)`, and `arg2` is the AST for `div(2)`. |