mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-18 11:49:01 +00:00
Allow chat messages to be copied to clipboard
commit 61d2757fe581ea1ae084e0e576f7e0e1b2e226fb
Author: Phillip Thelen <viirus@pherth.net>
Date: Thu Aug 4 12:22:58 2016 +0200
add copy to clipboard string
commit b73d727a2251326f7860ae7b48225eb289c66f0c
Author: jjbillings <jjbillings@noctrl.edu>
Date: Wed Aug 3 08:56:06 2016 -0400
Add message into strings.xml
# Conflicts:
# Habitica/res/values/strings.xml
commit 8546ee24e8b6a9593ae729e0084879d414a1a288
Merge: ecf1f33 93f264f
Author: Jack Billings <jjbillings@noctrl.edu>
Date: Tue Aug 2 18:28:19 2016 -0400
Merge remote-tracking branch 'origin/develop' into copy-chat-message
# Conflicts:
# Habitica/res/values/strings.xml
#Conflicts resolved...
commit 93f264f0b4
Merge: 81ded07 2ddc426
Author: Jack Billings <jjbillings@noctrl.edu>
Date: Tue Aug 2 18:23:35 2016 -0400
Merge pull request #2 from HabitRPG/develop
Merge from main repo
commit ecf1f33ed0b3cf9457723353d5f1f8fa9dabeecb
Author: Jack Billings <jjbillings@noctrl.edu>
Date: Fri Jul 29 09:27:09 2016 -0400
Merge remote-tracking branch 'origin/develop' into copy-chat-message
# Conflicts:
# Habitica/res/values/strings.xml
commit e64b3bda35aff3393c33a6e0628ea3843d517e22
Merge: f6e118d 81ded07
Author: Jack Billings <jjbillings@noctrl.edu>
Date: Fri Jul 29 09:26:35 2016 -0400
Merge remote-tracking branch 'origin/develop' into copy-chat-message
# Conflicts:
# Habitica/res/values/strings.xml
commit 81ded07730
Merge: 0f70acc f5f5f00
Author: Jack Billings <jjbillings@noctrl.edu>
Date: Fri Jul 29 09:08:35 2016 -0400
Merge pull request #1 from HabitRPG/develop
Update from original repo
commit f6e118d162a6b91a0716e7d1bceeaebe0aec96cb
Author: Jack Billings <jjbillings@noctrl.edu>
Date: Fri Jul 29 09:02:12 2016 -0400
Change Toast to SnackBar
commit 8835fe418df2fb5f2e08a06fdda94f2eae9d77f3
Merge: c72a1f5 80da760
Author: Jack Billings <jjbillings@noctrl.edu>
Date: Fri Jul 29 08:59:52 2016 -0400
Change Toast to SnackBar
commit c72a1f533d120cba9be838870460e2ee7a03ee9f
Author: Jack Billings <jjbillings@noctrl.edu>
Date: Wed Jul 27 20:30:43 2016 -0400
Add feature to copy chat messages to clipboard
commit 80da7601c48d63c92f909f4a3b4c6559bd907470
Merge: 2bf900d f0d997b
Author: Phillip Thelen <viirus@pherth.net>
Date: Tue Jun 7 19:11:08 2016 +0200
Merge branch 'travis' of github.com:HabitRPG/habitrpg-android into travis
# Conflicts:
# .travis.yml
commit 2bf900df64aa241db5feeb4820b643cd0e1fa1e8
Author: Phillip Thelen <viirus@pherth.net>
Date: Tue Jun 7 19:05:37 2016 +0200
.
commit f0d997b56f37d511e66e18734716934efef3af13
Author: Phillip Thelen <viirus@pherth.net>
Date: Tue Jun 7 19:05:37 2016 +0200
.
commit 62e96caf288ae6f7260d4eb73164f082db0c7016
Author: Phillip Thelen <viirus@pherth.net>
Date: Tue Jun 7 17:16:06 2016 +0200
.
commit b0f640ced3c2a0e654a2b34ca2fe8307be0b7208
Author: Phillip Thelen <viirus@pherth.net>
Date: Tue Jun 7 17:12:09 2016 +0200
.
commit 97d3892b0e9b259e94f1920ffe6226da05fa218c
Author: Phillip Thelen <viirus@pherth.net>
Date: Tue Jun 7 16:16:04 2016 +0200
.
commit 6b89f5ee013c2711fe1872e7ff657439ab61a02d
Author: Phillip Thelen <viirus@pherth.net>
Date: Tue Jun 7 16:00:39 2016 +0200
set node version
commit 79e2b3af80741266c8ba9dda90d6a3ad40c56d0a
Author: Phillip Thelen <viirus@pherth.net>
Date: Tue Jun 7 15:44:13 2016 +0200
test
commit 11a68ba8e91e219ad1db9f7cc6bac3a203cdd60f
Author: Phillip Thelen <viirus@pherth.net>
Date: Tue Jun 7 15:16:23 2016 +0200
test different config
commit 9c96911dc31d1ba123481eb3d291aee274973474
Author: Phillip Thelen <viirus@pherth.net>
Date: Tue Jun 7 14:52:33 2016 +0200
fix config
commit 9f41579bd9289985fb98f1a46d0292f897b6b420
Author: Phillip Thelen <viirus@pherth.net>
Date: Tue Jun 7 14:48:15 2016 +0200
fix yaml
This commit is contained in:
parent
3e58f9de5d
commit
41ef950068
5 changed files with 41 additions and 0 deletions
|
|
@ -9,6 +9,11 @@
|
|||
android:icon="@drawable/ic_action_chat"
|
||||
android:title="@string/send_pm" />
|
||||
<group>
|
||||
<item
|
||||
android:id="@+id/menu.chat.copy"
|
||||
android:icon="@drawable/ic_action_warning"
|
||||
app:showAsAction="always|withText"
|
||||
android:title="@string/copy_chat_message" />
|
||||
<item
|
||||
android:id="@+id/menu.chat.flag"
|
||||
android:icon="@drawable/ic_action_warning"
|
||||
|
|
|
|||
|
|
@ -363,4 +363,6 @@ To start, which parts of your life do you want to improve?</string>
|
|||
<string name="hourglasses">hourglasses</string>
|
||||
<string name="gold_singular">gold</string>
|
||||
<string name="gems_plural">gold</string>
|
||||
<string name="chat_message_copied">Message copied to Clipboard</string>
|
||||
<string name="copy_chat_message">Copy to clipboard</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.habitrpg.android.habitica.events.commands;
|
||||
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.ChatMessage;
|
||||
|
||||
/**
|
||||
* Created by jjbillings on 7/27/16.
|
||||
*/
|
||||
public class CopyChatMessageCommand extends ChatMessageCommandBase {
|
||||
public CopyChatMessageCommand(String groupId, ChatMessage chatMessage) {
|
||||
super(groupId, chatMessage);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.habitrpg.android.habitica.ui.adapter.social;
|
|||
import com.habitrpg.android.habitica.HabiticaApplication;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.events.commands.CopyChatAsTodoCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.CopyChatMessageCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.DeleteChatMessageCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.FlagChatMessageCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.OpenNewPMActivityCommand;
|
||||
|
|
@ -446,6 +447,12 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
case R.id.menu_chat_copy: {
|
||||
EventBus.getDefault().post(new CopyChatMessageCommand(groupId, currentMsg));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.habitrpg.android.habitica.HabiticaApplication;
|
|||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.components.AppComponent;
|
||||
import com.habitrpg.android.habitica.events.ToggledInnStateEvent;
|
||||
import com.habitrpg.android.habitica.events.commands.CopyChatMessageCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.DeleteChatMessageCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.FlagChatMessageCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.SendNewGroupMessageCommand;
|
||||
|
|
@ -23,6 +24,9 @@ import com.raizlabs.android.dbflow.sql.language.Select;
|
|||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
|
|
@ -33,6 +37,7 @@ import android.support.v7.widget.RecyclerView;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -159,6 +164,16 @@ public class ChatListFragment extends BaseFragment implements SwipeRefreshLayout
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(CopyChatMessageCommand cmd)
|
||||
{
|
||||
ClipboardManager clipMan = (ClipboardManager)getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipData chatMessage = ClipData.newPlainText("Chat Message",cmd.chatMessage.text);
|
||||
clipMan.setPrimaryClip(chatMessage);
|
||||
MainActivity activity = (MainActivity) getActivity();
|
||||
UiUtils.showSnackbar(activity, activity.getFloatingMenuWrapper(), getString(R.string.chat_message_copied), UiUtils.SnackbarDisplayType.NORMAL);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(final FlagChatMessageCommand cmd) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
|
|
|
|||
Loading…
Reference in a new issue