diff --git a/sampletorapp/.gitignore b/sampletorapp/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/sampletorapp/.gitignore @@ -0,0 +1 @@ +/build diff --git a/sampletorapp/build.gradle b/sampletorapp/build.gradle new file mode 100644 index 00000000..565538cf --- /dev/null +++ b/sampletorapp/build.gradle @@ -0,0 +1,38 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 27 + + + + defaultConfig { + applicationId "org.torproject.android.sample" + minSdkVersion 16 + targetSdkVersion 27 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + + implementation 'com.android.support:appcompat-v7:27.1.1' + implementation 'com.android.support.constraint:constraint-layout:1.1.0' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + + implementation project(':tor-android-binary') +} diff --git a/sampletorapp/proguard-rules.pro b/sampletorapp/proguard-rules.pro new file mode 100644 index 00000000..f1b42451 --- /dev/null +++ b/sampletorapp/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/sampletorapp/src/androidTest/java/org/torproject/android/sample/ExampleInstrumentedTest.java b/sampletorapp/src/androidTest/java/org/torproject/android/sample/ExampleInstrumentedTest.java new file mode 100644 index 00000000..daa72a18 --- /dev/null +++ b/sampletorapp/src/androidTest/java/org/torproject/android/sample/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package org.torproject.android.sample; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("org.torproject.android.sample", appContext.getPackageName()); + } +} diff --git a/sampletorapp/src/main/AndroidManifest.xml b/sampletorapp/src/main/AndroidManifest.xml new file mode 100644 index 00000000..5f0b87e6 --- /dev/null +++ b/sampletorapp/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sampletorapp/src/main/java/org/torproject/android/sample/sampleTorActivity.java b/sampletorapp/src/main/java/org/torproject/android/sample/sampleTorActivity.java new file mode 100644 index 00000000..cf752207 --- /dev/null +++ b/sampletorapp/src/main/java/org/torproject/android/sample/sampleTorActivity.java @@ -0,0 +1,41 @@ +package org.torproject.android.sample; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.widget.TextView; +import android.widget.Toast; + +import org.torproject.android.binary.TorResourceInstaller; + +import java.io.IOException; +import java.util.concurrent.TimeoutException; + + +public class sampleTorActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_sample_tor); + + try { + boolean success = new TorResourceInstaller(this,getFilesDir()).installResources(); + + String message = "Tor install success? " + success; + + ((TextView)findViewById(R.id.lblStatus)).setText(message); + + } catch (IOException e) { + e.printStackTrace(); + ((TextView)findViewById(R.id.lblStatus)).setText(e.getMessage()); + + } catch (TimeoutException e) { + e.printStackTrace(); + } + } + + public void doTorThings () + { + //please see this project: https://github.com/thaliproject/Tor_Onion_Proxy_Library/ + } +} diff --git a/sampletorapp/src/main/res/drawable-v24/ic_launcher_foreground.xml b/sampletorapp/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..c7bd21db --- /dev/null +++ b/sampletorapp/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/sampletorapp/src/main/res/drawable/ic_launcher_background.xml b/sampletorapp/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..d5fccc53 --- /dev/null +++ b/sampletorapp/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sampletorapp/src/main/res/layout/activity_sample_tor.xml b/sampletorapp/src/main/res/layout/activity_sample_tor.xml new file mode 100644 index 00000000..7eff9914 --- /dev/null +++ b/sampletorapp/src/main/res/layout/activity_sample_tor.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/sampletorapp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/sampletorapp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/sampletorapp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/sampletorapp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/sampletorapp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/sampletorapp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/sampletorapp/src/main/res/mipmap-hdpi/ic_launcher.png b/sampletorapp/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..a2f59082 Binary files /dev/null and b/sampletorapp/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/sampletorapp/src/main/res/mipmap-hdpi/ic_launcher_round.png b/sampletorapp/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 00000000..1b523998 Binary files /dev/null and b/sampletorapp/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/sampletorapp/src/main/res/mipmap-mdpi/ic_launcher.png b/sampletorapp/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..ff10afd6 Binary files /dev/null and b/sampletorapp/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/sampletorapp/src/main/res/mipmap-mdpi/ic_launcher_round.png b/sampletorapp/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 00000000..115a4c76 Binary files /dev/null and b/sampletorapp/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/sampletorapp/src/main/res/mipmap-xhdpi/ic_launcher.png b/sampletorapp/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..dcd3cd80 Binary files /dev/null and b/sampletorapp/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/sampletorapp/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/sampletorapp/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 00000000..459ca609 Binary files /dev/null and b/sampletorapp/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/sampletorapp/src/main/res/mipmap-xxhdpi/ic_launcher.png b/sampletorapp/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..8ca12fe0 Binary files /dev/null and b/sampletorapp/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/sampletorapp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/sampletorapp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..8e19b410 Binary files /dev/null and b/sampletorapp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/sampletorapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/sampletorapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..b824ebdd Binary files /dev/null and b/sampletorapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/sampletorapp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/sampletorapp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..4c19a13c Binary files /dev/null and b/sampletorapp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/sampletorapp/src/main/res/values/colors.xml b/sampletorapp/src/main/res/values/colors.xml new file mode 100644 index 00000000..3ab3e9cb --- /dev/null +++ b/sampletorapp/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #3F51B5 + #303F9F + #FF4081 + diff --git a/sampletorapp/src/main/res/values/strings.xml b/sampletorapp/src/main/res/values/strings.xml new file mode 100644 index 00000000..b06bffcd --- /dev/null +++ b/sampletorapp/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + SampleTorApp + diff --git a/sampletorapp/src/main/res/values/styles.xml b/sampletorapp/src/main/res/values/styles.xml new file mode 100644 index 00000000..5885930d --- /dev/null +++ b/sampletorapp/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/sampletorapp/src/test/java/org/torproject/android/sample/ExampleUnitTest.java b/sampletorapp/src/test/java/org/torproject/android/sample/ExampleUnitTest.java new file mode 100644 index 00000000..cc113634 --- /dev/null +++ b/sampletorapp/src/test/java/org/torproject/android/sample/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package org.torproject.android.sample; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 876426f6..9fc22bea 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':tor-android-binary' +include ':tor-android-binary', ':sampletorapp'