-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ab7bf3
commit 4f83ddc
Showing
22 changed files
with
340 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
#include <vector> | ||
|
||
#include "helpers.hpp" | ||
|
||
class Pandroid { | ||
public: | ||
static void onSmdhLoaded(const std::vector<u8> &smdh); | ||
|
||
namespace Pandroid { | ||
static void onSmdhLoaded(const std::vector<u8>& smdh); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 28 additions & 34 deletions
62
src/pandroid/app/src/main/java/com/panda3ds/pandroid/app/BaseActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,38 @@ | ||
package com.panda3ds.pandroid.app; | ||
|
||
import android.os.Bundle; | ||
|
||
import androidx.annotation.Nullable; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import com.panda3ds.pandroid.R; | ||
import com.panda3ds.pandroid.data.config.GlobalConfig; | ||
|
||
|
||
public class BaseActivity extends AppCompatActivity { | ||
private int currentTheme = GlobalConfig.get(GlobalConfig.KEY_APP_THEME); | ||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
applyTheme(); | ||
super.onCreate(savedInstanceState); | ||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
super.onResume(); | ||
if (GlobalConfig.get(GlobalConfig.KEY_APP_THEME) != currentTheme){ | ||
recreate(); | ||
} | ||
} | ||
|
||
private void applyTheme(){ | ||
switch (GlobalConfig.get(GlobalConfig.KEY_APP_THEME)){ | ||
case GlobalConfig.THEME_ANDROID: | ||
setTheme(R.style.Theme_Pandroid); | ||
break; | ||
case GlobalConfig.THEME_LIGHT: | ||
setTheme(R.style.Theme_Pandroid_Light); | ||
break; | ||
case GlobalConfig.THEME_DARK: | ||
setTheme(R.style.Theme_Pandroid_Dark); | ||
break; | ||
case GlobalConfig.THEME_BLACK: | ||
setTheme(R.style.Theme_Pandroid_Black); | ||
break; | ||
} | ||
currentTheme = GlobalConfig.get(GlobalConfig.KEY_APP_THEME); | ||
} | ||
private int currentTheme = GlobalConfig.get(GlobalConfig.KEY_APP_THEME); | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
applyTheme(); | ||
super.onCreate(savedInstanceState); | ||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
super.onResume(); | ||
|
||
if (GlobalConfig.get(GlobalConfig.KEY_APP_THEME) != currentTheme) { | ||
recreate(); | ||
} | ||
} | ||
|
||
private void applyTheme() { | ||
switch (GlobalConfig.get(GlobalConfig.KEY_APP_THEME)) { | ||
case GlobalConfig.THEME_ANDROID: setTheme(R.style.Theme_Pandroid); break; | ||
case GlobalConfig.THEME_LIGHT: setTheme(R.style.Theme_Pandroid_Light); break; | ||
case GlobalConfig.THEME_DARK: setTheme(R.style.Theme_Pandroid_Dark); break; | ||
case GlobalConfig.THEME_BLACK: setTheme(R.style.Theme_Pandroid_Black); break; | ||
} | ||
|
||
currentTheme = GlobalConfig.get(GlobalConfig.KEY_APP_THEME); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.