Browse Source

Fix for scroll-to-quickreply

pull/24/head
Ezerous 8 years ago
parent
commit
dfc57108a3
  1. 1
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  2. 18
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
  3. 9
      app/src/main/res/drawable/ic_reply.xml
  4. 2
      app/src/main/res/layout/activity_topic.xml

1
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java

@ -187,6 +187,7 @@ public class TopicActivity extends BaseActivity {
topicAdapter.prepareForReply(new ReplyTask(), topicTitle, loadedPageUrl);
replyFAB.hide();
bottomNavBar.setVisibility(View.GONE);
recyclerView.scrollToPosition(postsList.size() - 1);
}
}
});

18
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

@ -21,6 +21,7 @@ import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@ -136,6 +137,23 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
View view = LayoutInflater.from(parent.getContext()).
inflate(R.layout.activity_topic_quick_reply_row, parent, false);
view.findViewById(R.id.quick_reply_submit).setEnabled(true);
final EditText quickReplyText = (EditText) view.findViewById(R.id.quick_reply_text);
quickReplyText.setFocusableInTouchMode(true);
quickReplyText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
quickReplyText.post(new Runnable() {
@Override
public void run() {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(quickReplyText, InputMethodManager.SHOW_IMPLICIT);
}
});
}
});
quickReplyText.requestFocus();
//Default post subject
replyDataHolder[replySubject] = "Re: " + topicTitle;
//Build quotes

9
app/src/main/res/drawable/ic_reply.xml

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M10,9V5l-7,7 7,7v-4.1c5,0 8.5,1.6 11,5.1 -1,-5 -4,-10 -11,-11z"/>
</vector>

2
app/src/main/res/layout/activity_topic.xml

@ -123,7 +123,7 @@
android:layout_marginBottom="50dp"
android:layout_marginEnd="@dimen/fab_margins"
app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_add_fab"/>
app:srcCompat="@drawable/ic_reply"/>
</android.support.design.widget.CoordinatorLayout>

Loading…
Cancel
Save