📄 listcomposemsg.java
字号:
this.start();
}
private void start(){
gauge_compressor= new Gauge(l.LCM_COMPRESS_L,true,5,compression_level);
this.append(gauge_compressor);
String temp_text=utils.comprimiTesto(m.getText(), compression_level);
stringitem_text=new StringItem(l.LCM_TEXT+" ("+temp_text.length()+"/"+s.getMaxCharsWithSign()+"):",temp_text);
this.append(stringitem_text);
command_ok=new Command(l.COMMAND_OK,Command.SCREEN,1);
command_back=new Command(l.COMMAND_BACK,Command.BACK,2);
this.addCommand(command_ok);
this.addCommand(command_back);
this.setCommandListener(this);
this.setItemStateListener(this);
this.show();
}
public void show(){
gotext.display.setCurrent(this);
}
public void itemStateChanged(Item item) {
if (item==gauge_compressor){
String temp_text=utils.comprimiTesto(m.getText(), gauge_compressor.getValue());
stringitem_text.setLabel(l.LCM_TEXT+" ("+temp_text.length()+"/"+s.getMaxCharsWithSign()+"):");
stringitem_text.setText(temp_text);
this.show();
}
}
public void commandAction(Command c, Displayable d){
if (c==command_back){
TextForm.this.show();
} else if (c==command_ok){
compression_level=gauge_compressor.getValue();
m.setText(utils.comprimiTesto(m.getText(), compression_level));
new TextForm();
}
}
}
}
private class RecipientsForm extends Form implements CommandListener {
private TextField[] textfield;
private Command command_pul,command_ok,command_rub;
public RecipientsForm(){
super(l.LCM_DEST);
this.start();
}
private void start(){
textfield=new TextField[s.getMaxRecipients()];
switch(s.getIsNumericRecipient()){
case 0:
for (int i=0;i<textfield.length;i++){
try{
textfield[i]=new TextField(l.LCM_DEST+" "+(i+1), m.getRecipientsArray()[i], 50, TextField.EMAILADDR);
} catch(Exception e){
textfield[i]=new TextField(l.LCM_DEST+" "+(i+1), "", 50, TextField.EMAILADDR);
}
this.append(textfield[i]);
}
break;
case 1:
for (int i=0;i<textfield.length;i++){
try{
textfield[i]=new TextField(l.LCM_DEST+" "+(i+1), m.getRecipientsArray()[i], 13, TextField.PHONENUMBER);
} catch(Exception e){
textfield[i]=new TextField(l.LCM_DEST+" "+(i+1), "", 13, TextField.PHONENUMBER);
}
this.append(textfield[i]);
}
break;
}
command_ok=new Command(l.COMMAND_OK,Command.SCREEN,1);
command_pul=new Command(l.COMMAND_PUL,Command.SCREEN,2);
command_rub=new Command(l.COMMAND_RUB,Command.SCREEN,3);
this.addCommand(command_ok);
this.addCommand(command_pul);
this.addCommand(command_rub);
this.setCommandListener(this);
this.show();
}
public void show(){
gotext.display.setCurrent(this);
}
private int insNumbers(){
int error=0;
for (int i=0;i<textfield.length;i++){
if(textfield[i].getString().length()>0){
if(m.addNumericRecipient(textfield[i].getString())<0){
textfield[i].setString("");
//error+=utils.pow(2,i);
error++;
}
}
}
return error;
}
private int insEmail(){
int error=0;
for (int i=0;i<textfield.length;i++){
if(textfield[i].getString().length()>0){
if(m.addEmailRecipient(textfield[i].getString())<0){
textfield[i].setString("");
//error+=utils.pow(2,i);
error++;
}
}
}
return error;
}
public void commandAction(Command c, Displayable d){
if (c==command_pul){
for (int i=0;i<textfield.length;i++){
textfield[i].setString("");
}
} else if (c==command_ok){
m.resetRecipients();
int error=0;
switch(s.getIsNumericRecipient()){
case 0:
error=insEmail();
break;
case 1:
error=insNumbers();
break;
}
if (error>0)
utils.popup(l.ALERT_WARNING_TITLE, l.ALERT_WARNING4, gotext, AlertType.WARNING);
else
ListComposeMsg.this.refresh();
} else if (c==command_rub){
m.resetRecipients();
int error=0;
switch(s.getIsNumericRecipient()){
case 0:
error=insEmail();
break;
case 1:
error=insNumbers();
break;
}
if (error>0)
utils.popup(l.ALERT_WARNING_TITLE, l.ALERT_WARNING4+"("+error+").", gotext, AlertType.WARNING);
else
new ListSelectContact();
}
}
public class ListSelectContact extends List implements CommandListener{
private Command command_back;
public ListSelectContact() {
super(l.LCM_CONTACTS,List.IMPLICIT);
this.start();
}
private void start(){
this.setTitle(l.LCM_CONTACTS+": "+gotext.contacts.length);
if(gotext.contacts.length==0){
this.setTicker(new Ticker(l.LCM_NOCONTACT));
} else {
Image ico_contact=null;
Image ico_group=null;
try{
ico_contact = Image.createImage("/img/contact.png");
ico_group = Image.createImage("/img/group.png");
} catch (Exception e){}
for(int i=0;i<gotext.contacts.length;i++){
if(gotext.contacts[i].isGroup())
this.append(gotext.contacts[i].getName(), ico_group);
else
this.append(gotext.contacts[i].getName(), ico_contact);
}
}
command_back=new Command(l.COMMAND_BACK,Command.BACK,5);
this.addCommand(command_back);
this.setCommandListener(this);
this.show();
}
public void show(){
gotext.display.setCurrent(this);
}
public void commandAction(Command c, Displayable d){
if (c==List.SELECT_COMMAND){
if (this.getSelectedIndex()>=0) {
if(s.getIsNumericRecipient()==1){
String[] numbers=utils.splitString(gotext.contacts[this.getSelectedIndex()].getNumber(),";");
for(int i=0;i<numbers.length;i++)
m.addNumericRecipient(numbers[i]);
} else {
m.addEmailRecipient(gotext.contacts[this.getSelectedIndex()].getEmail());
}
}
new RecipientsForm();
} else if (c==command_back){
RecipientsForm.this.show();
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -