Add text quoting

captchafix
Floens 11 years ago
parent bb0a2fbf92
commit 4f234d701d
  1. 10
      Clover/app/src/main/java/org/floens/chan/core/manager/ReplyManager.java
  2. 15
      Clover/app/src/main/java/org/floens/chan/core/manager/ThreadManager.java
  3. 1
      Clover/app/src/main/res/values/strings.xml

@ -105,7 +105,15 @@ public class ReplyManager {
* @param no the raw no to quote to. * @param no the raw no to quote to.
*/ */
public void quote(int no) { public void quote(int no) {
draft.comment = draft.comment + ">>" + no + "\n"; draft.comment += ">>" + no + "\n";
}
public void quoteInline(int no, String text) {
draft.comment += ">>" + no + "\n";
String[] lines = text.split("\n+");
for (String line : lines) {
draft.comment += ">" + line + "\n";
}
} }
/** /**

@ -232,7 +232,7 @@ public class ThreadManager implements Loader.LoaderListener {
} }
if (loader.getLoadable().isThreadMode()) { if (loader.getLoadable().isThreadMode()) {
menu.add(Menu.NONE, 5, Menu.NONE, activity.getString(R.string.post_quick_reply)); menu.add(Menu.NONE, 10, Menu.NONE, activity.getString(R.string.post_quick_reply));
} }
String[] baseOptions = activity.getResources().getStringArray(R.array.post_options); String[] baseOptions = activity.getResources().getStringArray(R.array.post_options);
@ -257,22 +257,25 @@ public class ThreadManager implements Loader.LoaderListener {
@Override @Override
public boolean onMenuItemClick(final MenuItem item) { public boolean onMenuItemClick(final MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case 5: // Quick reply case 10: // Quick reply
openReply(false); openReply(false);
// Pass through // Pass through
case 0: // Quote case 0: // Quote
ChanApplication.getReplyManager().quote(post.no); ChanApplication.getReplyManager().quote(post.no);
break; break;
case 1: // Info case 1: // Quote inline
ChanApplication.getReplyManager().quoteInline(post.no, post.comment.toString());
break;
case 2: // Info
showPostInfo(post); showPostInfo(post);
break; break;
case 2: // Show clickables case 3: // Show clickables
showPostLinkables(post); showPostLinkables(post);
break; break;
case 3: // Copy text case 4: // Copy text
copyToClipboard(post.comment.toString()); copyToClipboard(post.comment.toString());
break; break;
case 4: // Report case 5: // Report
Utils.openLink(activity, ChanUrls.getReportUrl(post.board, post.no)); Utils.openLink(activity, ChanUrls.getReportUrl(post.board, post.no));
break; break;
case 6: // Id case 6: // Id

@ -99,6 +99,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<string name="post_info">Info</string> <string name="post_info">Info</string>
<string-array name="post_options"> <string-array name="post_options">
<item>Quote</item> <item>Quote</item>
<item>Quote text</item>
<item>Info</item> <item>Info</item>
<item>Show clickables</item> <item>Show clickables</item>
<item>Copy text</item> <item>Copy text</item>

Loading…
Cancel
Save