fblogin.java
来自「Sony Ericsson手机上的Facebook客户端全套代码」· Java 代码 · 共 341 行
JAVA
341 行
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3)
// Source File Name: FbLogin.java
package com.sonyericsson.fb.ui.fbPages;
import com.sonyericsson.fb.api.FbSessionHandler;
import com.sonyericsson.fb.strings.Strings;
import com.sonyericsson.fb.ui.PageController;
import com.sonyericsson.fb.ui.fbComponents.*;
import com.sonyericsson.fb.ui.fbComponents.listItems.*;
import com.sonyericsson.fb.utils.*;
import javax.microedition.lcdui.*;
import se.southend.drops.scene.Group;
import se.southend.drops.scene.Node;
import se.southend.drops.screen.*;
// Referenced classes of package com.sonyericsson.fb.ui.fbPages:
// Page
public class FbLogin extends Page
implements CommandListener
{
public FbLogin()
{
}
public void create()
{
FbRecordStore rs;
mSelectCommand = new Command(Strings.get(51), 8, 1);
mExitCommand = new Command(Strings.get(49), 7, 3);
mOkCommand = new Command(Strings.get(45), 4, 2);
mBackCommand = new Command(Strings.get(42), 2, 3);
add(new BackgroundFrame());
setIgnoreCamera(true);
mItems = new SimpleList();
add(mItems);
mWelcomeText = new FbTextItem(Strings.get(4), Properties.FONT_DEFAULT, 45, Node.SCREEN_WIDTH - 70, true);
mWelcomeText.setColor(0x457a0);
mDisclaimerText = new FbTextItem(Strings.get(8), Properties.FONT_DEFAULT, 45, Node.SCREEN_WIDTH - 70, false);
mDisclaimerText.setColor(0x457a0);
mUserField = new FbInputFieldItem(Node.SCREEN_WIDTH - 78, Strings.get(6));
mPassField = new FbInputFieldItem(Node.SCREEN_WIDTH - 78, Strings.get(7));
mPassField.setPasswordChar('*');
mRememberMe = new FbCheckBoxItem(Strings.get(3), Node.SCREEN_WIDTH);
mRememberMe.setChecked(FbSessionHandler.getInstance().hasStoredSession());
mRememberMe.setCommand(mSelectCommand);
mDontShowAgain = new FbCheckBoxItem(Strings.get(10), Node.SCREEN_WIDTH);
rs = new FbRecordStore();
rs.open(false);
mDontShowAgain.setChecked(!rs.getShowLoginDisclaimer());
Exception e;
try
{
rs.close();
}
// Misplaced declaration of an exception variable
catch(Exception e)
{
Logger.printErrorln("getShowLoginDisclaimer() 2: Caught exception: " + e.toString());
}
break MISSING_BLOCK_LABEL_464;
e;
Logger.printErrorln("getShowLoginDisclaimer() 1: Caught exception: " + e.toString());
try
{
rs.close();
}
// Misplaced declaration of an exception variable
catch(Exception e)
{
Logger.printErrorln("getShowLoginDisclaimer() 2: Caught exception: " + e.toString());
}
break MISSING_BLOCK_LABEL_464;
Exception exception;
exception;
try
{
rs.close();
}
catch(Exception e)
{
Logger.printErrorln("getShowLoginDisclaimer() 2: Caught exception: " + e.toString());
}
throw exception;
mDontShowAgain.setCommand(mSelectCommand);
mLoginButton = new FbButtonItem(Strings.get(5)) {
public void OnButtonReleased()
{
if(mDontShowAgain.isChecked())
{
boolean storeSession = mRememberMe.isChecked();
changeState(3);
PageController.getInstance().logIn(mUserField.getText(), mPassField.getText(), storeSession);
} else
{
changeState(1);
}
}
};
mLoginButton.setCommand(mSelectCommand);
mRegisterText = new FbTextItem(Strings.get(9), Properties.FONT_DEFAULT, Node.SCREEN_WIDTH - 32, true);
mRegisterText.setColor(0x457a0);
mRegisterText.setCommand(mSelectCommand);
if(mRememberMe.isChecked())
{
if(mDontShowAgain.isChecked())
mState = 2;
else
mState = 1;
} else
{
mState = 0;
}
mItems.add(mWelcomeText);
if(mState == 1)
{
mItems.add(mDisclaimerText);
mItems.add(mDontShowAgain);
mItems.setLocalPosition(0, -16896);
mItems.select(mDontShowAgain, true);
} else
{
mItems.add(mUserField);
mItems.add(mPassField);
mItems.add(mRememberMe);
mItems.add(mLoginButton);
mItems.add(mRegisterText);
mItems.setLocalPosition(0, -16896);
if(mState == 0)
mItems.select(mUserField, true);
else
mItems.select(mLoginButton, true);
}
mShader = new BackgroundFrameShader();
mShader.setVisible(false);
mProgress = new ProgressIndicator(false);
mProgress.setVisible(false);
add(mShader);
add(mProgress);
return;
}
public void changeState(int newState)
{
if(newState != mState)
{
if(mState == 1)
{
mItems.remove(mDontShowAgain);
mItems.remove(mDisclaimerText);
mItems.add(mUserField);
mItems.add(mPassField);
mItems.add(mRememberMe);
mItems.add(mLoginButton);
mItems.add(mRegisterText);
mItems.select(mLoginButton, true);
} else
if(newState == 1)
{
mItems.remove(mRegisterText);
mItems.remove(mLoginButton);
mItems.remove(mRememberMe);
mItems.remove(mPassField);
mItems.remove(mUserField);
mItems.add(mDisclaimerText);
mItems.add(mDontShowAgain);
mItems.select(mDontShowAgain, true);
}
mState = newState;
setSoftKeys();
boolean enabled = newState == 0 || newState == 1;
setInputEnabled(enabled);
mShader.setVisible(!enabled);
mProgress.setVisible(!enabled);
}
}
public void input(KeyHandler keyHandler)
{
mItems.input(keyHandler);
}
public void show()
{
setSoftKeys();
super.show();
if(mState == 2)
changeState(3);
else
if(mState == 3)
changeState(0);
}
public void hide()
{
ScreenEngine.getInstance().getCanvas().removeCommand(mExitCommand);
ScreenEngine.getInstance().getCanvas().removeCommand(mOkCommand);
ScreenEngine.getInstance().getCanvas().removeCommand(mBackCommand);
ScreenEngine.getInstance().getCanvas().removeCommand(mSelectCommand);
super.hide();
}
public void setSoftKeys()
{
ScreenEngine.getInstance().getCanvas().setCommandListener(this);
switch(mState)
{
case 0: // '\0'
ScreenEngine.getInstance().getCanvas().removeCommand(mBackCommand);
ScreenEngine.getInstance().getCanvas().removeCommand(mOkCommand);
ScreenEngine.getInstance().getCanvas().addCommand(mExitCommand);
break;
case 1: // '\001'
if(FbSessionHandler.getInstance().hasStoredSession())
{
ScreenEngine.getInstance().getCanvas().removeCommand(mBackCommand);
ScreenEngine.getInstance().getCanvas().addCommand(mOkCommand);
ScreenEngine.getInstance().getCanvas().addCommand(mExitCommand);
} else
{
ScreenEngine.getInstance().getCanvas().removeCommand(mExitCommand);
ScreenEngine.getInstance().getCanvas().addCommand(mOkCommand);
ScreenEngine.getInstance().getCanvas().addCommand(mBackCommand);
}
break;
default:
ScreenEngine.getInstance().getCanvas().removeCommand(mSelectCommand);
ScreenEngine.getInstance().getCanvas().removeCommand(mBackCommand);
ScreenEngine.getInstance().getCanvas().removeCommand(mOkCommand);
ScreenEngine.getInstance().getCanvas().removeCommand(mExitCommand);
break;
}
}
public void commandAction(Command command, Displayable displayable)
{
FbRecordStore rs;
if(command.equals(mExitCommand))
{
if(ScreenEngine.getInstance().isRunningOnHomescreen())
{
setInputEnabled(false);
hide();
ScreenEngine.getInstance().setHomescreenInStandby(true);
} else
{
ScreenMidletHS.getInstance().die();
}
break MISSING_BLOCK_LABEL_322;
}
if(command.equals(mBackCommand))
{
changeState(0);
break MISSING_BLOCK_LABEL_322;
}
if(!command.equals(mOkCommand))
break MISSING_BLOCK_LABEL_293;
rs = new FbRecordStore();
rs.open(false);
rs.setShowLoginDisclaimer(!mDontShowAgain.isChecked());
Exception e;
try
{
rs.close();
}
// Misplaced declaration of an exception variable
catch(Exception e)
{
Logger.printErrorln("setShowLoginDisclaimer() 2: Caught exception: " + e.toString());
}
break MISSING_BLOCK_LABEL_254;
e;
Logger.printErrorln("setShowLoginDisclaimer() 1: Caught exception: " + e.toString());
try
{
rs.close();
}
// Misplaced declaration of an exception variable
catch(Exception e)
{
Logger.printErrorln("setShowLoginDisclaimer() 2: Caught exception: " + e.toString());
}
break MISSING_BLOCK_LABEL_254;
Exception exception;
exception;
try
{
rs.close();
}
catch(Exception e)
{
Logger.printErrorln("setShowLoginDisclaimer() 2: Caught exception: " + e.toString());
}
throw exception;
boolean storeSession = mRememberMe.isChecked();
changeState(3);
PageController.getInstance().logIn(mUserField.getText(), mPassField.getText(), storeSession);
break MISSING_BLOCK_LABEL_322;
if(command.equals(mSelectCommand))
{
KeyHandler.getInstance().keyPressed(16, false);
KeyHandler.getInstance().keyReleased(16, false);
}
}
private FbButtonItem mLoginButton;
private FbInputFieldItem mUserField;
private FbInputFieldItem mPassField;
private FbCheckBoxItem mRememberMe;
private FbTextItem mWelcomeText;
private FbTextItem mRegisterText;
private FbTextItem mDisclaimerText;
private FbCheckBoxItem mDontShowAgain;
private BackgroundFrameShader mShader;
private ProgressIndicator mProgress;
private static final int UNIT = 8;
private static final int ENTER_USER_STATE = 0;
private static final int DISCLAIMER_STATE = 1;
private static final int CONNECT_STATE = 2;
public static final int CONNECTING_STATE = 3;
private static final int LIST_POS = -66;
private int mState;
private SimpleList mItems;
private Command mSelectCommand;
private Command mExitCommand;
private Command mOkCommand;
private Command mBackCommand;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?