File tree Expand file tree Collapse file tree 3 files changed +10
-0
lines changed
demo/app/src/utils/java/com/chaquo/python/utils Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 3
3
import android .app .*;
4
4
import android .content .*;
5
5
6
+ import androidx .appcompat .app .*;
6
7
import androidx .preference .*;
7
8
8
9
import com .chaquo .python .*;
@@ -28,4 +29,10 @@ public void onCreate() {
28
29
Python .start (platform );
29
30
}
30
31
32
+ public static void setPySubtitle (AppCompatActivity activity ) {
33
+ PyObject platform = Python .getInstance ().getModule ("platform" );
34
+ activity .getSupportActionBar ().setSubtitle (
35
+ "Python " + platform .callAttr ("python_version" ).toString ());
36
+ }
37
+
31
38
}
Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ public static class ConsoleModel extends ViewModel {
49
49
@ Override
50
50
protected void onCreate (Bundle savedInstanceState ) {
51
51
super .onCreate (savedInstanceState );
52
+ App .setPySubtitle (this );
53
+
52
54
consoleModel = ViewModelProviders .of (this ).get (ConsoleModel .class );
53
55
task = ViewModelProviders .of (this ).get (getTaskClass ());
54
56
setContentView (resId ("layout" , "activity_console" ));
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ protected void onCreate(Bundle savedInstanceState) {
16
16
String version = getPackageManager ().getPackageInfo (getPackageName (), 0 ).versionName ;
17
17
setTitle (getTitle () + " " + version );
18
18
} catch (PackageManager .NameNotFoundException ignored ) {}
19
+ App .setPySubtitle (this );
19
20
20
21
setContentView (resId ("layout" , "activity_menu" ));
21
22
((TextView )findViewById (resId ("id" , "tvCaption" )))
You can’t perform that action at this time.
0 commit comments