├── .classpath
├── .gitignore
├── .project
├── AUTHORS
├── AndroidManifest.xml
├── LICENSE
├── README.md
├── libs
├── android-integration.jar
└── android-support-v4.jar
├── proguard.cfg
├── project.properties
├── res
├── drawable-hdpi-v11
│ └── ic_stat_download.png
├── drawable-hdpi
│ ├── actionbar_shadow.9.png
│ ├── ic_action_add.png
│ ├── ic_action_info.png
│ ├── ic_action_overview.png
│ ├── ic_action_refresh.png
│ ├── ic_action_upload.png
│ ├── ic_application.png
│ ├── ic_audio.png
│ ├── ic_document.png
│ ├── ic_folder.png
│ ├── ic_image.png
│ ├── ic_menu_preferences.png
│ ├── ic_package.png
│ ├── ic_presentation.png
│ ├── ic_spreadsheet.png
│ ├── ic_stat_download.png
│ ├── ic_text.png
│ ├── ic_title_home.png
│ ├── ic_title_info.png
│ ├── ic_video.png
│ ├── ic_web.png
│ ├── icon.png
│ ├── sparkleshare_android_logo_512_512.png
│ └── sparkleshare_logo.png
├── drawable-ldpi-v11
│ └── ic_stat_download.png
├── drawable-ldpi
│ ├── ic_action_info.png
│ ├── ic_action_overview.png
│ ├── ic_application.png
│ ├── ic_audio.png
│ ├── ic_document.png
│ ├── ic_folder.png
│ ├── ic_image.png
│ ├── ic_package.png
│ ├── ic_presentation.png
│ ├── ic_spreadsheet.png
│ ├── ic_stat_download.png
│ ├── ic_text.png
│ ├── ic_video.png
│ ├── ic_web.png
│ └── icon.png
├── drawable-mdpi-v11
│ └── ic_stat_download.png
├── drawable-mdpi
│ ├── actionbar_shadow.9.png
│ ├── ic_action_info.png
│ ├── ic_action_overview.png
│ ├── ic_action_refresh.png
│ ├── ic_application.png
│ ├── ic_audio.png
│ ├── ic_document.png
│ ├── ic_folder.png
│ ├── ic_image.png
│ ├── ic_package.png
│ ├── ic_presentation.png
│ ├── ic_spreadsheet.png
│ ├── ic_stat_download.png
│ ├── ic_text.png
│ ├── ic_video.png
│ ├── ic_web.png
│ └── icon.png
├── drawable-nodpi
│ ├── actionbar_separator.9.png
│ ├── application.png
│ ├── audio.png
│ ├── document.png
│ ├── image.png
│ ├── package_icon.png
│ ├── presentation.png
│ ├── splash.png
│ ├── spreadsheet.png
│ ├── text.png
│ ├── video.png
│ └── web.png
├── drawable-xhdpi
│ └── actionbar_shadow.9.png
├── drawable
│ ├── actionbar_background.xml
│ ├── actionbar_compat_item.xml
│ ├── actionbar_compat_item_focused.xml
│ ├── actionbar_compat_item_pressed.xml
│ └── grey_gradient.xml
├── layout-v11
│ └── actionbar_indeterminate_progress.xml
├── layout
│ ├── about.xml
│ ├── about_fragment.xml
│ ├── actionbar_compat.xml
│ ├── browsing_fragment.xml
│ ├── download_progress.xml
│ ├── file_details.xml
│ ├── filedownload_fragment.xml
│ ├── list_item_entry.xml
│ ├── setup.xml
│ ├── setup_fragment.xml
│ ├── splash.xml
│ └── welcome_fragment.xml
├── menu
│ └── option.xml
├── values-de
│ └── strings.xml
├── values-es
│ └── strings.xml
├── values-fr
│ └── strings.xml
├── values-nl
│ └── strings.xml
├── values-pl
│ └── strings.xml
├── values-ru
│ └── strings.xml
├── values-sr
│ └── strings.xml
├── values-sv
│ └── strings.xml
├── values-uk
│ └── strings.xml
├── values-v11
│ └── styles.xml
├── values-v13
│ └── styles.xml
├── values
│ ├── attrs.xml
│ ├── colors.xml
│ ├── dimens.xml
│ ├── ids.xml
│ ├── strings.xml
│ └── styles.xml
└── xml
│ └── settings.xml
└── src
└── org
└── sparkleshare
└── android
├── AboutActivity.java
├── BrowsingActivity.java
├── BrowsingAdapter.java
├── FileDetailsActivity.java
├── SettingsActivity.java
├── SetupActivity.java
├── WelcomeActivity.java
├── actionbarcompat
├── ActionBarActivity.java
├── ActionBarHelper.java
├── ActionBarHelperBase.java
├── ActionBarHelperHoneycomb.java
├── ActionBarHelperICS.java
├── SimpleMenu.java
└── SimpleMenuItem.java
├── ui
├── AboutFragment.java
├── BrowsingFragment.java
├── FileDetailsFragment.java
├── ListEntryItem.java
├── SetupFragment.java
└── WelcomeFragment.java
└── utils
├── BitmapManager.java
├── ExternalDirectory.java
├── FakeSocketFactory.java
├── FakeTrustManager.java
├── FormatHelper.java
├── MimetypeChecker.java
└── URLPathDecoder.java
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /assets
2 | /gen
3 | /bin
4 | /lint.xml
5 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | SparkleShare-Android
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | Points of contact:
2 |
3 | Maintainer:
4 | Kai Wolf
5 |
6 | Visual and Interaction Design:
7 | Hylke Bons
8 |
9 |
10 | Contributors:
11 |
12 | ...
13 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
9 |
10 |
11 |
12 |
13 |
17 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Android Client for SparkleShare Project at http://www.sparkleshare.org
2 |
3 | ## Current Development Status ##
4 |
5 | SparkleShare for Android is available in Version 1.0 on [Android Market](https://market.android.com/details?id=org.sparkleshare.android)
6 | With the current version you can browse your files and download them onto your device.
7 | For upcoming features you might take a look at the [features page](https://github.com/NewProggie/SparkleShare-Android/issues?labels=Features&sort=created&direction=desc&state=open&page=1&milestone=1).
8 | Don't hesitate to suggest features which aren't already described there.
9 |
10 | ## Screenshots ##
11 |
12 | 
13 | 
14 | 
--------------------------------------------------------------------------------
/libs/android-integration.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/libs/android-integration.jar
--------------------------------------------------------------------------------
/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/proguard.cfg:
--------------------------------------------------------------------------------
1 | -optimizationpasses 5
2 | -dontusemixedcaseclassnames
3 | -dontskipnonpubliclibraryclasses
4 | -dontpreverify
5 | -verbose
6 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7 |
8 | -keep public class * extends android.app.Activity
9 | -keep public class * extends android.app.Application
10 | -keep public class * extends android.app.Service
11 | -keep public class * extends android.content.BroadcastReceiver
12 | -keep public class * extends android.content.ContentProvider
13 | -keep public class * extends android.app.backup.BackupAgentHelper
14 | -keep public class * extends android.preference.Preference
15 | -keep public class com.android.vending.licensing.ILicensingService
16 |
17 | -keepclasseswithmembernames class * {
18 | native ;
19 | }
20 |
21 | -keepclasseswithmembernames class * {
22 | public (android.content.Context, android.util.AttributeSet);
23 | }
24 |
25 | -keepclasseswithmembernames class * {
26 | public (android.content.Context, android.util.AttributeSet, int);
27 | }
28 |
29 | -keepclassmembers enum * {
30 | public static **[] values();
31 | public static ** valueOf(java.lang.String);
32 | }
33 |
34 | -keep class * implements android.os.Parcelable {
35 | public static final android.os.Parcelable$Creator *;
36 | }
37 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | android.library=false
11 | # Project target.
12 | target=android-15
13 |
--------------------------------------------------------------------------------
/res/drawable-hdpi-v11/ic_stat_download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi-v11/ic_stat_download.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/actionbar_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/actionbar_shadow.9.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_action_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_action_add.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_action_info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_action_info.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_action_overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_action_overview.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_action_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_action_refresh.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_action_upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_action_upload.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_application.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_application.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_audio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_audio.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_document.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_document.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_folder.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_image.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_menu_preferences.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_menu_preferences.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_package.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_package.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_presentation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_presentation.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_spreadsheet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_spreadsheet.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_stat_download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_stat_download.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_text.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_title_home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_title_home.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_title_info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_title_info.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_video.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/ic_web.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/sparkleshare_android_logo_512_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/sparkleshare_android_logo_512_512.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/sparkleshare_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-hdpi/sparkleshare_logo.png
--------------------------------------------------------------------------------
/res/drawable-ldpi-v11/ic_stat_download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi-v11/ic_stat_download.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_action_info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_action_info.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_action_overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_action_overview.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_application.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_application.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_audio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_audio.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_document.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_document.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_folder.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_image.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_package.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_package.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_presentation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_presentation.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_spreadsheet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_spreadsheet.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_stat_download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_stat_download.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_text.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_video.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/ic_web.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-mdpi-v11/ic_stat_download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi-v11/ic_stat_download.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/actionbar_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/actionbar_shadow.9.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_action_info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_action_info.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_action_overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_action_overview.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_action_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_action_refresh.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_application.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_application.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_audio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_audio.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_document.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_document.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_folder.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_image.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_package.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_package.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_presentation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_presentation.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_spreadsheet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_spreadsheet.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_stat_download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_stat_download.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_text.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_video.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/ic_web.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-nodpi/actionbar_separator.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-nodpi/actionbar_separator.9.png
--------------------------------------------------------------------------------
/res/drawable-nodpi/application.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-nodpi/application.png
--------------------------------------------------------------------------------
/res/drawable-nodpi/audio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-nodpi/audio.png
--------------------------------------------------------------------------------
/res/drawable-nodpi/document.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-nodpi/document.png
--------------------------------------------------------------------------------
/res/drawable-nodpi/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-nodpi/image.png
--------------------------------------------------------------------------------
/res/drawable-nodpi/package_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-nodpi/package_icon.png
--------------------------------------------------------------------------------
/res/drawable-nodpi/presentation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-nodpi/presentation.png
--------------------------------------------------------------------------------
/res/drawable-nodpi/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-nodpi/splash.png
--------------------------------------------------------------------------------
/res/drawable-nodpi/spreadsheet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-nodpi/spreadsheet.png
--------------------------------------------------------------------------------
/res/drawable-nodpi/text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-nodpi/text.png
--------------------------------------------------------------------------------
/res/drawable-nodpi/video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-nodpi/video.png
--------------------------------------------------------------------------------
/res/drawable-nodpi/web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-nodpi/web.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/actionbar_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NewProggie/SparkleShare-Android/e98c6921c953511d062614639fe63b9052876e6f/res/drawable-xhdpi/actionbar_shadow.9.png
--------------------------------------------------------------------------------
/res/drawable/actionbar_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
9 |
--------------------------------------------------------------------------------
/res/drawable/actionbar_compat_item.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
20 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/res/drawable/actionbar_compat_item_focused.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/res/drawable/actionbar_compat_item_pressed.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/res/drawable/grey_gradient.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
9 |
--------------------------------------------------------------------------------
/res/layout-v11/actionbar_indeterminate_progress.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
21 |
27 |
28 |
--------------------------------------------------------------------------------
/res/layout/about.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
15 |
22 |
27 |
32 |
33 |
41 |
48 |
56 |
57 |
--------------------------------------------------------------------------------
/res/layout/about_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/layout/actionbar_compat.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
--------------------------------------------------------------------------------
/res/layout/browsing_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/layout/download_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
15 |
24 |
32 |
--------------------------------------------------------------------------------
/res/layout/file_details.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
29 |
30 |
39 |
40 |
48 |
49 |
59 |
60 |
70 |
71 |
--------------------------------------------------------------------------------
/res/layout/filedownload_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/layout/list_item_entry.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
28 |
36 |
--------------------------------------------------------------------------------
/res/layout/setup.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
16 |
26 |
35 |
42 |
49 |
54 |
59 |
60 |
61 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/res/layout/setup_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/layout/splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
15 |
19 |
27 |
28 |
35 |
43 |
51 |
52 |
--------------------------------------------------------------------------------
/res/layout/welcome_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/res/menu/option.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/res/values-de/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | SparkleShare
4 | 1.0
5 | Willkommen zu SparkleShare!
6 | Adresse
7 | Domain Name oder IP-Adresse
8 | Ordnername:
9 | /home/user/repositoryname.git
10 | Email-Adresse
11 | Benutzername
12 | Passwort
13 | Link code
14 | Ok
15 | Bitte warten...
16 | Entschuldigung, der Server scheint derzeit nicht erreichbar zu sein...
17 | Schließen
18 | Projekt hinzufügen
19 | Füge Projekt hinzu...
20 | SparkleShare
21 | Aktualisieren
22 | Upload
23 | Entschuldigung, es scheint, als sei die passende App auf diesem Gerät nicht installiert.
24 | Entschuldigung, es scheint, also sei Barcode Scanner auf diesem Gerät nicht installiert.
25 | Noch nicht implementiert
26 | Downloading...
27 | Entschuldigung, beim Herunterladen ist ein Fehler aufgetreten.
28 | Diese Information befindet sich im SparkleShare Dashboard Interface unter dem Punkt: link new device.
29 | Ungültiger QR-Code
30 |
31 | Home
32 | Einstellungen
33 | Über SparkleShare
34 | Account
35 | Account löschen
36 | Zeige versteckte Dateien
37 | version
38 | Link Code eingeben
39 | QR-Code einlesen
40 | Bist du sicher?
41 | Soll der aktuelle Account wirklich gelöscht werden?
42 | Vergessen
43 | Rückgängig
44 | Füge ein neues Projekt hinzu:
45 | Egal
46 | Hinzufügen
47 | Copyright © 2011
48 | Kai Wolf, Hylke Bons und andere.
49 | SparkleShare is Free and Open Source Software. You are free to use, modify, and redistribute it under the GNU General Public License version 3 or later.
50 | Öffnen
51 | Download
52 |
53 |
--------------------------------------------------------------------------------
/res/values-es/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | SparkleShare
4 | 1.0
5 | ¡Bienvenido a SparkleShare!
6 | Dirección
7 | nombre de dominio o dirección IP
8 | Nombre de la carpeta:
9 | /home/usuario/nombrerepositorio.git
10 | Dirección de correo electrónico
11 | Usuario
12 | Contraseña
13 | Código de enlace
14 | enviar
15 | Por favor espere...
16 | Disculpe, pero no fué posible llevar al equipo...
17 | Cerrar
18 | Agregar proyecto
19 | Agregando de proyecto...
20 | SparkleShare
21 | Refrescar
22 | Subir
23 | Disculpe, pero parece que no hay instalada una aplicación que pueda manejar este tipo de archivo.
24 | Disculpe, pero no hemos podido encontrar un escáner de código de barras adecuado en este dispositivo.
25 | Aún no implementado
26 | Descargando...
27 | Disculpe, ha ocurrido un error al descargar el archivo.
28 | Puede encontrar esta información en el tablero de SparkleShare cuando decide conectar un dispositivo nuevo.
29 | Código QR inválido
30 | Inicio
31 | Configuración
32 | Acerca de SparkleShare
33 | Cuenta
34 | Olvidar cuenta
35 | Mostrar archivos ocultos
36 | versión
37 | Introduzca el código de enlace
38 | Escanear el código QR
39 | ¿Está seguro?
40 | ¿Está usted seguro de que quiere olvidarse de la cuenta actual?
41 | Olvidar
42 | Cancelar
43 | Empezar agregando un proyecto:
44 | No importa
45 | Añadir
46 | Copyright © 2011
47 | Kai Wolf, Bons Hylke y otros.
48 | SparkleShare es Software Libre y de Código Abierto. Usted es libre de usar, modificar y redistribuirlo bajo la versión de Licencia Pública General GNU versión 3 o posterior.
49 | Abrir
50 | Descargar
51 |
52 |
--------------------------------------------------------------------------------
/res/values-fr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | SparkleShare
4 | 1.0
5 | Bienvenue dans SparkleShare!
6 | Addresse
7 | nom de domaine ou adresse IP
8 | Nom du dossier:
9 | /home/user/repositoryname.git
10 | Adresse Email
11 | Nom d\'utilisateur
12 | Mot de passe
13 | Code d\'appairage
14 | soumettre
15 | Veuillez patienter...
16 | Désolé mais nous n\'avons pas réussi à contacter le serveur...
17 | Fermer
18 | Ajouter le projet
19 | Ajout du projet en cours...
20 | SparkleShare
21 | Actualiser
22 | Envoyer
23 | Désolé, il semble qu\'aucune des applications ne puisse ouvrir ce type de fichier.
24 | Désolé, nous n\'avons pu trouver de scanner de code barre sur cet appareil.
25 | Pas encore implémenté
26 | Téléchargement en cours...
27 | Désolé, une erreur s\'est produite pendant le téléchargement du fichier.
28 | Vous pouvez trouver cette information sur le tableau de bord de SparkleShare lorsque vous choisissez d\'appairer un nouvel appareil.
29 | QR code incorrect
30 | Home
31 | Paramètres
32 | A propos de SparkleShare
33 | Compte
34 | Oublier le compte
35 | Afficher les fichiers cachés
36 | versioncode
37 | Saisissez le code d\'appairage
38 | Scanner le QR code
39 | C\'est votre dernier mot?
40 | Etes-vous certain de vouloir oublier le compte courant?
41 | Oublier
42 | Annuler
43 | Commencer par ajouter un projet:
44 | Tant pis
45 | Ajouter
46 | Copyright © 2011
47 | Kai Wolf, Hylke Bons et d\'autres.
48 | SparkleShare est un logiciel gratuit et open source. Vous êtes libres de l\'utiliser, le modifier et le diffuser sous les termes de la license GNU General Public License (version 3 ou plus).
49 | Ouvrir
50 | Télécharger
51 |
52 |
--------------------------------------------------------------------------------
/res/values-nl/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | SparkleShare
4 | 1.0
5 | Welkom bij SparkleShare
6 | Adres
7 | domein naam of IP adres
8 | Folder naam
9 | /home/user/repositorynaam.git
10 | Email adres
11 | Gebruikersnaam
12 | Wachtwoord
13 | Link code
14 | voeg toe
15 | Even geduld aub..
16 | Sorry, de host kon niet bereikt worden...
17 | Sluiten
18 | Voeg project toe
19 | Project aan het toevoegen..
20 | SparkleShare
21 | Ververs
22 | Upload
23 | Sorry, er is geen App geïnstalleerd die met dit bestandsformaat kan omgaan.
24 | Sorry, er kon geen geschikte barcode scanner gevonden worden op dit apparaat.
25 | Nog niet geïmplementeerd
26 | Aan het downloaden..
27 | Sorry, er is een fout opgetreden tijdens het downloaden.
28 | U vindt deze informatie op het SparkleShare Dashboard als u een nieuw apparaat wilt koppelen.
29 | Ongeldige QR code
30 | Home
31 | Instellingen
32 | Over SparkleShare
33 | Account
34 | Vergeet account
35 | Laat verborgen bestanden zien
36 | versie
37 | Vul link code in
38 | Scan QR code
39 | Weet je het zeker?
40 | Weet je zeker dat het huidige account vergeten moet worden?
41 | Vergeet
42 | Cancel
43 | Begin door een project toe te voegen:
44 | Maakt niet uit
45 | Voeg toe
46 | Copyright © 2011
47 | Kai Wolf, Hylke Bons en anderen.
48 | SparkleShare is gratis en Open Source Software. U bent vrij om het te gebruiken, te wijzigen en verspreiden onder de GNU General Public License versie 3 of later.
49 | Open
50 | Download
51 |
52 |
--------------------------------------------------------------------------------
/res/values-pl/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | SparkleShare
4 | 1.0
5 | Witaj w programie SparkleShare!
6 | Adres
7 | nazwa komputera lub aders IP
8 | Nazwa katalogu:
9 | /home/użytkownik/repozytorium.git
10 | Adres e-mail
11 | Nazwa użytkownika
12 | Hasło
13 | Kod odnośnika
14 | wyślij
15 | Proszę czekać
16 | Niestetu, podany komputer jest nieosiągalny
17 | Zamknij
18 | Dodaj projekt
19 | Dodawanie projektu
20 | SparkleShare
21 | Odśwież
22 | Wyślij
23 | Żaden z zainstalowanych programów nie potrafi obsłużyć plików tego typu.
24 | Nie znaleziono odpowiedniego czytnika kodów kreskowych.
25 | Funkcjonalność nie została jeszcze zaimplementowana
26 | Pobieranie
27 | Wystąpił błąd podczas pobierania tego pliku.
28 | Informacje te znajdują się w programie SparkleShare Dashboard po wybraniu opcji połączenia z nowym urządzeniem.
29 | Niepoprawny kod QR
30 | Home
31 | Ustawienia
32 | O programie SparkleShare
33 | Konto
34 | Zapomnij o koncie
35 | Wyświet
36 | wersja
37 | Podaj kod
38 | Wczytaj kod QR
39 | Na pewno?
40 | Zapomnieć o bieżącym koncie?
41 | Zapomnij
42 | Anuluj
43 | Zacznij poprzez dodanie projektu:
44 | Nieważne
45 | Dodaj
46 | Copyright © 2011
47 | Kai Wolf, Hylke Bons i inni.
48 | Program SparkleShare jest oprogramowaniem wolnym i open source, można go rozprowadzać dalej i/lub modyfikować na warunkach Powszechnej Licencji Publicznej GNU w wersji 3 lub późniejszej.
49 | Otwórz
50 | Pobierz
51 |
52 |
--------------------------------------------------------------------------------
/res/values-ru/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | SparkleShare
4 | 1.0
5 | Добро пожаловать в SparkleShare!
6 | Адрес
7 | Доменное имя или IP адрес
8 | Имя папки:
9 | /home/user/repositoryname.git
10 | Электронная почта
11 | Имя пользователя
12 | Пароль
13 | Текст ссылки
14 | Отправить
15 | Подождите пожалуйста...
16 | К сожалению, мы не смогли установить соединение...
17 | Закрыть
18 | Добавить проект
19 | Добавляю проект...
20 | SparkleShare
21 | Обновить
22 | Загрузить
23 | К сожалению, мы не знаем чем открыть этот файл.
24 | К сожалению, у Вас не установлена программа для чтения штрихкодов
25 | Еще не разработано
26 | Скачиваю...
27 | К сожалению, произошла ошибка при скачивании этого файла
28 | Вы найдете эту информацию в SparkleShare Dashboard на этапе добавления нового устройва.
29 | Штрихкод нераспознан
30 | Главная
31 | Настройки
32 | О SparkleShare
33 | Аккаунт
34 | Удалить аккаунт
35 | Показать невидимые файлы
36 | версия
37 | Ввести ссылку
38 | Считать QR штрихкод
39 | Вы уверены?
40 | Вы уверены что хотите удалть этот аккаунт?
41 | Удалить
42 | Отменить
43 | Чтобы начать, добавьте проект:
44 | Проехали
45 | Добавить
46 | Авторские права © 2011
47 | Кай Вульф, Хайкл Бонс и другие
48 | SparkShare является бесплатной и открытой программой. Вы можете её использовать, изменять и распространять совершенно бесплано, только если Вы соблюдаете правила GNU General Public лицензии версии 3 и выше.
49 | Открыть
50 | Скачать
51 |
52 |
--------------------------------------------------------------------------------
/res/values-sr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | SparkleShare
4 | 1.0
5 | Добродошли у SparkleShare
6 | Адреса
7 | домен или IP адреса
8 | Назив фолдера:
9 | /home/user/repositoryname.git
10 | Адреса е-поште
11 | Корисничко име
12 | Лозинка
13 | Код повезивања
14 | пошаљи
15 | Молимо сачекајте
16 | Нажалост, не можемо да се повежемо на дестинацију...
17 | Затвори
18 | Додај пројекат
19 | Додајем пројекат...
20 | SparkleShare
21 | Освежи
22 | Отпреми
23 | Нажалост, изгледа немате инсталирану апликацију која може да отвори овај тип датотеке.
24 | Нажалост, не могу да пронађем одговарајући баркод скенер на вашем уређају.
25 | Још увек није завршено
26 | Преузимање...
27 | Нажалост, дошло је до грешке при преузимању ове датотеке.
28 | Ово можете видети на SparkleShare Контролној табли када изаберете да повежете нови уређај
29 | Погрешан QR код
30 | Почетна
31 | Подешавања
32 | О SparkleShare
33 | Налог
34 | Заборави налог
35 | Прикажи скривене датотеке
36 | верзија
37 | Унесите код повезивања
38 | Скенирај QR код
39 | Да ли сте сигурни?
40 | Да ли сте сигурни да желите да заборавите тренутни налог?
41 | Заборави
42 | Одустани
43 | Почните тако што ћете додати пројекат:
44 | Нема везе
45 | Додај
46 | Copyright © 2011
47 | Kai Wolf, Hylke Bons и остали.
48 | SparkleShare је софтвер слободног и отвореног кода. Имате слободу да га корисите, мењате и редистрибуирате под условима ГНУ Опште Јавне Лиценце верзија 3 или каснија.
49 | Отвори
50 | Преузми
51 |
52 |
--------------------------------------------------------------------------------
/res/values-sv/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | SparkleShare
4 | 1.0
5 | Välkommen till SparkleShare!
6 | Adress
7 | Domännamn eller IP-adress
8 | Katalognamn:
9 | /home/användare/arkivnamn.git
10 | E-postadress
11 | Användarnamn
12 | Lösenord
13 | Länkkod
14 | skicka
15 | Var god vänta...
16 | Tyvärr, servern kunde inte nås...
17 | Stäng
18 | Lägg till projekt
19 | Lägger till projekt...
20 | SparkleShare
21 | Uppdatera
22 | Ladda upp
23 | Tyvärr, det verkar inte finnas någon app installerad som kan hantera den här filtypen.
24 | Tyvärr, någon passande streckkodsskanner kunde inte hittas på den här enheten.
25 | Inte infört ännu
26 | Laddar ned...
27 | Tyvärr, ett fel inträffade vid nedladdning av den här filen.
28 | Du kan hitta den här informationen på SparkleShare-panelen när du länkar en ny enhet.
29 | Ogiltig streckkod
30 | Hem
31 | Inställningar
32 | Om SparkleShare
33 | Konto
34 | Glöm konto
35 | Visa dolda filer
36 | version
37 | Ange kod för länk
38 | Skanna streckkod
39 | Är du säker?
40 | Är du säker på att du vill glömma det nuvarande kontot?
41 | Glöm
42 | Avbryt
43 | Kom igång genom att lägga till ett projekt:
44 | Strung samma
45 | Lägg till
46 | Copyright © 2011
47 | Kai Wolf, Hylke Bons med flera.
48 | SparkleShare är fri och öppen programvara. Du är fri att använda, ändra och sprida den i enlighet med GNU General Public License version 3 eller senare.
49 | Öppna
50 | Ladda ned
51 |
52 |
--------------------------------------------------------------------------------
/res/values-uk/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | SparkleShare
4 | 1.0
5 | Ласкаво просимо в SparkleShare!
6 | Адрес
7 | Домен або IP адреса
8 | Ім\'я теки:
9 | /home/user/repositoryname.git
10 | Електронна пошта
11 | Ім\'я користувача
12 | Пароль
13 | Текст посилання
14 | Відправити
15 | Зачекайте будь-ласка...
16 | На жаль, ми не змогли встановити з\'єднання...
17 | Закрити
18 | Добавити проект
19 | Додаю проект...
20 | SparkleShare
21 | Оновити
22 | Загрузити
23 | На жаль, ми не знаємо чім відкрити цей файл.
24 | На жаль, у Вас не встановлена програма для читання штрих-кодів
25 | Ще не розроблено
26 | Завантажую...
27 | На жаль, трапилась помилка при завантаженні цього файлу
28 | Ви знайдете цю інформацію в SparkleShare Dashboard на етапі додавання нового пристрою.
29 | Штрих-код нерозпізнаний
30 | Головна
31 | Налаштування
32 | Про SparkleShare
33 | Аккаунт
34 | Видалити аккаунт
35 | Показати приховані файли
36 | версія
37 | Ввести посилання
38 | Зчитати QR штрих-код
39 | Ви впевнені?
40 | Ви впевнені що бажаєте видалити цей аккаунт?
41 | Видалити
42 | Відмінити
43 | Щоб почати, додайте проект:
44 | Відхилити
45 | Добавити
46 | Авторські права © 2011
47 | Кай Вульф, Хайкл Бонс та інші
48 | SparkShare це безкоштовна та відкрита програма. Ви можете її використовувати, змінювати та розповсюджувати безкоштовно, тільки якщо Ви дотримуєтесь правил GNU General Public ліцензії версії 3 та вище.
49 | Відкрити
50 | Завантажити
51 |
52 |
--------------------------------------------------------------------------------
/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
23 |
24 |
29 |
30 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/res/values-v13/styles.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 | #000000
5 | #6E6E6E
6 | #BDBDBD
7 | #F57900
8 | #00000000
9 | #80FFFFFF
10 | #80000000
11 |
12 | #FFFFFF
13 | #000000
14 |
15 | #FAB220
16 | #F17D00
17 |
18 | #1B1B1B
19 | #323232
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 48dp
5 | 48dp
6 | 56dp
7 |
8 |
9 | 14sp
10 | 18sp
11 | 20sp
12 |
13 |
--------------------------------------------------------------------------------
/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | SparkleShare
4 | 1.0
5 | Welcome to SparkleShare!
6 | Address
7 | domain name or IP address
8 | Folder name:
9 | /home/user/repositoryname.git
10 | Email adress
11 | Username
12 | Password
13 | Link code
14 | submit
15 | Please wait...
16 | Sorry, but we weren\'t able to reach the host...
17 | Close
18 | Add project
19 | Adding project...
20 | SparkleShare
21 | Refresh
22 | Upload
23 | Sorry, but it seems no installed App can handle this type of file.
24 | Sorry, but we couldn\'t find a suitable barcode scanner on this device.
25 | Not implemented yet
26 | Downloading...
27 | Sorry, an error occurred while downloading this file.
28 | You can find this information on the SparkleShare Dashboard when you choose to link a new device.
29 | Invalid QR code
30 |
31 | Home
32 | Settings
33 | About SparkleShare
34 | Account
35 | Forget account
36 | Show hidden files
37 | Security
38 | Accept all SSL certificates
39 | version
40 | Enter link code
41 | Scan QR code
42 | Are you sure?
43 | Are you sure you want to forget about the current account?
44 | Forget
45 | Cancel
46 | Get started by adding a project:
47 | Never mind
48 | Add
49 | Copyright © 2011
50 | Kai Wolf, Hylke Bons and others.
51 | SparkleShare is Free and Open Source Software. You are free to use, modify, and redistribute it under the GNU General Public License version 3 or later.
52 | Open
53 | Download
54 | Download again
55 | Delete from Phone
56 |
57 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
21 |
22 |
27 |
28 |
31 |
32 |
46 |
47 |
50 |
51 |
52 |
53 |
54 |
55 |
62 |
63 |
74 |
75 |
85 |
86 |
93 |
94 |
--------------------------------------------------------------------------------
/res/xml/settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
10 |
11 |
13 |
16 |
17 |
18 |
23 |
24 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/AboutActivity.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android;
2 |
3 | import org.sparkleshare.android.actionbarcompat.ActionBarActivity;
4 |
5 | import android.os.Bundle;
6 |
7 | /**
8 | * Provides basic information on how to use SparkleShare and this android app
9 | * @author kai
10 | *
11 | */
12 | public class AboutActivity extends ActionBarActivity {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.about_fragment);
18 | setTitle(R.string.info);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/BrowsingActivity.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android;
2 |
3 | import org.sparkleshare.android.actionbarcompat.ActionBarActivity;
4 | import org.sparkleshare.android.actionbarcompat.ActionBarHelper;
5 |
6 | import android.content.ContextWrapper;
7 | import android.content.Intent;
8 | import android.content.SharedPreferences;
9 | import android.content.res.Configuration;
10 | import android.os.Bundle;
11 | import android.view.Menu;
12 | import android.view.MenuInflater;
13 | import android.view.MenuItem;
14 | /**
15 | * Activity for browsing content of a SparkleShare-Dashboard instance.
16 | * @author kai
17 | *
18 | */
19 | public class BrowsingActivity extends ActionBarActivity {
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.browsing_fragment);
25 | }
26 |
27 | public void setRefreshingState(boolean refreshing) {
28 | getActionBarHelper().setRefreshActionItemState(refreshing);
29 | }
30 |
31 | @Override
32 | public void onConfigurationChanged(Configuration newConfig) {
33 | super.onConfigurationChanged(newConfig);
34 | }
35 |
36 | @Override
37 | public boolean onCreateOptionsMenu(Menu menu) {
38 | MenuInflater menuInflater = getMenuInflater();
39 | menuInflater.inflate(R.menu.option, menu);
40 | return super.onCreateOptionsMenu(menu);
41 | }
42 |
43 | @Override
44 | public boolean onOptionsItemSelected(MenuItem item) {
45 | switch (item.getItemId()) {
46 | case android.R.id.home:
47 | SharedPreferences prefs = SettingsActivity.getSettings((ContextWrapper) this);
48 | String serverUrl = prefs.getString("serverUrl", "");
49 | Intent overview = new Intent(this, BrowsingActivity.class);
50 | overview.putExtra("url", serverUrl + "/api/getFolderList");
51 | startActivity(overview);
52 | break;
53 | case R.id.opt_settings:
54 | Intent settings = new Intent(this, SettingsActivity.class);
55 | startActivity(settings);
56 | break;
57 | case R.id.opt_about:
58 | Intent about = new Intent(this, AboutActivity.class);
59 | startActivity(about);
60 | break;
61 | }
62 | return super.onOptionsItemSelected(item);
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/BrowsingAdapter.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android;
2 |
3 | import java.io.File;
4 | import java.util.ArrayList;
5 | import java.util.Collections;
6 |
7 | import org.sparkleshare.android.ui.ListEntryItem;
8 | import org.sparkleshare.android.utils.ExternalDirectory;
9 | import org.sparkleshare.android.utils.MimetypeChecker;
10 |
11 | import android.content.Context;
12 | import android.content.ContextWrapper;
13 | import android.content.SharedPreferences;
14 | import android.view.LayoutInflater;
15 | import android.view.View;
16 | import android.view.ViewGroup;
17 | import android.widget.BaseAdapter;
18 | import android.widget.ImageView;
19 | import android.widget.TextView;
20 |
21 | public class BrowsingAdapter extends BaseAdapter {
22 |
23 | private ArrayList items;
24 | private Context context;
25 | private Boolean hideFilesFolders;
26 |
27 | public BrowsingAdapter(Context context) {
28 | this.context = context;
29 | items = new ArrayList();
30 | SharedPreferences prefs = SettingsActivity.getSettings((ContextWrapper) context);
31 | hideFilesFolders = prefs.getBoolean("hideFilesFolders", false);
32 | }
33 |
34 | @Override
35 | public int getCount() {
36 | return items.size();
37 | }
38 |
39 | public void addEntry(ListEntryItem entry) {
40 | if (hideFilesFolders && entry.getTitle().startsWith(".")) {
41 | return;
42 | } else {
43 |
44 | entry.setFilePath(ExternalDirectory.getDownloadTargetPath(entry));
45 |
46 | if(entry.isDirectory()){
47 | ExternalDirectory.createDirectory(entry.getFilePath());
48 | }
49 |
50 | items.add(entry);
51 | Collections.sort(items);
52 |
53 | notifyDataSetChanged();
54 | }
55 | }
56 |
57 | @Override
58 | public Object getItem(int position) {
59 | return items.get(position);
60 | }
61 |
62 | public void setItem(ListEntryItem item, int listviewPosition) {
63 | items.set(listviewPosition, item);
64 | notifyDataSetChanged();
65 | }
66 |
67 | @Override
68 | public long getItemId(int position) {
69 | return position;
70 | }
71 |
72 | @Override
73 | public View getView(int position, View convertView, ViewGroup parent) {
74 | View view = convertView;
75 | Viewholder viewHolder;
76 | if (convertView == null) {
77 | view = LayoutInflater.from(context).inflate(R.layout.list_item_entry, null);
78 | TextView title = (TextView) view.findViewById(R.id.list_item_title);
79 | TextView subtitle = (TextView) view.findViewById(R.id.list_item_subtitle);
80 | ImageView icon = (ImageView) view.findViewById(R.id.list_item_icon);
81 | viewHolder = new Viewholder(title, subtitle, icon);
82 | view.setTag(viewHolder);
83 | } else {
84 | viewHolder = (Viewholder) convertView.getTag();
85 | }
86 | ListEntryItem item = items.get(position);
87 | viewHolder.title.setText(item.getTitle());
88 | File file = new File(item.getFilePath());
89 | if (file.exists()) {
90 | viewHolder.subtitle.setText("\u2714 " + item.getSubtitle());
91 | } else {
92 | viewHolder.subtitle.setText(item.getSubtitle());
93 | }
94 |
95 | if (item.getMimetype() != null) {
96 | viewHolder.icon.setImageResource(MimetypeChecker.getResIdforMimetype(item.getMimetype()));
97 | }
98 | return view;
99 | }
100 |
101 |
102 | private class Viewholder {
103 | TextView title, subtitle;
104 | ImageView icon;
105 |
106 | public Viewholder(TextView title, TextView subtitle, ImageView icon) {
107 | super();
108 | this.icon = icon;
109 | this.title = title;
110 | this.subtitle = subtitle;
111 | }
112 | }
113 |
114 | }
115 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/FileDetailsActivity.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android;
2 |
3 | import java.io.File;
4 |
5 | import org.sparkleshare.android.actionbarcompat.ActionBarActivity;
6 | import org.sparkleshare.android.ui.FileDetailsFragment;
7 | import org.sparkleshare.android.ui.ListEntryItem;
8 |
9 | import android.content.ActivityNotFoundException;
10 | import android.content.Intent;
11 | import android.graphics.Bitmap;
12 | import android.graphics.BitmapFactory;
13 | import android.net.Uri;
14 | import android.os.Bundle;
15 | import android.view.View;
16 | import android.webkit.MimeTypeMap;
17 | import android.widget.Button;
18 | import android.widget.ImageView;
19 | import android.widget.Toast;
20 |
21 | public class FileDetailsActivity extends ActionBarActivity {
22 |
23 | private Button btnOpenDownloadFile, btnRedownloadFile, btnDeleteFile;
24 | private ImageView ivFileIcon;
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.filedownload_fragment);
30 |
31 | btnOpenDownloadFile = (Button) findViewById(R.id.btn_toggle_open_download_file);
32 | btnRedownloadFile = (Button) findViewById(R.id.btn_redownload_file);
33 | btnDeleteFile = (Button) findViewById(R.id.btn_delete_file);
34 |
35 | ivFileIcon = (ImageView) findViewById(R.id.iv_file_icon);
36 |
37 | FileDetailsFragment fdFragment = (FileDetailsFragment) getSupportFragmentManager().findFragmentById(R.id.filedetails_fragment);
38 | ListEntryItem current = fdFragment.getCurrentListItem();
39 | File file = new File(current.getFilePath());
40 | String extension = MimeTypeMap.getFileExtensionFromUrl(current.getTitle());
41 |
42 | if (file.exists() && file.length() < 1000000) {
43 | Bitmap fileBitmap;
44 | try {
45 | BitmapFactory.Options options = new BitmapFactory.Options();
46 | options.inSampleSize = 4;
47 |
48 | fileBitmap = BitmapFactory.decodeFile(file.getAbsolutePath(), options);
49 | } catch (Exception e) {
50 | fileBitmap = null;
51 | }
52 |
53 | if (fileBitmap != null) {
54 | ivFileIcon.setImageBitmap(fileBitmap);
55 | }
56 | }
57 | }
58 |
59 | public void buttonClick(View target) {
60 | Button btn = (Button) target;
61 | String text = btn.getText().toString();
62 | FileDetailsFragment fdFragment = (FileDetailsFragment) getSupportFragmentManager().findFragmentById(R.id.filedetails_fragment);
63 | ListEntryItem current = fdFragment.getCurrentListItem();
64 | File file = new File(current.getFilePath());
65 | if (text.equals(getString(R.string.open_file))) {
66 | Intent open = new Intent(Intent.ACTION_VIEW, Uri.parse(file.getAbsolutePath()));
67 | open.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
68 | open.setAction(android.content.Intent.ACTION_VIEW);
69 | open.setDataAndType((Uri.fromFile(file)), current.getMimetype());
70 | try {
71 | startActivity(open);
72 | } catch (ActivityNotFoundException e) {
73 | Toast.makeText(this, getString(R.string.activity_not_found), Toast.LENGTH_SHORT).show();
74 | }
75 | } else if (text.equals(getString(R.string.delete_file))) {
76 | fdFragment.deleteFile();
77 | } else {
78 | /* text.equals(R.string.download_file) */
79 | /*
80 | * btn.setText(getString(R.string.downloading)); btn.setEnabled(false);
81 | */
82 |
83 | btnOpenDownloadFile.setText(getString(R.string.downloading));
84 | // btnRedownloadFile.setText(getString(R.string.downloading));
85 |
86 | btnRedownloadFile.setVisibility(View.INVISIBLE);
87 | btnDeleteFile.setVisibility(View.INVISIBLE);
88 |
89 | btnOpenDownloadFile.setEnabled(false);
90 | /*
91 | * btnRedownloadFile.setEnabled(false); btnDeleteFile.setEnabled(false);
92 | */
93 |
94 | fdFragment.startAsyncFileDownload();
95 | }
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android;
2 |
3 | import android.app.Activity;
4 | import android.app.AlertDialog;
5 | import android.content.Context;
6 | import android.content.ContextWrapper;
7 | import android.content.DialogInterface;
8 | import android.content.Intent;
9 | import android.content.SharedPreferences;
10 | import android.content.SharedPreferences.Editor;
11 | import android.os.Bundle;
12 | import android.preference.CheckBoxPreference;
13 | import android.preference.Preference;
14 | import android.preference.Preference.OnPreferenceChangeListener;
15 | import android.preference.Preference.OnPreferenceClickListener;
16 | import android.preference.PreferenceActivity;
17 |
18 | public class SettingsActivity extends PreferenceActivity {
19 |
20 | private Preference releaseAccount;
21 | private CheckBoxPreference hideFilesFolders;
22 | private Context context;
23 |
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | context = this;
28 | addPreferencesFromResource(R.xml.settings);
29 |
30 | hideFilesFolders = (CheckBoxPreference) findPreference(getString(R.string.settings_hide_files_folders));
31 | hideFilesFolders.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
32 |
33 | @Override
34 | public boolean onPreferenceChange(Preference preference, Object newValue) {
35 | SharedPreferences prefs = getSettings((ContextWrapper) context);
36 | Editor editor = prefs.edit();
37 | if (hideFilesFolders.isChecked()) {
38 | editor.putBoolean("hideFilesFolders", true);
39 | } else {
40 | editor.putBoolean("hideFilesFolders", false);
41 | }
42 | return editor.commit();
43 | }
44 | });
45 | releaseAccount = (Preference) findPreference(getString(R.string.settings_release_account));
46 | releaseAccount.setOnPreferenceClickListener(new OnPreferenceClickListener() {
47 |
48 | @Override
49 | public boolean onPreferenceClick(Preference preference) {
50 | AlertDialog.Builder builder = new AlertDialog.Builder(context);
51 | builder.setMessage(getString(R.string.release_account_hint))
52 | .setTitle(getString(R.string.are_you_sure))
53 | .setCancelable(false)
54 | .setPositiveButton(getString(R.string.release), new DialogInterface.OnClickListener() {
55 |
56 | @Override
57 | public void onClick(DialogInterface dialog, int which) {
58 | SharedPreferences prefs = SettingsActivity.getSettings((ContextWrapper) context);
59 | Editor editor = prefs.edit();
60 | editor.remove("ident");
61 | editor.remove("authCode");
62 | editor.commit();
63 | Intent backToSetup = new Intent(context, SetupActivity.class);
64 | backToSetup.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
65 | startActivity(backToSetup);
66 | ((Activity) context).finish();
67 | }
68 | }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
69 |
70 | @Override
71 | public void onClick(DialogInterface dialog, int which) {
72 | dialog.dismiss();
73 | }
74 | });
75 | AlertDialog alert = builder.create();
76 | alert.show();
77 | return true;
78 | }
79 | });
80 |
81 | }
82 |
83 | public static final SharedPreferences getSettings(final ContextWrapper context) {
84 | String name = context.getPackageName() + "_preferences";
85 | return context.getSharedPreferences(name, MODE_PRIVATE);
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/SetupActivity.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android;
2 |
3 | import org.sparkleshare.android.actionbarcompat.ActionBarActivity;
4 | import org.sparkleshare.android.ui.SetupFragment;
5 |
6 | import android.app.Activity;
7 | import android.content.Context;
8 | import android.os.Bundle;
9 | import android.view.View;
10 | import android.widget.Button;
11 |
12 | /**
13 | * This {@link Activity} handles a new setup for a SparkleShare instance.
14 | * @author kai
15 | *
16 | */
17 | public class SetupActivity extends ActionBarActivity {
18 |
19 | private Context context;
20 |
21 | @Override
22 | public void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | context = this;
25 |
26 | setContentView(R.layout.setup_fragment);
27 | setTitle(getString(R.string.add_project));
28 |
29 | if (getIntent().getStringExtra("url") != null && getIntent().getStringExtra("linkcode") != null) {
30 | /* processing scanned QR code */
31 | String url = getIntent().getStringExtra("url");
32 | String linkcode = getIntent().getStringExtra("linkcode");
33 | SetupFragment setupFragment = (SetupFragment) getSupportFragmentManager().findFragmentById(R.id.setup_fragment);
34 | setupFragment.edtServer.setText(url);
35 | setupFragment.edtLinkcode.setText(linkcode);
36 | setupFragment.startLogin(url);
37 | }
38 |
39 | }
40 |
41 | /**
42 | * Will be called when user clicks a button inside this {@link Activity }
43 | * @param target clicked {@link Button}
44 | */
45 | public void buttonClick(View target) {
46 | switch (target.getId()) {
47 | case R.id.btn_add:
48 | SetupFragment setupFragment = (SetupFragment) getSupportFragmentManager().findFragmentById(R.id.setup_fragment);
49 | String url = setupFragment.edtServer.getEditableText().toString();
50 | setupFragment.startLogin(url);
51 | break;
52 | case R.id.btn_never_mind:
53 | ((Activity) context).finish();
54 | break;
55 | }
56 | }
57 |
58 | }
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/WelcomeActivity.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.pm.PackageManager;
7 | import android.os.Bundle;
8 | import android.support.v4.app.FragmentActivity;
9 | import android.view.View;
10 | import android.widget.Toast;
11 | import android.view.KeyEvent;
12 |
13 | import com.google.zxing.integration.android.IntentIntegrator;
14 | import com.google.zxing.integration.android.IntentResult;
15 |
16 | /**
17 | * Splash {@link Activity} which will be shown to user when no previously saved credentials could be found.
18 | *
19 | * @author kai
20 | *
21 | */
22 | public class WelcomeActivity extends FragmentActivity {
23 |
24 | private Context context;
25 |
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | context = this;
31 | setContentView(R.layout.welcome_fragment);
32 | }
33 |
34 | /**
35 | * Will be called when user clicks a button inside this {@link Activity}
36 | *
37 | * @param target
38 | * Button which was clicked by user
39 | */
40 | public void buttonClick(View target) {
41 | switch (target.getId()) {
42 | case R.id.btn_insert_linkcode:
43 | Intent setup = new Intent(context, SetupActivity.class);
44 | startActivity(setup);
45 | break;
46 | case R.id.btn_scan_qrcode:
47 | PackageManager pm = getPackageManager();
48 | if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
49 | IntentIntegrator integrater = new IntentIntegrator(this);
50 | integrater.initiateScan();
51 | }
52 | break;
53 | }
54 | }
55 |
56 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
57 | IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
58 | if (scanResult != null && scanResult.getContents() != null) {
59 | String content = scanResult.getContents().toLowerCase();
60 | if (!content.startsWith("sshare:") || !content.contains("#")) {
61 | Toast.makeText(this, getString(R.string.invalid_qr_code), Toast.LENGTH_SHORT).show();
62 | } else {
63 | String url = content.split("sshare:")[1].split("#")[0];
64 | String linkcode = content.split("#")[1];
65 | Intent setup = new Intent(this, SetupActivity.class);
66 | setup.putExtra("url", url);
67 | setup.putExtra("linkcode", linkcode);
68 | startActivity(setup);
69 | }
70 |
71 | }
72 | }
73 |
74 | @Override
75 | public boolean onKeyDown (int keyCode, KeyEvent event)
76 | {
77 | switch(keyCode)
78 | {
79 | case KeyEvent.KEYCODE_MENU:
80 | Intent settings = new Intent(this, SettingsActivity.class);
81 | startActivity(settings);
82 | return true;
83 | }
84 | return false;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/actionbarcompat/ActionBarActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.sparkleshare.android.actionbarcompat;
18 |
19 | import android.app.Activity;
20 | import android.os.Bundle;
21 | import android.support.v4.app.FragmentActivity;
22 | import android.view.Menu;
23 | import android.view.MenuInflater;
24 |
25 | /**
26 | * A base activity that defers common functionality across app activities to an {@link
27 | * ActionBarHelper}.
28 | *
29 | * NOTE: dynamically marking menu items as invisible/visible is not currently supported.
30 | *
31 | * NOTE: this may used with the Android Compatibility Package by extending
32 | * android.support.v4.app.FragmentActivity instead of {@link Activity}.
33 | */
34 | public abstract class ActionBarActivity extends FragmentActivity {
35 | final ActionBarHelper mActionBarHelper = ActionBarHelper.createInstance(this);
36 |
37 | /**
38 | * Returns the {@link ActionBarHelper} for this activity.
39 | */
40 | protected ActionBarHelper getActionBarHelper() {
41 | return mActionBarHelper;
42 | }
43 |
44 | /**{@inheritDoc}*/
45 | @Override
46 | public MenuInflater getMenuInflater() {
47 | return mActionBarHelper.getMenuInflater(super.getMenuInflater());
48 | }
49 |
50 | /**{@inheritDoc}*/
51 | @Override
52 | protected void onCreate(Bundle savedInstanceState) {
53 | super.onCreate(savedInstanceState);
54 | mActionBarHelper.onCreate(savedInstanceState);
55 | }
56 |
57 | /**{@inheritDoc}*/
58 | @Override
59 | protected void onPostCreate(Bundle savedInstanceState) {
60 | super.onPostCreate(savedInstanceState);
61 | mActionBarHelper.onPostCreate(savedInstanceState);
62 | }
63 |
64 | /**
65 | * Base action bar-aware implementation for
66 | * {@link Activity#onCreateOptionsMenu(android.view.Menu)}.
67 | *
68 | * Note: marking menu items as invisible/visible is not currently supported.
69 | */
70 | @Override
71 | public boolean onCreateOptionsMenu(Menu menu) {
72 | boolean retValue = false;
73 | retValue |= mActionBarHelper.onCreateOptionsMenu(menu);
74 | retValue |= super.onCreateOptionsMenu(menu);
75 | return retValue;
76 | }
77 |
78 | /**{@inheritDoc}*/
79 | @Override
80 | protected void onTitleChanged(CharSequence title, int color) {
81 | mActionBarHelper.onTitleChanged(title, color);
82 | super.onTitleChanged(title, color);
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/actionbarcompat/ActionBarHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.sparkleshare.android.actionbarcompat;
18 |
19 | import android.app.Activity;
20 | import android.os.Build;
21 | import android.os.Bundle;
22 | import android.view.Menu;
23 | import android.view.MenuInflater;
24 |
25 | /**
26 | * An abstract class that handles some common action bar-related functionality in the app. This
27 | * class provides functionality useful for both phones and tablets, and does not require any Android
28 | * 3.0-specific features, although it uses them if available.
29 | *
30 | * Two implementations of this class are {@link ActionBarHelperBase} for a pre-Honeycomb version of
31 | * the action bar, and {@link ActionBarHelperHoneycomb}, which uses the built-in ActionBar features
32 | * in Android 3.0 and later.
33 | */
34 | public abstract class ActionBarHelper {
35 | protected Activity mActivity;
36 |
37 | /**
38 | * Factory method for creating {@link ActionBarHelper} objects for a
39 | * given activity. Depending on which device the app is running, either a basic helper or
40 | * Honeycomb-specific helper will be returned.
41 | */
42 | public static ActionBarHelper createInstance(Activity activity) {
43 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
44 | return new ActionBarHelperICS(activity);
45 | } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
46 | return new ActionBarHelperHoneycomb(activity);
47 | } else {
48 | return new ActionBarHelperBase(activity);
49 | }
50 | }
51 |
52 | protected ActionBarHelper(Activity activity) {
53 | mActivity = activity;
54 | }
55 |
56 | /**
57 | * Action bar helper code to be run in {@link Activity#onCreate(android.os.Bundle)}.
58 | */
59 | public void onCreate(Bundle savedInstanceState) {
60 | }
61 |
62 | /**
63 | * Action bar helper code to be run in {@link Activity#onPostCreate(android.os.Bundle)}.
64 | */
65 | public void onPostCreate(Bundle savedInstanceState) {
66 | }
67 |
68 | /**
69 | * Action bar helper code to be run in {@link Activity#onCreateOptionsMenu(android.view.Menu)}.
70 | *
71 | * NOTE: Setting the visibility of menu items in menu is not currently supported.
72 | */
73 | public boolean onCreateOptionsMenu(Menu menu) {
74 | return true;
75 | }
76 |
77 | /**
78 | * Action bar helper code to be run in {@link Activity#onTitleChanged(CharSequence, int)}.
79 | */
80 | protected void onTitleChanged(CharSequence title, int color) {
81 | }
82 |
83 | /**
84 | * Sets the indeterminate loading state of the item with ID {@link R.id.menu_refresh}.
85 | * (where the item ID was menu_refresh).
86 | */
87 | public abstract void setRefreshActionItemState(boolean refreshing);
88 |
89 | /**
90 | * Returns a {@link MenuInflater} for use when inflating menus. The implementation of this
91 | * method in {@link ActionBarHelperBase} returns a wrapped menu inflater that can read
92 | * action bar metadata from a menu resource pre-Honeycomb.
93 | */
94 | public MenuInflater getMenuInflater(MenuInflater superMenuInflater) {
95 | return superMenuInflater;
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/actionbarcompat/ActionBarHelperBase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.sparkleshare.android.actionbarcompat;
18 |
19 | import org.sparkleshare.android.R;
20 | import org.sparkleshare.android.WelcomeActivity;
21 | import org.xmlpull.v1.XmlPullParser;
22 | import org.xmlpull.v1.XmlPullParserException;
23 |
24 | import android.app.Activity;
25 | import android.content.Context;
26 | import android.content.Intent;
27 | import android.content.res.XmlResourceParser;
28 | import android.os.Bundle;
29 | import android.view.InflateException;
30 | import android.view.Menu;
31 | import android.view.MenuInflater;
32 | import android.view.MenuItem;
33 | import android.view.View;
34 | import android.view.ViewGroup;
35 | import android.view.Window;
36 | import android.widget.ImageButton;
37 | import android.widget.ImageView;
38 | import android.widget.LinearLayout;
39 | import android.widget.ProgressBar;
40 | import android.widget.TextView;
41 |
42 | import java.io.IOException;
43 | import java.util.HashSet;
44 | import java.util.Set;
45 |
46 | /**
47 | * A class that implements the action bar pattern for pre-Honeycomb devices.
48 | */
49 | public class ActionBarHelperBase extends ActionBarHelper {
50 | private static final String MENU_RES_NAMESPACE = "http://schemas.android.com/apk/res/android";
51 | private static final String MENU_ATTR_ID = "id";
52 | private static final String MENU_ATTR_SHOW_AS_ACTION = "showAsAction";
53 |
54 | protected Set mActionItemIds = new HashSet();
55 |
56 | protected ActionBarHelperBase(Activity activity) {
57 | super(activity);
58 | }
59 |
60 | /**{@inheritDoc}*/
61 | @Override
62 | public void onCreate(Bundle savedInstanceState) {
63 | mActivity.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
64 | }
65 |
66 | /**{@inheritDoc}*/
67 | @Override
68 | public void onPostCreate(Bundle savedInstanceState) {
69 | mActivity.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
70 | R.layout.actionbar_compat);
71 | setupActionBar();
72 |
73 | SimpleMenu menu = new SimpleMenu(mActivity);
74 | mActivity.onCreatePanelMenu(Window.FEATURE_OPTIONS_PANEL, menu);
75 | mActivity.onPrepareOptionsMenu(menu);
76 | for (int i = 0; i < menu.size(); i++) {
77 | MenuItem item = menu.getItem(i);
78 | if (mActionItemIds.contains(item.getItemId())) {
79 | addActionItemCompatFromMenuItem(item);
80 | }
81 | }
82 | }
83 |
84 | /**
85 | * Sets up the compatibility action bar with the given title.
86 | */
87 | private void setupActionBar() {
88 | final ViewGroup actionBarCompat = getActionBarCompat();
89 | if (actionBarCompat == null) {
90 | return;
91 | }
92 |
93 | LinearLayout.LayoutParams springLayoutParams = new LinearLayout.LayoutParams(
94 | 0, ViewGroup.LayoutParams.FILL_PARENT);
95 | springLayoutParams.weight = 1;
96 |
97 | // Add Home button
98 | SimpleMenu tempMenu = new SimpleMenu(mActivity);
99 | SimpleMenuItem homeItem = new SimpleMenuItem(
100 | tempMenu, android.R.id.home, 0, mActivity.getString(R.string.app_name));
101 | homeItem.setIcon(R.drawable.icon);
102 | addActionItemCompatFromMenuItem(homeItem);
103 |
104 | // Add title text
105 | TextView titleText = new TextView(mActivity, null, R.attr.actionbarCompatTitleStyle);
106 | titleText.setLayoutParams(springLayoutParams);
107 | titleText.setText(mActivity.getTitle());
108 | actionBarCompat.addView(titleText);
109 | }
110 |
111 | /**{@inheritDoc}*/
112 | @Override
113 | public void setRefreshActionItemState(boolean refreshing) {
114 | View refreshButton = mActivity.findViewById(R.id.actionbar_compat_item_refresh);
115 | View refreshIndicator = mActivity.findViewById(
116 | R.id.actionbar_compat_item_refresh_progress);
117 |
118 | if (refreshButton != null) {
119 | refreshButton.setVisibility(refreshing ? View.GONE : View.VISIBLE);
120 | }
121 | if (refreshIndicator != null) {
122 | refreshIndicator.setVisibility(refreshing ? View.VISIBLE : View.GONE);
123 | }
124 | }
125 |
126 | /**
127 | * Action bar helper code to be run in {@link Activity#onCreateOptionsMenu(android.view.Menu)}.
128 | *
129 | * NOTE: This code will mark on-screen menu items as invisible.
130 | */
131 | @Override
132 | public boolean onCreateOptionsMenu(Menu menu) {
133 | // Hides on-screen action items from the options menu.
134 | for (Integer id : mActionItemIds) {
135 | menu.findItem(id).setVisible(false);
136 | }
137 | return true;
138 | }
139 |
140 | /**{@inheritDoc}*/
141 | @Override
142 | protected void onTitleChanged(CharSequence title, int color) {
143 | TextView titleView = (TextView) mActivity.findViewById(R.id.actionbar_compat_title);
144 | if (titleView != null) {
145 | titleView.setText(title);
146 | }
147 | }
148 |
149 | /**
150 | * Returns a {@link android.view.MenuInflater} that can read action bar metadata on
151 | * pre-Honeycomb devices.
152 | */
153 | public MenuInflater getMenuInflater(MenuInflater superMenuInflater) {
154 | return new WrappedMenuInflater(mActivity, superMenuInflater);
155 | }
156 |
157 | /**
158 | * Returns the {@link android.view.ViewGroup} for the action bar on phones (compatibility action
159 | * bar). Can return null, and will return null on Honeycomb.
160 | */
161 | private ViewGroup getActionBarCompat() {
162 | return (ViewGroup) mActivity.findViewById(R.id.actionbar_compat);
163 | }
164 |
165 | /**
166 | * Adds an action button to the compatibility action bar, using menu information from a {@link
167 | * android.view.MenuItem}. If the menu item ID is menu_refresh
, the menu item's
168 | * state can be changed to show a loading spinner using
169 | * {@link com.example.android.actionbarcompat.ActionBarHelperBase#setRefreshActionItemState(boolean)}.
170 | */
171 | private View addActionItemCompatFromMenuItem(final MenuItem item) {
172 | final int itemId = item.getItemId();
173 |
174 | final ViewGroup actionBar = getActionBarCompat();
175 | if (actionBar == null) {
176 | return null;
177 | }
178 |
179 | // Create the button
180 | ImageButton actionButton = new ImageButton(mActivity, null,
181 | itemId == android.R.id.home
182 | ? R.attr.actionbarCompatItemHomeStyle
183 | : R.attr.actionbarCompatItemStyle);
184 | actionButton.setLayoutParams(new ViewGroup.LayoutParams(
185 | (int) mActivity.getResources().getDimension(
186 | itemId == android.R.id.home
187 | ? R.dimen.actionbar_compat_button_home_width
188 | : R.dimen.actionbar_compat_button_width),
189 | ViewGroup.LayoutParams.FILL_PARENT));
190 | if (itemId == R.id.menu_refresh) {
191 | actionButton.setId(R.id.actionbar_compat_item_refresh);
192 | }
193 | actionButton.setImageDrawable(item.getIcon());
194 | actionButton.setScaleType(ImageView.ScaleType.CENTER);
195 | actionButton.setContentDescription(item.getTitle());
196 | actionButton.setOnClickListener(new View.OnClickListener() {
197 | public void onClick(View view) {
198 | mActivity.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, item);
199 | }
200 | });
201 |
202 | actionBar.addView(actionButton);
203 |
204 | if (item.getItemId() == R.id.menu_refresh) {
205 | // Refresh buttons should be stateful, and allow for indeterminate progress indicators,
206 | // so add those.
207 | ProgressBar indicator = new ProgressBar(mActivity, null,
208 | R.attr.actionbarCompatProgressIndicatorStyle);
209 |
210 | final int buttonWidth = mActivity.getResources().getDimensionPixelSize(
211 | R.dimen.actionbar_compat_button_width);
212 | final int buttonHeight = mActivity.getResources().getDimensionPixelSize(
213 | R.dimen.actionbar_compat_height);
214 | final int progressIndicatorWidth = buttonWidth / 2;
215 |
216 | LinearLayout.LayoutParams indicatorLayoutParams = new LinearLayout.LayoutParams(
217 | progressIndicatorWidth, progressIndicatorWidth);
218 | indicatorLayoutParams.setMargins(
219 | (buttonWidth - progressIndicatorWidth) / 2,
220 | (buttonHeight - progressIndicatorWidth) / 2,
221 | (buttonWidth - progressIndicatorWidth) / 2,
222 | 0);
223 | indicator.setLayoutParams(indicatorLayoutParams);
224 | indicator.setVisibility(View.GONE);
225 | indicator.setId(R.id.actionbar_compat_item_refresh_progress);
226 | actionBar.addView(indicator);
227 | }
228 |
229 | return actionButton;
230 | }
231 |
232 | /**
233 | * A {@link android.view.MenuInflater} that reads action bar metadata.
234 | */
235 | private class WrappedMenuInflater extends MenuInflater {
236 | MenuInflater mInflater;
237 |
238 | public WrappedMenuInflater(Context context, MenuInflater inflater) {
239 | super(context);
240 | mInflater = inflater;
241 | }
242 |
243 | @Override
244 | public void inflate(int menuRes, Menu menu) {
245 | loadActionBarMetadata(menuRes);
246 | mInflater.inflate(menuRes, menu);
247 | }
248 |
249 | /**
250 | * Loads action bar metadata from a menu resource, storing a list of menu item IDs that
251 | * should be shown on-screen (i.e. those with showAsAction set to always or ifRoom).
252 | * @param menuResId
253 | */
254 | private void loadActionBarMetadata(int menuResId) {
255 | XmlResourceParser parser = null;
256 | try {
257 | parser = mActivity.getResources().getXml(menuResId);
258 |
259 | int eventType = parser.getEventType();
260 | int itemId;
261 | int showAsAction;
262 |
263 | boolean eof = false;
264 | while (!eof) {
265 | switch (eventType) {
266 | case XmlPullParser.START_TAG:
267 | if (!parser.getName().equals("item")) {
268 | break;
269 | }
270 |
271 | itemId = parser.getAttributeResourceValue(MENU_RES_NAMESPACE,
272 | MENU_ATTR_ID, 0);
273 | if (itemId == 0) {
274 | break;
275 | }
276 |
277 | showAsAction = parser.getAttributeIntValue(MENU_RES_NAMESPACE,
278 | MENU_ATTR_SHOW_AS_ACTION, -1);
279 | if (showAsAction == MenuItem.SHOW_AS_ACTION_ALWAYS ||
280 | showAsAction == MenuItem.SHOW_AS_ACTION_IF_ROOM) {
281 | mActionItemIds.add(itemId);
282 | }
283 | break;
284 |
285 | case XmlPullParser.END_DOCUMENT:
286 | eof = true;
287 | break;
288 | }
289 |
290 | eventType = parser.next();
291 | }
292 | } catch (XmlPullParserException e) {
293 | throw new InflateException("Error inflating menu XML", e);
294 | } catch (IOException e) {
295 | throw new InflateException("Error inflating menu XML", e);
296 | } finally {
297 | if (parser != null) {
298 | parser.close();
299 | }
300 | }
301 | }
302 |
303 | }
304 | }
305 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/actionbarcompat/ActionBarHelperHoneycomb.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.sparkleshare.android.actionbarcompat;
18 |
19 | import org.sparkleshare.android.R;
20 |
21 | import android.app.Activity;
22 | import android.content.Context;
23 | import android.view.LayoutInflater;
24 | import android.view.Menu;
25 | import android.view.MenuItem;
26 | import android.view.View;
27 |
28 | /**
29 | * An extension of {@link ActionBarHelper} that provides Android 3.0-specific functionality for
30 | * Honeycomb tablets. It thus requires API level 11.
31 | */
32 | public class ActionBarHelperHoneycomb extends ActionBarHelper {
33 | private Menu mOptionsMenu;
34 | private View mRefreshIndeterminateProgressView = null;
35 |
36 | protected ActionBarHelperHoneycomb(Activity activity) {
37 | super(activity);
38 | }
39 |
40 | @Override
41 | public boolean onCreateOptionsMenu(Menu menu) {
42 | mOptionsMenu = menu;
43 | return super.onCreateOptionsMenu(menu);
44 | }
45 |
46 | @Override
47 | public void setRefreshActionItemState(boolean refreshing) {
48 | // On Honeycomb, we can set the state of the refresh button by giving it a custom
49 | // action view.
50 | if (mOptionsMenu == null) {
51 | return;
52 | }
53 |
54 | final MenuItem refreshItem = mOptionsMenu.findItem(R.id.menu_refresh);
55 | if (refreshItem != null) {
56 | if (refreshing) {
57 | if (mRefreshIndeterminateProgressView == null) {
58 | LayoutInflater inflater = (LayoutInflater)
59 | getActionBarThemedContext().getSystemService(
60 | Context.LAYOUT_INFLATER_SERVICE);
61 | mRefreshIndeterminateProgressView = inflater.inflate(
62 | R.layout.actionbar_indeterminate_progress, null);
63 | }
64 |
65 | refreshItem.setActionView(mRefreshIndeterminateProgressView);
66 | } else {
67 | refreshItem.setActionView(null);
68 | }
69 | }
70 | }
71 |
72 | /**
73 | * Returns a {@link Context} suitable for inflating layouts for the action bar. The
74 | * implementation for this method in {@link ActionBarHelperICS} asks the action bar for a
75 | * themed context.
76 | */
77 | protected Context getActionBarThemedContext() {
78 | return mActivity;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/actionbarcompat/ActionBarHelperICS.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.sparkleshare.android.actionbarcompat;
18 |
19 | import android.app.Activity;
20 | import android.content.Context;
21 |
22 | /**
23 | * An extension of {@link com.example.android.actionbarcompat.ActionBarHelper} that provides Android
24 | * 4.0-specific functionality for IceCreamSandwich devices. It thus requires API level 14.
25 | */
26 | public class ActionBarHelperICS extends ActionBarHelperHoneycomb {
27 | protected ActionBarHelperICS(Activity activity) {
28 | super(activity);
29 | }
30 |
31 | @Override
32 | protected Context getActionBarThemedContext() {
33 | return mActivity.getActionBar().getThemedContext();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/actionbarcompat/SimpleMenu.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.sparkleshare.android.actionbarcompat;
18 |
19 | import android.content.ComponentName;
20 | import android.content.Context;
21 | import android.content.Intent;
22 | import android.content.res.Resources;
23 | import android.view.KeyEvent;
24 | import android.view.Menu;
25 | import android.view.MenuItem;
26 | import android.view.SubMenu;
27 |
28 | import java.util.ArrayList;
29 |
30 | /**
31 | * A really dumb implementation of the {@link android.view.Menu} interface, that's only
32 | * useful for our actionbar-compat purposes. See
33 | * com.android.internal.view.menu.MenuBuilder
in AOSP for a more complete
34 | * implementation.
35 | */
36 | public class SimpleMenu implements Menu {
37 |
38 | private Context mContext;
39 | private Resources mResources;
40 |
41 | private ArrayList mItems;
42 |
43 | public SimpleMenu(Context context) {
44 | mContext = context;
45 | mResources = context.getResources();
46 | mItems = new ArrayList();
47 | }
48 |
49 | public Context getContext() {
50 | return mContext;
51 | }
52 |
53 | public Resources getResources() {
54 | return mResources;
55 | }
56 |
57 | public MenuItem add(CharSequence title) {
58 | return addInternal(0, 0, title);
59 | }
60 |
61 | public MenuItem add(int titleRes) {
62 | return addInternal(0, 0, mResources.getString(titleRes));
63 | }
64 |
65 | public MenuItem add(int groupId, int itemId, int order, CharSequence title) {
66 | return addInternal(itemId, order, title);
67 | }
68 |
69 | public MenuItem add(int groupId, int itemId, int order, int titleRes) {
70 | return addInternal(itemId, order, mResources.getString(titleRes));
71 | }
72 |
73 | /**
74 | * Adds an item to the menu. The other add methods funnel to this.
75 | */
76 | private MenuItem addInternal(int itemId, int order, CharSequence title) {
77 | final SimpleMenuItem item = new SimpleMenuItem(this, itemId, order, title);
78 | mItems.add(findInsertIndex(mItems, order), item);
79 | return item;
80 | }
81 |
82 | private static int findInsertIndex(ArrayList extends MenuItem> items, int order) {
83 | for (int i = items.size() - 1; i >= 0; i--) {
84 | MenuItem item = items.get(i);
85 | if (item.getOrder() <= order) {
86 | return i + 1;
87 | }
88 | }
89 |
90 | return 0;
91 | }
92 |
93 | public int findItemIndex(int id) {
94 | final int size = size();
95 |
96 | for (int i = 0; i < size; i++) {
97 | SimpleMenuItem item = mItems.get(i);
98 | if (item.getItemId() == id) {
99 | return i;
100 | }
101 | }
102 |
103 | return -1;
104 | }
105 |
106 | public void removeItem(int itemId) {
107 | removeItemAtInt(findItemIndex(itemId));
108 | }
109 |
110 | private void removeItemAtInt(int index) {
111 | if ((index < 0) || (index >= mItems.size())) {
112 | return;
113 | }
114 | mItems.remove(index);
115 | }
116 |
117 | public void clear() {
118 | mItems.clear();
119 | }
120 |
121 | public MenuItem findItem(int id) {
122 | final int size = size();
123 | for (int i = 0; i < size; i++) {
124 | SimpleMenuItem item = mItems.get(i);
125 | if (item.getItemId() == id) {
126 | return item;
127 | }
128 | }
129 |
130 | return null;
131 | }
132 |
133 | public int size() {
134 | return mItems.size();
135 | }
136 |
137 | public MenuItem getItem(int index) {
138 | return mItems.get(index);
139 | }
140 |
141 | // Unsupported operations.
142 |
143 | public SubMenu addSubMenu(CharSequence charSequence) {
144 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
145 | }
146 |
147 | public SubMenu addSubMenu(int titleRes) {
148 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
149 | }
150 |
151 | public SubMenu addSubMenu(int groupId, int itemId, int order, CharSequence title) {
152 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
153 | }
154 |
155 | public SubMenu addSubMenu(int groupId, int itemId, int order, int titleRes) {
156 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
157 | }
158 |
159 | public int addIntentOptions(int i, int i1, int i2, ComponentName componentName,
160 | Intent[] intents, Intent intent, int i3, MenuItem[] menuItems) {
161 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
162 | }
163 |
164 | public void removeGroup(int i) {
165 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
166 | }
167 |
168 | public void setGroupCheckable(int i, boolean b, boolean b1) {
169 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
170 | }
171 |
172 | public void setGroupVisible(int i, boolean b) {
173 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
174 | }
175 |
176 | public void setGroupEnabled(int i, boolean b) {
177 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
178 | }
179 |
180 | public boolean hasVisibleItems() {
181 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
182 | }
183 |
184 | public void close() {
185 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
186 | }
187 |
188 | public boolean performShortcut(int i, KeyEvent keyEvent, int i1) {
189 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
190 | }
191 |
192 | public boolean isShortcutKey(int i, KeyEvent keyEvent) {
193 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
194 | }
195 |
196 | public boolean performIdentifierAction(int i, int i1) {
197 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
198 | }
199 |
200 | public void setQwertyMode(boolean b) {
201 | throw new UnsupportedOperationException("This operation is not supported for SimpleMenu");
202 | }
203 | }
204 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/actionbarcompat/SimpleMenuItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.sparkleshare.android.actionbarcompat;
18 |
19 | import android.content.Intent;
20 | import android.graphics.drawable.Drawable;
21 | import android.view.ActionProvider;
22 | import android.view.ContextMenu;
23 | import android.view.MenuItem;
24 | import android.view.SubMenu;
25 | import android.view.View;
26 |
27 | /**
28 | * A really dumb implementation of the {@link android.view.MenuItem} interface, that's only
29 | * useful for our actionbar-compat purposes. See
30 | * com.android.internal.view.menu.MenuItemImpl
in AOSP for a more complete
31 | * implementation.
32 | */
33 | public class SimpleMenuItem implements MenuItem {
34 |
35 | private SimpleMenu mMenu;
36 |
37 | private final int mId;
38 | private final int mOrder;
39 | private CharSequence mTitle;
40 | private CharSequence mTitleCondensed;
41 | private Drawable mIconDrawable;
42 | private int mIconResId = 0;
43 | private boolean mEnabled = true;
44 |
45 | public SimpleMenuItem(SimpleMenu menu, int id, int order, CharSequence title) {
46 | mMenu = menu;
47 | mId = id;
48 | mOrder = order;
49 | mTitle = title;
50 | }
51 |
52 | public int getItemId() {
53 | return mId;
54 | }
55 |
56 | public int getOrder() {
57 | return mOrder;
58 | }
59 |
60 | public MenuItem setTitle(CharSequence title) {
61 | mTitle = title;
62 | return this;
63 | }
64 |
65 | public MenuItem setTitle(int titleRes) {
66 | return setTitle(mMenu.getContext().getString(titleRes));
67 | }
68 |
69 | public CharSequence getTitle() {
70 | return mTitle;
71 | }
72 |
73 | public MenuItem setTitleCondensed(CharSequence title) {
74 | mTitleCondensed = title;
75 | return this;
76 | }
77 |
78 | public CharSequence getTitleCondensed() {
79 | return mTitleCondensed != null ? mTitleCondensed : mTitle;
80 | }
81 |
82 | public MenuItem setIcon(Drawable icon) {
83 | mIconResId = 0;
84 | mIconDrawable = icon;
85 | return this;
86 | }
87 |
88 | public MenuItem setIcon(int iconResId) {
89 | mIconDrawable = null;
90 | mIconResId = iconResId;
91 | return this;
92 | }
93 |
94 | public Drawable getIcon() {
95 | if (mIconDrawable != null) {
96 | return mIconDrawable;
97 | }
98 |
99 | if (mIconResId != 0) {
100 | return mMenu.getResources().getDrawable(mIconResId);
101 | }
102 |
103 | return null;
104 | }
105 |
106 | public MenuItem setEnabled(boolean enabled) {
107 | mEnabled = enabled;
108 | return this;
109 | }
110 |
111 | public boolean isEnabled() {
112 | return mEnabled;
113 | }
114 |
115 | // No-op operations. We use no-ops to allow inflation from menu XML.
116 |
117 | public int getGroupId() {
118 | // Noop
119 | return 0;
120 | }
121 |
122 | public View getActionView() {
123 | // Noop
124 | return null;
125 | }
126 |
127 | public MenuItem setActionProvider(ActionProvider actionProvider) {
128 | // Noop
129 | return this;
130 | }
131 |
132 | public ActionProvider getActionProvider() {
133 | // Noop
134 | return null;
135 | }
136 |
137 | public boolean expandActionView() {
138 | // Noop
139 | return false;
140 | }
141 |
142 | public boolean collapseActionView() {
143 | // Noop
144 | return false;
145 | }
146 |
147 | public boolean isActionViewExpanded() {
148 | // Noop
149 | return false;
150 | }
151 |
152 | @Override
153 | public MenuItem setOnActionExpandListener(OnActionExpandListener onActionExpandListener) {
154 | // Noop
155 | return this;
156 | }
157 |
158 | public MenuItem setIntent(Intent intent) {
159 | // Noop
160 | return this;
161 | }
162 |
163 | public Intent getIntent() {
164 | // Noop
165 | return null;
166 | }
167 |
168 | public MenuItem setShortcut(char c, char c1) {
169 | // Noop
170 | return this;
171 | }
172 |
173 | public MenuItem setNumericShortcut(char c) {
174 | // Noop
175 | return this;
176 | }
177 |
178 | public char getNumericShortcut() {
179 | // Noop
180 | return 0;
181 | }
182 |
183 | public MenuItem setAlphabeticShortcut(char c) {
184 | // Noop
185 | return this;
186 | }
187 |
188 | public char getAlphabeticShortcut() {
189 | // Noop
190 | return 0;
191 | }
192 |
193 | public MenuItem setCheckable(boolean b) {
194 | // Noop
195 | return this;
196 | }
197 |
198 | public boolean isCheckable() {
199 | // Noop
200 | return false;
201 | }
202 |
203 | public MenuItem setChecked(boolean b) {
204 | // Noop
205 | return this;
206 | }
207 |
208 | public boolean isChecked() {
209 | // Noop
210 | return false;
211 | }
212 |
213 | public MenuItem setVisible(boolean b) {
214 | // Noop
215 | return this;
216 | }
217 |
218 | public boolean isVisible() {
219 | // Noop
220 | return true;
221 | }
222 |
223 | public boolean hasSubMenu() {
224 | // Noop
225 | return false;
226 | }
227 |
228 | public SubMenu getSubMenu() {
229 | // Noop
230 | return null;
231 | }
232 |
233 | public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
234 | // Noop
235 | return this;
236 | }
237 |
238 | public ContextMenu.ContextMenuInfo getMenuInfo() {
239 | // Noop
240 | return null;
241 | }
242 |
243 | public void setShowAsAction(int i) {
244 | // Noop
245 | }
246 |
247 | public MenuItem setShowAsActionFlags(int i) {
248 | // Noop
249 | return null;
250 | }
251 |
252 | public MenuItem setActionView(View view) {
253 | // Noop
254 | return this;
255 | }
256 |
257 | public MenuItem setActionView(int i) {
258 | // Noop
259 | return this;
260 | }
261 | }
262 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/ui/AboutFragment.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android.ui;
2 |
3 | import org.sparkleshare.android.R;
4 |
5 | import android.os.Bundle;
6 | import android.support.v4.app.Fragment;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | public class AboutFragment extends Fragment {
12 |
13 | private static final String TAG = "AboutFragment";
14 |
15 | @Override
16 | public void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | }
19 |
20 | @Override
21 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
22 | Bundle savedInstanceState) {
23 | return inflater.inflate(R.layout.about, container, false);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/ui/BrowsingFragment.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android.ui;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.IOException;
5 | import java.io.InputStreamReader;
6 | import java.net.URI;
7 | import java.net.URISyntaxException;
8 |
9 | import org.apache.http.HttpResponse;
10 | import org.apache.http.HttpStatus;
11 | import org.apache.http.client.ClientProtocolException;
12 | import org.apache.http.client.HttpClient;
13 | import org.apache.http.client.methods.HttpGet;
14 | import org.apache.http.conn.scheme.PlainSocketFactory;
15 | import org.apache.http.conn.scheme.Scheme;
16 | import org.apache.http.conn.scheme.SchemeRegistry;
17 | import org.apache.http.conn.ssl.SSLSocketFactory;
18 | import org.apache.http.impl.client.DefaultHttpClient;
19 | import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
20 | import org.apache.http.params.BasicHttpParams;
21 | import org.apache.http.params.HttpParams;
22 | import org.json.JSONArray;
23 | import org.json.JSONException;
24 | import org.json.JSONObject;
25 | import org.sparkleshare.android.BrowsingActivity;
26 | import org.sparkleshare.android.BrowsingAdapter;
27 | import org.sparkleshare.android.FileDetailsActivity;
28 | import org.sparkleshare.android.R;
29 | import org.sparkleshare.android.SettingsActivity;
30 | import org.sparkleshare.android.actionbarcompat.ActionBarActivity;
31 | import org.sparkleshare.android.utils.FakeSocketFactory;
32 |
33 | import android.R.color;
34 | import android.content.ContextWrapper;
35 | import android.content.Intent;
36 | import android.content.SharedPreferences;
37 | import android.content.SharedPreferences.Editor;
38 | import android.os.AsyncTask;
39 | import android.os.Bundle;
40 | import android.support.v4.app.Fragment;
41 | import android.util.Log;
42 | import android.view.LayoutInflater;
43 | import android.view.View;
44 | import android.view.ViewGroup;
45 | import android.widget.AdapterView;
46 | import android.widget.AdapterView.OnItemClickListener;
47 | import android.widget.ListView;
48 |
49 | public class BrowsingFragment extends Fragment {
50 |
51 | private static final String TAG = "BrowsingFragment";
52 | private ListView lvBrowsing;
53 | private BrowsingAdapter adapter;
54 | private String ident, authCode, serverUrl, folderId, currentUrl;
55 | private String foldername = "SparkleShare";
56 |
57 | @Override
58 | public void onCreate(Bundle savedInstanceState) {
59 | super.onCreate(savedInstanceState);
60 | }
61 |
62 | @Override
63 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
64 | Bundle savedInstanceState) {
65 | lvBrowsing = new ListView(getActivity());
66 | adapter = new BrowsingAdapter(getActivity());
67 | lvBrowsing.setAdapter(adapter);
68 | lvBrowsing.setCacheColorHint(color.background_dark);
69 | lvBrowsing.setOnItemClickListener(onListItemClick());
70 |
71 |
72 | SharedPreferences prefs = SettingsActivity.getSettings((ContextWrapper) getActivity());
73 | ident = prefs.getString("ident", "");
74 | authCode = prefs.getString("authCode", "");
75 | serverUrl = prefs.getString("serverUrl", "");
76 | folderId = prefs.getString("folderId", "");
77 |
78 | if (getActivity().getIntent().hasExtra("foldername")) {
79 | foldername = getActivity().getIntent().getStringExtra("foldername");
80 | }
81 | currentUrl = getActivity().getIntent().getStringExtra("url");
82 | new DownloadFileList().execute(currentUrl);
83 | return lvBrowsing;
84 | }
85 |
86 | /**
87 | * Will be called everytime an item on this activities' listview was clicked.
88 | * @return newly created {@link OnItemClickListener}
89 | */
90 | private OnItemClickListener onListItemClick() {
91 | OnItemClickListener listener = new OnItemClickListener() {
92 |
93 | @Override
94 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
95 | ListEntryItem current = (ListEntryItem) adapter.getItem(position);
96 |
97 | if (current.getType().equals("dir")) {
98 | Log.d("BrowsingActivity", "dir");
99 | Intent browseFolder = new Intent(getActivity(), BrowsingActivity.class);
100 | String tmpUrl = serverUrl + "/api/getFolderContent/" + folderId + "?" + current.getUrl();
101 | browseFolder.putExtra("url", tmpUrl);
102 | browseFolder.putExtra("foldername", current.getTitle());
103 | startActivity(browseFolder);
104 | } else if (current.getType().equals("git")) {
105 | Log.d("BrowsingActivity", "git");
106 | Intent browseFolder = new Intent(getActivity(), BrowsingActivity.class);
107 | folderId = current.getId();
108 | SharedPreferences prefs = SettingsActivity.getSettings((ContextWrapper) parent.getContext());
109 | Editor editor = prefs.edit();
110 | editor.putString("folderId", folderId);
111 | editor.commit();
112 | browseFolder.putExtra("url", serverUrl + "/api/getFolderContent/" + folderId);
113 | browseFolder.putExtra("foldername", current.getTitle());
114 | startActivity(browseFolder);
115 | } else if (current.getType().equals("file")) {
116 | Intent showFile = new Intent(getActivity(), FileDetailsActivity.class);
117 | showFile.putExtra("ListEntryItem", current);
118 | showFile.putExtra("ident", ident);
119 | showFile.putExtra("authCode", authCode);
120 | showFile.putExtra("serverUrl", serverUrl);
121 | showFile.putExtra("folderId", folderId);
122 | startActivity(showFile);
123 | }
124 |
125 | }
126 | };
127 | return listener;
128 | }
129 |
130 | private class DownloadFileList extends AsyncTask {
131 |
132 | private boolean isProjectsDirectory = false;
133 |
134 | @Override
135 | protected void onPreExecute() {
136 | ((BrowsingActivity) getActivity()).setRefreshingState(true);
137 | }
138 |
139 | private HttpClient getNewHttpClient() {
140 | SharedPreferences sp = SettingsActivity.getSettings(getActivity());
141 | boolean acceptAll = sp.getBoolean(getResources().getString(R.string.settings_accept_all_certificates), false);
142 |
143 | SchemeRegistry s = new SchemeRegistry();
144 | s.register(new Scheme("http", new PlainSocketFactory(), 80));
145 | s.register(new Scheme("https", acceptAll ? new FakeSocketFactory() : SSLSocketFactory.getSocketFactory(), 443));
146 |
147 | HttpParams httpParams = new BasicHttpParams();
148 | return new DefaultHttpClient(new ThreadSafeClientConnManager(httpParams, s), httpParams);
149 | }
150 |
151 | @Override
152 | protected Boolean doInBackground(String... params) {
153 | String server = params[0];
154 |
155 | try {
156 | // TODO: Refactor I/O here and in SetupActivity to central place
157 | HttpClient client = getNewHttpClient();
158 | HttpGet get = new HttpGet(server);
159 | get.setHeader("X-SPARKLE-IDENT", ident);
160 | get.setHeader("X-SPARKLE-AUTH", authCode);
161 | HttpResponse response = client.execute(get);
162 | if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
163 | BufferedReader in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
164 | StringBuffer sb = new StringBuffer();
165 | String line = "";
166 | String NL = System.getProperty("line.separator");
167 | while ((line = in.readLine()) != null) {
168 | sb.append(line + NL);
169 | }
170 | in.close();
171 | JSONArray folderList = new JSONArray(sb.toString());
172 | for (int i=0; i {
125 |
126 | Notification notification;
127 | NotificationManager notificationManager;
128 | private int maxProgress;
129 | ListEntryItem current;
130 |
131 | @Override
132 | protected void onPreExecute() {
133 | notificationManager = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
134 | Intent notificationIntent = new Intent(getActivity(), BrowsingActivity.class);
135 | PendingIntent intent = PendingIntent.getActivity(getActivity(), 0, notificationIntent, 0);
136 | notification = new Notification(R.drawable.ic_stat_download, "", System.currentTimeMillis());
137 | notification.flags = notification.flags | Notification.FLAG_ONGOING_EVENT;
138 | notification.contentView = new RemoteViews(getActivity().getApplicationContext().getPackageName(),
139 | R.layout.download_progress);
140 | notification.contentIntent = intent;
141 |
142 | }
143 |
144 | private HttpClient getNewHttpClient() {
145 | SharedPreferences sp = SettingsActivity.getSettings(getActivity());
146 | boolean acceptAll = sp.getBoolean(getResources().getString(R.string.settings_accept_all_certificates), false);
147 |
148 | SchemeRegistry s = new SchemeRegistry();
149 | s.register(new Scheme("http", new PlainSocketFactory(), 80));
150 | s.register(new Scheme("https", acceptAll ? new FakeSocketFactory() : SSLSocketFactory.getSocketFactory(), 443));
151 |
152 | HttpParams httpParams = new BasicHttpParams();
153 | return new DefaultHttpClient(new ThreadSafeClientConnManager(httpParams, s), httpParams);
154 | }
155 |
156 | @Override
157 | protected Boolean doInBackground(ListEntryItem... params) {
158 | // TODO: Check for connectivity
159 | current = params[0];
160 | try {
161 | HttpClient client = getNewHttpClient();
162 | HttpGet get = new HttpGet(current.getUrl());
163 | get.setHeader("X-SPARKLE-IDENT", ident);
164 | get.setHeader("X-SPARKLE-AUTH", authCode);
165 | HttpResponse response = client.execute(get);
166 | if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
167 | publishProgress(0);
168 | HttpEntity entity = response.getEntity();
169 | if (entity != null) {
170 | notification.contentView.setTextViewText(R.id.tv_download_title, current.getTitle());
171 | notificationManager.notify(17, notification);
172 | File file = new File(current.getFilePath());
173 | maxProgress = Integer.valueOf(current.getFilesize());
174 | InputStream input = entity.getContent();
175 | OutputStream output = new FileOutputStream(file);
176 | byte buffer[] = new byte[1024];
177 | int count = 0, total = 0;
178 | long nextUpdate = System.currentTimeMillis() + 1000;
179 | while ((count = input.read(buffer)) > 0) {
180 | output.write(buffer, 0, count);
181 | total += count;
182 | if (System.currentTimeMillis() > nextUpdate) {
183 | publishProgress(total);
184 | nextUpdate = System.currentTimeMillis() + 1000;
185 | }
186 | }
187 | output.flush();
188 | output.close();
189 | input.close();
190 | }
191 | }
192 | } catch (ClientProtocolException e) {
193 | Log.e("DownloadFile", e.getLocalizedMessage());
194 | return false;
195 | } catch (IOException e) {
196 | Log.e("DownloadFile", e.getLocalizedMessage());
197 | return false;
198 | }
199 | return true;
200 | }
201 |
202 | @Override
203 | protected void onProgressUpdate(Integer... values) {
204 | int progress = values[0];
205 | notification.contentView.setProgressBar(R.id.pb_download_progressbar, maxProgress, progress,
206 | false);
207 | notificationManager.notify(17, notification);
208 | }
209 |
210 | @Override
211 | protected void onPostExecute(Boolean result) {
212 | notificationManager.cancel(17);
213 | if (result) {
214 | btnOpenDownloadFile.setText(R.string.open_file);
215 | //btnRedownloadFile.setText(R.string.redownload_file);
216 |
217 | btnOpenDownloadFile.setEnabled(true);
218 | //btnRedownloadFile.setEnabled(true);
219 | btnRedownloadFile.setVisibility(View.VISIBLE);
220 | btnDeleteFile.setVisibility(View.VISIBLE);
221 |
222 | File file = new File(current.getFilePath());
223 | String extension = MimeTypeMap.getFileExtensionFromUrl(current.getTitle());
224 |
225 | if (file.exists() && file.length() < 1000000) {
226 | Bitmap fileBitmap;
227 | try {
228 | BitmapFactory.Options options = new BitmapFactory.Options();
229 | options.inSampleSize = 4;
230 |
231 | fileBitmap = BitmapFactory.decodeFile(file.getAbsolutePath(), options);
232 | } catch (Exception e) {
233 | fileBitmap = null;
234 | }
235 |
236 | if (fileBitmap != null) {
237 | fileIcon.setImageBitmap(fileBitmap);
238 | }
239 | }
240 |
241 | } else {
242 | Toast.makeText(getActivity(), getString(R.string.downloading_failed), Toast.LENGTH_SHORT).show();
243 | }
244 | }
245 | }
246 |
247 | public void deleteFile() {
248 | File file = new File(current.getFilePath());
249 | if(file.exists() && file.delete()){
250 | btnRedownloadFile.setVisibility(View.INVISIBLE);
251 | btnDeleteFile.setVisibility(View.INVISIBLE);
252 | btnOpenDownloadFile.setText(R.string.download_file);
253 | }
254 | }
255 |
256 | }
257 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/ui/ListEntryItem.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android.ui;
2 |
3 | import org.sparkleshare.android.utils.FormatHelper;
4 |
5 | import android.os.Bundle;
6 | import android.os.Parcel;
7 | import android.os.Parcelable;
8 |
9 | public class ListEntryItem implements Comparable, Parcelable {
10 |
11 | private String title, subtitle;
12 | private String id;
13 | private String type;
14 | private String url;
15 | private String mime;
16 | private String mimeBase;
17 | private String filesize;
18 | private String filePath;
19 | private int listviewPosition;
20 |
21 | public ListEntryItem() {
22 | }
23 |
24 | public ListEntryItem(Parcel source) {
25 | Bundle b = source.readBundle();
26 | title = b.getString("title");
27 | subtitle = b.getString("subtitle");
28 | id = b.getString("id");
29 | url = b.getString("url");
30 | mime = b.getString("mime");
31 | mimeBase = b.getString("mimeBase");
32 | filesize = b.getString("filesize");
33 | listviewPosition = b.getInt("listviewPosition");
34 | filePath = b.getString("filePath");
35 | }
36 |
37 | public int getListviewPosition() {
38 | return listviewPosition;
39 | }
40 |
41 | public void setListviewPosition(int listviewPosition) {
42 | this.listviewPosition = listviewPosition;
43 | }
44 |
45 | public String getMimeBase() {
46 | return mimeBase;
47 | }
48 |
49 | public void setMimeBase(String mimeBase) {
50 | this.mimeBase = mimeBase;
51 | }
52 |
53 | public String getFilesize() {
54 | return filesize;
55 | }
56 |
57 | public void setFilesize(String filesize) {
58 | this.filesize = filesize;
59 | }
60 |
61 | public void setFilePath(String path) {
62 | this.filePath = path;
63 | }
64 |
65 | public String getFilePath() {
66 | return this.filePath;
67 | }
68 |
69 | public String getMimetype() {
70 | return mime;
71 | }
72 |
73 | public boolean isDirectory() {
74 |
75 | if(type.equals("dir")){
76 | return true;
77 | }
78 |
79 | return false;
80 | }
81 |
82 | public void setMimetype(String mimetype) {
83 | this.mime = mimetype;
84 | }
85 |
86 | public String getTitle() {
87 | return title;
88 | }
89 |
90 | public void setTitle(String title) {
91 | this.title = title;
92 | }
93 |
94 | public String getSubtitle() {
95 | if (filesize != null) {
96 | return FormatHelper.formatFilesize(filesize);
97 | } else {
98 | return subtitle;
99 | }
100 | }
101 |
102 | public void setSubtitle(String subtitle) {
103 | this.subtitle = subtitle;
104 | }
105 |
106 | public String getUrl() {
107 | return url;
108 | }
109 |
110 | public void setUrl(String url) {
111 | this.url = url;
112 | }
113 |
114 | public String getId() {
115 | return id;
116 | }
117 |
118 | public String getType() {
119 | return type;
120 | }
121 |
122 | public void setType(String type) {
123 | this.type = type;
124 | }
125 |
126 | public void setId(String id) {
127 | this.id = id;
128 | }
129 |
130 | @Override
131 | public int compareTo(ListEntryItem another) {
132 | if (type.equals("file")) {
133 | if (another.type.equals("dir")) {
134 | return 1;
135 | } else {
136 | return title.compareToIgnoreCase(another.title);
137 | }
138 | } else {
139 | /* type.equals("dir) */
140 | if (another.type.equals("file")) {
141 | return -1;
142 | } else {
143 | return title.compareToIgnoreCase(another.title);
144 | }
145 | }
146 | }
147 |
148 | @Override
149 | public int describeContents() {
150 | return 0;
151 | }
152 |
153 | @Override
154 | public void writeToParcel(Parcel dest, int flags) {
155 | Bundle b = new Bundle();
156 | b.putString("title", title);
157 | b.putString("subtitle", subtitle);
158 | b.putString("id", id);
159 | b.putString("url", url);
160 | b.putString("mime", mime);
161 | b.putString("mimeBase", mimeBase);
162 | b.putString("filesize", filesize);
163 | b.putInt("listviewPosition", listviewPosition);
164 | b.putString("filePath", filePath);
165 | dest.writeBundle(b);
166 | }
167 |
168 | public static final Parcelable.Creator CREATOR = new Creator() {
169 |
170 | @Override
171 | public ListEntryItem createFromParcel(Parcel source) {
172 | return new ListEntryItem(source);
173 | }
174 |
175 | @Override
176 | public ListEntryItem[] newArray(int size) {
177 | return new ListEntryItem[size];
178 | }
179 | };
180 |
181 | }
182 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/ui/SetupFragment.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android.ui;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.IOException;
5 | import java.io.InputStreamReader;
6 | import java.io.UnsupportedEncodingException;
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | import org.apache.http.HttpResponse;
11 | import org.apache.http.HttpStatus;
12 | import org.apache.http.NameValuePair;
13 | import org.apache.http.client.ClientProtocolException;
14 | import org.apache.http.client.HttpClient;
15 | import org.apache.http.client.entity.UrlEncodedFormEntity;
16 | import org.apache.http.client.methods.HttpPost;
17 | import org.apache.http.conn.scheme.PlainSocketFactory;
18 | import org.apache.http.conn.scheme.Scheme;
19 | import org.apache.http.conn.scheme.SchemeRegistry;
20 | import org.apache.http.conn.ssl.SSLSocketFactory;
21 | import org.apache.http.impl.client.DefaultHttpClient;
22 | import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
23 | import org.apache.http.message.BasicNameValuePair;
24 | import org.apache.http.params.BasicHttpParams;
25 | import org.apache.http.params.HttpParams;
26 | import org.json.JSONException;
27 | import org.json.JSONObject;
28 | import org.sparkleshare.android.BrowsingActivity;
29 | import org.sparkleshare.android.R;
30 | import org.sparkleshare.android.SettingsActivity;
31 | import org.sparkleshare.android.utils.FakeSocketFactory;
32 |
33 | import android.app.Activity;
34 | import android.app.AlertDialog;
35 | import android.app.ProgressDialog;
36 | import android.content.ContextWrapper;
37 | import android.content.DialogInterface;
38 | import android.content.Intent;
39 | import android.content.SharedPreferences;
40 | import android.content.SharedPreferences.Editor;
41 | import android.os.AsyncTask;
42 | import android.os.Bundle;
43 | import android.support.v4.app.Fragment;
44 | import android.text.Editable;
45 | import android.text.TextWatcher;
46 | import android.util.Log;
47 | import android.view.LayoutInflater;
48 | import android.view.View;
49 | import android.view.ViewGroup;
50 | import android.widget.Button;
51 | import android.widget.EditText;
52 | import android.widget.RelativeLayout;
53 |
54 | public class SetupFragment extends Fragment {
55 |
56 | private static final String TAG = "SetupFragment";
57 | public EditText edtServer, edtLinkcode;
58 | public Button btn_add;
59 |
60 | @Override
61 | public void onCreate(Bundle savedInstanceState) {
62 | super.onCreate(savedInstanceState);
63 | }
64 |
65 | @Override
66 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
67 | Bundle savedInstanceState) {
68 | RelativeLayout rl = (RelativeLayout) inflater.inflate(R.layout.setup, container, false);
69 | btn_add = (Button) rl.findViewById(R.id.btn_add);
70 | btn_add.setEnabled(false);
71 | edtServer = (EditText) rl.findViewById(R.id.edt_server);
72 | edtLinkcode = (EditText) rl.findViewById(R.id.edt_link_code);
73 | edtServer.addTextChangedListener(checkEditfields());
74 | edtLinkcode.addTextChangedListener(checkEditfields());
75 | return rl;
76 | }
77 |
78 | /**
79 | * Checks both mandatory edit fields and enables the add button inside this Activity.
80 | * @return
81 | */
82 | private TextWatcher checkEditfields() {
83 | TextWatcher watcher = new TextWatcher() {
84 |
85 | @Override
86 | public void onTextChanged(CharSequence s, int start, int before, int count) {}
87 |
88 | @Override
89 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
90 |
91 | @Override
92 | public void afterTextChanged(Editable s) {
93 | if (edtServer.getEditableText().length() > 0 && edtLinkcode.getEditableText().length() > 0) {
94 | btn_add.setEnabled(true);
95 | } else {
96 | btn_add.setEnabled(false);
97 | }
98 | }
99 | };
100 | return watcher;
101 | }
102 |
103 | public void startLogin(String serverUrl) {
104 | new Login().execute(formatServerUrl(serverUrl));
105 | }
106 |
107 | private String formatServerUrl(String url) {
108 | // TODO: Should use regular expression here.
109 | if (!url.contains(":")) {
110 | url = url.concat(":3000");
111 | }
112 | if (!url.startsWith("http")) {
113 | url = "http://" + url;
114 | }
115 | return url;
116 | }
117 |
118 | /**
119 | * Login to server asynchronously.
120 | * @author kai
121 | *
122 | */
123 | public class Login extends AsyncTask {
124 |
125 | private ProgressDialog loadingDialog;
126 | private final String AUTH_SUFFIX = "/api/getAuthCode";
127 | private String serverUrl;
128 |
129 | @Override
130 | protected void onPreExecute() {
131 | loadingDialog = ProgressDialog.show(getActivity(), "", getString(R.string.adding_project));
132 | }
133 |
134 | private HttpClient getNewHttpClient() {
135 | SharedPreferences sp = SettingsActivity.getSettings(getActivity());
136 | boolean acceptAll = sp.getBoolean(getResources().getString(R.string.settings_accept_all_certificates), false);
137 |
138 | SchemeRegistry s = new SchemeRegistry();
139 | s.register(new Scheme("http", new PlainSocketFactory(), 80));
140 | s.register(new Scheme("https", acceptAll ? new FakeSocketFactory() : SSLSocketFactory.getSocketFactory(), 443));
141 |
142 | HttpParams httpParams = new BasicHttpParams();
143 | return new DefaultHttpClient(new ThreadSafeClientConnManager(httpParams, s), httpParams);
144 | }
145 |
146 | @Override
147 | protected Boolean doInBackground(String... params) {
148 | HttpClient client = getNewHttpClient();
149 | serverUrl = params[0];
150 | HttpPost post = new HttpPost(serverUrl + AUTH_SUFFIX);
151 | try {
152 | List nameValuePairs = new ArrayList();
153 | nameValuePairs.add(new BasicNameValuePair("code", edtLinkcode.getText().toString()));
154 | nameValuePairs.add(new BasicNameValuePair("name", android.os.Build.MODEL));
155 | post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
156 | HttpResponse response = client.execute(post);
157 | if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
158 | BufferedReader in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
159 | StringBuffer sb = new StringBuffer();
160 | String line = "";
161 | String NL = System.getProperty("line.separator");
162 | while ((line = in.readLine()) != null) {
163 | sb.append(line + NL);
164 | }
165 | in.close();
166 | JSONObject credentials = new JSONObject(sb.toString());
167 | // TODO: encrypt credentials
168 | String ident = credentials.getString("ident");
169 | String authCode = credentials.getString("authCode");
170 | SharedPreferences prefs = SettingsActivity.getSettings((ContextWrapper) getActivity());
171 | Editor editor = prefs.edit();
172 | editor.putString("ident", ident);
173 | editor.putString("authCode", authCode);
174 | editor.putString("serverUrl", serverUrl);
175 | editor.commit();
176 | }
177 | } catch (UnsupportedEncodingException e) {
178 | Log.e("Login failed", e.getLocalizedMessage());
179 | return false;
180 | } catch (ClientProtocolException e) {
181 | Log.e("Login failed", e.getLocalizedMessage());
182 | return false;
183 | } catch (IOException e) {
184 | Log.e("Login failed", e.getLocalizedMessage());
185 | return false;
186 | } catch (JSONException e) {
187 | Log.e("Login failed", e.getLocalizedMessage());
188 | return false;
189 | } catch (Exception e) {
190 | Log.e("Login failed", e.getLocalizedMessage());
191 | return false;
192 | }
193 | return true;
194 | }
195 |
196 | @Override
197 | protected void onPostExecute(Boolean successfully) {
198 | loadingDialog.dismiss();
199 | if (successfully) {
200 | Intent browseData = new Intent(getActivity(), BrowsingActivity.class);
201 | // TODO: outsource API constants
202 | browseData.putExtra("url", serverUrl + "/api/getFolderList");
203 | startActivity(browseData);
204 | } else {
205 | AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
206 | builder.setMessage(getString(R.string.login_error))
207 | .setCancelable(false)
208 | .setPositiveButton(getString(R.string.close), new DialogInterface.OnClickListener() {
209 |
210 | @Override
211 | public void onClick(DialogInterface dialog, int which) {
212 | getActivity().finish();
213 | }
214 | });
215 | AlertDialog alert = builder.create();
216 | alert.show();
217 | }
218 | }
219 | }
220 |
221 | }
222 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/ui/WelcomeFragment.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android.ui;
2 |
3 | import org.sparkleshare.android.BrowsingActivity;
4 | import org.sparkleshare.android.R;
5 | import org.sparkleshare.android.SettingsActivity;
6 |
7 | import android.content.Intent;
8 | import android.content.SharedPreferences;
9 | import android.os.Bundle;
10 | import android.support.v4.app.Fragment;
11 | import android.view.LayoutInflater;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 |
15 | public class WelcomeFragment extends Fragment {
16 |
17 | private static final String TAG = "WelcomeFragment";
18 |
19 | @Override
20 | public void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | }
23 |
24 | @Override
25 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
26 | Bundle savedInstanceState) {
27 | return inflater.inflate(R.layout.splash, container, false);
28 | }
29 |
30 | @Override
31 | public void onActivityCreated(Bundle savedInstanceState) {
32 | super.onActivityCreated(savedInstanceState);
33 | /* Found credentials, forwarding to BrowsingActivity */
34 | SharedPreferences prefs = SettingsActivity.getSettings(getActivity());
35 | if (prefs.contains("ident")) {
36 | Intent browseData = new Intent(getActivity(), BrowsingActivity.class);
37 | String serverUrl = prefs.getString("serverUrl", "");
38 | browseData.putExtra("url", serverUrl + "/api/getFolderList");
39 | startActivity(browseData);
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/utils/BitmapManager.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android.utils;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStream;
5 | import java.lang.ref.SoftReference;
6 | import java.net.MalformedURLException;
7 | import java.net.URL;
8 | import java.util.Collections;
9 | import java.util.HashMap;
10 | import java.util.Map;
11 | import java.util.WeakHashMap;
12 | import java.util.concurrent.ExecutorService;
13 | import java.util.concurrent.Executors;
14 |
15 | import android.graphics.Bitmap;
16 | import android.graphics.BitmapFactory;
17 | import android.os.Handler;
18 | import android.os.Message;
19 | import android.util.Log;
20 | import android.widget.ImageView;
21 |
22 | public enum BitmapManager {
23 |
24 | INSTANCE;
25 |
26 | private final Map> cache;
27 | private final ExecutorService pool;
28 | private Map imageViews = Collections.synchronizedMap(new WeakHashMap());
29 | private Bitmap placeHolder;
30 |
31 | BitmapManager() {
32 | cache = new HashMap>();
33 | pool = Executors.newFixedThreadPool(5);
34 | }
35 |
36 | public void setPlaceHolder(Bitmap bmp) {
37 | placeHolder = bmp;
38 | }
39 |
40 | public Bitmap getBitmapFromCache(String url) {
41 | if (cache.containsKey(url)) {
42 | return cache.get(url).get();
43 | }
44 | return null;
45 | }
46 |
47 | public void queueJob(final String url, final ImageView imageView,
48 | final int width, final int height) {
49 | /* Create handler in UI thread. */
50 | final Handler handler = new Handler() {
51 | @Override
52 | public void handleMessage(Message msg) {
53 | String tag = imageViews.get(imageView);
54 | if (tag != null && tag.equals(url)) {
55 | if (msg.obj != null) {
56 | imageView.setImageBitmap((Bitmap) msg.obj);
57 | } else {
58 | imageView.setImageBitmap(placeHolder);
59 | Log.d("BitmapManager", "fail " + url);
60 | }
61 | }
62 | }
63 | };
64 |
65 | pool.submit(new Runnable() {
66 | @Override
67 | public void run() {
68 | final Bitmap bmp = downloadBitmap(url, width, height);
69 | Message message = Message.obtain();
70 | message.obj = bmp;
71 | Log.d(null, "Item downloaded: " + url);
72 |
73 | handler.sendMessage(message);
74 | }
75 | });
76 | }
77 |
78 | public void loadBitmap(final String url, final ImageView imageView,
79 | final int width, final int height) {
80 | imageViews.put(imageView, url);
81 | Bitmap bitmap = getBitmapFromCache(url);
82 |
83 | // will be checked in UI thread causing no concurrency issues
84 | if (bitmap != null) {
85 | Log.d(null, "Item loaded from cache: " + url);
86 | imageView.setImageBitmap(bitmap);
87 | } else {
88 | imageView.setImageBitmap(placeHolder);
89 | queueJob(url, imageView, width, height);
90 | }
91 | }
92 |
93 | private Bitmap downloadBitmap(String url, int width, int height) {
94 | try {
95 | Bitmap bitmap = BitmapFactory.decodeStream((InputStream) new URL(
96 | url).getContent());
97 | bitmap = Bitmap.createScaledBitmap(bitmap, width, height, true);
98 | cache.put(url, new SoftReference(bitmap));
99 | return bitmap;
100 | } catch (MalformedURLException e) {
101 | e.printStackTrace();
102 | } catch (IOException e) {
103 | e.printStackTrace();
104 | }
105 |
106 | return null;
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/utils/ExternalDirectory.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android.utils;
2 |
3 | import java.io.File;
4 |
5 | import android.os.Environment;
6 | import org.sparkleshare.android.ui.ListEntryItem;
7 |
8 | /**
9 | * Takes care of state of external storage and creates folder structure for downloaded files
10 | *
11 | * @author kai
12 | *
13 | */
14 | public class ExternalDirectory {
15 |
16 | /**
17 | * Takes care of state of external and throws a {@link RuntimeException} if sdcard is unmounted
18 | *
19 | * @return path to external storage
20 | */
21 | private static String getExternalRootDirectory() {
22 | if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
23 | File extDir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/.sparkleshare/");
24 | if (extDir.mkdirs() || extDir.exists()) {
25 | return extDir.getAbsolutePath();
26 | } else {
27 | throw new RuntimeException("Couldn't create external directory");
28 | }
29 | } else {
30 | throw new RuntimeException("External Storage is currently not available");
31 | }
32 | }
33 |
34 | public static void createDirectory(String path){
35 | File extDir = new File(path);
36 |
37 | if(!extDir.exists()){
38 | if(!extDir.mkdirs()){
39 | throw new RuntimeException("Couldn't create external directory");
40 | }
41 | }
42 | }
43 |
44 | public static String getDownloadTargetPath(ListEntryItem item){
45 | if(item.getUrl() == null){
46 | return ExternalDirectory.getExternalRootDirectory() + "/" + item.getTitle();
47 | }
48 |
49 | return ExternalDirectory.getExternalRootDirectory() + "/" + URLPathDecoder.decode(item.getUrl());
50 | }
51 |
52 | public static boolean isMounted() {
53 | String state = Environment.getExternalStorageState();
54 | if (Environment.MEDIA_MOUNTED.equals(state)) {
55 | return true;
56 | } else {
57 | return false;
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/utils/FakeSocketFactory.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android.utils;
2 |
3 | import java.io.IOException;
4 | import java.net.InetAddress;
5 | import java.net.InetSocketAddress;
6 | import java.net.Socket;
7 | import java.net.UnknownHostException;
8 |
9 | import javax.net.ssl.SSLContext;
10 | import javax.net.ssl.SSLSocket;
11 | import javax.net.ssl.TrustManager;
12 |
13 | import org.apache.http.conn.ConnectTimeoutException;
14 | import org.apache.http.conn.scheme.LayeredSocketFactory;
15 | import org.apache.http.conn.scheme.SocketFactory;
16 | import org.apache.http.params.HttpConnectionParams;
17 | import org.apache.http.params.HttpParams;
18 |
19 | public class FakeSocketFactory implements SocketFactory, LayeredSocketFactory {
20 |
21 | private SSLContext sslcontext = null;
22 |
23 | private static SSLContext createEasySSLContext() throws IOException {
24 | try {
25 | SSLContext context = SSLContext.getInstance("TLS");
26 | context.init(null, new TrustManager[] { new FakeTrustManager() }, null);
27 | return context;
28 | } catch (Exception e) {
29 | throw new IOException(e.getMessage());
30 | }
31 | }
32 |
33 | private SSLContext getSSLContext() throws IOException {
34 | if (this.sslcontext == null) {
35 | this.sslcontext = createEasySSLContext();
36 | }
37 | return this.sslcontext;
38 | }
39 |
40 | @Override
41 | public Socket connectSocket(Socket sock, String host, int port,
42 | InetAddress localAddress, int localPort, HttpParams params) throws IOException,
43 | UnknownHostException, ConnectTimeoutException {
44 | int connTimeout = HttpConnectionParams.getConnectionTimeout(params);
45 | int soTimeout = HttpConnectionParams.getSoTimeout(params);
46 |
47 | InetSocketAddress remoteAddress = new InetSocketAddress(host, port);
48 | SSLSocket sslsock = (SSLSocket) ((sock != null) ? sock : createSocket());
49 |
50 | if ((localAddress != null) || (localPort > 0)) {
51 | // we need to bind explicitly
52 | if (localPort < 0) {
53 | localPort = 0; // indicates "any"
54 | }
55 | InetSocketAddress isa = new InetSocketAddress(localAddress,
56 | localPort);
57 | sslsock.bind(isa);
58 | }
59 |
60 | sslsock.connect(remoteAddress, connTimeout);
61 | sslsock.setSoTimeout(soTimeout);
62 | return sslsock;
63 | }
64 |
65 | @Override
66 | public Socket createSocket() throws IOException {
67 | return getSSLContext().getSocketFactory().createSocket();
68 | }
69 |
70 | @Override
71 | public boolean isSecure(Socket arg0) throws IllegalArgumentException {
72 | return true;
73 | }
74 |
75 | @Override
76 | public Socket createSocket(Socket socket, String host, int port, boolean autoClose)
77 | throws IOException, UnknownHostException {
78 | return getSSLContext().getSocketFactory().createSocket(socket, host, port, autoClose);
79 | }
80 |
81 | }
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/utils/FakeTrustManager.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android.utils;
2 |
3 | import java.security.cert.CertificateException;
4 | import java.security.cert.X509Certificate;
5 |
6 | import javax.net.ssl.X509TrustManager;
7 |
8 | public class FakeTrustManager implements X509TrustManager {
9 |
10 | private static final X509Certificate[] _AcceptedIssuers = new X509Certificate[] {};
11 |
12 | @Override
13 | public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
14 | }
15 |
16 | @Override
17 | public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
18 | }
19 |
20 | public boolean isClientTrusted(X509Certificate[] chain) {
21 | return true;
22 | }
23 |
24 | public boolean isServerTrusted(X509Certificate[] chain) {
25 | return true;
26 | }
27 |
28 | @Override
29 | public X509Certificate[] getAcceptedIssuers() {
30 | return _AcceptedIssuers;
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/utils/FormatHelper.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android.utils;
2 |
3 | public class FormatHelper {
4 |
5 | public static String formatFilesize(String filesize) {
6 | float size = Float.valueOf(filesize)/1024;
7 | if (size > (1024*1024)) {
8 | size /= (1024*1024);
9 | return String.valueOf(Math.round(size*100.0f)/100.0f) + " GB";
10 | } else if (size > 1024) {
11 | size /= 1024;
12 | return String.valueOf(Math.round(size*10.0f)/10.0f) + " MB";
13 | } else {
14 | size = Float.valueOf(filesize)/1024;
15 | return String.valueOf(Math.round(size)) + " KB";
16 | }
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/utils/MimetypeChecker.java:
--------------------------------------------------------------------------------
1 | package org.sparkleshare.android.utils;
2 |
3 | import org.sparkleshare.android.R;
4 |
5 | public class MimetypeChecker {
6 |
7 | public static int getResIdforMimetype(String mimetype) {
8 | if (mimetype.contains("application")) {
9 | return R.drawable.ic_application;
10 | } else if (mimetype.contains("image")) {
11 | return R.drawable.ic_image;
12 | } else if (mimetype.contains("text")) {
13 | return R.drawable.ic_text;
14 | } else if (mimetype.contains("dir")) {
15 | return R.drawable.ic_folder;
16 | } else if (mimetype.contains("audio")) {
17 | return R.drawable.ic_audio;
18 | } else if (mimetype.contains("video")) {
19 | return R.drawable.ic_video;
20 | } else {
21 | return R.drawable.ic_text;
22 | }
23 | }
24 |
25 | public static int getLargeIconforMimetype(String mimetype) {
26 | if (mimetype.contains("application")) {
27 | return R.drawable.application;
28 | } else if (mimetype.contains("image")) {
29 | return R.drawable.image;
30 | } else if (mimetype.contains("text")) {
31 | return R.drawable.text;
32 | } else if (mimetype.contains("audio")) {
33 | return R.drawable.audio;
34 | } else if (mimetype.contains("video")) {
35 | return R.drawable.video;
36 | } else {
37 | return R.drawable.text;
38 | }
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/org/sparkleshare/android/utils/URLPathDecoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package org.sparkleshare.android.utils;
6 |
7 |
8 | /**
9 | *
10 | * @author richy
11 | */
12 | public class URLPathDecoder {
13 |
14 | public static String decode(String url) {
15 |
16 | String path = url.replace("%2F", "/");
17 | path = path.split("=")[1].split("&")[0];
18 |
19 | return path;
20 | }
21 |
22 |
23 | }
24 |
--------------------------------------------------------------------------------