Merge pull request #1248 from Jatin0312/master

Fix for issue #1224 showing complete notification on click
This commit is contained in:
Vivek Maskara 2018-03-06 02:46:20 +05:30 committed by GitHub
commit 51221f69c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 29 deletions

View file

@ -94,6 +94,8 @@ dependencies {
implementation "com.google.dagger:dagger-android-support:$DAGGER_VERSION" implementation "com.google.dagger:dagger-android-support:$DAGGER_VERSION"
kapt "com.google.dagger:dagger-compiler:$DAGGER_VERSION" kapt "com.google.dagger:dagger-compiler:$DAGGER_VERSION"
kapt "com.google.dagger:dagger-android-processor:$DAGGER_VERSION" kapt "com.google.dagger:dagger-android-processor:$DAGGER_VERSION"
compile 'com.borjabravo:readmoretextview:2.1.0'
} }
android { android {

View file

@ -1,11 +1,13 @@
package fr.free.nrw.commons.notification; package fr.free.nrw.commons.notification;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.borjabravo.readmoretextview.ReadMoreTextView;
import com.pedrogomez.renderers.Renderer; import com.pedrogomez.renderers.Renderer;
import butterknife.BindView; import butterknife.BindView;
@ -17,8 +19,8 @@ import fr.free.nrw.commons.R;
*/ */
public class NotificationRenderer extends Renderer<Notification> { public class NotificationRenderer extends Renderer<Notification> {
@BindView(R.id.title) TextView title; @BindView(R.id.title) ReadMoreTextView title;
@BindView(R.id.description) TextView description; @BindView(R.id.description) ReadMoreTextView description;
@BindView(R.id.time) TextView time; @BindView(R.id.time) TextView time;
@BindView(R.id.icon) ImageView icon; @BindView(R.id.icon) ImageView icon;
private NotificationClicked listener; private NotificationClicked listener;
@ -46,9 +48,13 @@ public class NotificationRenderer extends Renderer<Notification> {
@Override @Override
public void render() { public void render() {
Notification notification = getContent(); Notification notification = getContent();
title.setText(notification.notificationText); StringBuilder str = new StringBuilder(notification.notificationText);
str.append(" " );
title.setText(str);
time.setText(notification.date); time.setText(notification.date);
description.setText(notification.description); StringBuilder desc = new StringBuilder(notification.description);
desc.append(" ");
description.setText(desc);
switch (notification.notificationType) { switch (notification.notificationType) {
case THANK_YOU_EDIT: case THANK_YOU_EDIT:
icon.setImageResource(R.drawable.ic_edit_black_24dp); icon.setImageResource(R.drawable.ic_edit_black_24dp);

View file

@ -1,11 +1,10 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:foreground="?selectableItemBackground" android:foreground="?selectableItemBackground"
android:minHeight="72dp" android:minHeight="72dp">
>
<ImageView <ImageView
android:id="@+id/icon" android:id="@+id/icon"
@ -34,7 +33,7 @@
tools:text="@string/placeholder_place_distance" tools:text="@string/placeholder_place_distance"
/> />
<TextView <com.borjabravo.readmoretextview.ReadMoreTextView
android:id="@+id/title" android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -46,12 +45,13 @@
android:layout_toRightOf="@id/icon" android:layout_toRightOf="@id/icon"
android:layout_toStartOf="@id/time" android:layout_toStartOf="@id/time"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" app:trimLines="2"
app:colorClickableText="#969494"
android:textAppearance="@style/TextAppearance.AppCompat.Body2" android:textAppearance="@style/TextAppearance.AppCompat.Body2"
tools:text="@string/placeholder_place_name" tools:text="@string/placeholder_place_name"
/> />
<TextView <com.borjabravo.readmoretextview.ReadMoreTextView
android:id="@+id/description" android:id="@+id/description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -62,7 +62,8 @@
android:layout_below="@id/title" android:layout_below="@id/title"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="4" app:trimLines="2"
app:colorClickableText="#969494"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
tools:text="@string/placeholder_place_description" tools:text="@string/placeholder_place_description"
/> />

View file

@ -1,21 +1,29 @@
gradleVersion = 3.0.0 ## Project-wide Gradle settings.
#
SUPPORT_LIB_VERSION = 26.0.2 # For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
compileSdkVersion = android-26 #
buildToolsVersion = 26.0.2 # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
minSdkVersion = 15 # Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
targetSdkVersion = 25 #
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Thu Mar 01 15:28:48 IST 2018
systemProp.http.proxyPort=0
compileSdkVersion=android-26
android.useDeprecatedNdk=true android.useDeprecatedNdk=true
# Library dependencies
BUTTERKNIFE_VERSION=8.6.0 BUTTERKNIFE_VERSION=8.6.0
DAGGER_VERSION=2.13
LEAK_CANARY=1.5.4
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
buildToolsVersion=26.0.2
#TODO: Temporary disabled. https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#aapt2 targetSdkVersion=25
#Refer to PR: https://github.com/commons-app/apps-android-commons/pull/932
android.enableAapt2=false android.enableAapt2=false
SUPPORT_LIB_VERSION=26.0.2
minSdkVersion=15
systemProp.http.proxyHost=
LEAK_CANARY=1.5.4
DAGGER_VERSION=2.13
gradleVersion=3.0.0