Merge pull request #196 from nextcloud/callNotification

revamp call notification screen
This commit is contained in:
Mario Đanić 2018-06-14 22:06:26 +02:00 committed by GitHub
commit 3d7811b087
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 69 additions and 63 deletions

View file

@ -79,6 +79,8 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:${supportLibraryVersion}"
implementation "com.android.support:design:${supportLibraryVersion}"
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
implementation 'com.android.support:multidex:1.0.3'

View file

@ -1348,7 +1348,7 @@ public class CallActivity extends AppCompatActivity {
GlideApp.with(this)
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.load(ApiUtils.getUrlForAvatarWithName(baseUrl, participantMap.get(session).getUserId(), true))
.load(ApiUtils.getUrlForAvatarWithName(baseUrl, participantMap.get(session).getUserId(), R.dimen.avatar_size_big))
.centerInside()
.override(size, size)
.apply(RequestOptions.bitmapTransform(new CircleCrop()))

View file

@ -123,7 +123,7 @@ public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.User
if (userEntity.getBaseUrl().startsWith("http://") || userEntity.getBaseUrl().startsWith("https://")) {
holder.avatarImageView.setVisibility(View.VISIBLE);
GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),
participant.getUserId(), false), new LazyHeaders.Builder()
participant.getUserId(), R.dimen.avatar_size), new LazyHeaders.Builder()
.setHeader("Accept", "image/*")
.setHeader("User-Agent", ApiUtils.getUserAgent())
.build());

View file

@ -131,7 +131,7 @@ public class CallItem extends AbstractFlexibleItem<CallItem.RoomItemViewHolder>
if (!TextUtils.isEmpty(room.getName())) {
GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),
room.getName(), false), new LazyHeaders.Builder()
room.getName(), R.dimen.avatar_size), new LazyHeaders.Builder()
.setHeader("Accept", "image/*")
.setHeader("User-Agent", ApiUtils.getUserAgent())
.build());

View file

@ -99,7 +99,7 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<UserItem.UserI
}
GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(currentUser.getBaseUrl(),
userId, false), new LazyHeaders.Builder()
userId, R.dimen.avatar_size), new LazyHeaders.Builder()
.setHeader("Accept", "image/*")
.setHeader("User-Agent", ApiUtils.getUserAgent())
.build());

View file

@ -122,7 +122,7 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
}
GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),
participant.getUserId(), false), new LazyHeaders.Builder()
participant.getUserId(), R.dimen.avatar_size), new LazyHeaders.Builder()
.setHeader("Accept", "image/*")
.setHeader("User-Agent", ApiUtils.getUserAgent())
.build());

View file

@ -262,14 +262,14 @@ public class CallNotificationController extends BaseController {
private void loadAvatar() {
int avatarSize = Math.round(NextcloudTalkApplication
.getSharedApplication().getResources().getDimension(R.dimen.avatar_size_big));
.getSharedApplication().getResources().getDimension(R.dimen.avatar_size_very_big));
switch (currentRoom.getType()) {
case ROOM_TYPE_ONE_TO_ONE_CALL:
avatarImageView.setVisibility(View.VISIBLE);
GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(userBeingCalled.getBaseUrl(),
currentRoom.getName(), true), new LazyHeaders.Builder()
currentRoom.getName(), R.dimen.avatar_size_very_big), new LazyHeaders.Builder()
.setHeader("Accept", "image/*")
.setHeader("User-Agent", ApiUtils.getUserAgent())
.build());

View file

@ -499,7 +499,7 @@ public class SettingsController extends BaseController {
}
GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),
avatarId, true), new LazyHeaders.Builder()
avatarId, R.dimen.avatar_size_big), new LazyHeaders.Builder()
.setHeader("Accept", "image/*")
.setHeader("User-Agent", ApiUtils.getUserAgent())
.build());

View file

@ -21,6 +21,7 @@ package com.nextcloud.talk.models.json.chat;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.R;
import com.nextcloud.talk.utils.ApiUtils;
import com.stfalcon.chatkit.commons.models.IMessage;
import com.stfalcon.chatkit.commons.models.IUser;
@ -90,7 +91,7 @@ public class ChatMessage implements IMessage {
@Override
public String getAvatar() {
return ApiUtils.getUrlForAvatarWithName(getBaseUrl(), actorId, false);
return ApiUtils.getUrlForAvatarWithName(getBaseUrl(), actorId, R.dimen.avatar_size);
}
};
}

View file

@ -20,6 +20,7 @@
package com.nextcloud.talk.utils;
import android.net.Uri;
import android.support.annotation.DimenRes;
import android.support.annotation.Nullable;
import com.nextcloud.talk.BuildConfig;
@ -163,16 +164,9 @@ public class ApiUtils {
return "/status.php";
}
public static String getUrlForAvatarWithName(String baseUrl, String name, boolean isLargeAvatar) {
int avatarSize;
if (isLargeAvatar) {
avatarSize = Math.round(NextcloudTalkApplication
.getSharedApplication().getResources().getDimension(R.dimen.avatar_size_big));
} else {
avatarSize = Math.round(NextcloudTalkApplication
.getSharedApplication().getResources().getDimension(R.dimen.avatar_size));
}
public static String getUrlForAvatarWithName(String baseUrl, String name, @DimenRes int avatarSize) {
avatarSize = Math.round(NextcloudTalkApplication
.getSharedApplication().getResources().getDimension(avatarSize));
return baseUrl + "/index.php/avatar/" + Uri.encode(name) + "/" + avatarSize;
}

View file

@ -18,84 +18,90 @@
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<android.support.constraint.ConstraintLayout 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="match_parent"
android:background="@color/grey950">
<TextView
android:id="@+id/incomingCallTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_alignParentTop="true"
android:layout_marginTop="32dp"
android:text="@string/nc_incoming_call"
android:textAlignment="center"
android:textColor="@color/colorPrimary"
android:textSize="20sp"
android:layout_marginTop="48dp"
android:id="@+id/incomingCallTextView"/>
<ImageView
android:id="@+id/avatarImageView"
android:layout_width="@dimen/avatar_size_big"
android:layout_height="@dimen/avatar_size_big"
android:layout_centerHorizontal="true"
android:layout_below="@id/incomingCallTextView"
android:layout_margin="16dp"/>
android:textColor="@color/white30"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/conversationNameTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/avatarImageView"
android:layout_centerInParent="true"
android:ellipsize="marquee"
android:textAlignment="center"
android:textColor="@color/colorPrimary"
android:textSize="16sp"
/>
android:textColor="@color/white"
android:textSize="28sp"
app:layout_constraintTop_toBottomOf="@+id/incomingCallTextView"
tools:text="Victor Gregorius Magnus" />
<ImageView
android:id="@+id/avatarImageView"
android:layout_width="@dimen/avatar_size_very_big"
android:layout_height="@dimen/avatar_size_very_big"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.498"
tools:src="@color/white" />
<com.nextcloud.talk.utils.MagicFlipView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/callAnswerVoiceOnlyView"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_above="@id/callControlHangupView"
android:layout_centerHorizontal="true"
android:layout_toStartOf="@id/callControlHangupView"
android:layout_marginBottom="48dp"
app:checked="false"
app:enableInitialAnimation="false"
app:frontBackgroundColor="@color/colorPrimary"
app:frontImage="@drawable/ic_mic_white_24px"/>
app:frontImage="@drawable/ic_mic_white_24px"
app:layout_anchorGravity="top|center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.129"
app:layout_constraintStart_toStartOf="parent" />
<com.nextcloud.talk.utils.MagicFlipView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/callAnswerCameraView"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_above="@id/callControlHangupView"
android:layout_toEndOf="@id/callControlHangupView"
android:layout_marginBottom="48dp"
app:checked="false"
app:enableInitialAnimation="false"
app:frontBackgroundColor="@color/colorPrimary"
app:frontImage="@drawable/ic_videocam_white_24px"/>
app:frontImage="@drawable/ic_videocam_white_24px"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" />
<com.nextcloud.talk.utils.MagicFlipView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/callControlHangupView"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="24dp"
android:layout_marginBottom="64dp"
android:layout_marginBottom="48dp"
app:checked="false"
app:enableInitialAnimation="false"
app:frontBackgroundColor="@color/nc_darkRed"
app:frontImage="@drawable/ic_call_end_white_24px"/>
app:frontImage="@drawable/ic_call_end_white_24px"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.87"
app:layout_constraintStart_toStartOf="parent" />
</RelativeLayout>
</android.support.constraint.ConstraintLayout>

View file

@ -28,7 +28,7 @@
<string name="nc_search">검색</string>
<string name="nc_certificate_dialog_title">인증서 확인</string>
<string name="nc_certificate_dialog_text">%1$s에서 %2$s에게 발급한 %3$s부터 %4%s까지 유효한 알 수 없는 인증서를 신뢰하시겠습니까?</string>
<string name="nc_certificate_dialog_text">%1$s에서 %2$s에게 발급한 %3$s부터 %4$s까지 유효한 알 수 없는 인증서를 신뢰하시겠습니까?</string>
<string name="nc_yes"></string>
<string name="nc_no">아니요</string>
<string name="nc_details">자세히</string>

View file

@ -17,5 +17,7 @@
<color name="nc_light_grey">#E8E8E8</color>
<color name="grey_600">#757575</color>
<color name="nc_grey">#D5D5D5</color>
<color name="white30">#E9FFFFFF</color>
<color name="grey950">#111111</color>
</resources>

View file

@ -16,6 +16,7 @@
<dimen name="margin_between_elements">8dp</dimen>
<dimen name="avatar_size">40dp</dimen>
<dimen name="avatar_size_big">80dp</dimen>
<dimen name="avatar_size_very_big">180dp</dimen>
<dimen name="avatar_corner_radius">20dp</dimen>
<dimen name="chat_text_size">14sp</dimen>

View file

@ -113,7 +113,7 @@
<string name="nc_permissions_settings">Open settings</string>
<!-- Call -->
<string name="nc_incoming_call">Incoming call</string>
<string name="nc_incoming_call">Incoming call from</string>
<string name="nc_nick_guest">Guest</string>
<string name="nc_public_call">New public conversation</string>
<string name="nc_public_call_explanation">Public conversations let you invite people from outside through a