Merge pull request #1141 from nextcloud/shimmerAndUploadBottomSheet

Optimize Shimmer and upload bottom sheet
This commit is contained in:
Andy Scherzinger 2021-04-26 20:59:46 +02:00 committed by GitHub
commit 5b6760e4b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 155 additions and 143 deletions

View file

@ -20,27 +20,24 @@
package com.nextcloud.talk.adapters.items;
import android.content.res.Resources;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.material.radiobutton.MaterialRadioButton;
import com.nextcloud.talk.R;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.facebook.drawee.view.SimpleDraweeView;
import com.nextcloud.talk.R;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import eu.davidea.flexibleadapter.FlexibleAdapter;
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
import eu.davidea.flexibleadapter.items.IFlexible;
import eu.davidea.viewholders.FlexibleViewHolder;
import java.util.List;
public class NotificationSoundItem extends AbstractFlexibleItem<NotificationSoundItem.NotificationSoundItemViewHolder> {
private String notificationSoundName;
private String notificationSoundUri;
private final String notificationSoundName;
private final String notificationSoundUri;
public NotificationSoundItem(String notificationSoundName, String notificationSoundUri) {
this.notificationSoundName = notificationSoundName;
@ -73,31 +70,12 @@ public class NotificationSoundItem extends AbstractFlexibleItem<NotificationSoun
@Override
public void bindViewHolder(FlexibleAdapter<IFlexible> adapter, NotificationSoundItemViewHolder holder, int position, List<Object> payloads) {
holder.notificationName.setText(notificationSoundName);
if (adapter.isSelected(position)) {
holder.checkedImageView.setVisibility(View.VISIBLE);
} else {
holder.checkedImageView.setVisibility(View.GONE);
}
Resources resources = NextcloudTalkApplication.Companion.getSharedApplication().getResources();
holder.simpleDraweeView.getHierarchy().setBackgroundImage(new ColorDrawable(resources.getColor(R.color.colorPrimary)));
if (position == 0) {
holder.simpleDraweeView.getHierarchy().setImage(resources.getDrawable(R.drawable.ic_stop_white_24dp), 100,
true);
} else {
holder.simpleDraweeView.getHierarchy().setImage(resources.getDrawable(R.drawable.ic_play_circle_outline_white_24dp), 100,
true);
}
holder.notificationName.setChecked(adapter.isSelected(position));
}
static class NotificationSoundItemViewHolder extends FlexibleViewHolder {
@BindView(R.id.notificationNameTextView)
public TextView notificationName;
@BindView(R.id.simpleDraweeView)
SimpleDraweeView simpleDraweeView;
@BindView(R.id.checkedImageView)
ImageView checkedImageView;
public MaterialRadioButton notificationName;
/**
* Default constructor.
@ -107,6 +85,4 @@ public class NotificationSoundItem extends AbstractFlexibleItem<NotificationSoun
ButterKnife.bind(this, view);
}
}
}

View file

@ -643,6 +643,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
swipeRefreshLayout.setOnRefreshListener(() -> fetchData(true));
swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.refresh_spinner_background);
fastScroller.addOnScrollStateChangeListener(this);
adapter.setFastScroller(fastScroller);

View file

@ -522,6 +522,7 @@ public class ConversationsListController extends BaseController implements Searc
swipeRefreshLayout.setOnRefreshListener(() -> fetchData(false));
swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.refresh_spinner_background);
emptyLayoutView.setOnClickListener(v -> showNewConversationsScreen());
floatingActionButton.setOnClickListener(v -> {

View file

@ -1,25 +0,0 @@
<!--
~ Nextcloud Talk application
~
~ @author Mario Danic
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<vector android:autoMirrored="true" android:height="24dp"
android:tint="#FFFFFF" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M10,16.5l6,-4.5 -6,-4.5v9zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
</vector>

View file

@ -0,0 +1,23 @@
<!--
@author Google LLC
Copyright (C) 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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="M18,16.08C17.24,16.08 16.56,16.38 16.04,16.85L8.91,12.7C8.96,12.47 9,12.24 9,12C9,11.76 8.96,11.53 8.91,11.3L15.96,7.19C16.5,7.69 17.21,8 18,8A3,3 0 0,0 21,5A3,3 0 0,0 18,2A3,3 0 0,0 15,5C15,5.24 15.04,5.47 15.09,5.7L8.04,9.81C7.5,9.31 6.79,9 6,9A3,3 0 0,0 3,12A3,3 0 0,0 6,15C6.79,15 7.5,14.69 8.04,14.19L15.16,18.34C15.11,18.55 15.08,18.77 15.08,19C15.08,20.61 16.39,21.91 18,21.91C19.61,21.91 20.92,20.61 20.92,19A2.92,2.92 0 0,0 18,16.08Z" />
</vector>

View file

@ -1,25 +0,0 @@
<!--
~ Nextcloud Talk application
~
~ @author Mario Danic
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<vector android:autoMirrored="true" android:height="24dp"
android:tint="#FFFFFF" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M6,6h12v12H6z"/>
</vector>

View file

@ -20,9 +20,13 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_bottom_sheet">
android:background="@color/bg_bottom_sheet"
android:paddingStart="@dimen/standard_padding"
android:paddingTop="@dimen/standard_padding"
android:paddingEnd="@dimen/standard_half_padding">
<com.google.android.material.button.MaterialButton
android:id="@+id/ok_button"
@ -31,26 +35,23 @@
android:layout_height="wrap_content"
android:layout_below="@id/text_input_layout"
android:layout_alignParentEnd="true"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="12dp"
android:layout_marginTop="@dimen/standard_half_margin"
android:layout_marginBottom="@dimen/standard_half_margin"
android:alpha="0.7"
android:background="@color/bg_default"
android:enabled="false"
android:text="@string/nc_proceed"
android:textAllCaps="false"
android:textColor="@color/colorPrimary" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/text_input_layout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_horizontal_margin"
android:layout_marginBottom="@dimen/activity_horizontal_margin"
android:layout_marginEnd="8dp"
android:layout_marginEnd="@dimen/standard_half_margin"
android:layout_toStartOf="@id/smileyButton"
app:errorTextAppearance="@style/ErrorAppearance"
app:helperText=""
app:passwordToggleDrawable="@drawable/asl_password_visibility"
app:passwordToggleTint="@color/grey_600">
@ -67,14 +68,15 @@
<ImageButton
android:id="@+id/smileyButton"
android:layout_width="36dp"
android:visibility="gone"
android:layout_height="36dp"
android:layout_marginEnd="8dp"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_alignBottom="@id/text_input_layout"
android:layout_alignParentEnd="true"
android:layout_marginStart="-4dp"
android:background="@color/transparent"
android:src="@drawable/ic_insert_emoticon_black_24dp"
android:tint="@color/emoji_icons" />
android:tint="@color/emoji_icons"
android:visibility="gone"
tools:visibility="visible" />
</RelativeLayout>

View file

@ -2,6 +2,8 @@
~ Nextcloud Talk application
~
~ @author Marcel Hibbe
~ @author Andy Scherzinger
~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
~ Copyright (C) 2021 Marcel Hibbe <marcel.hibbe@nextcloud.com>
~
~ This program is free software: you can redistribute it and/or modify
@ -19,27 +21,85 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_bottom_sheet"
android:orientation="vertical"
android:paddingBottom="8dp">
android:paddingBottom="@dimen/standard_padding">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/txt_attach_file_from_local"
<TextView
android:id="@+id/upload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/standard_padding"
android:text="@string/nc_add_file"
android:textColor="@color/medium_emphasis_text"
android:textSize="@dimen/bottom_sheet_text_size" />
<LinearLayout
android:id="@+id/menu_attach_file_from_local"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="15dp"
android:text="@string/nc_upload_local_file"
android:textSize="20sp" />
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal"
android:paddingLeft="@dimen/standard_padding"
android:paddingTop="@dimen/standard_half_padding"
android:paddingRight="@dimen/standard_padding"
android:paddingBottom="@dimen/standard_half_padding"
tools:ignore="UseCompoundDrawables">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/txt_attach_file_from_cloud"
<ImageView
android:id="@+id/menu_icon_attach_file_from_local"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/upload"
app:tint="@color/colorPrimary" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/txt_attach_file_from_local"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/standard_margin"
android:text="@string/nc_upload_local_file"
android:textColor="@color/high_emphasis_text"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/menu_attach_file_from_cloud"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="15dp"
android:textSize="20sp" />
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal"
android:paddingLeft="@dimen/standard_padding"
android:paddingTop="@dimen/standard_half_padding"
android:paddingRight="@dimen/standard_padding"
android:paddingBottom="@dimen/standard_padding"
tools:ignore="UseCompoundDrawables">
</LinearLayout>
<ImageView
android:id="@+id/menu_icon_attach_file_from_cloud"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_share_variant"
app:tint="@color/colorPrimary" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/txt_attach_file_from_cloud"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/standard_margin"
android:textColor="@color/high_emphasis_text"
android:textSize="@dimen/bottom_sheet_text_size"
tools:text="Share from Nextcloud" />
</LinearLayout>
</LinearLayout>

View file

@ -20,6 +20,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
@ -47,7 +48,8 @@
android:layout_alignWithParentIfMissing="true"
android:lineSpacingMultiplier="1.2"
android:textColorHighlight="@color/nc_grey"
android:textIsSelectable="true" />
android:textIsSelectable="true"
tools:text="Talk to ayou later!" />
<TextView
android:id="@id/messageTime"
@ -55,7 +57,8 @@
android:layout_height="wrap_content"
android:layout_below="@id/messageText"
android:layout_marginStart="8dp"
app:layout_alignSelf="center" />
app:layout_alignSelf="center"
tools:text="10:35" />
<ImageView
android:id="@+id/checkMark"

View file

@ -32,7 +32,8 @@
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/double_margin_between_elements"
android:contentDescription="@null"
app:corners="100" />
app:corners="100"
app:custom_color="@color/nc_shimmer_default_color" />
<LinearLayout
android:layout_width="match_parent"
@ -45,12 +46,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="128dp"
android:textStyle="bold" />
android:textStyle="bold"
app:custom_color="@color/nc_shimmer_default_color" />
<com.elyeproj.loaderviewlibrary.LoaderTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp" />
android:layout_marginTop="6dp"
app:custom_color="@color/nc_shimmer_darker_color" />
</LinearLayout>

View file

@ -21,7 +21,6 @@
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -32,35 +31,17 @@
android:animateLayoutChanges="true"
android:orientation="vertical">
<ImageView
android:id="@+id/checkedImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/standard_margin"
android:contentDescription="@string/selected_list_item"
android:src="@drawable/ic_check_black_24dp"
app:tint="@color/colorPrimary" />
<TextView
<com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/notificationNameTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/checkedImageView"
android:layout_toEndOf="@id/simpleDraweeView"
android:clickable="false"
android:ellipsize="end"
android:lines="1"
android:paddingStart="24dp"
android:paddingEnd="0dp"
android:textAppearance="@style/ListItem"
tools:text="Ringy Gone" />
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/simpleDraweeView"
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/standard_margin"
app:roundAsCircle="true" />
</RelativeLayout>

View file

@ -28,13 +28,15 @@
android:layout_height="@dimen/iconized_single_line_item_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/standard_margin"
app:corners="100" />
app:corners="100"
app:custom_color="@color/nc_shimmer_default_color" />
<com.elyeproj.loaderviewlibrary.LoaderTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/standard_margin"
android:layout_marginEnd="@dimen/standard_margin" />
android:layout_marginEnd="@dimen/standard_margin"
app:custom_color="@color/nc_shimmer_default_color" />
</LinearLayout>

View file

@ -31,6 +31,7 @@
<!-- App bar -->
<color name="appbar">#1E1E1E</color>
<color name="fontAppbar">#FFFFFF</color>
<color name="refresh_spinner_background">#222222</color>
<!-- general text colors -->
<color name="high_emphasis_text">#deffffff</color>
@ -51,11 +52,14 @@
<color name="controller_chat_separator">#484848</color>
<!-- Chat window incoming message text & informational -->
<color name="nc_incoming_text_default">#D8D8D8</color>
<color name="nc_grey">@android:color/holo_purple</color>
<color name="bg_bottom_sheet">#121212</color>
<color name="bg_message_list_incoming_bubble">#484848</color>
<color name="bg_message_list_incoming_bubble_deleted">#66484848</color>
<color name="textColorMaxContrast">#8c8c8c</color>
<!-- shimmer element colors -->
<color name="nc_shimmer_default_color">#4B4B4B</color>
<color name="nc_shimmer_darker_color">#282828</color>
</resources>

View file

@ -32,6 +32,7 @@
<color name="appbar">@android:color/white</color>
<color name="fontAppbar">#666666</color>
<color name="fontSecondaryAppbar">#A5A5A5</color>
<color name="refresh_spinner_background">#ffffff</color>
<!-- general text colors -->
<color name="high_emphasis_text">#de000000</color>
@ -41,7 +42,7 @@
<!-- Text color of sent messages -->
<color name="nc_outcoming_text_default">#FFFFFF</color>
<!-- Text color of received messages -->
<color name="nc_incoming_text_default">#37505D</color>
<color name="nc_incoming_text_default">@color/high_emphasis_text</color>
<!-- Name of person or group for the chat conversation -->
<color name="conversation_item_header">@color/high_emphasis_text</color>
@ -76,4 +77,8 @@
<color name="call_buttons_background">#BF999999</color>
<color name="favorite_icon_tint">#FFCC00</color>
<!-- shimmer element colors -->
<color name="nc_shimmer_default_color">#D7D7D7</color>
<color name="nc_shimmer_darker_color">#B4B4B4</color>
</resources>

View file

@ -346,6 +346,7 @@
<string name="open_in_files_app">Open in Files app</string>
<!-- Upload -->
<string name="nc_add_file">Add to conversation</string>
<string name="nc_upload_local_file">Upload local file</string>
<string name="nc_upload_from_cloud">Share from %1$s</string>
<string name="nc_upload_failed">Sorry, upload failed</string>