Commit a37e83450c700275fc89d7d51d2c9ea98dea608b
1 parent
74affc6a
添加缓存逻辑判断
Showing
3 changed files
with
141 additions
and
76 deletions
app/src/main/java/com/cnlive/im/mode/VoiceMessage.java
| @@ -12,6 +12,7 @@ public class VoiceMessage { | @@ -12,6 +12,7 @@ public class VoiceMessage { | ||
| 12 | private CNVoiceMessage cnVoiceMessage; | 12 | private CNVoiceMessage cnVoiceMessage; |
| 13 | boolean isUserSend; | 13 | boolean isUserSend; |
| 14 | 14 | ||
| 15 | + private boolean isDownloading; | ||
| 15 | private int progress; | 16 | private int progress; |
| 16 | 17 | ||
| 17 | public VoiceMessage(String type, CNVoiceMessage cnVoiceMessage, boolean isUserSend) { | 18 | public VoiceMessage(String type, CNVoiceMessage cnVoiceMessage, boolean isUserSend) { |
| @@ -58,4 +59,12 @@ public class VoiceMessage { | @@ -58,4 +59,12 @@ public class VoiceMessage { | ||
| 58 | public void setProgress(int progress) { | 59 | public void setProgress(int progress) { |
| 59 | this.progress = progress; | 60 | this.progress = progress; |
| 60 | } | 61 | } |
| 62 | + | ||
| 63 | + public boolean isDownloading() { | ||
| 64 | + return isDownloading; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public void setDownloading(boolean downloading) { | ||
| 68 | + isDownloading = downloading; | ||
| 69 | + } | ||
| 61 | } | 70 | } |
app/src/main/java/com/cnlive/im/ui/ChatRoomActivity.java
| @@ -516,7 +516,7 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | @@ -516,7 +516,7 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | ||
| 516 | } | 516 | } |
| 517 | 517 | ||
| 518 | @Override | 518 | @Override |
| 519 | - public void onItemClick(VoiceMessage voiceMessage, final AnimationDrawable animationDrawable) { | 519 | + public void onItemClick(final VoiceMessage voiceMessage, final AnimationDrawable animationDrawable) { |
| 520 | if (voiceMessage == null) { | 520 | if (voiceMessage == null) { |
| 521 | Toast.makeText(this, "数据异常", Toast.LENGTH_LONG).show(); | 521 | Toast.makeText(this, "数据异常", Toast.LENGTH_LONG).show(); |
| 522 | return; | 522 | return; |
| @@ -536,23 +536,29 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | @@ -536,23 +536,29 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | ||
| 536 | } | 536 | } |
| 537 | startVoice(voicePath, animationDrawable); | 537 | startVoice(voicePath, animationDrawable); |
| 538 | } else { | 538 | } else { |
| 539 | - voiceMessage.getCnVoiceMessage().getVoice(voicePath, new IChat.OnDownloadListener() { | ||
| 540 | - @Override | ||
| 541 | - public void onSuccess() { | ||
| 542 | - startVoice(voicePath, animationDrawable); | ||
| 543 | - } | ||
| 544 | - | ||
| 545 | - @Override | ||
| 546 | - public void onError(int i, String s) { | 539 | + if (voiceMessage.isDownloading()) { |
| 540 | + Toast.makeText(context, "请稍等,正在下载...", Toast.LENGTH_SHORT).show(); | ||
| 541 | + } else { | ||
| 542 | + voiceMessage.setDownloading(true); | ||
| 543 | + voiceMessage.getCnVoiceMessage().getVoice(voicePath, new IChat.OnDownloadListener() { | ||
| 544 | + @Override | ||
| 545 | + public void onSuccess() { | ||
| 546 | + voiceMessage.setDownloading(false); | ||
| 547 | + startVoice(voicePath, animationDrawable); | ||
| 548 | + } | ||
| 547 | 549 | ||
| 548 | - } | ||
| 549 | - }); | 550 | + @Override |
| 551 | + public void onError(int i, String s) { | ||
| 552 | + voiceMessage.setDownloading(false); | ||
| 553 | + } | ||
| 554 | + }); | ||
| 555 | + } | ||
| 550 | } | 556 | } |
| 551 | } | 557 | } |
| 552 | } | 558 | } |
| 553 | 559 | ||
| 554 | @Override | 560 | @Override |
| 555 | - public void onVideoClick(VideoMessage videoMessage) { | 561 | + public void onVideoClick(final VideoMessage videoMessage) { |
| 556 | if (videoMessage.getCnVideoMessage().isSelf()) { | 562 | if (videoMessage.getCnVideoMessage().isSelf()) { |
| 557 | Intent intent = new Intent(ChatRoomActivity.this, VideoActivity.class); | 563 | Intent intent = new Intent(ChatRoomActivity.this, VideoActivity.class); |
| 558 | intent.putExtra("videoPath", videoMessage.getCnVideoMessage().getVideoPath()); | 564 | intent.putExtra("videoPath", videoMessage.getCnVideoMessage().getVideoPath()); |
| @@ -561,30 +567,41 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | @@ -561,30 +567,41 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | ||
| 561 | String videoUuid = videoMessage.getCnVideoMessage().getVideo().getUuid(); | 567 | String videoUuid = videoMessage.getCnVideoMessage().getVideo().getUuid(); |
| 562 | final String videoPath = FileUtil.getCacheFilePath(videoUuid); | 568 | final String videoPath = FileUtil.getCacheFilePath(videoUuid); |
| 563 | if (FileUtil.isCacheFileExist(videoUuid)) { | 569 | if (FileUtil.isCacheFileExist(videoUuid)) { |
| 570 | + File file = new File(videoPath); | ||
| 571 | + if (file.length() < videoMessage.getCnVideoMessage().getVideo().getSize()) { | ||
| 572 | + Toast.makeText(context, "请稍等,正在下载...", Toast.LENGTH_SHORT).show(); | ||
| 573 | + return; | ||
| 574 | + } | ||
| 564 | Intent intent = new Intent(ChatRoomActivity.this, VideoActivity.class); | 575 | Intent intent = new Intent(ChatRoomActivity.this, VideoActivity.class); |
| 565 | intent.putExtra("videoPath", videoPath); | 576 | intent.putExtra("videoPath", videoPath); |
| 566 | startActivity(intent); | 577 | startActivity(intent); |
| 567 | } else { | 578 | } else { |
| 568 | - videoMessage.getCnVideoMessage().getVideo().getVideo(videoPath, new IChat.OnDownloadListener() { | ||
| 569 | - @Override | ||
| 570 | - public void onSuccess() { | ||
| 571 | - Intent intent = new Intent(ChatRoomActivity.this, VideoActivity.class); | ||
| 572 | - intent.putExtra("videoPath", videoPath); | ||
| 573 | - startActivity(intent); | ||
| 574 | - } | ||
| 575 | - | ||
| 576 | - @Override | ||
| 577 | - public void onError(int i, String s) { | 579 | + if (videoMessage.isDownloading()) { |
| 580 | + Toast.makeText(context, "请稍等,正在下载...", Toast.LENGTH_SHORT).show(); | ||
| 581 | + } else { | ||
| 582 | + videoMessage.setDownloading(true); | ||
| 583 | + videoMessage.getCnVideoMessage().getVideo().getVideo(videoPath, new IChat.OnDownloadListener() { | ||
| 584 | + @Override | ||
| 585 | + public void onSuccess() { | ||
| 586 | + videoMessage.setDownloading(false); | ||
| 587 | + Intent intent = new Intent(ChatRoomActivity.this, VideoActivity.class); | ||
| 588 | + intent.putExtra("videoPath", videoPath); | ||
| 589 | + startActivity(intent); | ||
| 590 | + } | ||
| 578 | 591 | ||
| 579 | - } | ||
| 580 | - }); | 592 | + @Override |
| 593 | + public void onError(int i, String s) { | ||
| 594 | + videoMessage.setDownloading(false); | ||
| 595 | + } | ||
| 596 | + }); | ||
| 597 | + } | ||
| 581 | } | 598 | } |
| 582 | } | 599 | } |
| 583 | 600 | ||
| 584 | } | 601 | } |
| 585 | 602 | ||
| 586 | @Override | 603 | @Override |
| 587 | - public void onUgcVideoClick(UgcVideoMessage ugcVideoMessage) { | 604 | + public void onUgcVideoClick(final UgcVideoMessage ugcVideoMessage) { |
| 588 | if (ugcVideoMessage.getCnUgcMessage().isSelf()) { | 605 | if (ugcVideoMessage.getCnUgcMessage().isSelf()) { |
| 589 | Intent intent = new Intent(ChatRoomActivity.this, VideoActivity.class); | 606 | Intent intent = new Intent(ChatRoomActivity.this, VideoActivity.class); |
| 590 | intent.putExtra("videoPath", ugcVideoMessage.getCnUgcMessage().getVideoPath()); | 607 | intent.putExtra("videoPath", ugcVideoMessage.getCnUgcMessage().getVideoPath()); |
| @@ -593,23 +610,34 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | @@ -593,23 +610,34 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | ||
| 593 | String videoUuid = ugcVideoMessage.getCnUgcMessage().getFileId() + "_video"; | 610 | String videoUuid = ugcVideoMessage.getCnUgcMessage().getFileId() + "_video"; |
| 594 | final String videoPath = FileUtil.getCacheFilePath(videoUuid); | 611 | final String videoPath = FileUtil.getCacheFilePath(videoUuid); |
| 595 | if (FileUtil.isCacheFileExist(videoUuid)) { | 612 | if (FileUtil.isCacheFileExist(videoUuid)) { |
| 613 | + File file = new File(videoPath); | ||
| 614 | + if (file.length() < ugcVideoMessage.getCnUgcMessage().getVideo().getSize()) { | ||
| 615 | + Toast.makeText(context, "请稍等,正在下载...", Toast.LENGTH_SHORT).show(); | ||
| 616 | + return; | ||
| 617 | + } | ||
| 596 | Intent intent = new Intent(ChatRoomActivity.this, VideoActivity.class); | 618 | Intent intent = new Intent(ChatRoomActivity.this, VideoActivity.class); |
| 597 | intent.putExtra("videoPath", videoPath); | 619 | intent.putExtra("videoPath", videoPath); |
| 598 | startActivity(intent); | 620 | startActivity(intent); |
| 599 | } else { | 621 | } else { |
| 600 | - ugcVideoMessage.getCnUgcMessage().getVideo().getVideo(videoPath, new IChat.OnDownloadListener() { | ||
| 601 | - @Override | ||
| 602 | - public void onSuccess() { | ||
| 603 | - Intent intent = new Intent(ChatRoomActivity.this, VideoActivity.class); | ||
| 604 | - intent.putExtra("videoPath", videoPath); | ||
| 605 | - startActivity(intent); | ||
| 606 | - } | ||
| 607 | - | ||
| 608 | - @Override | ||
| 609 | - public void onError(int i, String s) { | 622 | + if (ugcVideoMessage.isDownloading()) { |
| 623 | + Toast.makeText(context, "请稍等,正在下载...", Toast.LENGTH_SHORT).show(); | ||
| 624 | + } else { | ||
| 625 | + ugcVideoMessage.setDownloading(true); | ||
| 626 | + ugcVideoMessage.getCnUgcMessage().getVideo().getVideo(videoPath, new IChat.OnDownloadListener() { | ||
| 627 | + @Override | ||
| 628 | + public void onSuccess() { | ||
| 629 | + ugcVideoMessage.setDownloading(false); | ||
| 630 | + Intent intent = new Intent(ChatRoomActivity.this, VideoActivity.class); | ||
| 631 | + intent.putExtra("videoPath", videoPath); | ||
| 632 | + startActivity(intent); | ||
| 633 | + } | ||
| 610 | 634 | ||
| 611 | - } | ||
| 612 | - }); | 635 | + @Override |
| 636 | + public void onError(int i, String s) { | ||
| 637 | + ugcVideoMessage.setDownloading(false); | ||
| 638 | + } | ||
| 639 | + }); | ||
| 640 | + } | ||
| 613 | } | 641 | } |
| 614 | } | 642 | } |
| 615 | } | 643 | } |
app/src/main/java/com/cnlive/im/ui/PrivateActivity.java
| @@ -626,7 +626,7 @@ public class PrivateActivity extends AppCompatActivity implements View.OnClickLi | @@ -626,7 +626,7 @@ public class PrivateActivity extends AppCompatActivity implements View.OnClickLi | ||
| 626 | float moveX = Math.abs(event.getX() - downX); | 626 | float moveX = Math.abs(event.getX() - downX); |
| 627 | float moveY = Math.abs(event.getY() - downY); | 627 | float moveY = Math.abs(event.getY() - downY); |
| 628 | if (moveY > 100) { | 628 | if (moveY > 100) { |
| 629 | -// Toast.makeText(ChatRoomActivity.this, "cancel", Toast.LENGTH_SHORT).show(); | 629 | +// Toast.makeText(PrivateActivity.this, "cancel", Toast.LENGTH_SHORT).show(); |
| 630 | mAudioRecordUtil.cancelRecord(); | 630 | mAudioRecordUtil.cancelRecord(); |
| 631 | } else { | 631 | } else { |
| 632 | mAudioRecordUtil.stopRecord(); //结束录音(保存录音文件) | 632 | mAudioRecordUtil.stopRecord(); //结束录音(保存录音文件) |
| @@ -639,7 +639,7 @@ public class PrivateActivity extends AppCompatActivity implements View.OnClickLi | @@ -639,7 +639,7 @@ public class PrivateActivity extends AppCompatActivity implements View.OnClickLi | ||
| 639 | float moveXm = Math.abs(event.getX() - downX); | 639 | float moveXm = Math.abs(event.getX() - downX); |
| 640 | float moveYm = Math.abs(event.getY() - downY); | 640 | float moveYm = Math.abs(event.getY() - downY); |
| 641 | if (moveYm > 100) { | 641 | if (moveYm > 100) { |
| 642 | -// Toast.makeText(ChatRoomActivity.this, "cancel", Toast.LENGTH_SHORT).show(); | 642 | +// Toast.makeText(PrivateActivity.this, "cancel", Toast.LENGTH_SHORT).show(); |
| 643 | if (sendMsgLayout.getVisibility() == View.VISIBLE) { | 643 | if (sendMsgLayout.getVisibility() == View.VISIBLE) { |
| 644 | sendMsgLayout.setVisibility(View.GONE); | 644 | sendMsgLayout.setVisibility(View.GONE); |
| 645 | cancelSendLayout.setVisibility(View.VISIBLE); | 645 | cancelSendLayout.setVisibility(View.VISIBLE); |
| @@ -734,7 +734,7 @@ public class PrivateActivity extends AppCompatActivity implements View.OnClickLi | @@ -734,7 +734,7 @@ public class PrivateActivity extends AppCompatActivity implements View.OnClickLi | ||
| 734 | } | 734 | } |
| 735 | 735 | ||
| 736 | @Override | 736 | @Override |
| 737 | - public void onItemClick(VoiceMessage voiceMessage, final AnimationDrawable animationDrawable) { | 737 | + public void onItemClick(final VoiceMessage voiceMessage, final AnimationDrawable animationDrawable) { |
| 738 | if (voiceMessage == null) { | 738 | if (voiceMessage == null) { |
| 739 | Toast.makeText(this, "数据异常", Toast.LENGTH_LONG).show(); | 739 | Toast.makeText(this, "数据异常", Toast.LENGTH_LONG).show(); |
| 740 | return; | 740 | return; |
| @@ -754,23 +754,29 @@ public class PrivateActivity extends AppCompatActivity implements View.OnClickLi | @@ -754,23 +754,29 @@ public class PrivateActivity extends AppCompatActivity implements View.OnClickLi | ||
| 754 | } | 754 | } |
| 755 | startVoice(voicePath, animationDrawable); | 755 | startVoice(voicePath, animationDrawable); |
| 756 | } else { | 756 | } else { |
| 757 | - voiceMessage.getCnVoiceMessage().getVoice(voicePath, new IChat.OnDownloadListener() { | ||
| 758 | - @Override | ||
| 759 | - public void onSuccess() { | ||
| 760 | - startVoice(voicePath, animationDrawable); | ||
| 761 | - } | ||
| 762 | - | ||
| 763 | - @Override | ||
| 764 | - public void onError(int i, String s) { | 757 | + if (voiceMessage.isDownloading()) { |
| 758 | + Toast.makeText(context, "请稍等,正在下载...", Toast.LENGTH_SHORT).show(); | ||
| 759 | + } else { | ||
| 760 | + voiceMessage.setDownloading(true); | ||
| 761 | + voiceMessage.getCnVoiceMessage().getVoice(voicePath, new IChat.OnDownloadListener() { | ||
| 762 | + @Override | ||
| 763 | + public void onSuccess() { | ||
| 764 | + voiceMessage.setDownloading(false); | ||
| 765 | + startVoice(voicePath, animationDrawable); | ||
| 766 | + } | ||
| 765 | 767 | ||
| 766 | - } | ||
| 767 | - }); | 768 | + @Override |
| 769 | + public void onError(int i, String s) { | ||
| 770 | + voiceMessage.setDownloading(false); | ||
| 771 | + } | ||
| 772 | + }); | ||
| 773 | + } | ||
| 768 | } | 774 | } |
| 769 | } | 775 | } |
| 770 | } | 776 | } |
| 771 | 777 | ||
| 772 | @Override | 778 | @Override |
| 773 | - public void onVideoClick(VideoMessage videoMessage) { | 779 | + public void onVideoClick(final VideoMessage videoMessage) { |
| 774 | if (videoMessage.getCnVideoMessage().isSelf()) { | 780 | if (videoMessage.getCnVideoMessage().isSelf()) { |
| 775 | Intent intent = new Intent(PrivateActivity.this, VideoActivity.class); | 781 | Intent intent = new Intent(PrivateActivity.this, VideoActivity.class); |
| 776 | intent.putExtra("videoPath", videoMessage.getCnVideoMessage().getVideoPath()); | 782 | intent.putExtra("videoPath", videoMessage.getCnVideoMessage().getVideoPath()); |
| @@ -779,30 +785,41 @@ public class PrivateActivity extends AppCompatActivity implements View.OnClickLi | @@ -779,30 +785,41 @@ public class PrivateActivity extends AppCompatActivity implements View.OnClickLi | ||
| 779 | String videoUuid = videoMessage.getCnVideoMessage().getVideo().getUuid(); | 785 | String videoUuid = videoMessage.getCnVideoMessage().getVideo().getUuid(); |
| 780 | final String videoPath = FileUtil.getCacheFilePath(videoUuid); | 786 | final String videoPath = FileUtil.getCacheFilePath(videoUuid); |
| 781 | if (FileUtil.isCacheFileExist(videoUuid)) { | 787 | if (FileUtil.isCacheFileExist(videoUuid)) { |
| 788 | + File file = new File(videoPath); | ||
| 789 | + if (file.length() < videoMessage.getCnVideoMessage().getVideo().getSize()) { | ||
| 790 | + Toast.makeText(context, "请稍等,正在下载...", Toast.LENGTH_SHORT).show(); | ||
| 791 | + return; | ||
| 792 | + } | ||
| 782 | Intent intent = new Intent(PrivateActivity.this, VideoActivity.class); | 793 | Intent intent = new Intent(PrivateActivity.this, VideoActivity.class); |
| 783 | intent.putExtra("videoPath", videoPath); | 794 | intent.putExtra("videoPath", videoPath); |
| 784 | startActivity(intent); | 795 | startActivity(intent); |
| 785 | } else { | 796 | } else { |
| 786 | - videoMessage.getCnVideoMessage().getVideo().getVideo(videoPath, new IChat.OnDownloadListener() { | ||
| 787 | - @Override | ||
| 788 | - public void onSuccess() { | ||
| 789 | - Intent intent = new Intent(PrivateActivity.this, VideoActivity.class); | ||
| 790 | - intent.putExtra("videoPath", videoPath); | ||
| 791 | - startActivity(intent); | ||
| 792 | - } | ||
| 793 | - | ||
| 794 | - @Override | ||
| 795 | - public void onError(int i, String s) { | 797 | + if (videoMessage.isDownloading()) { |
| 798 | + Toast.makeText(context, "请稍等,正在下载...", Toast.LENGTH_SHORT).show(); | ||
| 799 | + } else { | ||
| 800 | + videoMessage.setDownloading(true); | ||
| 801 | + videoMessage.getCnVideoMessage().getVideo().getVideo(videoPath, new IChat.OnDownloadListener() { | ||
| 802 | + @Override | ||
| 803 | + public void onSuccess() { | ||
| 804 | + videoMessage.setDownloading(false); | ||
| 805 | + Intent intent = new Intent(PrivateActivity.this, VideoActivity.class); | ||
| 806 | + intent.putExtra("videoPath", videoPath); | ||
| 807 | + startActivity(intent); | ||
| 808 | + } | ||
| 796 | 809 | ||
| 797 | - } | ||
| 798 | - }); | 810 | + @Override |
| 811 | + public void onError(int i, String s) { | ||
| 812 | + videoMessage.setDownloading(false); | ||
| 813 | + } | ||
| 814 | + }); | ||
| 815 | + } | ||
| 799 | } | 816 | } |
| 800 | } | 817 | } |
| 801 | 818 | ||
| 802 | } | 819 | } |
| 803 | 820 | ||
| 804 | @Override | 821 | @Override |
| 805 | - public void onUgcVideoClick(UgcVideoMessage ugcVideoMessage) { | 822 | + public void onUgcVideoClick(final UgcVideoMessage ugcVideoMessage) { |
| 806 | if (ugcVideoMessage.getCnUgcMessage().isSelf()) { | 823 | if (ugcVideoMessage.getCnUgcMessage().isSelf()) { |
| 807 | Intent intent = new Intent(PrivateActivity.this, VideoActivity.class); | 824 | Intent intent = new Intent(PrivateActivity.this, VideoActivity.class); |
| 808 | intent.putExtra("videoPath", ugcVideoMessage.getCnUgcMessage().getVideoPath()); | 825 | intent.putExtra("videoPath", ugcVideoMessage.getCnUgcMessage().getVideoPath()); |
| @@ -811,23 +828,34 @@ public class PrivateActivity extends AppCompatActivity implements View.OnClickLi | @@ -811,23 +828,34 @@ public class PrivateActivity extends AppCompatActivity implements View.OnClickLi | ||
| 811 | String videoUuid = ugcVideoMessage.getCnUgcMessage().getFileId() + "_video"; | 828 | String videoUuid = ugcVideoMessage.getCnUgcMessage().getFileId() + "_video"; |
| 812 | final String videoPath = FileUtil.getCacheFilePath(videoUuid); | 829 | final String videoPath = FileUtil.getCacheFilePath(videoUuid); |
| 813 | if (FileUtil.isCacheFileExist(videoUuid)) { | 830 | if (FileUtil.isCacheFileExist(videoUuid)) { |
| 831 | + File file = new File(videoPath); | ||
| 832 | + if (file.length() < ugcVideoMessage.getCnUgcMessage().getVideo().getSize()) { | ||
| 833 | + Toast.makeText(context, "请稍等,正在下载...", Toast.LENGTH_SHORT).show(); | ||
| 834 | + return; | ||
| 835 | + } | ||
| 814 | Intent intent = new Intent(PrivateActivity.this, VideoActivity.class); | 836 | Intent intent = new Intent(PrivateActivity.this, VideoActivity.class); |
| 815 | intent.putExtra("videoPath", videoPath); | 837 | intent.putExtra("videoPath", videoPath); |
| 816 | startActivity(intent); | 838 | startActivity(intent); |
| 817 | } else { | 839 | } else { |
| 818 | - ugcVideoMessage.getCnUgcMessage().getVideo().getVideo(videoPath, new IChat.OnDownloadListener() { | ||
| 819 | - @Override | ||
| 820 | - public void onSuccess() { | ||
| 821 | - Intent intent = new Intent(PrivateActivity.this, VideoActivity.class); | ||
| 822 | - intent.putExtra("videoPath", videoPath); | ||
| 823 | - startActivity(intent); | ||
| 824 | - } | ||
| 825 | - | ||
| 826 | - @Override | ||
| 827 | - public void onError(int i, String s) { | 840 | + if (ugcVideoMessage.isDownloading()) { |
| 841 | + Toast.makeText(context, "请稍等,正在下载...", Toast.LENGTH_SHORT).show(); | ||
| 842 | + } else { | ||
| 843 | + ugcVideoMessage.setDownloading(true); | ||
| 844 | + ugcVideoMessage.getCnUgcMessage().getVideo().getVideo(videoPath, new IChat.OnDownloadListener() { | ||
| 845 | + @Override | ||
| 846 | + public void onSuccess() { | ||
| 847 | + ugcVideoMessage.setDownloading(false); | ||
| 848 | + Intent intent = new Intent(PrivateActivity.this, VideoActivity.class); | ||
| 849 | + intent.putExtra("videoPath", videoPath); | ||
| 850 | + startActivity(intent); | ||
| 851 | + } | ||
| 828 | 852 | ||
| 829 | - } | ||
| 830 | - }); | 853 | + @Override |
| 854 | + public void onError(int i, String s) { | ||
| 855 | + ugcVideoMessage.setDownloading(false); | ||
| 856 | + } | ||
| 857 | + }); | ||
| 858 | + } | ||
| 831 | } | 859 | } |
| 832 | } | 860 | } |
| 833 | } | 861 | } |