This repository has been archived by the owner on Mar 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bademus
committed
Dec 16, 2013
1 parent
45733f6
commit 666d3af
Showing
37 changed files
with
1,146 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 *; | ||
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 100 additions & 0 deletions
100
feedly-andrss/src/main/java/org/github/bademux/feedly/andrss/FeedlyWebAuthActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
} |
Oops, something went wrong.