zoukankan      html  css  js  c++  java
  • 便签三

    界面源代码:

    public void handlerInfo(int scheduleID) {       
      BorderTextView date = new BorderTextView(this, (AttributeSet)null);     
        date.setTextColor(-16777216);      
       date.setBackgroundColor(-1);      
       date.setLayoutParams(this.params);     
        date.setGravity(16);       
      date.setHeight(40);     
        date.setPadding(10, 0, 10, 0);     
        BorderTextView type = new BorderTextView(this, (AttributeSet)null);      
       type.setTextColor(-16777216);       
      type.setBackgroundColor(-1);     
        type.setLayoutParams(this.params);     
        type.setGravity(17);     
        type.setHeight(40);     
        type.setPadding(10, 0, 10, 0);      
       type.setTag(Integer.valueOf(scheduleID));      
       BorderTextView info = new BorderTextView(this, (AttributeSet)null);    
         info.setTextColor(-16777216);      
       info.setBackgroundColor(-1);    
         info.setGravity(16);   
          info.setLayoutParams(this.params);   
          info.setPadding(10, 5, 10, 5);    
         this.layout.addView(type);   
          this.layout.addView(date);    
         this.layout.addView(info);     
        this.scheduleVO = this.dao.getScheduleByID(scheduleID);     
        date.setText(this.scheduleVO.getScheduleDate());   
          type.setText(CalendarConstant.sch_type[this.scheduleVO.getScheduleTypeID()]);      
       info.setText(this.scheduleVO.getScheduleContent());     
        type.setOnLongClickListener(new OnLongClickListener() {        
         public boolean onLongClick(View v) {              
       final String scheduleID = String.valueOf(v.getTag());         
            (new Builder(ScheduleInfoView.this)).setTitle("删除日程").setMessage("确认删除").setPositiveButton("确认", new OnClickListener() {
     
                        public void onClick(DialogInterface dialog, int which) {                  
           ScheduleInfoView.this.dao.delete(Integer.parseInt(scheduleID));                  
           Intent intent1 = new Intent();                       
      intent1.setClass(ScheduleInfoView.this, ScheduleAll.class);          
                   ScheduleInfoView.this.startActivity(intent1);             
            }              
       }).
    setNegativeButton("取消", (OnClickListener)null).show();     
                return true;        
         }       
      });   
      }
    }
     
     ScheduleView.this.setScheduleDateTag(ScheduleView.this.remindID, ScheduleView.this.scheduleYear, ScheduleView.this.tempMonth, ScheduleView.this.tempDay, scheduleID);   
                  }
                }     
        });  
       }
        public void setScheduleDateTag(int remindID, String year, String month, String day, int scheduleID) {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-M-d");    
         String d = year + "-" + month + "-" + day;      
       Calendar cal = Calendar.getInstance();
            try {             cal.setTime(format.parse(d));   
          } catch (ParseException var10) {             var10.printStackTrace();  
           }
            if(remindID >= 0 && remindID <= 3) {     
            ScheduleDateTag var11 = new ScheduleDateTag();  
               var11.setYear(Integer.parseInt(year));   
              var11.setMonth(Integer.parseInt(month));    
             var11.setDay(Integer.parseInt(day));        
         var11.setScheduleID(scheduleID);          
       this.dateTagList.add(var11);      
       } else {    
             int i;        
         if(remindID == 4) {    
                 for(i = 0; i <= (2049 - Integer.parseInt(year)) * 12 * 4 * 7; ++i) {       
                  if(i == 0) {                         cal.add(5, 0);                 
        } else {                         cal.add(5, 1);                     }
                        this.handleDate(cal, scheduleID);               }      
           } else if(remindID == 5) {       
              for(i = 0; i <= (2049 - Integer.parseInt(year)) * 12 * 4; ++i) {    
                     if(i == 0) {                         cal.add(4, 0);              
           } else {                         cal.add(4, 1);                 
        }
                        this.handleDate(cal, scheduleID);           
          }             } else if(remindID == 6) {             
        for(i = 0; i <= (2049 - Integer.parseInt(year)) * 12; ++i) {      
                   if(i == 0) {                         cal.add(2, 0);                     } else {                         cal.add(2, 1);                     }
                        this.handleDate(cal, scheduleID);                 }             } else if(remindID == 7) {   
                  for(i = 0; i <= 2049 - Integer.parseInt(year); ++i) {     
                    if(i == 0) {                         cal.add(1, 0);                  
       } else {                         cal.add(1, 1);                     }
                        this.handleDate(cal, scheduleID);                 }             }         }
                      this.dao.saveTagDate(this.dateTagList);     }
        public void handleDate(Calendar cal, int scheduleID) {   
          ScheduleDateTag dateTag = new ScheduleDateTag();
            dateTag.setYear(cal.get(1));    
         dateTag.setMonth(cal.get(2) + 1);    
         dateTag.setDay(cal.get(5));     
        dateTag.setScheduleID(scheduleID);     
        this.dateTagList.add(dateTag);     }
        public String handleInfo(int year, int month, int day, int hour, int minute, String week, int remindID) {     
        String remindType = this.remind[remindID];        
     String show = "";       
      if(remindID >= 0 && remindID <= 4) {             show = year + "-" + month + "-" + day + " " + hour + ":" + minute + " " + week + " " + remindType;     
        } else if(remindID == 5) {        
         show = "每周" + week + " " + hour + ":" + minute;      
       } else if(remindID == 6) {       
          show = "每月" + day + "号" + " " + hour + ":" + minute;    
         } else if(remindID == 7) {       
          show = "每年" + month + "-" + day + " " + hour + ":" + minute;         }
            return show; 
     public String getScheduleDate() {     
        Intent intent = this.getIntent();      
       if(intent.getStringArrayListExtra("scheduleDate") != null) {    
     
             scheduleDate = intent.getStringArrayListExtra("scheduleDate");  
           }
            int[] schType_remind = intent.getIntArrayExtra("schType_remind");       
      if(schType_remind != null) {         
        this.sch_typeID = schType_remind[0];        
         this.remindID = schType_remind[1];        
         this.scheduleType.setText(this.sch_type[this.sch_typeID] + " " + this.remind[this.remindID]);         }
            this.scheduleYear = (String)scheduleDate.get(0);     
        this.scheduleMonth = (String)scheduleDate.get(1);   
          this.tempMonth = this.scheduleMonth;    
         if(Integer.parseInt(this.scheduleMonth) < 10) {      
           this.scheduleMonth = "0" + this.scheduleMonth;         }
            this.scheduleDay = (String)scheduleDate.get(2);    
         this.tempDay = this.scheduleDay;  
           if(Integer.parseInt(this.scheduleDay) < 10) {  
               this.scheduleDay = "0" + this.scheduleDay;  
           }
            this.week = (String)scheduleDate.get(3);      
       String hour_c = String.valueOf(hour);      
       String minute_c = String.valueOf(minute);
            if(hour < 10) {        
         hour_c = "0" + hour_c;    
         }
            if(minute < 10) {             minute_c = "0" + minute_c;    
         }
            String scheduleLunarDay = this.getLunarDay(Integer.parseInt(this.scheduleYear), Integer.parseInt(this.scheduleMonth), Integer.parseInt(this.scheduleDay));         String scheduleLunarMonth = this.lc.getLunarMonth();       
      StringBuffer scheduleDateStr = new StringBuffer();     
        scheduleDateStr.append(this.scheduleYear).append("-").append(this.scheduleMonth).append("-").append(this.scheduleDay).append(" ").append(hour_c).append(":").append(minute_c).append(" ").append(scheduleLunarMonth).append(scheduleLunarDay).append(" ").append(this.week);     
        return scheduleDateStr.toString();     }
        public String getLunarDay(int year, int month, int day) {      
       String lunarDay = this.lc.getLunarDate(year, month, day, true);      
       if(lunarDay.substring(1, 2).equals("月")) {   
              lunarDay = "初一";    
         }
            return lunarDay;     } }
  • 相关阅读:
    [leetcode]5最长回文子串
    [leetcode]4寻找两个有序数组的中位数
    [leetcode]3无重复字符的最长字串
    [leetcode]2两数相加
    [leetcode]1两数之和
    [学习记录]堆
    [学习记录]平衡树
    [学习记录]二叉树删除
    [学习记录]排序算法总结
    创建mysql数据库
  • 原文地址:https://www.cnblogs.com/chenbaiwan/p/7041839.html
Copyright © 2011-2022 走看看