Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
Bademus committed Dec 16, 2013
1 parent 45733f6 commit 666d3af
Show file tree
Hide file tree
Showing 37 changed files with 1,146 additions and 3 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ There are some JUnit Integration Test. You can treat them as examples.

Features planned in nearest future:
* Fixes\Enhancements
* Documentation\JUnit tests
* AndroidLoginActivity based on WebKit along with sample RSS application
* More Documentation\JUnit tests
* Maven repo?

Warning: Library API isn't stable yet!
Expand Down
48 changes: 48 additions & 0 deletions feedly-andrss/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apply plugin: 'android'

dependencies {
compile 'com.android.support:support-v4:18.0.0'
//feedly-api
compile project(':feedly-api')

//google dependencies
compile "com.google.http-client:google-http-client-android:$versionGoogleClient"
}


buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}

idea.project { languageLevel = '1.7' }

android {
compileSdkVersion 19
buildToolsVersion "19.0.0"

defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
runProguard false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
productFlavors {
defaultFlavor {
proguardFile 'proguard-rules.txt'
}
}
}
17 changes: 17 additions & 0 deletions feedly-andrss/proguard-rules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /opt/android-studio/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
29 changes: 29 additions & 0 deletions feedly-andrss/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.github.bademux.feedly.andrss"
android:versionCode="1"
android:versionName="1.0" >

<uses-permission android:name="android.permission.INTERNET" />

<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="org.github.bademux.feedly.andrss.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="org.github.bademux.feedly.andrss.FeedlyWebAuthActivity" />
</application>

</manifest>
Binary file added feedly-andrss/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package org.github.bademux.feedly.andrss;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import org.github.bademux.feedly.api.oauth2.FeedlyOAuthConstants;

public class FeedlyWebAuthActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

//setup fullscreen
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

mProgressDialog = new ProgressDialog(this);
mProgressDialog.setTitle(getText(R.string.app_name));
mProgressDialog.setMessage(getText(R.string.msg_loading));

WebView webView = createWebView(this);
setContentView(webView);
webView.loadUrl(getIntent().getStringExtra(REQUEST_URL_TAG));
}

private WebView createWebView(Context context) {
WebView webView = new WebView(context);
webView.setWebViewClient(createWebViewClient());
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setVisibility(View.VISIBLE);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setSupportZoom(true);
webView.getSettings().setBuiltInZoomControls(false);
return webView;
}

private WebViewClient createWebViewClient() {
return new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap fav) { mProgressDialog.show(); }

@Override
public void onPageFinished(WebView view, String url) { mProgressDialog.dismiss(); }

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
mProgressDialog.dismiss();
if (url.startsWith(FeedlyOAuthConstants.REDIRECT_URI_LOCAL)
|| url.startsWith(FeedlyOAuthConstants.REDIRECT_URN)) {
FeedlyWebAuthActivity.this.finish(url);
return true;
}
return false;
}
};
}

protected void finish(String responseUrl) {
Intent intent = getIntent();
intent.putExtra(RESPONSE_URL_TAG, responseUrl);
setResult(Activity.RESULT_OK, intent);
finish();
}

public static void startActivityForResult(Activity target, String requestUrl, String state) {
Intent intend = new Intent(target, FeedlyWebAuthActivity.class);
intend.putExtra(REQUEST_URL_TAG, requestUrl);
intend.putExtra(STATE_TAG, state);
target.startActivityForResult(intend, FeedlyWebAuthActivity.REQUEST_CODE);
}

public static void startActivityForResult(Activity target, String requestUrl) {
startActivityForResult(target, requestUrl, null);
}

public static String getResponceUrl(Intent responseIntent) {
return responseIntent.getStringExtra(RESPONSE_URL_TAG);
}

private ProgressDialog mProgressDialog;

public final static int REQUEST_CODE = 0;

public final static String STATE_TAG = "STATE";

public final static String RESPONSE_URL_TAG = "ACCESS_CODE";

public final static String REQUEST_URL_TAG = "REQUEST_URL";
}
Loading

0 comments on commit 666d3af

Please sign in to comment.