mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-19 00:35:46 -04:00
Android: Display version in title
This commit is contained in:
@ -14,6 +14,7 @@ public class AndroidHostInterface {
|
||||
private long mNativePointer;
|
||||
private Context mContext;
|
||||
|
||||
static public native String getScmVersion();
|
||||
static public native AndroidHostInterface create(Context context, String userDirectory);
|
||||
|
||||
public AndroidHostInterface(Context context) {
|
||||
|
@ -45,6 +45,15 @@ public class MainActivity extends AppCompatActivity {
|
||||
return prefs.getBoolean("Main/SaveStateOnExit", true);
|
||||
}
|
||||
|
||||
private static String getTitleString() {
|
||||
String scmVersion = AndroidHostInterface.getScmVersion();
|
||||
final int gitHashPos = scmVersion.indexOf("-g");
|
||||
if (gitHashPos > 0)
|
||||
scmVersion = scmVersion.substring(0, gitHashPos);
|
||||
|
||||
return String.format("DuckStation %s", scmVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -52,6 +61,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
setContentView(R.layout.activity_main);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setTitle(getTitleString());
|
||||
|
||||
findViewById(R.id.fab_add_game_directory).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user