Cleanup android code

This commit is contained in:
Gabriel Calero 2018-04-27 18:58:09 -03:00
parent c27f415fea
commit ce8bd13685
5 changed files with 13 additions and 42 deletions

View file

@ -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>();

View file

@ -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) {

View file

@ -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);

View file

@ -40,10 +40,6 @@ void AndroidHelper::notifyLoadComplete() {
emit qtAppLoadComplete();
}
void AndroidHelper::goBackFromAndroidActivity() {
emit backFromAndroidActivity();
}
void AndroidHelper::notifyLoginComplete(bool success) {
emit loginComplete(success);
}

View file

@ -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);