Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for creating and sharing public url from the app #1285

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
public class ArticleActionsHelper {

private static final String TAG = ArticleActionsHelper.class.getSimpleName();
final Settings settings = App.getSettings();

public void initMenu(Menu menu, Article article) {
boolean archive = Boolean.TRUE.equals(article.getArchive());
Expand All @@ -48,6 +49,8 @@ public void initMenu(Menu menu, Article article) {
}

public boolean handleContextItemSelected(Activity activity, Article article, MenuItem item) {

String url = settings.getUrl();
switch (item.getItemId()) {
case R.id.menuArticleMarkAsRead:
case R.id.menuArticleMarkAsUnread:
Expand Down Expand Up @@ -83,6 +86,16 @@ public boolean handleContextItemSelected(Activity activity, Article article, Men
copyUrlToClipboard(activity, article.getUrl());
return true;

case R.id.menuOpenPublic:
article.setIsPublic(Boolean.TRUE);
openUrl(activity, url + "/share/" + article.getPublicUid());
return true;

case R.id.menuCopyPublicURL:
article.setIsPublic(Boolean.TRUE);
copyUrlToClipboard(activity, url + "/share/" + article.getPublicUid());
return true;

case R.id.menuDownloadAsFile:
showDownloadFileDialog(activity, article);
return true;
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/menu/article_list_context_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
<item
android:id="@+id/menuCopyOriginalURL"
android:title="@string/menuCopyOriginalURL" />
<item
android:id="@+id/menuOpenPublic"
android:title="@string/menuOpenPublic" />
<item
android:id="@+id/menuCopyPublicURL"
android:title="@string/menuCopyPublicURL" />
<item
android:id="@+id/menuDownloadAsFile"
android:title="@string/menuDownloadAsFile" />
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/menu/option_article.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
<item
android:id="@+id/menuCopyOriginalURL"
android:title="@string/menuCopyOriginalURL"/>
<item
android:id="@+id/menuOpenPublic"
android:title="@string/menuOpenPublic" />
<item
android:id="@+id/menuCopyPublicURL"
android:title="@string/menuCopyPublicURL" />
<item
android:id="@+id/menuDownloadAsFile"
android:title="@string/menuDownloadAsFile"/>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<string name="menuDelete">Delete</string>
<string name="menuOpenOriginal">Open original</string>
<string name="menuCopyOriginalURL">Copy original URL</string>
<string name="menuOpenPublic">Open public</string>
<string name="menuCopyPublicURL">Copy public URL</string>
<string name="menuTTS">Text To Speech</string>
<string name="ttsSpeed">Rate</string>
<string name="ttsPitch">Pitch</string>
Expand Down