|
@@ -1,8 +1,11 @@
|
|
|
package com.ynstkz.shitu.android.activity;
|
|
|
|
|
|
+import android.annotation.SuppressLint;
|
|
|
import android.content.Intent;
|
|
|
import android.net.Uri;
|
|
|
import android.os.Bundle;
|
|
|
+import android.os.Handler;
|
|
|
+import android.os.Message;
|
|
|
import android.support.annotation.Nullable;
|
|
|
import android.support.v4.view.ViewPager;
|
|
|
import android.text.TextUtils;
|
|
@@ -15,6 +18,7 @@ import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.ListView;
|
|
|
import android.widget.RelativeLayout;
|
|
|
+import android.widget.ScrollView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.bumptech.glide.Glide;
|
|
@@ -24,8 +28,10 @@ import com.google.gson.Gson;
|
|
|
import com.ynstkz.shitu.android.R;
|
|
|
import com.ynstkz.shitu.android.adapter.OrgCourseListAdapter;
|
|
|
import com.ynstkz.shitu.android.adapter.OrgDetailCommentPicAdapter;
|
|
|
+import com.ynstkz.shitu.android.adapter.ViewPagerAdapter;
|
|
|
import com.ynstkz.shitu.android.base.BaseBean;
|
|
|
import com.ynstkz.shitu.android.base.TitleBarActivity;
|
|
|
+import com.ynstkz.shitu.android.bean.BannerItenBean;
|
|
|
import com.ynstkz.shitu.android.bean.CourseItemBean;
|
|
|
import com.ynstkz.shitu.android.bean.EvaluateListBean;
|
|
|
import com.ynstkz.shitu.android.bean.OrgDetailBean;
|
|
@@ -36,6 +42,7 @@ import com.ynstkz.shitu.android.helper.UmengShareHelper;
|
|
|
import com.ynstkz.shitu.android.view.ListViewForScrollView;
|
|
|
import com.ynstkz.shitu.android.view.ScrollViewWithGridView;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -91,10 +98,13 @@ public class OrgDetailActivity extends TitleBarActivity {
|
|
|
LinearLayout llOrgService;
|
|
|
@Bind(R.id.ll_recommend_main)
|
|
|
LinearLayout llRecommendMain;
|
|
|
+ @Bind(R.id.sv_main)
|
|
|
+ ScrollView svMain;
|
|
|
|
|
|
private int memberId;
|
|
|
private boolean isCollect;
|
|
|
private OrgDetailBean.DataBean dataBean;
|
|
|
+ private int bannerIndex;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
@@ -160,7 +170,7 @@ public class OrgDetailActivity extends TitleBarActivity {
|
|
|
ivCollect.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
- if(isLogin()){
|
|
|
+ if (isLogin()) {
|
|
|
if (!isCollect) {
|
|
|
collectOrg(memberId + "");
|
|
|
} else {
|
|
@@ -225,6 +235,7 @@ public class OrgDetailActivity extends TitleBarActivity {
|
|
|
showToast(orgDetailBean.getMsg());
|
|
|
}
|
|
|
}
|
|
|
+ svMain.smoothScrollTo(0,0);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -248,6 +259,9 @@ public class OrgDetailActivity extends TitleBarActivity {
|
|
|
isCollect = dataBean.isCollect();
|
|
|
initCollectIcon();
|
|
|
|
|
|
+ //初始化Banner信息
|
|
|
+ initBannerView();
|
|
|
+
|
|
|
//课程信息
|
|
|
if (dataBean.getCourseList() != null && dataBean.getCourseList().size() > 0) {
|
|
|
OrgCourseListAdapter orgCourseListAdapter = new OrgCourseListAdapter(this, dataBean.getCourseList());
|
|
@@ -309,7 +323,7 @@ public class OrgDetailActivity extends TitleBarActivity {
|
|
|
}
|
|
|
|
|
|
//相似评论
|
|
|
- if(dataBean.getRecentList() != null && dataBean.getRecentList().size() > 0){
|
|
|
+ if (dataBean.getRecentList() != null && dataBean.getRecentList().size() > 0) {
|
|
|
llRecommendMain.setVisibility(View.VISIBLE);
|
|
|
} else {
|
|
|
llRecommendMain.setVisibility(View.GONE);
|
|
@@ -317,6 +331,60 @@ public class OrgDetailActivity extends TitleBarActivity {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 初始化banner信息
|
|
|
+ */
|
|
|
+ private void initBannerView() {
|
|
|
+ if (dataBean.getShowPicList() != null && dataBean.getShowPicList().size() > 0) {
|
|
|
+ List<View> listShowPic = new ArrayList<>();
|
|
|
+ for (int i = 0; i < dataBean.getShowPicList().size(); i++) {
|
|
|
+ ImageView imageView = new ImageView(this);
|
|
|
+ final BannerItenBean bannerItenBean = dataBean.getShowPicList().get(i);
|
|
|
+ String picUrl = bannerItenBean.getUrl();
|
|
|
+ if (!TextUtils.isEmpty(picUrl)) {
|
|
|
+ if (picUrl.startsWith("http")) {
|
|
|
+ Glide.with(this).load(picUrl).into(imageView);
|
|
|
+ } else {
|
|
|
+ Glide.with(this).load(UrlCat.HOST + picUrl).into(imageView);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ imageView.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ Intent intent = new Intent(OrgDetailActivity.this, WebViewActivity.class);
|
|
|
+ intent.putExtra("url", bannerItenBean.getAppJump());
|
|
|
+ startActivity(intent);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ listShowPic.add(imageView);
|
|
|
+ }
|
|
|
+ ViewPagerAdapter adapter = new ViewPagerAdapter(listShowPic);
|
|
|
+ vpBanner.setAdapter(adapter);
|
|
|
+ vpBanner.setCurrentItem(bannerIndex);
|
|
|
+ adapter.notifyDataSetChanged();
|
|
|
+ handler.sendEmptyMessage(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressLint("HandlerLeak")
|
|
|
+ Handler handler = new Handler() {
|
|
|
+ @Override
|
|
|
+ public void handleMessage(Message msg) {
|
|
|
+ switch (msg.what) {
|
|
|
+ case 0:
|
|
|
+ bannerIndex++;
|
|
|
+ if (bannerIndex < dataBean.getShowPicList().size()) {
|
|
|
+ vpBanner.setCurrentItem(bannerIndex);
|
|
|
+ } else {
|
|
|
+ vpBanner.setCurrentItem(0);
|
|
|
+ bannerIndex = 0;
|
|
|
+ }
|
|
|
+ handler.sendEmptyMessageDelayed(0, 3000);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
* 收藏
|
|
|
*
|
|
|
* @param memberId
|
|
@@ -410,4 +478,10 @@ public class OrgDetailActivity extends TitleBarActivity {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onDestroy() {
|
|
|
+ super.onDestroy();
|
|
|
+ handler.removeCallbacksAndMessages(null);
|
|
|
+ }
|
|
|
}
|