mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
commit
38d32c38bc
7 changed files with 49 additions and 42 deletions
|
@ -6,6 +6,7 @@ import android.webkit.WebView;
|
|||
import android.webkit.WebViewClient;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.network.APIConstants;
|
||||
|
||||
public class AddFacebook extends NbFragmentActivity {
|
||||
|
||||
|
@ -22,7 +23,7 @@ public class AddFacebook extends NbFragmentActivity {
|
|||
|
||||
webview.setWebViewClient(new WebViewClient() {
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url){
|
||||
if (TextUtils.equals(url, "http://www.newsblur.com/")) {
|
||||
if (TextUtils.equals(url, APIConstants.NEWSBLUR_URL + "/")) {
|
||||
AddFacebook.this.setResult(FACEBOOK_AUTHED);
|
||||
AddFacebook.this.finish();
|
||||
return true;
|
||||
|
@ -32,7 +33,7 @@ public class AddFacebook extends NbFragmentActivity {
|
|||
}
|
||||
});
|
||||
|
||||
webview.loadUrl("http://www.newsblur.com/oauth/facebook_connect/");
|
||||
webview.loadUrl(APIConstants.URL_CONNECT_FACEBOOK);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.webkit.WebView;
|
|||
import android.webkit.WebViewClient;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.network.APIConstants;
|
||||
|
||||
public class AddTwitter extends NbFragmentActivity {
|
||||
|
||||
|
@ -22,7 +23,7 @@ public class AddTwitter extends NbFragmentActivity {
|
|||
|
||||
webview.setWebViewClient(new WebViewClient() {
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url){
|
||||
if (TextUtils.equals(url, "http://www.newsblur.com/")) {
|
||||
if (TextUtils.equals(url, APIConstants.NEWSBLUR_URL + "/")) {
|
||||
AddTwitter.this.setResult(TWITTER_AUTHED);
|
||||
AddTwitter.this.finish();
|
||||
return true;
|
||||
|
@ -32,7 +33,7 @@ public class AddTwitter extends NbFragmentActivity {
|
|||
}
|
||||
});
|
||||
|
||||
webview.loadUrl("http://www.newsblur.com/oauth/twitter_connect/");
|
||||
webview.loadUrl(APIConstants.URL_CONNECT_TWITTER);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.webkit.WebView;
|
|||
import android.webkit.WebViewClient;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.network.APIConstants;
|
||||
|
||||
public class ImportFeeds extends NbFragmentActivity {
|
||||
|
||||
|
@ -21,7 +22,7 @@ public class ImportFeeds extends NbFragmentActivity {
|
|||
|
||||
webContainer.setWebViewClient(new WebViewClient() {
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url){
|
||||
if (TextUtils.equals(url, "http://www.newsblur.com/")) {
|
||||
if (TextUtils.equals(url, APIConstants.NEWSBLUR_URL + "/")) {
|
||||
ImportFeeds.this.setResult(RESULT_OK);
|
||||
ImportFeeds.this.finish();
|
||||
return true;
|
||||
|
@ -31,7 +32,7 @@ public class ImportFeeds extends NbFragmentActivity {
|
|||
}
|
||||
});
|
||||
|
||||
webContainer.loadUrl("http://www.newsblur.com/import/authorize/");
|
||||
webContainer.loadUrl(APIConstants.URL_IMPORT_AUTHORIZATION);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,38 +2,45 @@ package com.newsblur.network;
|
|||
|
||||
public class APIConstants {
|
||||
|
||||
public static final String NEWSBLUR_URL = "https://newsblur.com";
|
||||
public static final String COOKIE_DOMAIN = ".newsblur.com";
|
||||
public static final String URL_CATEGORIES = NEWSBLUR_URL + "/categories/";
|
||||
public static final String PARAMETER_CATEGORY = "category";
|
||||
public static final String URL_ADD_CATEGORIES = NEWSBLUR_URL + "/categories/subscribe";
|
||||
public static final String URL_AUTOFOLLOW_PREF = NEWSBLUR_URL + "/profile/set_preference";
|
||||
|
||||
// TODO: make use of trailing slashes on URLs consistent or document why
|
||||
// they are not.
|
||||
|
||||
public static final String URL_LOGIN = "http://newsblur.com/api/login";
|
||||
public static final String URL_FEEDS = "http://newsblur.com/reader/feeds/";
|
||||
public static final String URL_USER_PROFILE = "http://newsblur.com/social/profile";
|
||||
public static final String URL_MY_PROFILE = "http://newsblur.com/social/load_user_profile";
|
||||
public static final String URL_FOLLOW = "http://newsblur.com/social/follow";
|
||||
public static final String URL_UNFOLLOW = "http://newsblur.com/social/unfollow";
|
||||
public static final String URL_LOGIN = NEWSBLUR_URL + "/api/login";
|
||||
public static final String URL_FEEDS = NEWSBLUR_URL + "/reader/feeds/";
|
||||
public static final String URL_USER_PROFILE = NEWSBLUR_URL + "/social/profile";
|
||||
public static final String URL_MY_PROFILE = NEWSBLUR_URL + "/social/load_user_profile";
|
||||
public static final String URL_FOLLOW = NEWSBLUR_URL + "/social/follow";
|
||||
public static final String URL_UNFOLLOW = NEWSBLUR_URL + "/social/unfollow";
|
||||
|
||||
public static final String URL_USER_INTERACTIONS = "http://newsblur.com/social/interactions";
|
||||
public static final String URL_RIVER_STORIES = "http://newsblur.com/reader/river_stories";
|
||||
public static final String URL_SHARED_RIVER_STORIES = "http://newsblur.com/social/river_stories";
|
||||
public static final String URL_USER_INTERACTIONS = NEWSBLUR_URL + "/social/interactions";
|
||||
public static final String URL_RIVER_STORIES = NEWSBLUR_URL + "/reader/river_stories";
|
||||
public static final String URL_SHARED_RIVER_STORIES = NEWSBLUR_URL + "/social/river_stories";
|
||||
|
||||
public static final String URL_FEED_STORIES = "http://newsblur.com/reader/feed";
|
||||
public static final String URL_SOCIALFEED_STORIES = "http://newsblur.com/social/stories";
|
||||
public static final String URL_SIGNUP = "http://newsblur.com/api/signup";
|
||||
public static final String URL_FEED_COUNTS = "http://newsblur.com/reader/refresh_feeds/";
|
||||
public static final String URL_MARK_FEED_AS_READ = "http://newsblur.com/reader/mark_feed_as_read/";
|
||||
public static final String URL_MARK_ALL_AS_READ = "http://newsblur.com/reader/mark_all_as_read/";
|
||||
public static final String URL_MARK_STORIES_READ = "http://newsblur.com/reader/mark_story_hashes_as_read/";
|
||||
public static final String URL_SHARE_STORY = "http://newsblur.com/social/share_story";
|
||||
public static final String URL_MARK_STORY_AS_STARRED = "http://newsblur.com/reader/mark_story_as_starred/";
|
||||
public static final String URL_MARK_STORY_AS_UNREAD = "http://newsblur.com/reader/mark_story_as_unread/";
|
||||
public static final String URL_STARRED_STORIES = "http://newsblur.com/reader/starred_stories";
|
||||
public static final String URL_FEED_AUTOCOMPLETE = "http://newsblur.com/rss_feeds/feed_autocomplete";
|
||||
public static final String URL_LIKE_COMMENT = "http://newsblur.com/social/like_comment";
|
||||
public static final String URL_UNLIKE_COMMENT = "http://newsblur.com/social/remove_like_comment";
|
||||
public static final String URL_REPLY_TO = "http://newsblur.com/social/save_comment_reply";
|
||||
public static final String URL_ADD_FEED = "http://newsblur.com/reader/add_url";
|
||||
public static final String URL_DELETE_FEED = "http://newsblur.com/reader/delete_feed";
|
||||
public static final String URL_CLASSIFIER_SAVE = "http://newsblur.com/classifier/save";
|
||||
public static final String URL_FEED_STORIES = NEWSBLUR_URL + "/reader/feed";
|
||||
public static final String URL_SOCIALFEED_STORIES = NEWSBLUR_URL + "/social/stories";
|
||||
public static final String URL_SIGNUP = NEWSBLUR_URL + "/api/signup";
|
||||
public static final String URL_FEED_COUNTS = NEWSBLUR_URL + "/reader/refresh_feeds/";
|
||||
public static final String URL_MARK_FEED_AS_READ = NEWSBLUR_URL + "/reader/mark_feed_as_read/";
|
||||
public static final String URL_MARK_ALL_AS_READ = NEWSBLUR_URL + "/reader/mark_all_as_read/";
|
||||
public static final String URL_MARK_STORIES_READ = NEWSBLUR_URL + "/reader/mark_story_hashes_as_read/";
|
||||
public static final String URL_SHARE_STORY = NEWSBLUR_URL + "/social/share_story";
|
||||
public static final String URL_MARK_STORY_AS_STARRED = NEWSBLUR_URL + "/reader/mark_story_as_starred/";
|
||||
public static final String URL_MARK_STORY_AS_UNREAD = NEWSBLUR_URL + "/reader/mark_story_as_unread/";
|
||||
public static final String URL_STARRED_STORIES = NEWSBLUR_URL + "/reader/starred_stories";
|
||||
public static final String URL_FEED_AUTOCOMPLETE = NEWSBLUR_URL + "/rss_feeds/feed_autocomplete";
|
||||
public static final String URL_LIKE_COMMENT = NEWSBLUR_URL + "/social/like_comment";
|
||||
public static final String URL_UNLIKE_COMMENT = NEWSBLUR_URL + "/social/remove_like_comment";
|
||||
public static final String URL_REPLY_TO = NEWSBLUR_URL + "/social/save_comment_reply";
|
||||
public static final String URL_ADD_FEED = NEWSBLUR_URL + "/reader/add_url";
|
||||
public static final String URL_DELETE_FEED = NEWSBLUR_URL + "/reader/delete_feed";
|
||||
public static final String URL_CLASSIFIER_SAVE = NEWSBLUR_URL + "/classifier/save";
|
||||
|
||||
public static final String PARAMETER_FEEDS = "f";
|
||||
public static final String PARAMETER_PASSWORD = "password";
|
||||
|
@ -62,10 +69,7 @@ public class APIConstants {
|
|||
public static final String PARAMETER_ORDER = "order";
|
||||
public static final String PARAMETER_READ_FILTER = "read_filter";
|
||||
|
||||
public static final String NEWSBLUR_URL = "http://newsblur.com";
|
||||
public static final String URL_CATEGORIES = "http://newsblur.com/categories/" ;
|
||||
public static final String PARAMETER_CATEGORY = "category";
|
||||
public static final String URL_ADD_CATEGORIES = "http://newsblur.com/categories/subscribe";
|
||||
public static final String URL_AUTOFOLLOW_PREF = "http://newsblur.com/profile/set_preference";
|
||||
|
||||
public static final String URL_CONNECT_FACEBOOK = NEWSBLUR_URL + "/oauth/facebook_connect/";
|
||||
public static final String URL_CONNECT_TWITTER = NEWSBLUR_URL + "/oauth/twitter_connect/";
|
||||
public static final String URL_IMPORT_AUTHORIZATION = NEWSBLUR_URL + "/import/authorize/";
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ public class APIManager {
|
|||
CookieSyncManager.createInstance(context.getApplicationContext());
|
||||
CookieManager cookieManager = CookieManager.getInstance();
|
||||
|
||||
cookieManager.setCookie(".newsblur.com", response.getCookie());
|
||||
cookieManager.setCookie(APIConstants.COOKIE_DOMAIN, response.getCookie());
|
||||
CookieSyncManager.getInstance().sync();
|
||||
}
|
||||
return registerResponse;
|
||||
|
|
|
@ -16,7 +16,6 @@ public class AppConstants {
|
|||
public static final int REGISTRATION_COMPLETED = 1;
|
||||
|
||||
public static final String FOLDER_PRE = "folder_collapsed";
|
||||
public static final String NEWSBLUR_URL = "http://www.newsblur.com";
|
||||
public static final float FONT_SIZE_LOWER_BOUND = 0.7f;
|
||||
public static final float FONT_SIZE_INCREMENT_FACTOR = 8;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import android.util.Log;
|
|||
import android.widget.ImageView;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.network.APIConstants;
|
||||
|
||||
public class ImageLoader {
|
||||
|
||||
|
@ -126,7 +127,7 @@ public class ImageLoader {
|
|||
|
||||
try {
|
||||
if (url.startsWith("/")) {
|
||||
url = AppConstants.NEWSBLUR_URL + url;
|
||||
url = APIConstants.NEWSBLUR_URL + url;
|
||||
}
|
||||
final URL imageUrl = new URL(url);
|
||||
final HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection();
|
||||
|
|
Loading…
Add table
Reference in a new issue