コンテキストメニューに「URLを共有」を追加

This commit is contained in:
tateisu 2018-08-17 13:12:36 +09:00
parent 7ceb9e4f51
commit 09d2d69ea6
7 changed files with 49 additions and 2 deletions

View File

@ -2846,7 +2846,7 @@ class Column(
}
if(isMisskey) {
log.d("refresh-status-offset: misskey does not allows gap reading.")
log.d("refresh-status-offset: Misskey does not allow gap reading.")
addOne(list_tmp, TootGap(max_id, last_since_id))
bGapAdded = true
break

View File

@ -3,6 +3,7 @@ package jp.juggler.subwaytooter
import android.annotation.SuppressLint
import android.app.Dialog
import android.graphics.PorterDuff
import android.support.v4.app.ShareCompat
import android.support.v7.app.AlertDialog
import android.view.View
import android.view.WindowManager
@ -150,6 +151,8 @@ internal class DlgContextMenu(
viewRoot.findViewById<View>(R.id.btnQuoteUrlStatus).setOnClickListener(this)
viewRoot.findViewById<View>(R.id.btnQuoteUrlAccount).setOnClickListener(this)
viewRoot.findViewById<View>(R.id.btnShareUrlStatus).setOnClickListener(this)
viewRoot.findViewById<View>(R.id.btnShareUrlAccount).setOnClickListener(this)
viewRoot.findViewById<View>(R.id.btnQuoteName).setOnClickListener(this)
val account_list = SavedAccount.loadAccountList(activity)
@ -648,7 +651,13 @@ internal class DlgContextMenu(
R.id.btnQuoteUrlAccount -> who?.url?.let { url ->
if(url.isNotEmpty()) Action_Account.openPost(activity, url)
}
R.id.btnShareUrlStatus -> status?.url?.let { url ->
if(url.isNotEmpty()) shareText(activity, url)
}
R.id.btnShareUrlAccount -> who?.url?.let { url ->
if(url.isNotEmpty()) shareText(activity, url)
}
R.id.btnNotificationDelete -> notification?.let { notification ->
Action_Notification.deleteOne(activity, access_info, notification)
}
@ -668,6 +677,13 @@ internal class DlgContextMenu(
}
}
private fun shareText(activity : ActMain, text : String) {
ShareCompat.IntentBuilder.from(activity)
.setText(text)
.setType("text/plain")
.startChooser()
}
override fun onLongClick(v : View) : Boolean {
val who = whoRef?.get()

View File

@ -1030,7 +1030,7 @@ internal class ItemViewHolder(
btnSearchTag, llTrendTag -> when(item) {
is TootGap -> {
if( access_info.isMisskey){
showToast(activity,false, "Misskey does not allows gap reading.")
showToast(activity,false, "Misskey does not allow gap reading.")
}else {
column.startGap(item)
}

View File

@ -87,6 +87,20 @@
android:textAllCaps="false"
/>
<Button
android:id="@+id/btnShareUrlStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_bg_transparent"
android:gravity="start|center_vertical"
android:minHeight="32dp"
android:paddingBottom="4dp"
android:paddingEnd="8dp"
android:paddingStart="8dp"
android:paddingTop="4dp"
android:text="@string/share_url_more"
android:textAllCaps="false"
/>
<Button
android:id="@+id/btnBoostedBy"
android:layout_width="match_parent"
@ -467,6 +481,20 @@
android:text="@string/quote_url"
android:textAllCaps="false"
/>
<Button
android:id="@+id/btnShareUrlAccount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_bg_transparent"
android:gravity="start|center_vertical"
android:minHeight="32dp"
android:paddingBottom="4dp"
android:paddingEnd="8dp"
android:paddingStart="8dp"
android:paddingTop="4dp"
android:text="@string/share_url_more"
android:textAllCaps="false"
/>
<Button
android:id="@+id/btnQuoteName"

View File

@ -587,6 +587,7 @@
<string name="open_browser_of">Open \"%1$s\" in browser</string>
<string name="open_in_browser">Open in browser</string>
<string name="share_url">Share URL</string>
<string name="share_url_more">Share URL…</string>
<string name="copy_url">Copy URL to clipboard</string>
<string name="media_attachment_empty">Missing media attachments.</string>
<string name="media_attachment_type_error">The type of media attachment is \"%1$s\". ST can\'t handle it, but you can try open in browser.</string>

View File

@ -869,6 +869,7 @@
<string name="open_browser_of">\"%1$s\"をブラウザで開く</string>
<string name="open_in_browser">ブラウザで開く</string>
<string name="share_url">URLを共有</string>
<string name="share_url_more">URLを共有…</string>
<string name="copy_url">URLをクリップボードにコピー</string>
<string name="media_attachment_empty">添付メディアがありません</string>
<string name="media_attachment_type_error">添付メディアの種類\"%1$s\"はこのアプリでは開けません。下の「…」にある「ブラウザで開く」を試すことができます</string>

View File

@ -575,6 +575,7 @@
<string name="open_browser_of">Open \"%1$s\" in browser</string>
<string name="open_in_browser">Open in browser</string>
<string name="share_url">Share URL</string>
<string name="share_url_more">Share URL…</string>
<string name="copy_url">Copy URL to clipboard</string>
<string name="media_attachment_empty">Missing media attachments.</string>
<string name="media_attachment_type_error">The type of media attachment is \"%1$s\". ST can\'t handle it, but you can try open in browser.</string>