Imagine we have a reducer to control a list of items:
function listOfItems(state: Array<Object> = [], action: Object = {}): Array<Object> {
switch(action.type) {
case 'SHOW_ALL_ITEMS':
return action.data.items
default:| import android.arch.lifecycle.Lifecycle | |
| import android.arch.lifecycle.LifecycleObserver | |
| import android.arch.lifecycle.LifecycleOwner | |
| import android.arch.lifecycle.OnLifecycleEvent | |
| import com.jakewharton.rxrelay.BehaviorRelay | |
| import rx.Observable | |
| import rx.android.schedulers.AndroidSchedulers | |
| import rx.functions.Action1 | |
| import rx.subscriptions.CompositeSubscription |
This test rule is now in the 'test-rules' support repository. Use that one!
https://developer.android.com/reference/android/support/test/rule/ActivityTestRule.html
| /** | |
| * ArcUtils.java | |
| * | |
| * Copyright (c) 2014 BioWink GmbH. | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is |
System directories
| Method | Result |
|---|---|
| Environment.getDataDirectory() | /data |
| Environment.getDownloadCacheDirectory() | /cache |
| Environment.getRootDirectory() | /system |
External storage directories
| /*bin/mkdir /tmp/rip 2> /dev/null | |
| javac -d /tmp/rip $0 | |
| java -cp /tmp/rip Rip "$@" | |
| exit | |
| */ | |
| import java.io.BufferedReader; | |
| import java.io.IOException; | |
| import java.io.InputStreamReader; | |
| import java.util.*; | |
| import java.util.regex.Matcher; |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| <parent> | |
| <artifactId>myproject</artifactId> | |
| <groupId>com.example</groupId> | |
| <version>1.0.0-SNAPSHOT</version> | |
| </parent> | |
| <modelVersion>4.0.0</modelVersion> | |
| <artifactId>myapp</artifactId> |
| /* | |
| * Copyright 2012 Google Inc. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| // In ResourceLoader.java I added the following method: | |
| // | |
| public void loadLibraryProjectResources(File libraryProjectRoot) throws Exception { | |
| File systemResourceDir = getSystemResourceDir(getPathToAndroidResources()); | |
| File localValueResourceDir = getValueResourceDir(libraryProjectRoot); | |
| File systemValueResourceDir = getValueResourceDir(systemResourceDir); | |
| loadStringResources(localValueResourceDir, systemValueResourceDir); | |
| loadPluralsResources(localValueResourceDir, systemValueResourceDir); | |
| loadValueResources(localValueResourceDir, systemValueResourceDir); |