mirror of
https://github.com/gsantner/dandelion
synced 2024-11-25 05:42:10 +01:00
Commented DiasporaUrlHelper and added license
This commit is contained in:
parent
c2e5dab920
commit
be54e65abe
2 changed files with 99 additions and 4 deletions
|
@ -1025,7 +1025,6 @@ public class MainActivity extends AppCompatActivity
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case R.id.nav_exit: {
|
case R.id.nav_exit: {
|
||||||
moveTaskToBack(true);
|
moveTaskToBack(true);
|
||||||
finish();
|
finish();
|
||||||
|
|
|
@ -1,10 +1,30 @@
|
||||||
|
/*
|
||||||
|
This file is part of the Diaspora for Android.
|
||||||
|
|
||||||
|
Diaspora for Android is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Diaspora for Android is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with the Diaspora for Android.
|
||||||
|
|
||||||
|
If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.github.dfa.diaspora_android.util;
|
package com.github.dfa.diaspora_android.util;
|
||||||
|
|
||||||
import com.github.dfa.diaspora_android.data.AppSettings;
|
import com.github.dfa.diaspora_android.data.AppSettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by vanitas on 10.08.16.
|
* Helper class that provides easy access to specific urls related to diaspora
|
||||||
|
* Created by vanitasvitae on 10.08.16.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class DiasporaUrlHelper {
|
public class DiasporaUrlHelper {
|
||||||
private AppSettings settings;
|
private AppSettings settings;
|
||||||
|
|
||||||
|
@ -31,66 +51,142 @@ public class DiasporaUrlHelper {
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url of the pod set in AppSettings.
|
||||||
|
* Eg. https://pod.geraspora.de
|
||||||
|
* @return https://(pod-domain.tld)
|
||||||
|
*/
|
||||||
public String getPodUrl() {
|
public String getPodUrl() {
|
||||||
return HTTPS+settings.getPodDomain();
|
return HTTPS+settings.getPodDomain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that points to the stream of the configured diaspora account
|
||||||
|
* @return https://(pod-domain.tld)/stream
|
||||||
|
*/
|
||||||
public String getStreamUrl() {
|
public String getStreamUrl() {
|
||||||
return getPodUrl()+SUBURL_STREAM;
|
return getPodUrl()+SUBURL_STREAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that points to the notifications feed of the configured diaspora account
|
||||||
|
* @return https://(pod-domain.tld)/notifications
|
||||||
|
*/
|
||||||
public String getNotificationsUrl() {
|
public String getNotificationsUrl() {
|
||||||
return getPodUrl()+SUBURL_NOTIFICATIONS;
|
return getPodUrl()+SUBURL_NOTIFICATIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPostsUrl() {
|
/**
|
||||||
return getPodUrl()+SUBURL_POSTS;
|
* Returns a https url that points to the post with the id postId
|
||||||
|
* @return https://(pod-domain.tld)/posts/(postId)
|
||||||
|
*/
|
||||||
|
public String getPostsUrl(long postId) {
|
||||||
|
return getPodUrl()+SUBURL_POSTS+postId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that points to the conversations overview of the registered diaspora account
|
||||||
|
* @return https://(pod-domain.tld)/conversations
|
||||||
|
*/
|
||||||
public String getConversationsUrl() {
|
public String getConversationsUrl() {
|
||||||
return getPodUrl()+SUBURL_CONVERSATIONS;
|
return getPodUrl()+SUBURL_CONVERSATIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that points to the new-post form that lets the user create a new post
|
||||||
|
* @return https://(pod-domain.tld)/status_messages/new
|
||||||
|
*/
|
||||||
public String getNewPostUrl() {
|
public String getNewPostUrl() {
|
||||||
return getPodUrl()+SUBURL_NEW_POST;
|
return getPodUrl()+SUBURL_NEW_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that shows the profile of the currently registered diaspora account
|
||||||
|
* @return https://(pod-domain.tld)/people/(profileId)
|
||||||
|
*/
|
||||||
public String getProfileUrl() {
|
public String getProfileUrl() {
|
||||||
return getPodUrl()+SUBURL_PEOPLE+settings.getProfileId();
|
return getPodUrl()+SUBURL_PEOPLE+settings.getProfileId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that shows the profile of the user with user id profileId
|
||||||
|
* @param profileId Id of the profile to be shown
|
||||||
|
* @return https://(pod-domain.tld)/people/(profileId)
|
||||||
|
*/
|
||||||
|
public String getProfileUrl(long profileId) {
|
||||||
|
return getPodUrl()+SUBURL_PEOPLE+profileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that points to the activities feed of the currently registered diaspora account
|
||||||
|
* @return https://(pod-domain.tld)/activity
|
||||||
|
*/
|
||||||
public String getActivityUrl() {
|
public String getActivityUrl() {
|
||||||
return getPodUrl()+SUBURL_ACTIVITY;
|
return getPodUrl()+SUBURL_ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that points to the feed of posts that were liked by the currently registered diaspora account
|
||||||
|
* @return https://(pod-domain.tld)/liked
|
||||||
|
*/
|
||||||
public String getLikedPostsUrl() {
|
public String getLikedPostsUrl() {
|
||||||
return getPodUrl()+SUBURL_LIKED;
|
return getPodUrl()+SUBURL_LIKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that points to the stream of posts that were commented by the currently registered diaspora account
|
||||||
|
* @return https://(pod-domain.tld)/commented
|
||||||
|
*/
|
||||||
public String getCommentedUrl() {
|
public String getCommentedUrl() {
|
||||||
return getPodUrl()+SUBURL_COMMENTED;
|
return getPodUrl()+SUBURL_COMMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that points to the stream of posts in which the currently registered diaspora account has been mentioned in
|
||||||
|
* @return https://(pod-domain.tld)/mentions
|
||||||
|
*/
|
||||||
public String getMentionsUrl() {
|
public String getMentionsUrl() {
|
||||||
return getPodUrl()+SUBURL_MENTIONS;
|
return getPodUrl()+SUBURL_MENTIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that points to the stream of public posts
|
||||||
|
* @return https://(pod-domain.tld)/public
|
||||||
|
*/
|
||||||
public String getPublicUrl() {
|
public String getPublicUrl() {
|
||||||
return getPodUrl()+SUBURL_PUBLIC;
|
return getPodUrl()+SUBURL_PUBLIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that toggles between mobile and desktop view when opened
|
||||||
|
* @return https://(pod-domain.tld)/mobile/toggle
|
||||||
|
*/
|
||||||
public String getToggleMobileUrl() {
|
public String getToggleMobileUrl() {
|
||||||
return getPodUrl()+SUBURL_TOGGLE_MOBILE;
|
return getPodUrl()+SUBURL_TOGGLE_MOBILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that queries posts for the given hashtag query
|
||||||
|
* @param query hashtag to be searched
|
||||||
|
* @return https://(pod-domain.tld)/tags/query
|
||||||
|
*/
|
||||||
public String getSearchTagsUrl(String query) {
|
public String getSearchTagsUrl(String query) {
|
||||||
return getPodUrl()+SUBURL_SEARCH_TAGS+query;
|
return getPodUrl()+SUBURL_SEARCH_TAGS+query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a https url that queries user accounts for query
|
||||||
|
* @param query search term
|
||||||
|
* @return https://(pod-domain.tld)/people.mobile?q=(query)
|
||||||
|
*/
|
||||||
public String getSearchPeopleUrl(String query) {
|
public String getSearchPeopleUrl(String query) {
|
||||||
return getPodUrl()+SUBURL_SEARCH_PEOPLE+query;
|
return getPodUrl()+SUBURL_SEARCH_PEOPLE+query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the url of the blank WebView
|
||||||
|
* @return about:blank
|
||||||
|
*/
|
||||||
public String getBlankUrl() {
|
public String getBlankUrl() {
|
||||||
return URL_BLANK;
|
return URL_BLANK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue