Skip to content

Commit

Permalink
Migrate to default project structure
Browse files Browse the repository at this point in the history
Structure of this project have not changed much since the start. This commit completely removes the legacy of Ant build system.
  • Loading branch information
TheDrHax committed Aug 13, 2017
1 parent 6e64630 commit 5a7ef8e
Show file tree
Hide file tree
Showing 96 changed files with 4,471 additions and 4,196 deletions.
119 changes: 119 additions & 0 deletions app/app.iml
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/main" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/main" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="libandroid_tensorflow_inference_java" level="project" />
<orderEntry type="library" exported="" name="okio-1.6.0" level="project" />
<orderEntry type="library" exported="" name="support-compat-25.2.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="runner-0.5" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="exposed-instrumentation-api-publish-0.5" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" name="jsoup-1.8.3" level="project" />
<orderEntry type="library" exported="" name="okhttp-3.2.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" name="json-simple-1.1.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-25.2.0" level="project" />
</component>
</module>
107 changes: 107 additions & 0 deletions app/build.gradle
@@ -0,0 +1,107 @@
apply plugin: 'com.android.application'
apply plugin: 'androidsvgdrawable'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"

defaultConfig {
applicationId 'pw.thedrhax.mosmetro'
minSdkVersion 11
targetSdkVersion 25
versionCode 61
versionName "1.7.7"

// GitHub Pages
buildConfigField "String", "\$GITHUB", "\"https://thedrhax.github.io/mosmetro-android\""
buildConfigField "String", "NEWS_URL", "\$GITHUB + \"/news.json\""
buildConfigField "String", "API_URL_SOURCE", "\$GITHUB + \"/base-url\""

// Default stat URL
buildConfigField "String", "API_URL_DEFAULT", "\"https://mosmetro.duckdns.org\""

// Relative URLs for stat server
buildConfigField "String", "API_REL_STATISTICS", "\"/api/v1/statistics.php\""
buildConfigField "String", "API_REL_BRANCHES", "\"/api/v1/branches.php\""

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

def keystorePropertiesFile = rootProject.file("keystore.properties")
if (keystorePropertiesFile.exists()) {
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

signingConfigs {
release {
storeFile new File(keystoreProperties['RELEASE_STORE_FILE'])
storePassword keystoreProperties['RELEASE_STORE_PASSWORD']
keyAlias keystoreProperties['RELEASE_KEY_ALIAS']
keyPassword keystoreProperties['RELEASE_KEY_PASSWORD']
}
}
}

buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

if (keystorePropertiesFile.exists()) {
signingConfig signingConfigs.release
}
}
}

sourceSets {
// Test sources.
test.java.srcDir 'src/test/java'
androidTest.java.srcDir 'src/androidTest/java'

main {
res.srcDirs = ['src/main/res', 'build/generated/res/main']
jniLibs.srcDirs = ['libs']
java {
srcDir 'src'
exclude 'androidTest/**'
exclude 'test/**'
}
}

lintOptions {
abortOnError false
}
}
}

import fr.avianey.androidsvgdrawable.gradle.SvgDrawableTask
task svgToDrawablePng(type: SvgDrawableTask) {
from = files('src/main/res-svg/drawable')
to = file('build/generated/res/main')
createMissingDirectories = true
overwriteMode = 'ifModified'
targetedDensities = ['ldpi', 'hdpi', 'mdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi']
outputFormat = 'PNG'
outputType = 'drawable'
}

dependencies {
// Runtime dependencies.
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-annotations:25.2.0'
compile 'com.android.support:support-compat:25.2.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'org.jsoup:jsoup:1.8.3'
compile ('com.googlecode.json-simple:json-simple:1.1.1') {
exclude module: 'junit'
}

// Test dependencies.
testCompile 'junit:junit:4.12'

// Needed because there is a conflict in 'com.android.support.test:runner' package.
// Here we explicitly define the version for the 'androidTest' sources build variant.
androidTestCompile 'com.android.support:support-annotations:25.2.0'
androidTestCompile 'com.android.support.test:runner:0.5'
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions app/src/androidTest/assets/frozen_graph_ler=0.02.pb
34 changes: 34 additions & 0 deletions app/src/androidTest/java/pw/thedrhax/util/AndroidHacksTest.java
@@ -0,0 +1,34 @@
/**
* Wi-Fi в метро (pw.thedrhax.mosmetro, Moscow Wi-Fi autologin)
* Copyright © 2015 Dmitry Karikh <the.dr.hax@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package pw.thedrhax.util;

import org.junit.Test;

/**
* A collection of the AndroidHacks class tests
* @author Dmitry Karikh <the.dr.hax@gmail.com>
*/
public class AndroidHacksTest {

@Test
public void classWellDefined() throws Exception {
UtilityClasses.assertUtilityClassWellDefined(AndroidHacks.class);
}

}
70 changes: 70 additions & 0 deletions app/src/androidTest/java/pw/thedrhax/util/UtilTest.java
@@ -0,0 +1,70 @@
/**
* Wi-Fi в метро (pw.thedrhax.mosmetro, Moscow Wi-Fi autologin)
* Copyright © 2015 Dmitry Karikh <the.dr.hax@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package pw.thedrhax.util;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.test.InstrumentationRegistry;

import org.junit.Test;

import static org.junit.Assert.*;

/**
* A collection of the Util class tests
* @author Dmitry Karikh <the.dr.hax@gmail.com>
*/
public class UtilTest {
private static final String ASSETS_PATH = "example_captcha";

private Context context = InstrumentationRegistry.getContext();

@Test
public void getIntPreference() throws Exception {
assertEquals(123, Util.getIntPreference(context, "none", 123));
}

@Test
public void bitmapToBase64() throws Exception {
// Select just one of CAPTCHA examples
Bitmap bitmap = BitmapFactory.decodeStream(
context.getAssets().open(
"example_captcha/" + context.getAssets().list("example_captcha")[0]
)
);

// Bitmap -> Base64 -> Bitmap -> Base64
String encoded = Util.bitmapToBase64(bitmap);
Bitmap decoded = Util.base64ToBitmap(encoded);
String reencoded = Util.bitmapToBase64(decoded);

assertEquals(encoded, reencoded);
}

@Test
public void convertCyrillicSymbols() throws Exception {
assertEquals("abcdef", Util.convertCyrillicSymbols("абсдеф"));
}

@Test
public void wellDefinedClass() throws Exception {
UtilityClasses.assertUtilityClassWellDefined(Util.class);
}
}

0 comments on commit 5a7ef8e

Please sign in to comment.