Created
August 24, 2010 14:59
-
-
Save shaobin0604/547692 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov Date: 2010-8-24 22:45:44 | |
| // Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version! | |
| // Decompiler options: packimports(3) | |
| // Source File Name: ClockWidget.java | |
| package com.sonyericsson.android.digitalclock; | |
| import android.app.Service; | |
| import android.appwidget.AppWidgetManager; | |
| import android.content.BroadcastReceiver; | |
| import android.content.ComponentName; | |
| import android.content.ContentResolver; | |
| import android.content.Context; | |
| import android.content.Intent; | |
| import android.content.IntentFilter; | |
| import android.content.res.Configuration; | |
| import android.content.res.Resources; | |
| import android.database.ContentObserver; | |
| import android.graphics.Bitmap; | |
| import android.graphics.BitmapFactory; | |
| import android.graphics.Canvas; | |
| import android.graphics.Paint; | |
| import android.graphics.PorterDuffXfermode; | |
| import android.graphics.Rect; | |
| import android.graphics.Typeface; | |
| import android.net.Uri; | |
| import android.os.IBinder; | |
| import android.text.format.DateFormat; | |
| import android.widget.RemoteViews; | |
| import java.util.Date; | |
| import java.util.GregorianCalendar; | |
| // Referenced classes of package com.sonyericsson.android.digitalclock: | |
| // ClockWidget | |
| public class ClockWidget$UpdateService extends Service | |
| { | |
| /* member class not found */ | |
| class DateFormatContentObserver {} | |
| private void CreateChangedTimeReceiver() | |
| { | |
| /* block-local class not found */ | |
| class _cls1 {} | |
| _cls1 _lcls1 = new _cls1(); | |
| mIntentReceiver = _lcls1; | |
| } | |
| public static RemoteViews buildUpdate(Context context) | |
| { | |
| String s = context.getPackageName(); | |
| RemoteViews remoteviews = new RemoteViews(s, 32515); | |
| Bitmap bitmap = createDateTimeBitmap(context); | |
| remoteviews.setImageViewBitmap(32519, bitmap); | |
| return remoteviews; | |
| } | |
| private static Bitmap createDateTimeBitmap(Context context) | |
| { | |
| float f; | |
| int i; | |
| float f1; | |
| float f2; | |
| int j; | |
| float f3; | |
| float f4; | |
| String s1; | |
| String s2; | |
| String s3; | |
| int k; | |
| int l; | |
| f = context.getResources().getDimension(32517); | |
| i = (int)context.getResources().getDimension(1); | |
| f1 = context.getResources().getDimension(2); | |
| f2 = (int)context.getResources().getDimension(3); | |
| j = (int)context.getResources().getDimension(4); | |
| f3 = (int)context.getResources().getDimension(5); | |
| f4 = context.getResources().getDimension(6); | |
| s1 = context.getResources().getString(4); | |
| s2 = context.getApplicationContext().getResources().getString(5); | |
| s3 = context.getResources().getString(32518); | |
| k = (int)context.getResources().getDimension(7); | |
| Resources resources = context.getResources(); | |
| byte byte0 = 8; | |
| l = (int)resources.getDimension(byte0); | |
| Object obj2 = 0; | |
| context; | |
| JVM INSTR monitorenter ; | |
| Object obj3 = mSurface; | |
| if(obj3 != 0) goto _L2; else goto _L1 | |
| _L1: | |
| obj3 = android.graphics.Bitmap$Config.ARGB_4444; | |
| int i1 = k; | |
| int j1 = l; | |
| android.graphics.Bitmap$Config bitmap$config = ((android.graphics.Bitmap$Config) (obj3)); | |
| mSurface = Bitmap.createBitmap(i1, j1, bitmap$config); | |
| Canvas canvas = JVM INSTR new #101 <Class Canvas>; | |
| obj3 = mSurface; | |
| Canvas canvas2 = canvas; | |
| Bitmap bitmap = ((Bitmap) (obj3)); | |
| canvas2.Canvas(bitmap); | |
| mCanvas = canvas; | |
| _L9: | |
| obj3 = mCanvas; | |
| Object obj1; | |
| Paint paint; | |
| Bitmap bitmap1; | |
| Paint paint7; | |
| obj2 = mSurface; | |
| paint = new Paint(); | |
| Paint paint1 = paint; | |
| boolean flag = true; | |
| paint1.setAntiAlias(flag); | |
| Paint paint2 = paint; | |
| float f5 = f1; | |
| paint2.setTextSize(f5); | |
| Paint paint3 = paint; | |
| char c = '\377'; | |
| char c1 = '\377'; | |
| char c2 = '\377'; | |
| char c3 = '\377'; | |
| paint3.setARGB(c, c1, c2, c3); | |
| obj1 = android.graphics.Widget.UpdateService.mSurface; | |
| Paint paint4 = paint; | |
| android.graphics.Paint$Align paint$align = ((android.graphics.Paint$Align) (obj1)); | |
| paint4.setTextAlign(paint$align); | |
| Paint paint5 = paint; | |
| float f6 = 16544; | |
| float f7 = 0; | |
| float f8 = 0; | |
| char c4 = '\uFF00'; | |
| paint5.setShadowLayer(f6, f7, f8, c4); | |
| Paint paint6 = new Paint(); | |
| char c5 = '\377'; | |
| char c6 = '\200'; | |
| char c7 = '\200'; | |
| char c8 = '\200'; | |
| paint6.setARGB(c5, c6, c7, c8); | |
| Date date = new Date(); | |
| obj1 = new GregorianCalendar(); | |
| ((GregorianCalendar) (obj1)).setTime(date); | |
| java.text.DateFormat dateformat = DateFormat.getDateFormat(context); | |
| Date date1 = date; | |
| String s4 = dateformat.format(date1); | |
| Context context1 = context; | |
| int k1 = 1; | |
| bitmap1 = createMaskImage(context1, k1); | |
| paint7 = getMaskPaint(); | |
| date = (float)(k / 2); | |
| int l1 = (int)paint.measureText(s4); | |
| Rect rect1 = JVM INSTR new #169 <Class Rect>; | |
| float f9 = l1 / 2; | |
| int k2 = (int)(date - f9); | |
| l1 = (int)((float)(l1 / 2) + date); | |
| Rect rect2 = rect1; | |
| int l2 = k2; | |
| int i3 = i; | |
| int j3 = l1; | |
| int k3 = f2; | |
| rect2.Rect(l2, i3, j3, k3); | |
| Typeface typeface = Typeface.SANS_SERIF; | |
| Paint paint8 = paint; | |
| Typeface typeface1 = typeface; | |
| paint8.setTypeface(typeface1); | |
| f2 = f2; | |
| Object obj5 = obj3; | |
| String s5 = s4; | |
| float f10 = date; | |
| float f11 = f2; | |
| Paint paint9 = paint; | |
| ((Canvas) (obj5)).drawText(s5, f10, f11, paint9); | |
| if(bitmap1 != 0) | |
| { | |
| f2 = 0; | |
| Object obj6 = obj3; | |
| Bitmap bitmap2 = bitmap1; | |
| Rect rect3 = f2; | |
| Rect rect4 = rect1; | |
| Paint paint10 = paint7; | |
| ((Canvas) (obj6)).drawBitmap(bitmap2, rect3, rect4, paint10); | |
| } | |
| f2 = DateFormat.is24HourFormat(context); | |
| if(!f2) goto _L4; else goto _L3 | |
| _L3: | |
| Object obj4; | |
| Object aobj[] = new Object[1]; | |
| int i2 = 0; | |
| Date date2 = new Date(); | |
| aobj[i2] = date2; | |
| String s6 = "%1$tk:%1$tM"; | |
| Object aobj1[] = aobj; | |
| String s = String.format(s6, aobj1); | |
| obj4 = s; | |
| _L10: | |
| Object obj; | |
| Context context2 = context; | |
| byte byte1 = 2; | |
| obj = createMaskImage(context2, byte1); | |
| Rect rect = JVM INSTR new #169 <Class Rect>; | |
| Rect rect5 = rect; | |
| int l3 = 0; | |
| int i4 = 0; | |
| int j4 = k; | |
| int k4 = i; | |
| rect5.Rect(l3, i4, j4, k4); | |
| Paint paint11 = paint; | |
| float f12 = f; | |
| paint11.setTextSize(f12); | |
| if(mSomaFont == 0) | |
| { | |
| android.content.res.AssetManager assetmanager = context.getAssets(); | |
| String s7 = s3; | |
| mSomaFont = Typeface.createFromAsset(assetmanager, s7); | |
| } | |
| Typeface typeface2 = mSomaFont; | |
| Paint paint12 = paint; | |
| Typeface typeface3 = typeface2; | |
| paint12.setTypeface(typeface3); | |
| Object obj7 = obj3; | |
| String s8 = ((String) (obj4)); | |
| float f13 = date; | |
| float f14 = f; | |
| Paint paint13 = paint; | |
| ((Canvas) (obj7)).drawText(s8, f13, f14, paint13); | |
| if(obj != 0) | |
| { | |
| Object obj8 = obj3; | |
| Bitmap bitmap3 = ((Bitmap) (obj)); | |
| Rect rect6 = 0; | |
| Rect rect7 = rect; | |
| Paint paint14 = paint7; | |
| ((Canvas) (obj8)).drawBitmap(bitmap3, rect6, rect7, paint14); | |
| } | |
| if(DateFormat.is24HourFormat(context)) goto _L6; else goto _L5 | |
| _L5: | |
| Paint paint15 = paint; | |
| String s9 = ((String) (obj4)); | |
| float f15 = paint15.measureText(s9) / 16384 + date; | |
| f3 = (int)((float)f3 + f15); | |
| if(((GregorianCalendar) (obj1)).get(9) != 0) goto _L8; else goto _L7 | |
| _L7: | |
| s1 = s1; | |
| _L11: | |
| Typeface typeface4 = Typeface.SANS_SERIF; | |
| Paint paint16 = paint; | |
| Typeface typeface5 = typeface4; | |
| paint16.setTypeface(typeface5); | |
| Paint paint17 = paint; | |
| float f16 = f4; | |
| paint17.setTextSize(f16); | |
| android.graphics.Paint$Align paint$align1 = android.graphics.at; | |
| Paint paint18 = paint; | |
| android.graphics.Paint$Align paint$align2 = paint$align1; | |
| paint18.setTextAlign(paint$align2); | |
| Paint paint19 = paint; | |
| boolean flag1 = true; | |
| paint19.setFakeBoldText(flag1); | |
| f3 = f3; | |
| float f17 = (float)j + f4; | |
| Object obj9 = obj3; | |
| String s10 = s1; | |
| float f18 = f3; | |
| float f19 = j; | |
| Paint paint20 = paint; | |
| ((Canvas) (obj9)).drawText(s10, f18, f19, paint20); | |
| _L6: | |
| if(bitmap1 != 0) | |
| bitmap1.recycle(); | |
| if(obj != 0) | |
| ((Bitmap) (obj)).recycle(); | |
| context; | |
| JVM INSTR monitorexit ; | |
| return ((Bitmap) (obj2)); | |
| _L2: | |
| Canvas canvas1 = mCanvas; | |
| obj3 = 0; | |
| obj4 = android.graphics.Widget.UpdateService.mCanvas; | |
| Canvas canvas3 = canvas1; | |
| int l4 = ((int) (obj3)); | |
| android.graphics.PorterDuff$Mode porterduff$mode = ((android.graphics.as) (obj4)); | |
| canvas3.drawColor(l4, porterduff$mode); | |
| goto _L9 | |
| Exception exception; | |
| exception; | |
| Object obj10 = obj2; | |
| _L12: | |
| context; | |
| JVM INSTR monitorexit ; | |
| throw exception; | |
| _L4: | |
| obj4 = ((Object) (new Object[1])); | |
| int j2 = 0; | |
| Date date3 = new Date(); | |
| obj4[j2] = date3; | |
| String s11 = "%1$tl:%1$tM"; | |
| Object aobj2[] = ((Object []) (obj4)); | |
| obj = String.format(s11, aobj2); | |
| obj4 = obj; | |
| goto _L10 | |
| _L8: | |
| s1 = s2; | |
| goto _L11 | |
| exception; | |
| Object obj11 = obj3; | |
| goto _L12 | |
| exception; | |
| goto _L12 | |
| } | |
| private static Bitmap createMaskImage(Context context, int i) | |
| { | |
| android.graphics.as as = new android.graphics.t>(); | |
| android.graphics.Bitmap$Config bitmap$config = android.graphics.t>; | |
| as.eferredConfig = bitmap$config; | |
| return BitmapFactory.decodeResource(context.getResources(), i, as); | |
| } | |
| public static void drawTime(Context context) | |
| { | |
| boolean flag = mIsScreenOn; | |
| if(flag) | |
| { | |
| RemoteViews remoteviews = buildUpdate(context); | |
| Class class1 = com/sonyericsson/android/digitalclock/ClockWidget; | |
| ComponentName componentname = new ComponentName(context, class1); | |
| AppWidgetManager appwidgetmanager = AppWidgetManager.getInstance(context); | |
| int ai[] = appwidgetmanager.getAppWidgetIds(componentname); | |
| if(ai != 0) | |
| { | |
| int i = ai.length; | |
| if(i > 0) | |
| { | |
| int k = 0; | |
| do | |
| { | |
| int j = ai.length; | |
| if(k >= j) | |
| break; | |
| j = ai[k]; | |
| appwidgetmanager.updateAppWidget(j, remoteviews); | |
| long l = 70; | |
| try | |
| { | |
| Thread.sleep(l); | |
| } | |
| catch(Exception exception) { } | |
| k++; | |
| } while(true); | |
| } | |
| } | |
| } | |
| } | |
| private static Paint getMaskPaint() | |
| { | |
| Paint paint = new Paint(); | |
| paint.setAntiAlias(true); | |
| paint.setDither(true); | |
| paint.setFilterBitmap(true); | |
| android.graphics.PorterDuff$Mode porterduff$mode = android.graphics.pWidget; | |
| PorterDuffXfermode porterduffxfermode = new PorterDuffXfermode(porterduff$mode); | |
| paint.setXfermode(porterduffxfermode); | |
| return paint; | |
| } | |
| public IBinder onBind(Intent intent) | |
| { | |
| return 0; | |
| } | |
| public final void onConfigurationChanged(Configuration configuration) | |
| { | |
| super.onConfigurationChanged(configuration); | |
| if(configuration.orientation == 2 || configuration.orientation == 1) | |
| drawTime(this); | |
| } | |
| public void onCreate() | |
| { | |
| String s = 0; | |
| super.onCreate(); | |
| if(mIntentReceiver == 0) | |
| { | |
| IntentFilter intentfilter = new IntentFilter(); | |
| intentfilter.addAction("android.intent.action.TIME_TICK"); | |
| intentfilter.addAction("android.intent.action.TIME_SET"); | |
| intentfilter.addAction("android.intent.action.TIMEZONE_CHANGED"); | |
| intentfilter.addAction("android.intent.action.DATE_CHANGED"); | |
| intentfilter.addAction("android.intent.action.SCREEN_ON"); | |
| intentfilter.addAction("android.intent.action.SCREEN_OFF"); | |
| CreateChangedTimeReceiver(); | |
| BroadcastReceiver broadcastreceiver = mIntentReceiver; | |
| registerReceiver(broadcastreceiver, intentfilter, s, s); | |
| } | |
| if(mObserver == 0) | |
| { | |
| String s1 = DateFormat.getDateFormat(this).toString(); | |
| DateFormatContentObserver dateformatcontentobserver = new DateFormatContentObserver(s, this, s1); | |
| mObserver = dateformatcontentobserver; | |
| Uri uri = Uri.parse(getResources().getString(1)); | |
| ContentResolver contentresolver = getContentResolver(); | |
| ContentObserver contentobserver = mObserver; | |
| contentresolver.registerContentObserver(uri, true, contentobserver); | |
| } | |
| drawTime(this); | |
| } | |
| public void onDestroy() | |
| { | |
| BroadcastReceiver broadcastreceiver = 0; | |
| super.onDestroy(); | |
| if(mIntentReceiver != 0) | |
| { | |
| BroadcastReceiver broadcastreceiver1 = mIntentReceiver; | |
| unregisterReceiver(broadcastreceiver1); | |
| mIntentReceiver = broadcastreceiver; | |
| } | |
| if(mObserver != 0) | |
| { | |
| ContentResolver contentresolver = getContentResolver(); | |
| ContentObserver contentobserver = mObserver; | |
| contentresolver.unregisterContentObserver(contentobserver); | |
| mObserver = broadcastreceiver; | |
| } | |
| } | |
| public void onStart(Intent intent, int i) | |
| { | |
| String s = 0; | |
| super.onStart(intent, i); | |
| if(mIntentReceiver == 0) | |
| { | |
| IntentFilter intentfilter = new IntentFilter(); | |
| intentfilter.addAction("android.intent.action.TIME_TICK"); | |
| intentfilter.addAction("android.intent.action.TIME_SET"); | |
| intentfilter.addAction("android.intent.action.TIMEZONE_CHANGED"); | |
| intentfilter.addAction("android.intent.action.DATE_CHANGED"); | |
| intentfilter.addAction("android.intent.action.SCREEN_ON"); | |
| intentfilter.addAction("android.intent.action.SCREEN_OFF"); | |
| CreateChangedTimeReceiver(); | |
| BroadcastReceiver broadcastreceiver = mIntentReceiver; | |
| registerReceiver(broadcastreceiver, intentfilter, s, s); | |
| } | |
| if(mObserver == 0) | |
| { | |
| String s1 = DateFormat.getDateFormat(this).toString(); | |
| DateFormatContentObserver dateformatcontentobserver = new DateFormatContentObserver(s, this, s1); | |
| mObserver = dateformatcontentobserver; | |
| Uri uri = Uri.parse(getResources().getString(1)); | |
| ContentResolver contentresolver = getContentResolver(); | |
| ContentObserver contentobserver = mObserver; | |
| contentresolver.registerContentObserver(uri, true, contentobserver); | |
| } | |
| drawTime(this); | |
| } | |
| private static Canvas mCanvas = 0; | |
| private static boolean mIsScreenOn = true; | |
| private static Typeface mSomaFont = 0; | |
| private static Bitmap mSurface = 0; | |
| private BroadcastReceiver mIntentReceiver; | |
| private ContentObserver mObserver; | |
| /* | |
| static boolean access$002(boolean flag) | |
| { | |
| mIsScreenOn = flag; | |
| return flag; | |
| } | |
| */ | |
| public ClockWidget$UpdateService() | |
| { | |
| mIntentReceiver = 0; | |
| mObserver = 0; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment