diff --git a/demo/app/src/utils/java/com/chaquo/python/utils/App.java b/demo/app/src/utils/java/com/chaquo/python/utils/App.java index afa1a98f3b..94fdd15417 100644 --- a/demo/app/src/utils/java/com/chaquo/python/utils/App.java +++ b/demo/app/src/utils/java/com/chaquo/python/utils/App.java @@ -3,6 +3,7 @@ import android.app.*; import android.content.*; +import androidx.appcompat.app.*; import androidx.preference.*; import com.chaquo.python.*; @@ -28,4 +29,10 @@ public void onCreate() { Python.start(platform); } + public static void setPySubtitle(AppCompatActivity activity) { + PyObject platform = Python.getInstance().getModule("platform"); + activity.getSupportActionBar().setSubtitle( + "Python " + platform.callAttr("python_version").toString()); + } + } \ No newline at end of file diff --git a/demo/app/src/utils/java/com/chaquo/python/utils/ConsoleActivity.java b/demo/app/src/utils/java/com/chaquo/python/utils/ConsoleActivity.java index 1e923296be..766109fb9e 100644 --- a/demo/app/src/utils/java/com/chaquo/python/utils/ConsoleActivity.java +++ b/demo/app/src/utils/java/com/chaquo/python/utils/ConsoleActivity.java @@ -49,6 +49,8 @@ public static class ConsoleModel extends ViewModel { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + App.setPySubtitle(this); + consoleModel = ViewModelProviders.of(this).get(ConsoleModel.class); task = ViewModelProviders.of(this).get(getTaskClass()); setContentView(resId("layout", "activity_console")); diff --git a/demo/app/src/utils/java/com/chaquo/python/utils/MainActivity.java b/demo/app/src/utils/java/com/chaquo/python/utils/MainActivity.java index d47d76299b..9ad12932ad 100644 --- a/demo/app/src/utils/java/com/chaquo/python/utils/MainActivity.java +++ b/demo/app/src/utils/java/com/chaquo/python/utils/MainActivity.java @@ -16,6 +16,7 @@ protected void onCreate(Bundle savedInstanceState) { String version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName; setTitle(getTitle() + " " + version); } catch (PackageManager.NameNotFoundException ignored) {} + App.setPySubtitle(this); setContentView(resId("layout", "activity_menu")); ((TextView)findViewById(resId("id", "tvCaption")))