Merge branch 'Data5tream-emojis' into develop
|
|
@ -1,4 +1,5 @@
|
|||
language: android
|
||||
|
||||
android:
|
||||
components:
|
||||
# Uncomment the lines below if you want to
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@ repositories {
|
|||
url "http://dl.bintray.com/florent37/maven"
|
||||
}
|
||||
|
||||
// Markdown
|
||||
maven {
|
||||
url "https://s3.amazonaws.com/repo.commonsware.com"
|
||||
}
|
||||
|
||||
maven {
|
||||
url "https://jitpack.io"
|
||||
}
|
||||
|
|
@ -61,6 +66,12 @@ dependencies {
|
|||
// Icons
|
||||
compile 'com.mikepenz:fontawesome-typeface:4.4.0.1@aar'
|
||||
|
||||
// Emojis
|
||||
compile 'com.github.data5tream:emoji-lib:0.0.2.1'
|
||||
|
||||
// Markdown
|
||||
compile 'com.commonsware.cwac:anddown:0.2.4'
|
||||
|
||||
// Changelog Fragment, minSDK 17
|
||||
compile 'com.github.porokoro.paperboy:paperboy:2.1.0'
|
||||
|
||||
|
|
|
|||
BIN
Habitica/res/drawable-hdpi/ic_emoticon_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Habitica/res/drawable-hdpi/ic_keyboard_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 460 B |
BIN
Habitica/res/drawable-mdpi/ic_emoticon_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 762 B |
BIN
Habitica/res/drawable-mdpi/ic_keyboard_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 252 B |
BIN
Habitica/res/drawable-xhdpi/ic_emoticon_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Habitica/res/drawable-xhdpi/ic_keyboard_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 391 B |
BIN
Habitica/res/drawable-xxhdpi/ic_emoticon_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
Habitica/res/drawable-xxhdpi/ic_keyboard_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 565 B |
BIN
Habitica/res/drawable-xxxhdpi/ic_emoticon_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
Habitica/res/drawable-xxxhdpi/ic_keyboard_grey600_24dp.png
Normal file
|
After Width: | Height: | Size: 666 B |
8
Habitica/res/drawable/emoticon.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<!-- drawable/emoticon.xml -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path android:fillColor="#000" android:pathData="M12,17.5C14.33,17.5 16.3,16.04 17.11,14H6.89C7.69,16.04 9.67,17.5 12,17.5M8.5,11A1.5,1.5 0 0,0 10,9.5A1.5,1.5 0 0,0 8.5,8A1.5,1.5 0 0,0 7,9.5A1.5,1.5 0 0,0 8.5,11M15.5,11A1.5,1.5 0 0,0 17,9.5A1.5,1.5 0 0,0 15.5,8A1.5,1.5 0 0,0 14,9.5A1.5,1.5 0 0,0 15.5,11M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" />
|
||||
</vector>
|
||||
8
Habitica/res/drawable/keyboard.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<!-- drawable/keyboard.xml -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path android:fillColor="#000" android:pathData="M19,10H17V8H19M19,13H17V11H19M16,10H14V8H16M16,13H14V11H16M16,17H8V15H16M7,10H5V8H7M7,13H5V11H7M8,11H10V13H8M8,8H10V10H8M11,11H13V13H11M11,8H13V10H11M20,5H4C2.89,5 2,5.89 2,7V17A2,2 0 0,0 4,19H20A2,2 0 0,0 22,17V7C22,5.89 21.1,5 20,5Z" />
|
||||
</vector>
|
||||
|
|
@ -12,7 +12,6 @@
|
|||
android:orientation="vertical"
|
||||
android:padding="@dimen/abc_action_bar_content_inset_material">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/task_task_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -20,30 +19,58 @@
|
|||
android:layout_marginTop="@dimen/abc_action_bar_content_inset_material"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="72dp"
|
||||
app:hintTextAppearance="@style/TextAppearance.AppCompat">
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/task_text_edittext"
|
||||
<ImageButton
|
||||
android:id="@+id/emoji.toggle.btn0"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/ic_emoticon_grey600_24dp"
|
||||
android:background="@drawable/md_transparent"
|
||||
android:contentDescription="Toogle Emoji"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
app:hintTextAppearance="@style/TextAppearance.AppCompat">
|
||||
|
||||
<com.github.data5tream.emojilib.EmojiEditText
|
||||
android:id="@+id/task_text_edittext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:hint="@string/text"
|
||||
android:textColor="@android:color/black"
|
||||
android:inputType="textCapSentences" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="72dp"
|
||||
app:hintTextAppearance="@style/TextAppearance.AppCompat">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/task_notes_edittext"
|
||||
<ImageButton
|
||||
android:id="@+id/emoji.toggle.btn1"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/ic_emoticon_grey600_24dp"
|
||||
android:background="@drawable/md_transparent"
|
||||
android:contentDescription="Toogle Emoji" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
app:hintTextAppearance="@style/TextAppearance.AppCompat">
|
||||
|
||||
<com.github.data5tream.emojilib.EmojiEditText
|
||||
android:id="@+id/task_notes_edittext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:hint="@string/notes"
|
||||
android:textColor="@android:color/black"
|
||||
|
|
@ -56,7 +83,7 @@
|
|||
android:layout_height="72dp"
|
||||
app:hintTextAppearance="@style/TextAppearance.AppCompat">
|
||||
|
||||
<EditText
|
||||
<com.github.data5tream.emojilib.EmojiEditText
|
||||
android:id="@+id/task_value_edittext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -65,7 +92,7 @@
|
|||
android:textColor="@android:color/black"
|
||||
android:numeric="decimal" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -183,7 +210,15 @@
|
|||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<EditText
|
||||
<ImageButton
|
||||
android:id="@+id/emoji.toggle.btn2"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/ic_emoticon_grey600_24dp"
|
||||
android:background="@drawable/md_transparent"
|
||||
android:contentDescription="Toogle Emoji" />
|
||||
|
||||
<com.github.data5tream.emojilib.EmojiEditText
|
||||
android:id="@+id/new_checklist"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -302,4 +337,4 @@
|
|||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</ScrollView>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
android:id="@+id/delete_item_button"
|
||||
android:text="x" />
|
||||
|
||||
<EditText
|
||||
<com.github.data5tream.emojilib.EmojiEditText
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/item_edittext"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
android:button="@drawable/daily_checkbox"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
<com.github.data5tream.emojilib.EmojiTextView
|
||||
android:id="@+id/checkedTextView"
|
||||
style="@style/CardTitle"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:bind="http://schemas.android.com/tools">
|
||||
<data>
|
||||
<import type="com.magicmicky.habitrpgwrapper.lib.models.tasks.Task" />
|
||||
<import type="android.view.View"/>
|
||||
|
|
@ -58,18 +59,18 @@
|
|||
android:layout_alignParentStart="true"
|
||||
android:layout_toLeftOf="@+id/checklistIndicatorWrapper"
|
||||
android:layout_toStartOf="@+id/checklistIndicatorWrapper">
|
||||
<TextView
|
||||
<com.github.data5tream.emojilib.EmojiTextView
|
||||
android:id="@+id/checkedTextView"
|
||||
style="@style/CardTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{daily.text}" />
|
||||
<TextView
|
||||
bind:parsemarkdown="@{daily.text}" />
|
||||
<com.github.data5tream.emojilib.EmojiTextView
|
||||
android:id="@+id/notesTextView"
|
||||
style="@style/CardText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{daily.notes}"
|
||||
bind:parsemarkdown="@{daily.notes}"
|
||||
android:visibility="@{daily.notes != null ? View.VISIBLE : View.GONE}"/>
|
||||
</LinearLayout>
|
||||
<RelativeLayout android:orientation="vertical"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
android:layout_weight="8"
|
||||
app:hintTextAppearance="@style/TextAppearance.AppCompat">
|
||||
|
||||
<EditText
|
||||
<com.github.data5tream.emojilib.EmojiEditText
|
||||
android:id="@+id/editText"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
<com.github.data5tream.emojilib.EmojiTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:text="@{party.name}"
|
||||
bind:parsemarkdown="@{party.name}"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
|
|
@ -44,10 +44,11 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp">
|
||||
|
||||
<TextView android:layout_margin="5dp"
|
||||
<com.github.data5tream.emojilib.EmojiTextView
|
||||
android:layout_margin="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{party.description}" />
|
||||
bind:parsemarkdown="@{party.description}" />
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:bind="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
|
|
@ -73,19 +74,19 @@
|
|||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="@dimen/task_top_bottom_padding"
|
||||
android:paddingTop="@dimen/task_top_bottom_padding">
|
||||
<TextView
|
||||
<com.github.data5tream.emojilib.EmojiTextView
|
||||
android:id="@+id/checkedTextView"
|
||||
style="@style/CardTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{habit.text}" />
|
||||
bind:parsemarkdown="@{habit.text}" />
|
||||
|
||||
<TextView
|
||||
<com.github.data5tream.emojilib.EmojiTextView
|
||||
android:id="@+id/notesTextView"
|
||||
style="@style/CardText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{habit.notes}"
|
||||
bind:parsemarkdown="@{habit.notes}"
|
||||
android:visibility="@{habit.notes != null ? View.VISIBLE : View.GONE}"/>
|
||||
</LinearLayout>
|
||||
<View
|
||||
|
|
|
|||
|
|
@ -51,19 +51,19 @@
|
|||
android:layout_toRightOf="@+id/imageView3"
|
||||
android:layout_toEndOf="@+id/imageView3">
|
||||
|
||||
<TextView
|
||||
<com.github.data5tream.emojilib.EmojiTextView
|
||||
android:id="@+id/checkedTextView"
|
||||
style="@style/CardTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{reward.text}"/>
|
||||
bind:parsemarkdown="@{reward.text}"/>
|
||||
|
||||
<TextView
|
||||
<com.github.data5tream.emojilib.EmojiTextView
|
||||
android:id="@+id/notesTextView"
|
||||
style="@style/CardText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{reward.notes}"
|
||||
bind:parsemarkdown="@{reward.notes}"
|
||||
android:visibility="@{reward.notes != null ? View.VISIBLE : View.GONE}"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
<com.github.data5tream.emojilib.EmojiTextView
|
||||
android:id="@+id/message_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -18,6 +18,15 @@
|
|||
android:orientation="horizontal"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/emoji.toggle.btn"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_emoticon_grey600_24dp"
|
||||
android:scaleType="center"
|
||||
android:backgroundTint="@color/transparent"
|
||||
android:contentDescription="Toogle Emojis" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -25,13 +34,13 @@
|
|||
android:layout_weight="1"
|
||||
app:hintTextAppearance="@style/TextAppearance.AppCompat">
|
||||
|
||||
<EditText
|
||||
<com.github.data5tream.emojilib.EmojiEditText
|
||||
android:id="@+id/edit.new.message.text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:hint="Write Message"
|
||||
android:textColor="@android:color/black"
|
||||
android:textColor="@android:color/black" />
|
||||
android:inputType="textCapSentences" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
|
@ -44,4 +53,4 @@
|
|||
android:drawableTint="@color/white"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:bind="http://schemas.android.com/tools">
|
||||
<data>
|
||||
<import type="com.magicmicky.habitrpgwrapper.lib.models.tasks.Task" />
|
||||
<import type="android.view.View"/>
|
||||
|
|
@ -52,19 +53,19 @@
|
|||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="@dimen/task_top_bottom_padding"
|
||||
android:paddingTop="@dimen/task_top_bottom_padding">
|
||||
<CheckedTextView
|
||||
<com.github.data5tream.emojilib.EmojiTextView
|
||||
android:id="@+id/checkedTextView"
|
||||
style="@style/CardTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{todo.text}" />
|
||||
bind:parsemarkdown="@{todo.text}" />
|
||||
|
||||
<TextView
|
||||
<com.github.data5tream.emojilib.EmojiTextView
|
||||
android:id="@+id/notesTextView"
|
||||
style="@style/CardText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@{todo.notes}"
|
||||
bind:parsemarkdown="@{todo.notes}"
|
||||
android:visibility="@{todo.notes != null ? View.VISIBLE : View.GONE}" />
|
||||
</LinearLayout>
|
||||
<RelativeLayout android:orientation="vertical"
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package com.habitrpg.android.habitica.ui;
|
|||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.github.data5tream.emojilib.EmojiEditText;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.events.commands.CreateTagCommand;
|
||||
import com.habitrpg.android.habitica.ui.helpers.ViewHelper;
|
||||
|
|
@ -56,7 +56,7 @@ public class EditTextDrawer extends BasePrimaryDrawerItem<EditTextDrawer> {
|
|||
View view;
|
||||
|
||||
@Bind(R.id.editText)
|
||||
EditText editText;
|
||||
EmojiEditText editText;
|
||||
|
||||
@Bind(R.id.btnAdd)
|
||||
Button btnAdd;
|
||||
|
|
|
|||
|
|
@ -5,10 +5,12 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
|
@ -18,15 +20,21 @@ import android.widget.ArrayAdapter;
|
|||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.NumberPicker;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.data5tream.emojilib.EmojiEditText;
|
||||
import com.github.data5tream.emojilib.EmojiGridView;
|
||||
import com.github.data5tream.emojilib.EmojiPopup;
|
||||
import com.github.data5tream.emojilib.emoji.Emojicon;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.events.TaskSaveEvent;
|
||||
import com.habitrpg.android.habitica.events.commands.DeleteTaskCommand;
|
||||
import com.habitrpg.android.habitica.ui.helpers.MarkdownParser;
|
||||
import com.habitrpg.android.habitica.ui.WrapContentRecyclerViewLayoutManager;
|
||||
import com.habitrpg.android.habitica.ui.adapter.tasks.CheckListAdapter;
|
||||
import com.habitrpg.android.habitica.ui.helpers.SimpleItemTouchHelperCallback;
|
||||
|
|
@ -63,7 +71,7 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
private CheckListAdapter checklistAdapter;
|
||||
|
||||
@Bind(R.id.task_value_edittext)
|
||||
EditText taskValue;
|
||||
EmojiEditText taskValue;
|
||||
|
||||
@Bind(R.id.task_value_layout)
|
||||
TextInputLayout taskValueLayout;
|
||||
|
|
@ -81,10 +89,10 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
LinearLayout mainWrapper;
|
||||
|
||||
@Bind(R.id.task_text_edittext)
|
||||
EditText taskText;
|
||||
EmojiEditText taskText;
|
||||
|
||||
@Bind(R.id.task_notes_edittext)
|
||||
EditText taskNotes;
|
||||
EmojiEditText taskNotes;
|
||||
|
||||
@Bind(R.id.task_difficulty_spinner)
|
||||
Spinner taskDifficultySpinner;
|
||||
|
|
@ -120,14 +128,23 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
RecyclerView recyclerView;
|
||||
|
||||
@Bind(R.id.new_checklist)
|
||||
EditText newCheckListEditText;
|
||||
EmojiEditText newCheckListEditText;
|
||||
|
||||
@Bind(R.id.add_checklist_button)
|
||||
Button button;
|
||||
|
||||
@Bind(R.id.emoji_toggle_btn0)
|
||||
ImageButton emojiToggle0;
|
||||
|
||||
@Bind(R.id.emoji_toggle_btn1)
|
||||
ImageButton emojiToggle1;
|
||||
|
||||
|
||||
ImageButton emojiToggle2;
|
||||
@Bind(R.id.task_duedate_layout)
|
||||
LinearLayout dueDateLayout;
|
||||
|
||||
EmojiPopup popup;
|
||||
@Bind(R.id.task_duedate_picker)
|
||||
DatePicker dueDatePicker;
|
||||
|
||||
|
|
@ -150,7 +167,7 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
}
|
||||
|
||||
btnDelete.setEnabled(false);
|
||||
ViewHelper.SetBackgroundTint(btnDelete, getResources().getColor(R.color.worse_10));
|
||||
ViewHelper.SetBackgroundTint(btnDelete, ContextCompat.getColor(this, R.color.worse_10));
|
||||
btnDelete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
|
@ -231,11 +248,140 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
btnDelete.setEnabled(true);
|
||||
} else {
|
||||
setTitle((Task) null);
|
||||
taskText.requestFocus();
|
||||
}
|
||||
|
||||
if (taskType.equals("todo") || taskType.equals("daily")) {
|
||||
createCheckListRecyclerView();
|
||||
}
|
||||
|
||||
// Emoji keyboard stuff
|
||||
boolean isTodo = false;
|
||||
if (taskType.equals("todo")) {
|
||||
isTodo = true;
|
||||
}
|
||||
|
||||
// If it's a to-do, change the emojiToggle2 to the actual emojiToggle2 (prevents NPEs when not a to-do task)
|
||||
if (isTodo) {
|
||||
emojiToggle2 = (ImageButton) findViewById(R.id.emoji_toggle_btn2);
|
||||
} else {
|
||||
emojiToggle2 = emojiToggle0;
|
||||
}
|
||||
|
||||
popup = new EmojiPopup(emojiToggle0.getRootView(), this, ContextCompat.getColor(this, R.color.brand));
|
||||
|
||||
popup.setSizeForSoftKeyboard();
|
||||
popup.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
||||
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
changeEmojiKeyboardIcon(false);
|
||||
}
|
||||
});
|
||||
popup.setOnSoftKeyboardOpenCloseListener(new EmojiPopup.OnSoftKeyboardOpenCloseListener() {
|
||||
|
||||
@Override
|
||||
public void onKeyboardOpen(int keyBoardHeight) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyboardClose() {
|
||||
if (popup.isShowing())
|
||||
popup.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
popup.setOnEmojiconClickedListener(new EmojiGridView.OnEmojiconClickedListener() {
|
||||
|
||||
@Override
|
||||
public void onEmojiconClicked(Emojicon emojicon) {
|
||||
EmojiEditText emojiEditText = null;
|
||||
if (getCurrentFocus() == null || !isEmojiEditText(getCurrentFocus()) || emojicon == null) {
|
||||
return;
|
||||
} else {
|
||||
emojiEditText = (EmojiEditText) getCurrentFocus();
|
||||
}
|
||||
int start = emojiEditText.getSelectionStart();
|
||||
int end = emojiEditText.getSelectionEnd();
|
||||
if (start < 0) {
|
||||
emojiEditText.append(emojicon.getEmoji());
|
||||
} else {
|
||||
emojiEditText.getText().replace(Math.min(start, end),
|
||||
Math.max(start, end), emojicon.getEmoji(), 0,
|
||||
emojicon.getEmoji().length());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
popup.setOnEmojiconBackspaceClickedListener(new EmojiPopup.OnEmojiconBackspaceClickedListener() {
|
||||
|
||||
@Override
|
||||
public void onEmojiconBackspaceClicked(View v) {
|
||||
if (isEmojiEditText(getCurrentFocus())) {
|
||||
KeyEvent event = new KeyEvent(
|
||||
0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL);
|
||||
getCurrentFocus().dispatchKeyEvent(event);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
emojiToggle0.setOnClickListener(new emojiClickListener(taskText));
|
||||
emojiToggle1.setOnClickListener(new emojiClickListener(taskNotes));
|
||||
if (isTodo) {
|
||||
emojiToggle2.setOnClickListener(new emojiClickListener(newCheckListEditText));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isEmojiEditText(View view) {
|
||||
return view instanceof EmojiEditText;
|
||||
}
|
||||
|
||||
private void changeEmojiKeyboardIcon(Boolean keyboardOpened) {
|
||||
|
||||
if (keyboardOpened) {
|
||||
emojiToggle0.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_keyboard_grey600_24dp));
|
||||
emojiToggle1.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_keyboard_grey600_24dp));
|
||||
emojiToggle2.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_keyboard_grey600_24dp));
|
||||
} else {
|
||||
emojiToggle0.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_emoticon_grey600_24dp));
|
||||
emojiToggle1.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_emoticon_grey600_24dp));
|
||||
emojiToggle2.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_emoticon_grey600_24dp));
|
||||
}
|
||||
}
|
||||
|
||||
private class emojiClickListener implements View.OnClickListener {
|
||||
|
||||
EmojiEditText view;
|
||||
|
||||
public emojiClickListener(EmojiEditText view) {
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(!popup.isShowing()){
|
||||
|
||||
if(popup.isKeyBoardOpen()){
|
||||
popup.showAtBottom();
|
||||
changeEmojiKeyboardIcon(true);
|
||||
}
|
||||
|
||||
else{
|
||||
view.setFocusableInTouchMode(true);
|
||||
view.requestFocus();
|
||||
popup.showAtBottomPending();
|
||||
final InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
|
||||
changeEmojiKeyboardIcon(true);
|
||||
}
|
||||
}
|
||||
|
||||
else{
|
||||
popup.dismiss();
|
||||
changeEmojiKeyboardIcon(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createCheckListRecyclerView() {
|
||||
|
|
@ -385,9 +531,9 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
if (task.type.equals("daily")) {
|
||||
|
||||
if (task.getStartDate() != null) {
|
||||
Calendar calendar = new GregorianCalendar();
|
||||
calendar.setTime(task.getStartDate());
|
||||
startDatePicker.updateDate(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
|
||||
GregorianCalendar calendar = new GregorianCalendar();
|
||||
calendar.setTime(task.getStartDate());
|
||||
startDatePicker.updateDate(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
|
||||
}
|
||||
|
||||
if (task.getFrequency().equals("weekly")) {
|
||||
|
|
@ -420,7 +566,7 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
}
|
||||
|
||||
private boolean saveTask(Task task) {
|
||||
task.text = taskText.getText().toString();
|
||||
task.text = MarkdownParser.parseCompiled(taskText.getText());
|
||||
|
||||
if (checklistAdapter != null) {
|
||||
if (checklistAdapter.getCheckListItems() != null) {
|
||||
|
|
@ -431,7 +577,7 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
if (task.text.isEmpty())
|
||||
return false;
|
||||
|
||||
task.notes = taskNotes.getText().toString();
|
||||
task.notes = MarkdownParser.parseCompiled(taskNotes.getText());
|
||||
|
||||
if (this.taskDifficultySpinner.getSelectedItemPosition() == 0) {
|
||||
task.setPriority((float) 0.1);
|
||||
|
|
@ -451,7 +597,7 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
|
|||
break;
|
||||
|
||||
case "daily": {
|
||||
Calendar calendar = new GregorianCalendar();
|
||||
GregorianCalendar calendar = new GregorianCalendar();
|
||||
calendar.set(startDatePicker.getYear(), startDatePicker.getMonth(), startDatePicker.getDayOfMonth());
|
||||
task.setStartDate(new Date(calendar.getTimeInMillis()));
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.habitrpg.android.habitica.ui.adapter.social;
|
|||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.AppCompatEditText;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
|
|
@ -15,6 +15,8 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.data5tream.emojilib.EmojiEditText;
|
||||
import com.github.data5tream.emojilib.EmojiTextView;
|
||||
import com.habitrpg.android.habitica.HabiticaApplication;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.events.commands.CopyChatAsTodoCommand;
|
||||
|
|
@ -24,6 +26,7 @@ import com.habitrpg.android.habitica.events.commands.OpenNewPMActivityCommand;
|
|||
import com.habitrpg.android.habitica.events.commands.SendNewGroupMessageCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.ToggleInnCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.ToggleLikeMessageCommand;
|
||||
import com.habitrpg.android.habitica.ui.helpers.EmojiKeyboard;
|
||||
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
|
||||
import com.habitrpg.android.habitica.ui.helpers.ViewHelper;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.ChatMessage;
|
||||
|
|
@ -137,7 +140,7 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
|
|||
// New Msg
|
||||
@Bind(R.id.edit_new_message_text)
|
||||
@Nullable
|
||||
AppCompatEditText textNewMessage;
|
||||
EmojiEditText textNewMessage;
|
||||
|
||||
@Bind(R.id.btn_send_message)
|
||||
@Nullable
|
||||
|
|
@ -161,7 +164,7 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
|
|||
|
||||
@Bind(R.id.message_text)
|
||||
@Nullable
|
||||
TextView messageText;
|
||||
EmojiTextView messageText;
|
||||
|
||||
@Bind(R.id.ago_label)
|
||||
@Nullable
|
||||
|
|
@ -202,7 +205,7 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
|
|||
|
||||
case TYPE_NEW_MESSAGE: {
|
||||
btnSendNewMessage.setOnClickListener(this);
|
||||
int color = res.getColor(R.color.brand);
|
||||
int color = ContextCompat.getColor(context, R.color.brand);
|
||||
|
||||
// Using the Iconics buttons, it is unable to tint the background
|
||||
btnSendNewMessage.setTypeface(Iconics.findFont(FontAwesome.Icon.faw_comment).getTypeface(context));
|
||||
|
|
@ -210,6 +213,9 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
|
|||
|
||||
ViewHelper.SetBackgroundTint(btnSendNewMessage, color);
|
||||
|
||||
// Set up the emoji keyboard
|
||||
EmojiKeyboard.createKeyboard(itemView, context);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -237,7 +243,9 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
|
|||
userLabel.setText(msg.user);
|
||||
DataBindingUtils.setForegroundTintColor(userLabel, msg.getContributorForegroundColor());
|
||||
|
||||
messageText.setText(msg.text.trim());
|
||||
if (messageText != null) {
|
||||
messageText.setText(msg.parsedText);
|
||||
}
|
||||
agoLabel.setText(msg.getAgoString());
|
||||
}
|
||||
}
|
||||
|
|
@ -283,8 +291,8 @@ public class ChatRecyclerViewAdapter extends RecyclerView.Adapter<ChatRecyclerVi
|
|||
foregroundColorRes = R.color.tavern_nolikes_foreground;
|
||||
}
|
||||
|
||||
DataBindingUtils.setRoundedBackground(likeBackground, res.getColor(backgroundColorRes));
|
||||
tvLikes.setTextColor(res.getColor(foregroundColorRes));
|
||||
DataBindingUtils.setRoundedBackground(likeBackground, ContextCompat.getColor(context, backgroundColorRes));
|
||||
tvLikes.setTextColor( ContextCompat.getColor(context, foregroundColorRes));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.github.data5tream.emojilib.EmojiEditText;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.ui.helpers.ItemTouchHelperAdapter;
|
||||
import com.habitrpg.android.habitica.ui.helpers.ItemTouchHelperViewHolder;
|
||||
|
|
@ -80,7 +80,7 @@ public class CheckListAdapter extends RecyclerView.Adapter<CheckListAdapter.Item
|
|||
ItemTouchHelperViewHolder, Button.OnClickListener {
|
||||
|
||||
@Bind(R.id.item_edittext)
|
||||
EditText checkListTextView;
|
||||
EmojiEditText checkListTextView;
|
||||
|
||||
@Bind(R.id.delete_item_button)
|
||||
Button deleteButton;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import android.databinding.DataBindingUtil;
|
|||
import android.databinding.ObservableArrayList;
|
||||
import android.graphics.Rect;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
|
|
@ -23,6 +24,7 @@ import android.widget.TextView;
|
|||
import com.afollestad.materialdialogs.DialogAction;
|
||||
import com.afollestad.materialdialogs.GravityEnum;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.github.data5tream.emojilib.EmojiTextView;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.databinding.DailyItemCardBinding;
|
||||
import com.habitrpg.android.habitica.databinding.HabitItemCardBinding;
|
||||
|
|
@ -312,6 +314,7 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
public HabitViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
|
||||
binding = DataBindingUtil.bind(itemView);
|
||||
|
||||
btnPlus.setClickable(true);
|
||||
|
|
@ -340,7 +343,6 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
@Override
|
||||
public void bindHolder(Task habitItem, int position) {
|
||||
super.bindHolder(habitItem, position);
|
||||
|
||||
binding.setHabit(habitItem);
|
||||
}
|
||||
}
|
||||
|
|
@ -409,7 +411,7 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
for (ChecklistItem item : this.Item.checklist) {
|
||||
LinearLayout itemView = (LinearLayout) layoutInflater.inflate(R.layout.checklist_item_row, null);
|
||||
CheckBox checkbox = (CheckBox) itemView.findViewById(R.id.checkBox);
|
||||
TextView textView = (TextView) itemView.findViewById(R.id.checkedTextView);
|
||||
EmojiTextView textView = (EmojiTextView) itemView.findViewById(R.id.checkedTextView);
|
||||
// Populate the data into the template view using the data object
|
||||
textView.setText(item.getText());
|
||||
checkbox.setChecked(item.getCompleted());
|
||||
|
|
@ -548,7 +550,7 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private MaterialDialog createGearDialog(LinearLayout contentViewForDialog) {
|
||||
|
|
@ -562,7 +564,7 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
}
|
||||
})
|
||||
.contentGravity(GravityEnum.CENTER)
|
||||
.positiveColor(context.getResources().getColor(R.color.brand_200))
|
||||
.positiveColor(ContextCompat.getColor(context, R.color.brand_200))
|
||||
.positiveText(R.string.reward_dialog_buy)
|
||||
.title(binding.getReward().getText())
|
||||
.customView(contentViewForDialog, true)
|
||||
|
|
@ -620,7 +622,7 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
priceTextView.setPadding(10, 0, 0, 0);
|
||||
|
||||
ImageView gold = new ImageView(context);
|
||||
gold.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_header_gold));
|
||||
gold.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_header_gold));
|
||||
gold.setMinimumHeight(50);
|
||||
gold.setMinimumWidth(50);
|
||||
gold.setPadding(0, 0, 5, 0);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.habitrpg.android.habitica.ui.fragments.social;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
|
@ -12,6 +13,7 @@ import android.support.v7.widget.RecyclerView;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.habitrpg.android.habitica.APIHelper;
|
||||
import com.habitrpg.android.habitica.HabiticaApplication;
|
||||
|
|
@ -26,6 +28,7 @@ import com.habitrpg.android.habitica.events.commands.ToggleInnCommand;
|
|||
import com.habitrpg.android.habitica.events.commands.ToggleLikeMessageCommand;
|
||||
import com.habitrpg.android.habitica.ui.UiUtils;
|
||||
import com.habitrpg.android.habitica.ui.adapter.social.ChatRecyclerViewAdapter;
|
||||
import com.habitrpg.android.habitica.ui.helpers.MarkdownParser;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.ChatMessage;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.PostChatMessageResult;
|
||||
|
|
@ -121,7 +124,7 @@ public class ChatListFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||
LinearLayoutManager layoutManager;
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
ButterKnife.bind(this, view);
|
||||
|
|
@ -164,6 +167,7 @@ public class ChatListFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||
public void success(List<ChatMessage> chatMessages, Response response) {
|
||||
currentChatMessages = chatMessages;
|
||||
|
||||
//Load unparsed messages first
|
||||
ChatRecyclerViewAdapter tavernAdapter = new ChatRecyclerViewAdapter(chatMessages, ctx, userId, groupId, isTavern);
|
||||
|
||||
if(mRecyclerView != null) {
|
||||
|
|
@ -173,6 +177,9 @@ public class ChatListFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||
swipeRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
|
||||
//Parse chatMessages in AsyncTask
|
||||
ParseMessages parseMessages = new ParseMessages(chatMessages);
|
||||
parseMessages.execute();
|
||||
gotNewMessages = true;
|
||||
|
||||
markMessagesAsSeen();
|
||||
|
|
@ -183,7 +190,7 @@ public class ChatListFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||
|
||||
private void markMessagesAsSeen(){
|
||||
if(!isTavern && seenGroupId != null && !seenGroupId.isEmpty()
|
||||
&& gotNewMessages && navigatedOnceToFragment) {
|
||||
&& gotNewMessages && navigatedOnceToFragment) {
|
||||
|
||||
gotNewMessages = false;
|
||||
|
||||
|
|
@ -319,4 +326,34 @@ public class ChatListFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
private class ParseMessages extends AsyncTask<Void, Void, Void> {
|
||||
private List<ChatMessage> chatMessages;
|
||||
|
||||
public ParseMessages(List<ChatMessage> chatMessages) {
|
||||
this.chatMessages = chatMessages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
|
||||
for (int i = 0; i < chatMessages.size() ; i++) {
|
||||
chatMessages.get(i).parsedText = MarkdownParser.parseMarkdown(chatMessages.get(i).text);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void onPostExecute(Void result) {
|
||||
ChatRecyclerViewAdapter tavernAdapter = new ChatRecyclerViewAdapter(chatMessages, ctx, userId, groupId, isTavern);
|
||||
|
||||
if(mRecyclerView != null) {
|
||||
mRecyclerView.setAdapter(tavernAdapter);
|
||||
}
|
||||
|
||||
if (swipeRefreshLayout != null) {
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.data5tream.emojilib.EmojiTextView;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.databinding.ValueBarBinding;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
|
@ -115,6 +116,13 @@ public class DataBindingUtils {
|
|||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("parsemarkdown")
|
||||
public static void bindEmojiconTextView(EmojiTextView textView, CharSequence value) {
|
||||
if (value != null) {
|
||||
textView.setText(MarkdownParser.parseMarkdown(value.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
public static class LayoutWeightAnimation extends Animation {
|
||||
float targetWeight;
|
||||
float initializeWeight;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,127 @@
|
|||
package com.habitrpg.android.habitica.ui.helpers;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.PopupWindow;
|
||||
|
||||
import com.github.data5tream.emojilib.EmojiEditText;
|
||||
import com.github.data5tream.emojilib.EmojiGridView;
|
||||
import com.github.data5tream.emojilib.EmojiPopup;
|
||||
import com.github.data5tream.emojilib.emoji.Emojicon;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
|
||||
/**
|
||||
* @author data5tream
|
||||
*/
|
||||
public class EmojiKeyboard {
|
||||
|
||||
/**
|
||||
* Create a Emoji keyboard
|
||||
*
|
||||
* @param itemView Must contain views with the following IDs:
|
||||
* 'emoji.toggle.btn' for the ImageButton that is used to enable/disable the emoji keyboard
|
||||
* 'edit.new.message.text' for the EmojiEditText where the emojis are put into
|
||||
* @param context The context from the calling Activity
|
||||
*/
|
||||
public static void createKeyboard(View itemView, final Context context) {
|
||||
|
||||
final ImageButton emojiButton = (ImageButton) itemView.findViewById(R.id.emoji_toggle_btn);
|
||||
final EmojiEditText emojiEditText = (EmojiEditText) itemView.findViewById(R.id.edit_new_message_text);
|
||||
final EmojiPopup popup = new EmojiPopup(itemView.getRootView(), context, ContextCompat.getColor(context, R.color.brand));
|
||||
|
||||
popup.setSizeForSoftKeyboard();
|
||||
|
||||
popup.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
||||
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
changeEmojiKeyboardIcon(emojiButton, context, false);
|
||||
}
|
||||
});
|
||||
|
||||
popup.setOnSoftKeyboardOpenCloseListener(new EmojiPopup.OnSoftKeyboardOpenCloseListener() {
|
||||
|
||||
@Override
|
||||
public void onKeyboardOpen(int keyBoardHeight) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyboardClose() {
|
||||
if(popup.isShowing())
|
||||
popup.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
popup.setOnEmojiconClickedListener(new EmojiGridView.OnEmojiconClickedListener() {
|
||||
|
||||
@Override
|
||||
public void onEmojiconClicked(Emojicon emojicon) {
|
||||
if (emojiEditText == null || emojicon == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int start = emojiEditText.getSelectionStart();
|
||||
int end = emojiEditText.getSelectionEnd();
|
||||
if (start < 0) {
|
||||
emojiEditText.append(emojicon.getEmoji());
|
||||
} else {
|
||||
emojiEditText.getText().replace(Math.min(start, end),
|
||||
Math.max(start, end), emojicon.getEmoji(), 0,
|
||||
emojicon.getEmoji().length());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
popup.setOnEmojiconBackspaceClickedListener(new EmojiPopup.OnEmojiconBackspaceClickedListener() {
|
||||
|
||||
@Override
|
||||
public void onEmojiconBackspaceClicked(View v) {
|
||||
KeyEvent event = new KeyEvent(
|
||||
0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL);
|
||||
emojiEditText.dispatchKeyEvent(event);
|
||||
}
|
||||
});
|
||||
|
||||
emojiButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if(!popup.isShowing()){
|
||||
|
||||
if(popup.isKeyBoardOpen()){
|
||||
popup.showAtBottom();
|
||||
changeEmojiKeyboardIcon(emojiButton, context, true);
|
||||
}
|
||||
|
||||
else{
|
||||
emojiEditText.setFocusableInTouchMode(true);
|
||||
emojiEditText.requestFocus();
|
||||
popup.showAtBottomPending();
|
||||
final InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.showSoftInput(emojiEditText, InputMethodManager.SHOW_IMPLICIT);
|
||||
changeEmojiKeyboardIcon(emojiButton, context, true);
|
||||
}
|
||||
}
|
||||
|
||||
else{
|
||||
popup.dismiss();
|
||||
changeEmojiKeyboardIcon(emojiButton, context, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
private static void changeEmojiKeyboardIcon(ImageButton view, Context context, Boolean keyboardOpened) {
|
||||
|
||||
if (keyboardOpened) {
|
||||
view.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_keyboard_grey600_24dp));
|
||||
} else {
|
||||
view.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_emoticon_grey600_24dp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.habitrpg.android.habitica.ui.helpers;
|
||||
|
||||
import android.text.Html;
|
||||
|
||||
import com.commonsware.cwac.anddown.AndDown;
|
||||
import com.github.data5tream.emojilib.EmojiParser;
|
||||
|
||||
/**
|
||||
* @author data5tream
|
||||
*/
|
||||
public class MarkdownParser {
|
||||
|
||||
static AndDown processor = new AndDown();
|
||||
|
||||
/**
|
||||
* Parses formatted markdown and returns it as styled CharSequence
|
||||
*
|
||||
* @param input Markdown formatted String
|
||||
* @return Stylized CharSequence
|
||||
*/
|
||||
public static CharSequence parseMarkdown(String input) {
|
||||
CharSequence output = Html.fromHtml(processor.markdownToHtml(EmojiParser.parseEmojis(input.trim())));
|
||||
if (output.length() >= 2) output = output.subSequence(0, output.length() - 2);
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts stylized CharSequence into markdown
|
||||
*
|
||||
* @param input Stylized CharSequence
|
||||
* @return Markdown formatted String
|
||||
*/
|
||||
public static String parseCompiled(CharSequence input) {
|
||||
return EmojiParser.convertToCheatCode(input.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -32,6 +32,8 @@ public class ChatMessage {
|
|||
|
||||
public String text;
|
||||
|
||||
public CharSequence parsedText;
|
||||
|
||||
public long timestamp;
|
||||
|
||||
public HashMap<String, Boolean> likes;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ public class Task extends BaseModel {
|
|||
public static final String FREQUENCY_WEEKLY = "weekly";
|
||||
public static final String FREQUENCY_DAILY = "daily";
|
||||
|
||||
|
||||
@Column
|
||||
@PrimaryKey
|
||||
@NotNull
|
||||
|
|
|
|||