Browse Source

Audio player design

Now showing documents names in conversations list and in notifications
master
Igor Zhukov 10 years ago
parent
commit
4638cbae51
  1. 4
      app/css/app.css
  2. 14
      app/js/directives.js
  3. 2
      app/js/services.js
  4. 4
      app/partials/desktop/dialog.html

4
app/css/app.css

@ -1545,11 +1545,11 @@ img.im_message_document_thumb { @@ -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;

14
app/js/directives.js

@ -1824,6 +1824,8 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -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']) @@ -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']) @@ -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']) @@ -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();
})
})

2
app/js/services.js

@ -1936,7 +1936,7 @@ angular.module('myApp.services', ['myApp.i18n']) @@ -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;

4
app/partials/desktop/dialog.html

@ -48,10 +48,10 @@ @@ -48,10 +48,10 @@
></span>{{((dialogMessage.out || dialogMessage.peerID &lt; 0) &amp;&amp; (dialogMessage.message.length || dialogMessage.media &amp;&amp; dialogMessage.media._ != 'messageMediaEmpty')) ? ':' : ''}}
</span>
<span class="im_dialog_message_media" ng-if="dialogMessage.media &amp;&amp; dialogMessage.media._ != 'messageMediaEmpty'" ng-switch="dialogMessage.media._">
<span class="im_dialog_message_media" ng-if="dialogMessage.media" ng-switch="dialogMessage.media._">
<span ng-switch-when="messageMediaPhoto" my-i18n="conversation_media_photo"></span>
<span ng-switch-when="messageMediaVideo" my-i18n="conversation_media_video"></span>
<span ng-switch-when="messageMediaDocument" my-i18n="conversation_media_document"></span>
<span ng-switch-when="messageMediaDocument" ng-bind="dialogMessage.media.document.file_name"></span>
<span ng-switch-when="messageMediaAudio" my-i18n="conversation_media_audio"></span>
<span ng-switch-when="messageMediaGeo" my-i18n="conversation_media_location"></span>
<span ng-switch-when="messageMediaContact" my-i18n="conversation_media_contact"></span>

Loading…
Cancel
Save