예제 #1
0
 @Override
 public View getView(final int position, View convertView, ViewGroup parent) {
   VH vh = null;
   try {
     if (convertView == null) {
       convertView = View.inflate(context, R.layout.adapter_view_index_last_info, null);
       vh = new VH();
       vh.tvName = (TextView) convertView.findViewById(R.id.index_last_info_tv_course_name);
       vh.tvDay = (TextView) convertView.findViewById(R.id.index_last_info_tv_day);
       vh.tvWeek = (TextView) convertView.findViewById(R.id.index_last_info_tv_week);
       vh.tvTime = (TextView) convertView.findViewById(R.id.index_last_info_tv_time);
       vh.ivCourseLogo =
           (ImageView) convertView.findViewById(R.id.index_last_info_iv_course_logo);
       convertView.setTag(vh);
     } else {
       vh = (VH) convertView.getTag();
     }
     final HMCourseBean bean = courseBeans.get(position);
     vh.update(bean);
     convertView.setOnClickListener(
         new OnClickListener() {
           @Override
           public void onClick(View v) {
             Bundle bundle = new Bundle();
             bundle.putString("courseId", bean.getId());
             bundle.putString("courseName", bean.getName());
             HMNavUtil.goToNewAct(context, HMCourseDetailAct.class, bundle);
           }
         });
   } catch (Exception e) {
     ToastUtil.printErr(e);
   }
   return convertView;
 }
예제 #2
0
 /** 更新显示界面 */
 private void updateView() {
   try {
     String teachDate = null;
     String week = null;
     tvName.setText(studentBean.getChild().getName());
     if (currentCourse != null) {
       String strBT = currentCourse.getTeachTime().get(0).get("beginTime");
       String strET = currentCourse.getTeachTime().get(0).get("endTime");
       week = currentCourse.getTeachTime().get(0).get("week");
       tvToTime.setText(strET.substring(0, strET.lastIndexOf(":")));
       tvFromTime.setText(strBT.substring(0, strBT.lastIndexOf(":")));
       teachDate = currentCourse.getTeachDate();
       tvClassName.setText(currentCourse.getName());
     } else {
       teachDate = DateUtil.datetimeToString(new Date(), "yyyy-MM-dd");
       week = DateUtil.datetimeToString(new Date(), "EEEE");
     }
     ToastUtil.log(TAG, teachDate + " " + week);
     tvClassInfo.setText(
         "今天 "
             + teachDate
                 .replace("-", ".")
                 .substring(teachDate.indexOf("-") + 1, teachDate.length())
             + " "
             + week);
   } catch (Exception e) {
     ToastUtil.printErr(e);
   }
 }
예제 #3
0
 @Override
 public void setRequestSuc(String url, int statusCode, Header[] headers, JsonObject jo) {
   super.setRequestSuc(url, statusCode, headers, jo);
   try {
   } catch (Exception e) {
     ToastUtil.printErr(e);
   }
 }
예제 #4
0
 private void dealAdapterViews(ViewHolder holder, List<String> datas, int position) {
   String bean = datas.get(position);
   try {
     TextView tvName = holder.getViewById(R.id.chat_index_contacts_tv_name, TextView.class);
     tvName.setText(bean);
   } catch (Exception e) {
     ToastUtil.printErr(e);
   }
 }
예제 #5
0
 public IndexLastInfoView(Context context, HMStudentBean studentBean) {
   super();
   this.context = context;
   this.studentBean = studentBean;
   try {
     view = View.inflate(context, R.layout.view_index_last_info, null);
     init();
     initListener();
     updateView();
   } catch (Exception e) {
     ToastUtil.printErr(e);
   }
 }
 @Override
 public void onReceive(Context context, Intent intent) {
   try {
     long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0);
     DownloadManager downloadManager = FileManager.getDownloadManager(context);
     Uri uri = downloadManager.getUriForDownloadedFile(downloadId);
     FileManager.apkInstall(context, new File(uri.getPath()));
     PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0);
     FileManager.sendNotification(context, "学苗", "下载已完成", R.mipmap.logo, pi);
   } catch (Exception e) {
     ToastUtil.printErr(e);
   }
 }
 public OnPageChangeListener(ViewPager viewPager) {
   try {
     Field leftEdgeField = viewPager.getClass().getDeclaredField("mLeftEdge");
     Field rightEdgeField = viewPager.getClass().getDeclaredField("mRightEdge");
     if (leftEdgeField != null && rightEdgeField != null) {
       leftEdgeField.setAccessible(true);
       rightEdgeField.setAccessible(true);
       leftEdge = (EdgeEffectCompat) leftEdgeField.get(viewPager);
       rightEdge = (EdgeEffectCompat) rightEdgeField.get(viewPager);
     }
   } catch (Exception e) {
     ToastUtil.printErr(e);
   }
 }
예제 #8
0
  private void init() {
    try {
      names = HMApiChat.getInstance().userList();
      adapter =
          new CommonAdapter<String>(getActivity(), names, R.layout.chat_adapter_index_contacts) {

            @Override
            public void dealViews(ViewHolder holder, List<String> datas, int position) {
              dealAdapterViews(holder, datas, position);
            }
          };
      lvSession.setAdapter(adapter);
    } catch (Exception e) {
      ToastUtil.printErr(e);
    }
  }