fbstandbybubble.java
来自「Sony Ericsson手机上的Facebook客户端全套代码」· Java 代码 · 共 196 行
JAVA
196 行
// 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: FbStandByBubble.java
package com.sonyericsson.fb.ui.fbComponents.standbyItems;
import com.sonyericsson.fb.api.FbSessionHandler;
import com.sonyericsson.fb.utils.Properties;
import com.sonyericsson.fb.utils.TimeUtilities;
import javax.microedition.lcdui.Image;
import se.southend.drops.gui.*;
import se.southend.drops.integeraffector.*;
import se.southend.drops.scene.*;
import se.southend.drops.tools.Tools;
public class FbStandByBubble extends Group
{
public FbStandByBubble()
{
mStatusText = new TextSprite();
mFriendName = new TextSprite();
mTimeStampText = new TextSprite();
mTimeStamp = 0L;
mStatusText.setMaxLines(3);
mStatusText.setMaxWidth(176);
mStatusText.setAnchor(20);
mStatusText.setLocalPosition(-22528, -17920);
mFriendName.setMaxLines(1);
mFriendName.setMaxWidth(100);
mFriendName.setAnchor(3);
mFriendName.setLocalPosition(0, -20480);
mTimeStampText.setMaxLines(1);
mTimeStampText.setMaxWidth(100);
mTimeStampText.setAnchor(24);
mTimeStampText.setLocalPosition(22528, -3584);
Image bgImage = Tools.loadImage("/stanbybubble.png");
mBackGroundBubble = new StretchBitmapSprite();
StretchTemplate stretch = new StretchTemplate();
stretch.addColumn(8, 0);
stretch.addColumn(12, 1);
stretch.addColumn(23, 0);
stretch.addColumn(12, 1);
stretch.addColumn(8, 0);
stretch.addRow(8, 0);
stretch.addRow(14, 1);
stretch.addRow(16, 0);
mBackGroundBubble.setImage(bgImage);
mBackGroundBubble.setStretchTemplate(stretch);
mBackGroundBubble.setSize(225, 115);
mBackGroundBubble.setLocalPosition(-256, -10496);
mBackGroundBubble.setAnchor(3);
Image facebookImage = Tools.loadImage("/fb_icon.png");
mFacebookLogo = new BitmapSprite(facebookImage);
mFacebookLogo.setLocalPosition(-20480, -23040);
add(mBackGroundBubble);
add(mFacebookLogo);
add(mTimeStampText);
add(mStatusText);
add(mFriendName);
}
public void setFriendName(String friendName)
{
mFriendName.setText(friendName, Properties.FONT_BOLD, 0x457a0);
}
public void setStatusText(String statusText)
{
mStatusText.setText(statusText, Properties.FONT_DEFAULT, 0);
updatePositionsBasedOnNumberOfLines();
}
public void setTimeStamp(long timeStamp)
{
mTimeStamp = timeStamp;
long serverTimeStamp = FbSessionHandler.getInstance().getServerTimeStamp();
String timeString = TimeUtilities.getTimeStampString(mTimeStamp, serverTimeStamp);
mTimeStampText.setText(timeString, Properties.FONT_DEFAULT, 0);
}
public void setArrowPosition(int i)
{
}
public void animateIn(AffectorHandler affector)
{
show(false);
mBackGroundBubble.setVisible(true);
affector.addAffector(new InterpolationAffector(0, 256, 250, 0) {
public void run()
{
int positionOffset = 54 - mStatusText.getHeight() << 8;
int newValue = getValue();
mBackGroundBubble.setSize((225 * newValue) / 256, (mBackGroundBubbleHeigth * newValue) / 256);
int newPosY = (((-10496 + positionOffset / 2) - 11776) * newValue) / 256 + 11776;
mBackGroundBubble.setLocalPosition(-256, newPosY);
}
public void finish()
{
int positionOffset = 54 - mStatusText.getHeight() << 8;
mBackGroundBubble.setSize(225, mBackGroundBubbleHeigth);
mBackGroundBubble.setLocalPosition(-256, -10496 + positionOffset / 2);
show(true);
}
});
}
public void setFaded(boolean faded)
{
if(faded)
{
Image bgImage = Tools.loadImage("/stanbybubbleUnfocus.png");
mBackGroundBubble.setImage(bgImage);
Image facebookImage = Tools.loadImage("/fb_icon.png");
int rgb[] = new int[facebookImage.getWidth() * facebookImage.getHeight()];
facebookImage.getRGB(rgb, 0, facebookImage.getWidth(), 0, 0, facebookImage.getWidth(), facebookImage.getHeight());
for(int i = 0; i < facebookImage.getWidth() * facebookImage.getHeight(); i++)
rgb[i] = rgb[i] & 0xffffff | 0x80000000;
mFacebookLogo.setImage(Image.createRGBImage(rgb, facebookImage.getWidth(), facebookImage.getHeight(), true));
} else
{
Image bgImage = Tools.loadImage("/stanbybubble.png");
mBackGroundBubble.setImage(bgImage);
Image facebookImage = Tools.loadImage("/fb_icon.png");
mFacebookLogo.setImage(facebookImage);
}
}
public void show(boolean show)
{
if(show)
{
mBackGroundBubble.setVisible(true);
mFacebookLogo.setVisible(true);
mTimeStampText.setVisible(true);
mStatusText.setVisible(true);
mFriendName.setVisible(true);
} else
{
mBackGroundBubble.setVisible(false);
mFacebookLogo.setVisible(false);
mTimeStampText.setVisible(false);
mStatusText.setVisible(false);
mFriendName.setVisible(false);
}
}
private void updatePositionsBasedOnNumberOfLines()
{
int positionOffset = 54 - mStatusText.getHeight() << 8;
mStatusText.setLocalPosition(-22528, -17920 + positionOffset);
mFriendName.setLocalPosition(0, -20480 + positionOffset);
mFacebookLogo.setLocalPosition(-20480, -23040 + positionOffset);
mBackGroundBubbleHeigth = 115 - (positionOffset >> 8);
mBackGroundBubble.setLocalPosition(-256, -10496 + positionOffset / 2);
}
private final int BUBBLE_ANIMATION_DURATION = 250;
private final int STATUS_TEXT_WIDTH = 176;
private final int STATUS_TEXT_MAX_LINES = 3;
private final int STATUS_TEXT_POSITION_Y = -17920;
private final int STATUS_TEXT_POSITION_X = -22528;
private final int FRIEND_TEXT_WIDTH = 100;
private final int FRIEND_TEXT_MAX_LINES = 1;
private final int FRIEND_TEXT_POSITION_Y = -20480;
private final int FRIEND_TEXT_POSITION_X = 0;
private final int TIME_TEXT_WIDTH = 100;
private final int TIME_TEXT_MAX_LINES = 1;
private final int TIME_TEXT_POSITION_Y = -3584;
private final int TIME_TEXT_POSITION_X = 22528;
private final int BACKGROUND_WIDTH = 225;
private final int BACKGROUND_HEIGTH = 115;
private final int BACKGROUND_POSITION_Y = -10496;
private final int BACKGROUND_POSITION_X = -256;
private final int BACKGROUND_ANIMATE_IN_START_POSITION_Y = 11776;
private final int ARROW_POSITION_Y = 3584;
private final int LOGO_POSITION_Y = -23040;
private final int LOGO_POSITION_X = -20480;
private TextSprite mStatusText;
private TextSprite mFriendName;
private BitmapSprite mFacebookLogo;
private StretchBitmapSprite mBackGroundBubble;
private TextSprite mTimeStampText;
private long mTimeStamp;
private int mBackGroundBubbleHeigth;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?