1
1
package seven .drawalive .nodebase ;
2
2
3
3
import android .content .Context ;
4
+ import android .graphics .Bitmap ;
5
+ import android .graphics .BitmapFactory ;
4
6
import android .util .Log ;
5
7
import android .view .View ;
6
8
import android .widget .ArrayAdapter ;
7
9
import android .widget .Button ;
8
10
import android .widget .EditText ;
11
+ import android .widget .ImageView ;
9
12
import android .widget .LinearLayout ;
10
13
import android .widget .Spinner ;
11
14
import android .widget .TableLayout ;
@@ -62,14 +65,40 @@ public void collectAppInformation() {
62
65
63
66
public void prepareLayout () {
64
67
Context context = getContext ();
68
+ LinearLayout frame = new LinearLayout (context );
69
+ frame .setOrientation (LinearLayout .HORIZONTAL );
70
+
71
+ ImageView image = new ImageView (context );
72
+ LinearLayout .LayoutParams params = new LinearLayout .LayoutParams (64 , 64 );
73
+ params .setMargins (1 , 1 , 1 , 1 );
74
+ image .setLayoutParams (params );
75
+ image .setMaxHeight (64 );
76
+ image .setMaxWidth (64 );
77
+ image .setMinimumHeight (64 );
78
+ image .setMinimumWidth (64 );
79
+ try {
80
+ File imgfile = new File (_appdir .getAbsolutePath ().concat ("/icon.png" ));
81
+ if (imgfile .exists ()) {
82
+ Bitmap bmp = BitmapFactory .decodeFile (imgfile .getAbsolutePath ());
83
+ image .setImageBitmap (bmp );
84
+ } else {
85
+ image .setBackgroundResource (R .drawable .default_icon );
86
+ }
87
+ } catch (Exception e ) {
88
+ }
89
+ frame .addView (image );
90
+
91
+ LinearLayout contents = new LinearLayout (context );
92
+ contents .setOrientation (LinearLayout .VERTICAL );
93
+
65
94
TextView label ;
66
95
label = new TextView (context );
67
96
label .setText (String .format ("\n =============== App: %s ===" , _appdir .getName ()));
68
- addView (label );
97
+ contents . addView (label );
69
98
label = new TextView (context );
70
99
label .setText (_readme );
71
100
_readme = null ; // release memory
72
- addView (label );
101
+ contents . addView (label );
73
102
74
103
TableLayout tbl = new TableLayout (context );
75
104
TableRow tbl_r_t = null ;
@@ -91,7 +120,7 @@ public void prepareLayout() {
91
120
tbl_r_t .addView (_txtParams );
92
121
tbl .addView (tbl_r_t );
93
122
tbl .setStretchAllColumns (true );
94
- addView (tbl );
123
+ contents . addView (tbl );
95
124
96
125
97
126
LinearLayout subview = new LinearLayout (context );
@@ -107,7 +136,10 @@ public void prepareLayout() {
107
136
_btnShare .setText ("Share" );
108
137
_btnShare .setEnabled (false );
109
138
subview .addView (_btnShare );
110
- addView (subview );
139
+ contents .addView (subview );
140
+
141
+ frame .addView (contents );
142
+ addView (frame );
111
143
}
112
144
113
145
public void prepareEvents () {
0 commit comments