Fixes media attachments in the composer being un-removable, and long usernames overlapping time stamps in statuses.

Also added the MIT license notice to the EmojiOne code to comply with its usage terms.
This commit is contained in:
Vavassor 2017-03-07 20:44:51 -05:00
parent dc75939d50
commit 1ddb17f8d3
4 changed files with 36 additions and 14 deletions

View file

@ -1,3 +1,22 @@
/* (MIT License)
*
* Copyright 2014-2016 Marco Pracucci
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
package com.emojione; package com.emojione;
import android.os.Build; import android.os.Build;

View file

@ -38,7 +38,6 @@ import android.os.Bundle;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.provider.OpenableColumns; import android.provider.OpenableColumns;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;
@ -65,9 +64,7 @@ import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnection;
import android.webkit.MimeTypeMap; import android.webkit.MimeTypeMap;
import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
@ -390,7 +387,10 @@ public class ComposeActivity extends BaseActivity {
textEditor.onRestoreInstanceState(savedInstanceState.getParcelable("textEditorState")); textEditor.onRestoreInstanceState(savedInstanceState.getParcelable("textEditorState"));
} }
RelativeLayout editArea = (RelativeLayout) findViewById(R.id.compose_edit_area); RelativeLayout editArea = (RelativeLayout) findViewById(R.id.compose_edit_area);
editArea.addView(textEditor); /* Adding this at index zero because it implicitly gives it the lowest input priority. So,
* when media previews are added in front of the editor, they can receive click events
* without the text editor stealing the events from behind them. */
editArea.addView(textEditor, 0);
final TextView charactersLeft = (TextView) findViewById(R.id.characters_left); final TextView charactersLeft = (TextView) findViewById(R.id.characters_left);
final int mentionColour = ThemeUtils.getColor(this, R.attr.compose_mention_color); final int mentionColour = ThemeUtils.getColor(this, R.attr.compose_mention_color);
TextWatcher textEditorWatcher = new TextWatcher() { TextWatcher textEditorWatcher = new TextWatcher() {

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_compose" android:id="@+id/activity_compose"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">

View file

@ -53,10 +53,21 @@
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:paddingTop="@dimen/status_avatar_padding"> android:paddingTop="@dimen/status_avatar_padding">
<TextView
android:id="@+id/status_since_created"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="20m ago"
android:textColor="?android:textColorSecondary" />
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@id/status_since_created">
<TextView <TextView
android:id="@+id/status_display_name" android:id="@+id/status_display_name"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -77,15 +88,8 @@
android:maxLines="1" android:maxLines="1"
android:ellipsize="end" android:ellipsize="end"
android:text="Username is the slongest thing ever i am totally going" /> android:text="Username is the slongest thing ever i am totally going" />
</LinearLayout>
<TextView </LinearLayout>
android:id="@+id/status_since_created"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="20m ago"
android:textColor="?android:textColorSecondary" />
</RelativeLayout> </RelativeLayout>