Commit 926172c9 authored by PurkkaKoodari's avatar PurkkaKoodari

Initialize repository

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry exported="true" kind="lib" path="json-simple-1.1.1.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
# Libraries
*.jar
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>WordbaseHacker</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.pietu1998.wordbasehacker"
android:versionCode="1"
android:versionName="alpha 0.1" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".GameListActivity"
android:label="@string/app_name" >
</activity>
<activity-alias
android:name=".GameListActivityNormal"
android:enabled="true"
android:label="@string/app_name"
android:targetActivity=".GameListActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".GameListActivityHorst"
android:enabled="false"
android:label="@string/app_name_horst"
android:targetActivity=".GameListActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity
android:name=".BoardActivity"
android:label="@string/hack_game" >
</activity>
<service android:name="net.pietu1998.wordbasehacker.HudService" >
</service>
<receiver
android:name="net.pietu1998.wordbasehacker.BootReceiver"
android:enabled="true"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application>
</manifest>
\ No newline at end of file
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="5dp"
tools:context="${relativePackage}.${activityClass}" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/scoringBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/scoring" />
<Button
android:id="@+id/playBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/play" />
</LinearLayout>
<TextView
android:id="@+id/status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|center_horizontal"
android:text=""
android:textAppearance="@android:style/TextAppearance.Holo.Widget.TextView" />
<ImageView
android:id="@+id/movePicture"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:scaleType="fitCenter" />
</LinearLayout>
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="${relativePackage}.${activityClass}" >
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@android:id/empty"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow>
<Space
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:layout_height="wrap_content"
android:gravity="center|top"
android:text="@string/gained"
android:textAppearance="@android:style/TextAppearance.Holo.Widget.TextView"
android:textStyle="bold" />
<TextView
android:layout_height="wrap_content"
android:gravity="center|top"
android:text="@string/killed"
android:textAppearance="@android:style/TextAppearance.Holo.Widget.TextView"
android:textStyle="bold" />
</TableRow>
<TableRow>
<TextView
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/letters"
android:textAppearance="@android:style/TextAppearance.Holo.Widget.TextView" />
<EditText
android:id="@+id/lettersBox"
android:layout_height="wrap_content"
android:ems="4"
android:inputType="number" />
<Space />
</TableRow>
<TableRow>
<TextView
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/tiles"
android:textAppearance="@android:style/TextAppearance.Holo.Widget.TextView" />
<EditText
android:id="@+id/tilesPlrBox"
android:layout_height="wrap_content"
android:ems="4"
android:inputType="number" />
<EditText
android:id="@+id/tilesOppBox"
android:layout_height="wrap_content"
android:ems="4"
android:inputType="number" />
</TableRow>
<TableRow>
<TextView
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/progress"
android:textAppearance="@android:style/TextAppearance.Holo.Widget.TextView" />
<EditText
android:id="@+id/progressPlrBox"
android:layout_height="wrap_content"
android:ems="4"
android:inputType="number" />
<EditText
android:id="@+id/progressOppBox"
android:layout_height="wrap_content"
android:ems="4"
android:inputType="number" />
</TableRow>
<TableRow>
<CheckBox
android:id="@+id/winBox"
android:layout_height="wrap_content"
android:layout_span="3"
android:text="@string/preferwin" />
</TableRow>
</TableLayout>
<Button
android:id="@+id/defaults"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/defaults" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/miDev"
android:icon="@drawable/ic_menu_myplaces"
android:showAsAction="ifRoom"
android:title="@string/dev">
<menu>
<item
android:id="@+id/miExtfile"
android:showAsAction="never"
android:title="@string/extfile"/>
<item
android:id="@+id/miHudsvc"
android:showAsAction="never"
android:title="@string/start_hud"/>
<item
android:id="@+id/miHudsvcoff"
android:showAsAction="never"
android:title="@string/stop_hud"/>
<item
android:id="@+id/miOffdev"
android:showAsAction="never"
android:title="@string/off_dev"/>
</menu>
</item>
<item
android:id="@+id/miRefresh"
android:icon="@drawable/ic_menu_refresh"
android:showAsAction="always"
android:title="@string/refresh">
</item>
</menu>
\ No newline at end of file
<resources>
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Wordbase Hacker</string>
<string name="app_name_horst">Wordbase Horster</string>
<string name="choose_game">Choose game</string>
<string name="loading_games_db">Acquiring database&#8230;</string>
<string name="loading_games_tbl">Loading games&#8230;</string>
<string name="cant_get_root">Couldn\'t get root.</string>
<string name="cant_find_db">Couldn\'t find Wordbase data. Are you sure it\'s installed?</string>
<string name="internal_error">An internal error occurred.</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="pending_opponent">(pending opponent)</string>
<string name="unknown_opponent">(unknown player)</string>
<string name="hack_game">Hack game</string>
<string name="gained">Gained</string>
<string name="killed">Killed</string>
<string name="letters">Letters</string>
<string name="tiles">Tiles</string>
<string name="progress">Progress</string>
<string name="preferwin">Prefer winning moves</string>
<string name="defaults">Defaults</string>
<string name="scoring">Scoring</string>
<string name="play">Play</string>
<string name="loading_board">Loading board</string>
<string name="loading_moves">Loading moves</string>
<string name="applying_moves">Applying moves</string>
<string name="analyzing_words">Analyzing words</string>
<string name="finding_words">Finding words</string>
<string name="scoring_words">Scoring words</string>
<string name="no_board_found">No board found. Try opening the game in Wordbase first.</string>
<string name="no_moves">No moves found.</string>
<string name="best_move">Best word: %1$s (%2$d)</string>
<string name="refresh">Refresh</string>
<string name="dev">Developer</string>
<string name="dev_on">Developer options enabled</string>
<string name="dev_off">Developer options disabled</string>
<string name="horst_toggle">Horst mode toggled</string>
<string name="extfile">External database file</string>
<string name="off_dev">Disable developer options</string>
<string name="dbfile">Database file:</string>
<string name="reset">Reset</string>
<string name="start_hud">Start HUD service</string>
<string name="stop_hud">Stop HUD service</string>
</resources>
\ No newline at end of file
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
package net.pietu1998.wordbasehacker;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.pietu1998.wordbasehacker.solver.Board;
import net.pietu1998.wordbasehacker.solver.Coordinate;
import net.pietu1998.wordbasehacker.solver.Game;
import net.pietu1998.wordbasehacker.solver.Move;
import net.pietu1998.wordbasehacker.solver.Possibility;
import net.pietu1998.wordbasehacker.solver.Scoring;
import net.pietu1998.wordbasehacker.solver.Tile;
import org.json.simple.JSONArray;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.ComponentName;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteCantOpenDatabaseException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
public class BoardActivity extends Activity {
private Scoring currentScoring, scoring = Scoring.DEFAULT;
private boolean changingValues = false;
private Game game;
private List<Possibility> possibilities = new ArrayList<>();
private boolean loaded = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_board);
loadScoring();
Button scoring = (Button) findViewById(R.id.scoringBtn);
scoring.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
scoringDialog();
}
});
Parcelable extra = getIntent().getParcelableExtra("game");
if (extra == null) {
Toast.makeText(this, R.string.internal_error, Toast.LENGTH_SHORT).show();
finish();
return;
}
game = (Game) extra;
loaded = false;
}
@Override