diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-07-12 13:36:47 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-07-12 13:36:47 +0200 |
commit | 8f444d9ad5a8bfafd89c36cda34c256cc143febc (patch) | |
tree | 16444846f5ee7f91e4f45bf36ca8c19a9a56f971 | |
parent | 9539ead467e13cd1c8e338d621e7bdb877afa1b3 (diff) | |
download | AntennaPod-8f444d9ad5a8bfafd89c36cda34c256cc143febc.zip |
Added activities and classes for flattr authentication
-rw-r--r-- | AndroidManifest.xml | 6 | ||||
-rw-r--r-- | res/layout/flattr_auth.xml | 30 | ||||
-rw-r--r-- | res/values/strings.xml | 8 | ||||
-rw-r--r-- | res/xml/preferences.xml | 8 | ||||
-rw-r--r-- | src/de/podfetcher/activity/FlattrAuthActivity.java | 67 | ||||
-rw-r--r-- | src/de/podfetcher/util/FlattrUtil.java | 11 |
6 files changed, 129 insertions, 1 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index b937b3ac9..1c591b410 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -89,6 +89,12 @@ </intent-filter> </receiver> <activity android:name=".activity.StorageErrorActivity"></activity> + <activity android:name=".activity.FlattrAuthActivity" android:label="@string/flattr_auth_label"> + <intent-filter> + <action android:name=".activities.FlattrAuthActivity"/> + <category android:name="android.intent.category.DEFAULT"/> + </intent-filter> + </activity> </application> </manifest>
\ No newline at end of file diff --git a/res/layout/flattr_auth.xml b/res/layout/flattr_auth.xml new file mode 100644 index 000000000..9244b786d --- /dev/null +++ b/res/layout/flattr_auth.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" > + + <TextView + android:id="@+id/txtvExplanation" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_margin="8dp" + android:text="@string/flattr_auth_explanation" /> + + <Button + android:id="@+id/but_authenticate" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_margin="8dp" + android:text="@string/authenticate_label" /> + + <Button + android:id="@+id/but_return_home" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:text="@string/return_home_label" + android:visibility="gone" /> + +</LinearLayout>
\ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 95c59c373..d4b75aad5 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -99,5 +99,13 @@ <string name="clear_queue_label">Clear queue</string> <string name="refreshing_label">Refreshing...</string> <string name="download_log_label">Download log</string> + <string name="flattr_auth_label">Flattr authentification</string> + <string name="flattr_auth_explanation">Press the button below to start the authentication process. You will be forwarded to the flattr login screen in your browser and be asked to give Antennapod the permission to flattr things. After you have given permission, you will return to this screen automatically.</string> + <string name="authenticate_label">Authenticate</string> + <string name="return_home_label">Return to home</string> + <string name="flattr_auth_success">Authentication was successful! You can now flattr things within the app.</string> + <string name="flattr_settings_label">Flattr settings</string> + <string name="pref_flattr_auth_title">Flattr Authentication</string> + <string name="pref_flattr_auth_sum">Connect your flattr account to Antennapod to flattr things from within the app.</string> </resources>
\ No newline at end of file diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index a7433ac7f..00a8b5f64 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -16,7 +16,6 @@ android:title="@string/pref_followQueue_title" /> </PreferenceCategory> <PreferenceCategory android:title="@string/network_pref" > - <ListPreference android:defaultValue="0" android:entries="@array/update_intervall_options" @@ -32,6 +31,13 @@ android:summary="@string/pref_mobileUpdate_sum" android:title="@string/pref_mobileUpdate_title" /> </PreferenceCategory> + <PreferenceCategory android:title="@string/flattr_settings_label" > + <PreferenceScreen + android:summary="@string/pref_flattr_auth_sum" + android:title="@string/pref_flattr_auth_title" > + <intent android:action=".activities.FlattrAuthActivity"/> + </PreferenceScreen> + </PreferenceCategory> <PreferenceCategory android:title="@string/other_pref" > <Preference android:title="@string/version_pref" /> <Preference android:title="@string/about_pref" /> diff --git a/src/de/podfetcher/activity/FlattrAuthActivity.java b/src/de/podfetcher/activity/FlattrAuthActivity.java new file mode 100644 index 000000000..a2fb57b7f --- /dev/null +++ b/src/de/podfetcher/activity/FlattrAuthActivity.java @@ -0,0 +1,67 @@ +package de.podfetcher.activity; + +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.Button; +import android.widget.TextView; + +import com.actionbarsherlock.app.SherlockActivity; +import com.actionbarsherlock.view.Menu; +import com.actionbarsherlock.view.MenuItem; + +import de.podfetcher.R; + +/** Guides the user through the authentication process */ +public class FlattrAuthActivity extends SherlockActivity { + private static final String TAG = "FlattrAuthActivity"; + + private TextView txtvExplanation; + private Button butAuthenticate; + private Button butReturn; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + Log.d(TAG, "Activity created"); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + setContentView(R.layout.flattr_auth); + txtvExplanation = (TextView) findViewById(R.id.txtvExplanation); + butAuthenticate = (Button) findViewById(R.id.but_authenticate); + butReturn = (Button) findViewById(R.id.but_return_home); + + butReturn.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + startActivity(new Intent(FlattrAuthActivity.this, + PodfetcherActivity.class)); + } + }); + } + + @Override + protected void onResume() { + super.onResume(); + Log.d(TAG, "Activity resumed"); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + break; + default: + return false; + } + return true; + } + +} diff --git a/src/de/podfetcher/util/FlattrUtil.java b/src/de/podfetcher/util/FlattrUtil.java new file mode 100644 index 000000000..bd94cec9a --- /dev/null +++ b/src/de/podfetcher/util/FlattrUtil.java @@ -0,0 +1,11 @@ +package de.podfetcher.util; + +/** Utility methods for doing something with flattr. */ +public class FlattrUtil { + + private static final String HOST_NAME = ""; + private static final String APP_KEY = ""; + private static final String APP_SECRET = ""; + + private static final String PREF_ACCESS_TOKEN = "de.danoeh.antennapod.preference.flattrAccessToken"; +} |