Added activities and classes for flattr authentication

This commit is contained in:
daniel oeh 2012-07-12 13:36:47 +02:00
parent 9539ead467
commit 8f444d9ad5
6 changed files with 129 additions and 1 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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" />

View File

@ -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;
}
}

View File

@ -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";
}