Quellcode durchsuchen

版本升级为3.4.9:
调整评论列表:添加楼层与发布时间
视频详情页面布局优化

zengjiebin vor 7 Jahren
Ursprung
Commit
0eacfa65de

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/model/entity/UserEntity.java

@@ -420,7 +420,7 @@ public class UserEntity implements Serializable {
         return level >= LEVEL_VIP;
     }
     public CharSequence getVIPInfo(){
-        String info = String.format(Locale.CHINA, "(%s到期)", TimeUtil.TimeStamp2Date(vip_time, "yyyy/MM/dd"));
-        return new SpannableSb().append("VIP").append(info, R.dimen.text_size_10).getSsb();
+        String info = String.format(Locale.CHINA, "\t%s到期", TimeUtil.TimeStamp2Date(vip_time, "yyyy.MM.dd"));
+        return new SpannableSb().append("VIP").append(info, R.dimen.text_size_9).getSsb();
     }
 }

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java

@@ -1539,7 +1539,7 @@ public class ViewUtil {
             LayoutParamsUtil.resetLayoutParams(dialog_yf_shop_ad_btn_tv, new Lp(per).setBottomMargin(100));
 
             ViewUtil.setText(dialog_yf_shop_ad_yuan_tv, new SpannableSb().append("¥", R.dimen.text_size_2).append(receiveCouponsCheckResq.getAmountText(), R.dimen.text_size_28).setTextStyle(Typeface.BOLD).getSsb());
-            ViewUtil.setText(dialog_yf_shop_ad_tip_tv, R.string.yf_shop_quan_tip, receiveCouponsCheckResq.getAmountText());
+            ViewUtil.setText(dialog_yf_shop_ad_tip_tv, R.string.yf_shop_quan_tip, receiveCouponsCheckResq.getAmountText(), receiveCouponsCheckResq.getAmountText());
             dialog_close.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View v) {

+ 27 - 5
app/src/main/java/com/sheep/gamegroup/view/activity/ActVideoDetail.java

@@ -17,6 +17,7 @@ import android.widget.ImageView;
 import android.widget.TextView;
 import android.widget.VideoView;
 
+import com.danikula.videocache.CacheListener;
 import com.kfzs.duanduan.utils.StatusBarUtils;
 import com.sheep.gamegroup.absBase.BaseUMActivity;
 import com.sheep.gamegroup.absBase.IRefresh;
@@ -39,6 +40,7 @@ import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.umeng.socialize.bean.SHARE_MEDIA;
 
+import java.io.File;
 import java.util.ArrayList;
 
 import butterknife.BindView;
@@ -50,7 +52,7 @@ import io.reactivex.schedulers.Schedulers;
  * realicing@sina.com
  * 小绵羊3.4.5新增 -- 视频详情
  */
-public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfoListener, MediaPlayer.OnPreparedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnCompletionListener {
+public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfoListener, MediaPlayer.OnPreparedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnCompletionListener, CacheListener {
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -150,6 +152,8 @@ public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfo
         videoView.setOnCompletionListener(this);
 //        videoView.setMediaController(new MediaController(this));
         videoView.setVideoURI(getUri());
+//        videoView.setVideoPath(getUrl());
+//        videoView.start();
         resetVideoOrientation();
     }
     //重新设置视频的方向,videoView没法设置方向
@@ -157,9 +161,16 @@ public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfo
 //        if(orientation > 0 && orientation < 360)
 //            videoView.setRotation(orientation);
     }
+    private boolean isResister = false;
+    //转化地址
+    private String getUrl(){
+        if(isResister)
+            SheepApp.getHttpProxyCacheServer().registerCacheListener(this, video_url);
+        return SheepApp.getHttpProxyCacheServer().getProxyUrl(video_url);
+    }
     //转化地址
     private Uri getUri(){
-        String proxyUrl = SheepApp.getHttpProxyCacheServer().getProxyUrl(video_url);
+        String proxyUrl = getUrl();
         Uri uri = Uri.parse(proxyUrl);
         LogUtil.println(ActVideoDetail.class.getSimpleName(),"\n", video_url, "\n", proxyUrl);
         return uri;
@@ -229,6 +240,10 @@ public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfo
     public void onClickAddVideo(View view) {
         Jump2View.getInstance().gotoActPublishArticle(MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO);
     }
+    //点击返回
+    public void onClickBackImg(View view) {
+        onBackPressed();
+    }
     //点击头像跳转用户游戏主页
     public void onClickAvatar(View view) {
         if (user_id > 0)
@@ -380,6 +395,8 @@ public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfo
             return;
         }
         videoView.stopPlayback();
+        if(isResister)
+            SheepApp.getHttpProxyCacheServer().unregisterCacheListener(this, video_url);
     }
 
 
@@ -527,7 +544,7 @@ public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfo
     @Override
     public boolean onInfo(MediaPlayer mediaPlayer, int what, int extra) {
         LogUtil.println("ActPlayVideo", "onInfo what = " + what + " extra = " + extra);
-        if (!mediaPlayer.isLooping())
+        if(!mediaPlayer.isLooping())
             mediaPlayer.setLooping(true);
         switch (what) {
             case MediaPlayer.MEDIA_INFO_BUFFERING_START:
@@ -555,8 +572,9 @@ public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfo
 
     @Override
     public boolean onError(MediaPlayer mediaPlayer, int what, int extra) {
-        LogUtil.println("ActPlayVideo", "onInfo what = " + what + " extra = " + extra);
-        return false;
+        LogUtil.println("ActPlayVideo", "onError what = " + what + " extra = " + extra);
+        initPlay();
+        return true;
     }
 
     @Override
@@ -564,4 +582,8 @@ public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfo
         LogUtil.println("ActPlayVideo", "onCompletion");
     }
 
+    @Override
+    public void onCacheAvailable(File cacheFile, String url, int percentsAvailable) {
+        LogUtil.println("ActPlayVideo", "onCacheAvailable", cacheFile.getAbsolutePath(), url, percentsAvailable);
+    }
 }

+ 4 - 0
app/src/main/java/com/sheep/gamegroup/view/adapter/AdpArticleComment.java

@@ -13,12 +13,14 @@ import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.ApiUtil;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.TextViewUtil;
+import com.sheep.gamegroup.util.TimeUtil;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
 
 import java.util.List;
+import java.util.Locale;
 
 import rx.functions.Action1;
 
@@ -49,6 +51,7 @@ public class AdpArticleComment extends BaseQuickAdapter<UserComment, BaseViewHol
         TextView article_comment_num1 = helper.itemView.findViewById(R.id.article_comment_num1);
         final TextView article_comment_num2 = helper.itemView.findViewById(R.id.article_comment_num2);
         final TextView article_comment_num3 = helper.itemView.findViewById(R.id.article_comment_num3);
+        TextView article_comment_time_tv = helper.itemView.findViewById(R.id.article_comment_time_tv);
         View article_comment_line_top = helper.itemView.findViewById(R.id.article_comment_line_top);
         ViewUtil.setVisibility(article_comment_line_top, position != 0);
         if(item == null){
@@ -59,6 +62,7 @@ public class AdpArticleComment extends BaseQuickAdapter<UserComment, BaseViewHol
         ViewUtil.setText(article_comment_num2, item.getLike());
         ViewUtil.setText(article_comment_num3, item.getExpression());
         ViewUtil.setText(article_comment_user_name, item.getNickname());
+        ViewUtil.setText(article_comment_time_tv, String.format(Locale.CHINA, "%d楼\u3000%s", position + 1, TimeUtil.TimeStamp2Date(item.getCreate_time(), "yyyy-MM-dd\u0020hh:mm")));
         //String.format(Locale.CHINA, "%d %d %d %d", position, helper.getAdapterPosition(), helper.getLayoutPosition(), helper.getOldPosition()));
         TextViewUtil.initIntroView(helper.itemView, item.getShowAll());
         ViewUtil.setVisibility(article_comment_num1, hasCommentDetail);

+ 4 - 0
app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGcGameAppComment.java

@@ -13,12 +13,14 @@ import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.ApiUtil;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.TextViewUtil;
+import com.sheep.gamegroup.util.TimeUtil;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
 
 import java.util.List;
+import java.util.Locale;
 
 /**
  * Created by realicing on 2018/11/1.
@@ -39,6 +41,7 @@ public class AdpGcGameAppComment extends BaseQuickAdapter<UserComment, BaseViewH
         TextView game_app_comment_num1 = helper.itemView.findViewById(R.id.game_app_comment_num1);
         final TextView game_app_comment_num2 = helper.itemView.findViewById(R.id.game_app_comment_num2);
         final TextView game_app_comment_num3 = helper.itemView.findViewById(R.id.game_app_comment_num3);
+        TextView game_app_comment_time_tv = helper.itemView.findViewById(R.id.game_app_comment_time_tv);
         View game_app_comment_line_top = helper.itemView.findViewById(R.id.game_app_comment_line_top);
         ViewUtil.setVisibility(game_app_comment_line_top, position != 0);
         if (item == null) {
@@ -51,6 +54,7 @@ public class AdpGcGameAppComment extends BaseQuickAdapter<UserComment, BaseViewH
         game_app_comment_score.setProgress(item.getScore());
         game_app_comment_score.setMax(10);
         ViewUtil.setText(game_app_comment_user_name, item.getNickname());
+        ViewUtil.setText(game_app_comment_time_tv, String.format(Locale.CHINA, "%d楼\u3000%s", position + 1, TimeUtil.TimeStamp2Date(item.getCreate_time(), "yyyy-MM-dd\u0020hh:mm")));
         //String.format(Locale.CHINA, "%d %d %d %d", position, helper.getAdapterPosition(), helper.getLayoutPosition(), helper.getOldPosition()));
         TextViewUtil.initIntroView(helper.itemView, item.getShowAll());
 

+ 16 - 0
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtArticleComment.java

@@ -177,11 +177,13 @@ public class FgtArticleComment extends BaseListFragment3<UserComment> implements
     private View find_information_bottom_item_line;
     private View find_information_bottom_item_game;
     private View find_article_comment_title_rl;
+    private TextView find_article_comment_title_tv;
 
     //初始化headerView
     private void initHeaderView() {
         headerView = LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.header_act_article, null);
         find_article_comment_title_rl = headerView.findViewById(R.id.find_article_comment_title_rl);
+        find_article_comment_title_tv = headerView.findViewById(R.id.find_article_comment_title_tv);
         find_information_bottom_item = headerView.findViewById(R.id.find_information_bottom_item);
         find_information_bottom_item_line = headerView.findViewById(R.id.find_information_bottom_item_line);
         find_information_bottom_item_game = headerView.findViewById(R.id.find_information_bottom_item_game);
@@ -349,6 +351,20 @@ public class FgtArticleComment extends BaseListFragment3<UserComment> implements
         return UserComment.class;
     }
 
+    @Override
+    public void notifyDataSetChanged() {
+        super.notifyDataSetChanged();
+        int totalCount = list.size();
+        if(lastMessage != null && lastMessage.getTotal() > totalCount)
+            totalCount = lastMessage.getTotal();
+        if(totalCount == 0){
+            ViewUtil.setVisibility(find_article_comment_title_rl, false);
+        } else {
+            ViewUtil.setVisibility(find_article_comment_title_rl, true);
+            ViewUtil.setText(find_article_comment_title_tv, String.format(Locale.CHINA, "用户评价(%d)", totalCount));
+        }
+    }
+
     private Map<String, TextView> downLoadTextViewMap = new HashMap<>();
 
     //获取任务对应的TextView来更新进度

+ 16 - 2
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtGcGameAppComment.java

@@ -58,6 +58,7 @@ public class FgtGcGameAppComment extends BaseListFragment3<UserComment> {
     private List<GameAppScore> scoreList = ListUtil.emptyList();
     //头部view
     private View headerView;
+    private TextView comment_title_tv;
     private WaterWaveProgress circularProgressView;
     private RatingBar header_gc_game_app_comment_score;
     private RecyclerView header_gc_game_app_comment_xin_list;
@@ -66,6 +67,7 @@ public class FgtGcGameAppComment extends BaseListFragment3<UserComment> {
     protected RecyclerView.Adapter getAdapter() {
         //头部
         headerView = LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.header_gc_game_app_comment, null);
+        comment_title_tv = headerView.findViewById(R.id.comment_title_tv);
         circularProgressView = headerView.findViewById(R.id.header_gc_game_app_comment_score_progress);
         header_gc_game_app_comment_score = headerView.findViewById(R.id.header_gc_game_app_comment_score);
 
@@ -119,6 +121,19 @@ public class FgtGcGameAppComment extends BaseListFragment3<UserComment> {
     protected Class<UserComment> getTClass() {
         return UserComment.class;
     }
+    @Override
+    public void notifyDataSetChanged() {
+        super.notifyDataSetChanged();
+        int totalCount = list.size();
+        if(lastMessage != null && lastMessage.getTotal() > totalCount)
+            totalCount = lastMessage.getTotal();
+        if(totalCount == 0){
+            ViewUtil.setVisibility(comment_title_tv, false);
+        } else {
+            ViewUtil.setVisibility(comment_title_tv, true);
+            ViewUtil.setText(comment_title_tv, String.format(Locale.CHINA, "用户评价(%d)", totalCount));
+        }
+    }
 
     //不会用到了,因为评分系统重新做了一套,以前的没用了
     public void loadData(GameEntity gameEntity) {
@@ -193,8 +208,7 @@ public class FgtGcGameAppComment extends BaseListFragment3<UserComment> {
 
     //刷新头部view
     private void notifyHeaderDataSetChanged() {
-        if (header_gc_game_app_comment_xin_list != null)
-            header_gc_game_app_comment_xin_list.getAdapter().notifyDataSetChanged();
+        ViewUtil.notifyDataSetChanged(header_gc_game_app_comment_xin_list);
 
         if (empty_view != null) {
             empty_view.postDelayed(new Runnable() {

+ 0 - 1
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtGcGameAppDetail.java

@@ -1,6 +1,5 @@
 package com.sheep.gamegroup.view.fragment;
 
-import android.app.Activity;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.text.TextUtils;

+ 1 - 0
app/src/main/res/layout/header_act_article.xml

@@ -96,6 +96,7 @@
         app:layout_constraintTop_toBottomOf="@id/find_information_bottom_item_game">
 
         <TextView
+            android:id="@+id/find_article_comment_title_tv"
             style="@style/style_wc_line_title"
             android:text="用户评价" />
 

+ 1 - 0
app/src/main/res/layout/header_gc_game_app_comment.xml

@@ -74,6 +74,7 @@
         app:layout_constraintTop_toBottomOf="@id/header_gc_game_app_comment_xin_list" />
 
     <TextView
+        android:id="@+id/comment_title_tv"
         style="@style/style_wc_line_title"
         android:layout_marginTop="21dp"
         android:text="用户评价"

+ 24 - 11
app/src/main/res/layout/include_article_video_top.xml

@@ -7,46 +7,59 @@
     android:background="#33000000">
 
     <ImageView
-        android:id="@+id/video_camera_iv"
+        android:id="@+id/video_back_iv"
         android:layout_width="66dp"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="22dp"
-        android:padding="18dp"
-        android:onClick="onClickAddVideo"
-        android:src="@drawable/loading_01"
+        android:layout_height="76dp"
+        android:layout_marginTop="24dp"
+        android:onClick="onClickBackImg"
+        android:scaleType="centerInside"
+        android:src="@drawable/narrow_back_white"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
+    <View
+        android:id="@+id/video_top_top"
+        android:layout_width="wrap_content"
+        android:layout_height="70dp"/>
 
     <ImageView
         android:id="@+id/video_avatar_iv"
         android:layout_width="76dp"
         android:layout_height="76dp"
-        android:layout_marginTop="15dp"
         android:onClick="onClickAvatar"
         android:padding="18dp"
         android:src="@drawable/avatar"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+        app:layout_constraintTop_toBottomOf="@id/video_top_top" />
 
     <ImageView
         android:layout_width="42dp"
         android:layout_height="42dp"
-        android:layout_marginTop="31dp"
+        android:layout_marginTop="16dp"
         android:layout_marginEnd="16dp"
         android:background="@drawable/shape_circle_white_stroke"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+        app:layout_constraintTop_toBottomOf="@id/video_top_top" />
 
     <android.support.design.widget.CheckableImageButton
         android:id="@+id/video_focus_iv"
         android:layout_width="34dp"
         android:layout_height="34dp"
-        android:layout_marginTop="56dp"
+        android:layout_marginTop="41dp"
         android:layout_marginEnd="20dp"
         android:background="@null"
         android:onClick="onClickVideoFocus"
         android:padding="10dp"
         android:src="@drawable/selector_focus"
         app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/video_top_top" />
+    <ImageView
+        android:id="@+id/video_camera_iv"
+        android:layout_width="76dp"
+        android:layout_height="76dp"
+        android:layout_marginTop="24dp"
+        android:onClick="onClickAddVideo"
+        android:scaleType="centerInside"
+        android:src="@drawable/loading_01"
+        app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 </android.support.constraint.ConstraintLayout>

+ 12 - 0
app/src/main/res/layout/item_article_comment.xml

@@ -117,4 +117,16 @@
         app:layout_constraintEnd_toStartOf="@id/article_comment_num2"
         app:layout_constraintTop_toTopOf="@id/article_comment_num1" />
 
+    <TextView
+        android:id="@+id/article_comment_time_tv"
+        android:layout_width="wrap_content"
+        android:layout_height="0dp"
+        android:paddingStart="16dp"
+        android:paddingEnd="16dp"
+        android:textSize="7sp"
+        android:textColor="#ff666666"
+        android:gravity="center_vertical"
+        android:text="@string/app_name"
+        app:layout_constraintBottom_toBottomOf="@id/article_comment_num1"
+        app:layout_constraintTop_toTopOf="@id/article_comment_num1"/>
 </android.support.constraint.ConstraintLayout>

+ 12 - 0
app/src/main/res/layout/item_gc_game_app_comment.xml

@@ -127,4 +127,16 @@
         app:layout_constraintEnd_toStartOf="@id/game_app_comment_num2"
         app:layout_constraintTop_toTopOf="@id/game_app_comment_num1" />
 
+    <TextView
+        android:id="@+id/game_app_comment_time_tv"
+        android:layout_width="wrap_content"
+        android:layout_height="0dp"
+        android:paddingStart="16dp"
+        android:paddingEnd="16dp"
+        android:textSize="7sp"
+        android:textColor="#ff666666"
+        android:gravity="center_vertical"
+        android:text="@string/app_name"
+        app:layout_constraintBottom_toBottomOf="@id/game_app_comment_num1"
+        app:layout_constraintTop_toTopOf="@id/game_app_comment_num1"/>
 </android.support.constraint.ConstraintLayout>

+ 1 - 0
app/src/main/res/values/common.xml

@@ -20,6 +20,7 @@
     <dimen name="text_size_3">14sp</dimen>
     <dimen name="text_size_4">16sp</dimen>
     <dimen name="text_size_5">18sp</dimen>
+    <dimen name="text_size_9">9sp</dimen>
     <dimen name="text_size_10">10sp</dimen>
     <dimen name="text_size_12">12sp</dimen>
     <dimen name="text_size_15">15sp</dimen>

+ 1 - 1
app/src/main/res/values/strings.xml

@@ -208,7 +208,7 @@
     <string name="you_had_cancel_pay">您取消了支付</string>
     <string name="task_detail_vip_tip">做任务可提高收益哦,奖励优先审核</string>
     <string name="get_money_x_yuan">账户入账通知 尊敬的羊羊用户,恭喜元宝账户收入XXX元。</string>
-    <string name="yf_shop_quan_tip">恭喜你获得%s元商品劵,你可前往商城,直接选择心仪的商品哦~</string>
+    <string name="yf_shop_quan_tip">恭喜你获得%1$s元的商品劵,但需消耗%2$s的绵羊币,确认后可以前往商城,直接选择心仪的商品哦~</string>
     <string name="yf_shop_quan_title">—— 商城优惠券  ——</string>
     <string name="yf_shop_ask_tip">恭喜%s用户,元旦邀新活动,你已获得礼品,请前往填写收件信息,羊羊乐园的工作人员将尽快的为你安排发货,请耐心等待!</string>
     <string name="yf_shop_ask_tip_2">恭喜%s用户,元旦邀新活动,你已获得礼品。请耐心等待,羊羊乐园的工作人员将尽快的为你安排发货,!</string>

+ 2 - 2
gradle.properties

@@ -17,8 +17,8 @@
 # org.gradle.parallel=true
 #android.injected.build.model.only.versioned = 3
 
-VERSION_NAME=3.4.8
-VERSION_CODE=3004008
+VERSION_NAME=3.4.9
+VERSION_CODE=3004009
 ANDROID_COMPILE_SDK_VERSION=28
 ANDROID_BUILD_TOOLS_VERSION=28.0.3
 ANDROID_MIN_SDK_VERSION=18