From 4638cbae5178ce04eafb01d0f38fdf79ba53debc Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Fri, 26 Sep 2014 16:48:16 +0400 Subject: [PATCH] Audio player design Now showing documents names in conversations list and in notifications --- app/css/app.css | 4 ++-- app/js/directives.js | 14 ++++++++++++++ app/js/services.js | 2 +- app/partials/desktop/dialog.html | 4 ++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/css/app.css b/app/css/app.css index a9a161b8..c25251cf 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -1545,11 +1545,11 @@ img.im_message_document_thumb { } .tg_play_progress { background: #e4e9ed; - border-radius: 2px; + border-radius: 1px; } .tg_play_progress .progress-bar { background: #628fb2; - border-radius: 2px; + border-radius: 1px; /*-webkit-transition: width 1s linear; transition: width 1s linear;*/ -webkit-transition: none; diff --git a/app/js/directives.js b/app/js/directives.js index 8cc50882..637bf2f8 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1824,6 +1824,8 @@ angular.module('myApp.directives', ['myApp.filters']) .directive('myAudioPlayer', function ($sce, $timeout, $q, FileManager, MtpApiFileManager) { + var currentPlayer = false; + return { link: link, scope: { @@ -1859,6 +1861,16 @@ angular.module('myApp.directives', ['myApp.filters']) }); } + function checkPlayer (newPlayer) { + if (newPlayer === currentPlayer) { + return false; + } + if (currentPlayer) { + currentPlayer.pause(); + } + currentPlayer = newPlayer; + } + function link($scope, element, attrs) { $scope.mediaPlayer = {}; @@ -1872,6 +1884,7 @@ angular.module('myApp.directives', ['myApp.filters']) $scope.togglePlay = function () { if ($scope.audio.url) { + checkPlayer($scope.mediaPlayer.player); $scope.mediaPlayer.player.playPause(); } else if ($scope.audio.progress && $scope.audio.progress.enabled) { @@ -1880,6 +1893,7 @@ angular.module('myApp.directives', ['myApp.filters']) else { downloadAudio($scope.audio).then(function () { onContentLoaded(function () { + checkPlayer($scope.mediaPlayer.player); $scope.mediaPlayer.player.play(); }) }) diff --git a/app/js/services.js b/app/js/services.js index 817e90e6..3224ac2b 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -1936,7 +1936,7 @@ angular.module('myApp.services', ['myApp.i18n']) switch (message.media._) { case 'messageMediaPhoto': notificationMessage = _('conversation_media_photo'); break; case 'messageMediaVideo': notificationMessage = _('conversation_media_video'); break; - case 'messageMediaDocument': notificationMessage = _('conversation_media_document'); break; + case 'messageMediaDocument': notificationMessage = message.media.document.file_name || _('conversation_media_document'); break; case 'messageMediaAudio': notificationMessage = _('conversation_media_audio'); break; case 'messageMediaGeo': notificationMessage = _('conversation_media_location'); break; case 'messageMediaContact': notificationMessage = _('conversation_media_contact'); break; diff --git a/app/partials/desktop/dialog.html b/app/partials/desktop/dialog.html index 286483a2..3925b59b 100644 --- a/app/partials/desktop/dialog.html +++ b/app/partials/desktop/dialog.html @@ -48,10 +48,10 @@ >{{((dialogMessage.out || dialogMessage.peerID < 0) && (dialogMessage.message.length || dialogMessage.media && dialogMessage.media._ != 'messageMediaEmpty')) ? ':' : ''}} - + - +