便签二

界面源代码:

'''

// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) //
package com.pwp.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.LinearLayout.LayoutParams;
import com.pwp.activity.CalendarActivity;
import com.pwp.activity.ScheduleInfoView;
import com.pwp.activity.ScheduleView;
import com.pwp.borderText.BorderTextView;
import com.pwp.constant.CalendarConstant;
import com.pwp.dao.ScheduleDAO;
import com.pwp.vo.ScheduleVO;
import java.util.ArrayList;
import java.util.Iterator;
public class ScheduleAll extends Activity {   
  private ScrollView sv = null;     
private LinearLayout layout = null;     
private BorderTextView textTop = null;   
  private ScheduleDAO dao = null;     
private ScheduleVO scheduleVO = null;
    private ArrayList<ScheduleVO> schList = new ArrayList();     
private String scheduleInfo = "";    
 private final LayoutParams params = new LayoutParams(-1, -2);    
 private int scheduleID = -1;
    public ScheduleAll() {     }
    protected void onCreate(Bundle savedInstanceState) {       
  super.onCreate(savedInstanceState);        
 this.dao = new ScheduleDAO(this);       
  this.sv = new ScrollView(this);        
 this.params.setMargins(0, 5, 0, 0);        
 this.layout = new LinearLayout(this);         
this.layout.setOrientation(1);        
 this.layout.setBackgroundResource(2130837516);     
    this.layout.setLayoutParams(this.params);        
 this.textTop = new BorderTextView(this, (AttributeSet)null);        
 this.textTop.setTextColor(-16777216);      
   this.textTop.setBackgroundResource(2130837519);    
     this.textTop.setText("所有日程");     
    this.textTop.setHeight(47);        
 this.textTop.setGravity(17);       
  this.layout.addView(this.textTop);        
 this.sv.addView(this.layout);        
 this.setContentView(this.sv);        
 this.getScheduleAll();     }
    public void getScheduleAll() {       
  this.schList = this.dao.getAllSchedule();        
 if(this.schList != null) {             Iterator var2 = this.schList.iterator();
            while(var2.hasNext()) {                
 ScheduleVO vo = (ScheduleVO)var2.next();                
 String content = vo.getScheduleContent();               
  int startLine = content.indexOf(" ");               
  if(startLine > 0) {                    
 content = content.substring(0, startLine) + "...";                
 } else if(content.length() > 30) {                     
content = content.substring(0, 30) + "...";               
  }
                this.scheduleInfo = CalendarConstant.sch_type[vo.getScheduleTypeID()] + " " + vo.getScheduleDate() + " " + content;                
                this.scheduleID = vo.getScheduleID();                
                 this.createInfotext(this.scheduleInfo, this.scheduleID);          
   }       
  } else {            
 this.scheduleInfo = "没有日程";           
  this.createInfotext(this.scheduleInfo, -1);         }
    }

public void createInfotext(String scheduleInfo, int scheduleID) {       
  BorderTextView info = new BorderTextView(this, (AttributeSet)null);      
   info.setText(scheduleInfo);      
   info.setTextColor(-16777216);        
 info.setBackgroundColor(-1);      
   info.setLayoutParams(this.params);       
  info.setGravity(16);        
 info.setPadding(10, 5, 10, 5);         
info.setTag(Integer.valueOf(scheduleID));      
   this.layout.addView(info);      
   info.setOnClickListener(new OnClickListener() {         
    public void onClick(View v) {                
 String schID = String.valueOf(v.getTag());               
  String[] scheduleIDs = new String[]{schID};            
     Intent intent = new Intent();               
  intent.setClass(ScheduleAll.this, ScheduleInfoView.class);               
  intent.putExtra("scheduleID", scheduleIDs);             
    ScheduleAll.this.startActivity(intent);             }         });     }
    public boolean onCreateOptionsMenu(Menu menu) {        
 menu.add(1, 1, 1, "返回日历");        
 menu.add(1, 1 + 1, 1 + 1, "添加日程");       
  return super.onCreateOptionsMenu(menu);  
   }
    public boolean onOptionsItemSelected(MenuItem item) {     
    switch(item.getItemId()) {       
  case 1:         
    Intent intent = new Intent();    
         intent.setClass(this, CalendarActivity.class);        
     this.startActivity(intent);           
  break;         
case 2:            
 Intent intent1 = new Intent();       
      intent1.setClass(this, ScheduleView.class);         
    this.startActivity(intent1);  
       }
        return 
       super.onOptionsItemSelected(item);     } }

'''

'''

//

// Source code recreated from a .

class file by IntelliJ IDEA

// (powered by Fernflower decompiler)

// package com.pwp.activity;

import android.app.Activity;

import android.app.AlertDialog.Builder;

import android.content.DialogInterface;

import android.content.Intent;

import android.content.DialogInterface.OnClickListener;

import android.os.Bundle; import android.util.AttributeSet;

import android.view.Menu;

import android.view.MenuItem;

import android.view.View;

import android.view.View.OnLongClickListener;

import android.widget.LinearLayout;

import android.widget.LinearLayout.LayoutParams;

import com.pwp.activity.ScheduleAll;

import com.pwp.borderText.BorderEditText;

import com.pwp.borderText.BorderTextView;

import com.pwp.constant.CalendarConstant;

import com.pwp.dao.ScheduleDAO;

import com.pwp.vo.ScheduleVO;

public class ScheduleInfoView

 extends Activity {    

 private LinearLayout layout = null;     

private BorderTextView textTop = null;   

  private BorderTextView info = null;     

private BorderTextView date = null;    

 private BorderTextView type = null;   

  private BorderEditText editInfo = null;    

 private ScheduleDAO dao = null;    

 private ScheduleVO scheduleVO = null;     

private String scheduleInfo = "";    

 private String scheduleChangeInfo = "";   

  private final LayoutParams params = new LayoutParams(-1, -2);    

 public ScheduleInfoView() {     

}   

  protected void onCreate(Bundle savedInstanceState) {        

 super.onCreate(savedInstanceState);        

 this.dao = new ScheduleDAO(this);         

this.params.setMargins(0, 5, 0, 0);       

  this.layout = new LinearLayout(this);     

    this.layout.setOrientation(1);        

 this.layout.setBackgroundResource(2130837516);         

this.layout.setLayoutParams(this.params);       

  this.textTop = new BorderTextView(this, (AttributeSet)null);        

 this.textTop.setTextColor(-16777216);       

  this.textTop.setBackgroundResource(2130837519);     

    this.textTop.setText("日程详情");         

this.textTop.setHeight(47);      

   this.textTop.setGravity(17);     

    this.editInfo = new BorderEditText(this, (AttributeSet)null);       

  this.editInfo.setTextColor(-16777216);      

   this.editInfo.setBackgroundColor(-1);      

   this.editInfo.setHeight(200);       

  this.editInfo.setGravity(48);       

  this.editInfo.setLayoutParams(this.params);       

  this.editInfo.setPadding(10, 5, 10, 5);       

  this.layout.addView(this.textTop);       

  Intent intent = this.getIntent();      

   String[] scheduleIDs = intent.getStringArrayExtra("scheduleID");       

  for(int i = 0; i < scheduleIDs.length; ++i) {        

     this.handlerInfo(Integer.parseInt(scheduleIDs[i]));         }

        this.setContentView(this.layout);  

   }     

public boolean onCreateOptionsMenu(Menu menu) {        

 menu.add(1, 1, 1, "所有日程");        

 menu.add(1, 1 + 1, 1 + 1, "添加日程");         

return super.onCreateOptionsMenu(menu);   

  }   

  public boolean onOptionsItemSelected(MenuItem item) {        

 switch(item.getItemId()) {         

case 1:          

   Intent intent = new Intent();            

 intent.setClass(this, ScheduleAll.class);             

this.startActivity(intent);       

  case 2:      

   default:         

    return super.onOptionsItemSelected(item);        

 }   

  }

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;

            }     

    });

    } }

'''

 

 
原文地址:https://www.cnblogs.com/chenbaiwan/p/7039413.html