Skip to content

Commit

Permalink
Android: Added Dropbox Sync API bindings. A quick authentication test…
Browse files Browse the repository at this point in the history
… has been added to SyncActivity temporarily.

Related to issue #406.
  • Loading branch information
ycastonguay committed Oct 16, 2013
1 parent 3b64a4e commit 5ba5a05
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 12 deletions.
32 changes: 24 additions & 8 deletions MPfm/MPfm.Android/Classes/Activities/SyncActivity.cs
Expand Up @@ -24,6 +24,7 @@
using Android.Views;
using Android.OS;
using Android.Widget;
using Com.Dropbox.Sync.Android;
using MPfm.Android.Classes.Adapters;
using MPfm.Android.Classes.Fragments;
using MPfm.Android.Classes.Navigation;
Expand All @@ -39,18 +40,24 @@ namespace MPfm.Android
public class SyncActivity : BaseActivity, ISyncView
{
private MobileNavigationManager _navigationManager;
TextView _lblIPAddress;
TextView _lblStatus;
Button _btnConnectManually;
ListView _listView;
SyncListAdapter _listAdapter;
List<SyncDevice> _devices;
private TextView _lblIPAddress;
private TextView _lblStatus;
private Button _btnConnectManually;
private ListView _listView;
private SyncListAdapter _listAdapter;
private List<SyncDevice> _devices;

private DbxAccountManager _accountManager;

protected override void OnCreate(Bundle bundle)
{
Console.WriteLine("SyncActivity - OnCreate");
base.OnCreate(bundle);

string appKey = "6tc6565743i743n";
string appSecret = "fbkt3neevjjl0l2";
_accountManager = DbxAccountManager.GetInstance(ApplicationContext, appKey, appSecret);

_navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
SetContentView(Resource.Layout.Sync);
ActionBar.SetDisplayHomeAsUpEnabled(true);
Expand All @@ -72,8 +79,17 @@ protected override void OnCreate(Bundle bundle)

private void BtnConnectManuallyOnClick(object sender, EventArgs eventArgs)
{
SyncManualConnectFragment fragment = new SyncManualConnectFragment();
fragment.Show(FragmentManager, "SyncManualConnect");
if (_accountManager.HasLinkedAccount)
{
var account = _accountManager.LinkedAccount;
}
else
{
_accountManager.StartLink(this, 0);
}

//SyncManualConnectFragment fragment = new SyncManualConnectFragment();
//fragment.Show(FragmentManager, "SyncManualConnect");
}

private void ListViewOnItemClick(object sender, AdapterView.ItemClickEventArgs itemClickEventArgs)
Expand Down
Binary file added MPfm/MPfm.Android/Lib/Dropbox.Android.dll
Binary file not shown.
Binary file not shown.
Binary file added MPfm/MPfm.Android/Lib/armeabi/libDropboxSync.so
Binary file not shown.
Binary file added MPfm/MPfm.Android/Lib/x86/libDropboxSync.so
Binary file not shown.
12 changes: 9 additions & 3 deletions MPfm/MPfm.Android/MPfm.Android.csproj
Expand Up @@ -46,6 +46,10 @@
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
</PropertyGroup>
<ItemGroup>
<Reference Include="Dropbox.Android, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Lib\Dropbox.Android.dll</HintPath>
</Reference>
<Reference Include="Mono.Android" />
<Reference Include="Mono.Android.Support.v13" />
<Reference Include="mscorlib" />
Expand Down Expand Up @@ -149,6 +153,9 @@
<AndroidNativeLibrary Include="Lib\armeabi-v7a\libbass_alac.so" />
<AndroidNativeLibrary Include="Lib\armeabi-v7a\libbass_ape.so" />
<AndroidNativeLibrary Include="Lib\armeabi-v7a\libbass_fx.so" />
<AndroidNativeLibrary Include="Lib\armeabi\libDropboxSync.so" />
<AndroidNativeLibrary Include="Lib\x86\libDropboxSync.so" />
<AndroidNativeLibrary Include="Lib\armeabi-v7a\libDropboxSync.so" />
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
<AndroidResource Include="Resources\layout\Player.axml">
Expand Down Expand Up @@ -312,6 +319,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Lib\Dropbox.Android.dll" />
<Content Include="Properties\AndroidManifest.xml">
<SubType>Designer</SubType>
</Content>
Expand Down Expand Up @@ -613,9 +621,7 @@
<AndroidResource Include="Resources\drawable-xxhdpi\actionbar_playlist.png" />
<AndroidResource Include="Resources\drawable\carrouseldot.xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Lib\armeabi\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
14 changes: 13 additions & 1 deletion MPfm/MPfm.Android/Properties/AndroidManifest.xml
@@ -1,10 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" android:versionCode="1" android:versionName="Alpha" package="org.sessionsapp.android">
<uses-sdk android:targetSdkVersion="17" android:minSdkVersion="15" />
<application android:label="Sessions" android:theme="@style/MyAppTheme" android:icon="@drawable/icon"></application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<application android:label="Sessions" android:theme="@style/MyAppTheme" android:icon="@drawable/icon">
<!-- Dropbox -->
<activity android:name="com.dropbox.sync.android.DbxAuthActivity" />
<activity android:name="com.dropbox.client2.android.AuthActivity" android:launchMode="singleTask">
<intent-filter>
<data android:scheme="db-6tc6565743i743n" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service android:name="com.dropbox.sync.android.DbxSyncService" android:enabled="true" android:exported="false" android:label="Dropbox Sync" />
</application>
</manifest>

0 comments on commit 5ba5a05

Please sign in to comment.