add enclosure url share button
This commit is contained in:
parent
4686603697
commit
8f88419419
@ -82,6 +82,13 @@
|
|||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:text="@string/attachment_view" />
|
android:text="@string/attachment_view" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/attachment_share"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:text="@string/attachment_share" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/attachment_copy"
|
android:id="@+id/attachment_copy"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -129,4 +129,5 @@
|
|||||||
<string name="notify_article_unpublished">Article unpublished</string>
|
<string name="notify_article_unpublished">Article unpublished</string>
|
||||||
<string name="notify_article_note_set">Article note saved</string>
|
<string name="notify_article_note_set">Article note saved</string>
|
||||||
<string name="update_headlines">Refresh</string>
|
<string name="update_headlines">Refresh</string>
|
||||||
|
<string name="attachment_share">Share</string>
|
||||||
</resources>
|
</resources>
|
@ -42,7 +42,8 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonE
|
|||||||
private String m_api;
|
private String m_api;
|
||||||
private boolean m_trustAny = false;
|
private boolean m_trustAny = false;
|
||||||
private boolean m_transportDebugging = false;
|
private boolean m_transportDebugging = false;
|
||||||
protected int m_httpStatusCode = 0;
|
protected int m_responseCode = 0;
|
||||||
|
protected String m_responseMessage;
|
||||||
protected int m_apiStatusCode = 0;
|
protected int m_apiStatusCode = 0;
|
||||||
protected Context m_context;
|
protected Context m_context;
|
||||||
private SharedPreferences m_prefs;
|
private SharedPreferences m_prefs;
|
||||||
@ -154,10 +155,11 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonE
|
|||||||
out.write(postData);
|
out.write(postData);
|
||||||
out.close();
|
out.close();
|
||||||
|
|
||||||
m_httpStatusCode = conn.getResponseCode();
|
m_responseCode = conn.getResponseCode();
|
||||||
|
m_responseMessage = conn.getResponseMessage();
|
||||||
|
|
||||||
switch (m_httpStatusCode) {
|
switch (m_responseCode) {
|
||||||
case 200:
|
case HttpURLConnection.HTTP_OK:
|
||||||
BufferedReader buffer = new BufferedReader(
|
BufferedReader buffer = new BufferedReader(
|
||||||
new InputStreamReader(conn.getInputStream()), 8192);
|
new InputStreamReader(conn.getInputStream()), 8192);
|
||||||
|
|
||||||
@ -201,16 +203,16 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonE
|
|||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
case 401:
|
case HttpURLConnection.HTTP_UNAUTHORIZED:
|
||||||
m_lastError = ApiError.HTTP_UNAUTHORIZED;
|
m_lastError = ApiError.HTTP_UNAUTHORIZED;
|
||||||
break;
|
break;
|
||||||
case 403:
|
case HttpURLConnection.HTTP_FORBIDDEN:
|
||||||
m_lastError = ApiError.HTTP_FORBIDDEN;
|
m_lastError = ApiError.HTTP_FORBIDDEN;
|
||||||
break;
|
break;
|
||||||
case 404:
|
case HttpURLConnection.HTTP_NOT_FOUND:
|
||||||
m_lastError = ApiError.HTTP_NOT_FOUND;
|
m_lastError = ApiError.HTTP_NOT_FOUND;
|
||||||
break;
|
break;
|
||||||
case 500:
|
case HttpURLConnection.HTTP_INTERNAL_ERROR:
|
||||||
m_lastError = ApiError.HTTP_SERVER_ERROR;
|
m_lastError = ApiError.HTTP_SERVER_ERROR;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -214,7 +214,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
String strUrl = url.toString().trim();
|
String strUrl = url.toString().trim();
|
||||||
|
|
||||||
if (a.content_type.indexOf("image") != -1 && !articleContent.contains(strUrl)) {
|
if (a.content_type.indexOf("image") != -1 && !articleContent.contains(strUrl)) {
|
||||||
content += "<br/><img src=\"" + strUrl.replace("\"", "\\\"") + "\">";
|
content += "<p><img src=\"" + strUrl.replace("\"", "\\\"") + "\"></p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
spinnerArray.add(a);
|
spinnerArray.add(a);
|
||||||
@ -256,7 +256,25 @@ public class ArticleFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Button attachmentsShare = (Button) view.findViewById(R.id.attachment_share);
|
||||||
|
|
||||||
|
if (!m_activity.isPortrait()) {
|
||||||
|
attachmentsShare.setOnClickListener(new OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Attachment attachment = (Attachment) spinner.getSelectedItem();
|
||||||
|
|
||||||
|
if (attachment != null) {
|
||||||
|
m_activity.shareText(attachment.content_url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
attachmentsShare.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
view.findViewById(R.id.attachments_holder).setVisibility(View.GONE);
|
view.findViewById(R.id.attachments_holder).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -964,6 +964,16 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
return tmp.replaceAll(",$", "");
|
return tmp.replaceAll(",$", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void shareText(String text) {
|
||||||
|
|
||||||
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||||
|
|
||||||
|
intent.setType("text/plain");
|
||||||
|
intent.putExtra(Intent.EXTRA_TEXT, text);
|
||||||
|
|
||||||
|
startActivity(Intent.createChooser(intent, text));
|
||||||
|
}
|
||||||
|
|
||||||
public void shareArticle(Article article) {
|
public void shareArticle(Article article) {
|
||||||
if (article != null) {
|
if (article != null) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user