diff options
28 files changed, 142 insertions, 123 deletions
@@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>bitmask_android</name> + <name>bitmask_for_android</name> <comment></comment> <projects> </projects> diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 70e0211d..df0eba0f 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -40,6 +40,7 @@ <application android:allowBackup="true" android:icon="@drawable/icon" + android:logo="@drawable/icon" android:label="@string/app" > <activity android:name="se.leap.openvpn.AboutFragment" /> <activity @@ -142,7 +143,9 @@ <activity android:name="se.leap.bitmaskclient.Dashboard" - android:label="@string/title_activity_dashboard" > + android:label="@string/title_activity_dashboard" + android:uiOptions="splitActionBarWhenNarrow" > + <intent-filter android:label="@string/app_name"> <action android:name="android.intent.action.MAIN" /> @@ -151,7 +154,8 @@ </activity> <activity android:name="se.leap.bitmaskclient.ConfigurationWizard" - android:label="@string/title_activity_configuration_wizard" > + android:label="@string/title_activity_configuration_wizard" + android:uiOptions="splitActionBarWhenNarrow" > </activity> <service android:name="se.leap.bitmaskclient.EIP" android:exported="false"> diff --git a/Building_from_eclipse.md b/Building_from_eclipse.md new file mode 100644 index 00000000..827ba778 --- /dev/null +++ b/Building_from_eclipse.md @@ -0,0 +1,24 @@ +# Download Eclipse ADT environment + +# Download Android SDK for Bitmask Android + +- From the Android SDK Manager, install API 17 (Android 4.2.2) SDK Platform and ARM EABI v7a System Image +- Restart Eclipse + +# Setup an AVD + +- Leave default settings +- Set the name (api_17 for example) +- Device 4.0 WVGA +- API level 17 +- SD card size = 100 MiB + +# Import project +## Import repository from Git + +File -> Import -> Git -> Projects from Git +Uri -> https://github.com/leapcode/bitmask_android.git -> leave develop and master checked -> initial branch = develop -> leave "Import existing projects" -> deselect leap_androidTest -> Finish + +## Build OpenVPN + +- From the project directory, execute "./compile-native-openvpn.sh" @@ -1 +1 @@ -README.txt
\ No newline at end of file +README.md
\ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..1609d0ce --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# Bitmask Android App + +This repository contains the source code for the [Bitmask][https://bitmask.net/] Android app. + +Please see the [issues](https://github.com/leapcode/bitmask_android/issues) section to +report any bugs or feature requests and to see the list of known issues. + +## License + +* [See LICENSE file](https://github.com/leapcode/bitmask_android/blob/master/LICENSE.txt) + +## Building + +The build requires [Ant](https://ant.apache.org/) v1.6+, the [Android SDK](http://developer.android.com/sdk/index.html) API 17 and the [Android NDK](http://developer.android.com/tools/sdk/ndk/index.html) r8b +to be installed in your development environment. + +In addition you'll need ant/bin, android/tools, 'platforms-tools' and 'android-ndk-r8b' in your enviroment path. + +After satisfying those requirements, the build is pretty simple: + +* Run `./compile.sh` from the project directory to build the APK only + +You might find that your device doesn't let you install your build if you +already have the version from the Android Market installed. This is standard +Android security as it it won't let you directly replace an app that's been +signed with a different key. Manually uninstall Bitmask Android from your device and +you will then be able to install your own built version. +To uninstall it, do: adb uninstall se.leap.bitmaskclient + +See [here](https://github.com/parmegv/bitmask_android/blob/feature/docs/Building_from_eclipse.md) for +instructions on building from [Eclipse](http://eclipse.org). + +## Acknowledgements + +This project uses code from [ics-openvpn project](https://code.google.com/p/ics-openvpn/). + +## Contributing + +Please fork this repository and contribute back using +[pull requests](https://github.com/leapcode/leap_android/pulls). + +Any contributions, large or small, major features, bug fixes, additional +language translations, unit/integration tests are welcomed and appreciated +but will be thoroughly reviewed and discussed. diff --git a/README.txt b/README.txt deleted file mode 100644 index c7dd933b..00000000 --- a/README.txt +++ /dev/null @@ -1,65 +0,0 @@ -Compiling -========= - -Preconditions ----------------- - -1. Android SDK installed (follow instructions from http://developer.android.com/sdk/index.html) -2. API version 16 or version installed. -2. Ant 1.6 or greater - -Instructions to compile ------------------------ - -1. cd $PROJECT_LOCATION/leap_android -2. ./compile.sh - -Postconditions --------------- - -1. $PROJECT_LOCATION/leap_android/bin/Bitmask Android-debug.apk exists - -Running on the emulator -========================= - -Preconditions ------------------ - -1. Android SDK is installed, and its tools are in the PATH. -2. Bitmask Android has been compiled. -3. An avd exists in ~/.android/avd/ (if you do not have one, follow instructions from http://developer.android.com/tools/devices/managing-avds-cmdline.html) - -Instructions to run on the emulator ------------------------------------ - -1. cd $PROJECT_LOCATION/leap_android -1. Run script: ./run.sh @AVD-NAME . (avd names are the names of the files in ~/.android/avd with extension .avd). - -Postconditions --------------- - -1. Bitmask Android is running. - -Debugging from console -====================== - -Preconditions ------------------ - -1. Android SDK is installed, and its tools are in the PATH. -2. Bitmask Android has been compiled. -3. An avd exists in ~/.android/avd/ (if you do not have one, follow instructions from http://developer.android.com/tools/devices/managing-avds-cmdline.html). -4. jdb is installed (this program is part of OpenJDK 7) - -Instructions to debug from the console ------------------------------------ - -1. cd $PROJECT_LOCATION/leap_android -2. Run script: ./debug.sh @AVD-NAME . (avd names are the names of the files in ~/.android/avd with extension .avd). - -Postconditions --------------- - -1. Bitmask Android is running. -2. Bitmask Android does not show the message "Application Bitmask for Android (process se.leap.bitmaskclient) is waiting for the debugger to attach". -3. You are in a jdb debuggin session. @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<project name="Bitmask Android" default="help"> +<project name="Bitmask for Android" default="help"> <!-- The local.properties file is created and updated by the 'android' tool. It contains the path to the SDK. It should *NOT* be checked into diff --git a/compile-native-openvpn.sh b/compile-native-openvpn.sh new file mode 100755 index 00000000..7b512631 --- /dev/null +++ b/compile-native-openvpn.sh @@ -0,0 +1,14 @@ +#!/bin/bash +function compile() { + svn co http://google-breakpad.googlecode.com/svn/trunk/ google-breakpad + ./build-native.sh +} + +if command -v $(head -n 1 build-native.sh | column | cut -d ' ' -f 1); then + compile +elif command -v ndk-build; then + sed -i 's/.*ndk-build/ndk-build/g' build-native.sh + compile +else + echo "Install ndk, or modify build-native script to point to your ndk-build executable" +fi @@ -1,3 +1,11 @@ #!/bin/bash -android update project --path . --name "Bitmask Android" --target android-17 +libopenvpn_so_files=`find libs -name libopenvpn.so | wc --lines` +libopvnutil_so_files=`find libs -name libopvpnutil.so | wc --lines` +minivpn_files=`find libs -name minivpn | wc --lines` +if [ $libopenvpn_so_files -lt 4 ] || [ $libopvnutil_so_files -lt 4 ] || [ $minivpn_files -lt 4 ]; +then + ./compile-native-openvpn.sh +fi + +android update project --path . --name "Bitmask for Android" --target android-17 ant debug @@ -22,7 +22,7 @@ wait_until_booted() { echo "Emulator booted!" } -emulator -wipe-data @$avd_name & # If you want to test the app from scratch +emulator @$avd_name & # If you want to test the app from scratch wait_until_booted adb install -r $PROJECT_FOLDER/bin/LEAP\ Android-debug.apk # Install the new version of the application adb shell am start -D se.leap.bitmaskclient/.Dashboard # Run app diff --git a/hosts-for-android-emulator b/hosts-for-tests index ab0cf906..ab0cf906 100644 --- a/hosts-for-android-emulator +++ b/hosts-for-tests diff --git a/res/drawable-hdpi/ic_menu_add.png b/res/drawable-hdpi/ic_menu_add.png Binary files differnew file mode 100644 index 00000000..444e8a5e --- /dev/null +++ b/res/drawable-hdpi/ic_menu_add.png diff --git a/res/drawable-hdpi/ic_menu_login.png b/res/drawable-hdpi/ic_menu_login.png Binary files differnew file mode 100644 index 00000000..afa152b2 --- /dev/null +++ b/res/drawable-hdpi/ic_menu_login.png diff --git a/res/drawable-hdpi/ic_menu_settings_holo_light.png b/res/drawable-hdpi/ic_menu_settings_holo_light.png Binary files differnew file mode 100644 index 00000000..577e0558 --- /dev/null +++ b/res/drawable-hdpi/ic_menu_settings_holo_light.png diff --git a/res/drawable-ldpi/ic_menu_add.png b/res/drawable-ldpi/ic_menu_add.png Binary files differnew file mode 100644 index 00000000..89620af8 --- /dev/null +++ b/res/drawable-ldpi/ic_menu_add.png diff --git a/res/drawable-ldpi/ic_menu_login.png b/res/drawable-ldpi/ic_menu_login.png Binary files differnew file mode 100644 index 00000000..d4181de5 --- /dev/null +++ b/res/drawable-ldpi/ic_menu_login.png diff --git a/res/drawable-mdpi/ic_menu_add.png b/res/drawable-mdpi/ic_menu_add.png Binary files differnew file mode 100755 index 00000000..361c7c46 --- /dev/null +++ b/res/drawable-mdpi/ic_menu_add.png diff --git a/res/drawable-mdpi/ic_menu_login.png b/res/drawable-mdpi/ic_menu_login.png Binary files differnew file mode 100644 index 00000000..122ba33b --- /dev/null +++ b/res/drawable-mdpi/ic_menu_login.png diff --git a/res/drawable-mdpi/ic_menu_settings_holo_light.png b/res/drawable-mdpi/ic_menu_settings_holo_light.png Binary files differnew file mode 100644 index 00000000..f32a37e4 --- /dev/null +++ b/res/drawable-mdpi/ic_menu_settings_holo_light.png diff --git a/res/drawable-xhdpi/ic_menu_add.png b/res/drawable-xhdpi/ic_menu_add.png Binary files differnew file mode 100644 index 00000000..7d498a96 --- /dev/null +++ b/res/drawable-xhdpi/ic_menu_add.png diff --git a/res/drawable-xhdpi/ic_menu_login.png b/res/drawable-xhdpi/ic_menu_login.png Binary files differnew file mode 100644 index 00000000..5095ed97 --- /dev/null +++ b/res/drawable-xhdpi/ic_menu_login.png diff --git a/res/drawable-xhdpi/ic_menu_settings_holo_light.png b/res/drawable-xhdpi/ic_menu_settings_holo_light.png Binary files differnew file mode 100644 index 00000000..aa33c388 --- /dev/null +++ b/res/drawable-xhdpi/ic_menu_settings_holo_light.png diff --git a/res/layout/provider_list_fragment.xml b/res/layout/provider_list_fragment.xml index 0db0734b..5a6770c8 100644 --- a/res/layout/provider_list_fragment.xml +++ b/res/layout/provider_list_fragment.xml @@ -8,15 +8,8 @@ <ListView
android:id="@id/android:list"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="0dip"
android:layout_weight="1"
- android:layout_alignParentTop="true"
android:drawSelectorOnTop="false" />
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:onClick="addAndSelectNewProvider"
- android:text="@string/new_provider_button" />
-
</LinearLayout>
diff --git a/res/menu/client_dashboard.xml b/res/menu/client_dashboard.xml index 55ad91b4..2ce8b87c 100644 --- a/res/menu/client_dashboard.xml +++ b/res/menu/client_dashboard.xml @@ -3,12 +3,33 @@ <item android:id="@+id/menu_settings" android:orderInCategory="100" - android:showAsAction="never" + android:showAsAction="ifRoom" + android:icon="@drawable/ic_menu_settings_holo_light" android:title="@string/menu_settings"/> - <item android:id="@+id/about_leap" android:title="@string/about" android:orderInCategory="110" /> - <item android:id="@+id/legacy_interface" android:title="ICS OpenVPN Interface" android:orderInCategory="500" /> - <item android:id="@+id/switch_provider" android:title="@string/switch_provider_menu_option" android:orderInCategory="501"/> - <item android:id="@+id/login_button" android:title="@string/login_button" android:visible="false"></item> - <item android:id="@+id/logout_button" android:title="@string/logout_button" android:visible="false"></item> + <item + android:id="@+id/about_leap" + android:orderInCategory="110" + android:title="@string/about"/> + <item + android:id="@+id/legacy_interface" + android:orderInCategory="500" + android:title="ICS OpenVPN Interface"/> + <item + android:id="@+id/switch_provider" + android:orderInCategory="501" + android:title="@string/switch_provider_menu_option"/> + <item + android:id="@+id/login_button" + android:showAsAction="ifRoom" + android:icon="@drawable/ic_menu_login" + android:title="@string/login_button" + android:visible="false"> + </item> + <item + android:id="@+id/logout_button" + android:showAsAction="ifRoom" + android:title="@string/logout_button" + android:visible="false"> + </item> </menu>
\ No newline at end of file diff --git a/res/menu/configuration_wizard_activity.xml b/res/menu/configuration_wizard_activity.xml index 9e441a18..9936b6dc 100644 --- a/res/menu/configuration_wizard_activity.xml +++ b/res/menu/configuration_wizard_activity.xml @@ -5,4 +5,11 @@ android:orderInCategory="110" android:title="@string/about"/> + <item + android:id="@+id/new_provider" + android:orderInCategory="210" + android:title="@string/new_provider_button" + android:showAsAction="ifRoom|withText" + android:icon="@drawable/ic_menu_add" + /> </menu>
\ No newline at end of file @@ -34,5 +34,5 @@ else fi wait_until_booted -adb install -r $PROJECT_FOLDER/bin/Bitmask\ Android-debug.apk # Install the new version of the application +adb install -r $PROJECT_FOLDER/bin/Bitmask\ for\ Android-debug.apk # Install the new version of the application adb shell am start se.leap.bitmaskclient/.Dashboard # Run app diff --git a/src/se/leap/bitmaskclient/ConfigurationWizard.java b/src/se/leap/bitmaskclient/ConfigurationWizard.java index bcb4fa9f..a0ac1bc2 100644 --- a/src/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/src/se/leap/bitmaskclient/ConfigurationWizard.java @@ -301,9 +301,8 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn /**
* Open the new provider dialog
- * @param view from which the dialog is showed
*/
- public void addAndSelectNewProvider(View view) {
+ public void addAndSelectNewProvider() {
FragmentTransaction fragment_transaction = getFragmentManager().beginTransaction();
Fragment previous_new_provider_dialog = getFragmentManager().findFragmentByTag(NewProviderDialog.TAG);
if (previous_new_provider_dialog != null) {
@@ -380,6 +379,10 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn switch (item.getItemId()){
case R.id.about_leap:
showAboutFragment(getCurrentFocus());
+ return true;
+ case R.id.new_provider:
+ addAndSelectNewProvider();
+ return true;
default:
return super.onOptionsItemSelected(item);
}
diff --git a/tests/.project b/tests/.project deleted file mode 100644 index 851db452..00000000 --- a/tests/.project +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>leap_androidTest</name> - <comment></comment> - <projects> - <project>leap_android</project> - </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> |