Skip to content

Commit

Permalink
Use Instrumentation in the app rather than using an androidTest project
Browse files Browse the repository at this point in the history
  • Loading branch information
efokschaner committed Dec 31, 2015
1 parent be2b600 commit 6276d46
Show file tree
Hide file tree
Showing 17 changed files with 176 additions and 774 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# infinity-loop-solver
Automatically plays the android game named "∞ Loop" (com.balysv.loop)

## How To
### Install the game if needed:

adb install ∞\ Loop_v3_0.apk

### Install the application (debug works fine):

./gradlew installDebug

### Launch the application:

adb shell am instrument -w efokschaner.infinityloopsolver/efokschaner.infinityloopsolver.SolverInstrumentation

The application only works when launched this way as it uses UiAutomation api's that are not
available to normally launched applications.

This file was deleted.

34 changes: 7 additions & 27 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="efokschaner.infinityloopsolver">

<uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" />
<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".SolverApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand All @@ -21,32 +21,12 @@
</intent-filter>
</activity>

<service
android:name=".AccessibilityService"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>

<meta-data
android:name="android.accessibilityservice"
android:resource="@xml/accessibility_service_config" />
</service>

<!--
<activity
android:name=".SettingsActivity"
android:label="@string/title_activity_settings" />
-->
<activity
android:name=".MediaProjectionRequest"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />

<service
android:name=".SolverService"
android:enabled="true"
android:exported="false" />

</application>

<instrumentation android:name="efokschaner.infinityloopsolver.SolverInstrumentation"
android:targetPackage="efokschaner.infinityloopsolver"
android:handleProfiling="false"
android:functionalTest="false"
android:label="Instrumentation for efokschaner.infinityloopsolver"/>

</manifest>

This file was deleted.

This file was deleted.

21 changes: 11 additions & 10 deletions app/src/main/java/efokschaner/infinityloopsolver/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
package efokschaner.infinityloopsolver;

import android.content.Intent;
import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.Switch;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final SolverApplication app = (SolverApplication) getApplication();
setContentView(R.layout.activity_main);
final Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
final Switch enabledSwitch = (Switch) findViewById(R.id.switch_solver_enabled);
enabledSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onClick(View v) {
Intent settingsActivityIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
settingsActivityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(settingsActivityIntent);
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked) {
app.enableSolver();
} else {
app.disableSolver();
}
}
});
}
Expand Down

This file was deleted.

Loading

0 comments on commit 6276d46

Please sign in to comment.