21
21
import android .view .View ;
22
22
import android .graphics .Bitmap ;
23
23
import android .graphics .Canvas ;
24
+ import android .view .Display ;
25
+ import android .view .WindowManager ;
24
26
25
27
public class Plasma extends Activity
26
28
{
@@ -29,7 +31,8 @@ public class Plasma extends Activity
29
31
public void onCreate (Bundle savedInstanceState )
30
32
{
31
33
super .onCreate (savedInstanceState );
32
- setContentView (new PlasmaView (this ));
34
+ Display display = getWindowManager ().getDefaultDisplay ();
35
+ setContentView (new PlasmaView (this , display .getWidth (), display .getHeight ()));
33
36
}
34
37
35
38
/* load our native library */
@@ -45,13 +48,9 @@ class PlasmaView extends View {
45
48
/* implementend by libplasma.so */
46
49
private static native void renderPlasma (Bitmap bitmap , long time_ms );
47
50
48
- public PlasmaView (Context context ) {
51
+ public PlasmaView (Context context , int width , int height ) {
49
52
super (context );
50
-
51
- final int W = 200 ;
52
- final int H = 200 ;
53
-
54
- mBitmap = Bitmap .createBitmap (W , H , Bitmap .Config .RGB_565 );
53
+ mBitmap = Bitmap .createBitmap (width , height , Bitmap .Config .RGB_565 );
55
54
mStartTime = System .currentTimeMillis ();
56
55
}
57
56
0 commit comments