mirror of
https://github.com/overte-org/overte.git
synced 2025-04-06 18:53:16 +02:00
Cleanup android code
This commit is contained in:
parent
c27f415fea
commit
ce8bd13685
5 changed files with 13 additions and 42 deletions
|
@ -182,10 +182,6 @@ JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnResu
|
|||
JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnExitVr(JNIEnv* env, jobject obj) {
|
||||
}
|
||||
|
||||
JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeGoBackFromAndroidActivity(JNIEnv *env, jobject instance) {
|
||||
AndroidHelper::instance().goBackFromAndroidActivity();
|
||||
}
|
||||
|
||||
// HifiUtils
|
||||
JNIEXPORT jstring JNICALL Java_io_highfidelity_hifiinterface_HifiUtils_getCurrentAddress(JNIEnv *env, jobject instance) {
|
||||
QSharedPointer<AddressManager> addressManager = DependencyManager::get<AddressManager>();
|
||||
|
|
|
@ -41,11 +41,8 @@ public class InterfaceActivity extends QtActivity {
|
|||
//private native void nativeOnResume();
|
||||
private native void nativeOnDestroy();
|
||||
private native void nativeGotoUrl(String url);
|
||||
private native void nativeGoBackFromAndroidActivity();
|
||||
private native void nativeEnterBackground();
|
||||
private native void nativeEnterForeground();
|
||||
//private native void saveRealScreenSize(int width, int height);
|
||||
//private native void setAppVersion(String version);
|
||||
private native long nativeOnExitVr();
|
||||
|
||||
private AssetManager assetManager;
|
||||
|
@ -92,7 +89,6 @@ public class InterfaceActivity extends QtActivity {
|
|||
|
||||
Point size = new Point();
|
||||
getWindowManager().getDefaultDisplay().getRealSize(size);
|
||||
// saveRealScreenSize(size.x, size.y);
|
||||
|
||||
try {
|
||||
PackageInfo pInfo = this.getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
|
@ -201,7 +197,6 @@ public class InterfaceActivity extends QtActivity {
|
|||
if (intent.hasExtra(DOMAIN_URL)) {
|
||||
nativeGotoUrl(intent.getStringExtra(DOMAIN_URL));
|
||||
}
|
||||
nativeGoBackFromAndroidActivity();
|
||||
}
|
||||
|
||||
public void openAndroidActivity(String activityName) {
|
||||
|
|
|
@ -82,54 +82,40 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
private void loadHomeFragment() {
|
||||
Fragment fragment = HomeFragment.newInstance();
|
||||
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
FragmentTransaction ft = fragmentManager.beginTransaction();
|
||||
ft.replace(R.id.content_frame, fragment);
|
||||
ft.commit();
|
||||
|
||||
setTitle(getString(R.string.home));
|
||||
mDrawerLayout.closeDrawer(mNavigationView);
|
||||
loadFragment(fragment, getString(R.string.home), false);
|
||||
}
|
||||
|
||||
private void loadLoginFragment() {
|
||||
Fragment fragment = LoginFragment.newInstance();
|
||||
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
FragmentTransaction ft = fragmentManager.beginTransaction();
|
||||
ft.replace(R.id.content_frame, fragment).addToBackStack(null);
|
||||
ft.commit();
|
||||
|
||||
// update selected item title, then close the drawer
|
||||
setTitle(getString(R.string.login));
|
||||
mDrawerLayout.closeDrawer(mNavigationView);
|
||||
loadFragment(fragment, getString(R.string.login), true);
|
||||
}
|
||||
|
||||
private void loadGotoFragment() {
|
||||
Fragment fragment = GotoFragment.newInstance();
|
||||
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
FragmentTransaction ft = fragmentManager.beginTransaction();
|
||||
ft.replace(R.id.content_frame, fragment).addToBackStack(null);
|
||||
ft.commit();
|
||||
|
||||
// update selected item title, then close the drawer
|
||||
setTitle(getString(R.string.go_to));
|
||||
mDrawerLayout.closeDrawer(mNavigationView);
|
||||
loadFragment(fragment, getString(R.string.go_to), true);
|
||||
}
|
||||
|
||||
private void loadPrivacyPolicyFragment() {
|
||||
Fragment fragment = PolicyFragment.newInstance();
|
||||
|
||||
loadFragment(fragment, getString(R.string.privacyPolicy), true);
|
||||
}
|
||||
|
||||
private void loadFragment(Fragment fragment, String title, boolean addToBackStack) {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
FragmentTransaction ft = fragmentManager.beginTransaction();
|
||||
ft.replace(R.id.content_frame, fragment).addToBackStack(null);
|
||||
ft.replace(R.id.content_frame, fragment);
|
||||
if (addToBackStack) {
|
||||
ft.addToBackStack(null);
|
||||
}
|
||||
ft.commit();
|
||||
|
||||
// update selected item title, then close the drawer
|
||||
setTitle(getString(R.string.privacyPolicy));
|
||||
setTitle(title);
|
||||
mDrawerLayout.closeDrawer(mNavigationView);
|
||||
}
|
||||
|
||||
|
||||
private void updateLoginMenu() {
|
||||
TextView loginOption = findViewById(R.id.login);
|
||||
TextView logoutOption = findViewById(R.id.logout);
|
||||
|
|
|
@ -40,10 +40,6 @@ void AndroidHelper::notifyLoadComplete() {
|
|||
emit qtAppLoadComplete();
|
||||
}
|
||||
|
||||
void AndroidHelper::goBackFromAndroidActivity() {
|
||||
emit backFromAndroidActivity();
|
||||
}
|
||||
|
||||
void AndroidHelper::notifyLoginComplete(bool success) {
|
||||
emit loginComplete(success);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ public:
|
|||
}
|
||||
void requestActivity(const QString &activityName);
|
||||
void notifyLoadComplete();
|
||||
void goBackFromAndroidActivity();
|
||||
|
||||
void notifyLoginComplete(bool success);
|
||||
void performHapticFeedback(const QString& feedbackConstant);
|
||||
|
@ -36,7 +35,6 @@ public:
|
|||
void operator=(AndroidHelper const&) = delete;
|
||||
signals:
|
||||
void androidActivityRequested(const QString &activityName);
|
||||
void backFromAndroidActivity();
|
||||
void qtAppLoadComplete();
|
||||
void loginComplete(bool success);
|
||||
void hapticFeedbackRequested(const QString &feedbackConstant);
|
||||
|
|
Loading…
Reference in a new issue