mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Handle back button presses
This commit is contained in:
parent
ad92053018
commit
6e47d7866d
1 changed files with 18 additions and 2 deletions
|
|
@ -13,10 +13,13 @@ import fr.free.nrw.commons.R;
|
||||||
|
|
||||||
public class SignupActivity extends Activity {
|
public class SignupActivity extends Activity {
|
||||||
|
|
||||||
|
private boolean otherPage;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
Log.d("SignupActivity", "Signup Activity started");
|
Log.d("SignupActivity", "Signup Activity started");
|
||||||
|
otherPage = false;
|
||||||
|
|
||||||
WebView webView = new WebView(this);
|
WebView webView = new WebView(this);
|
||||||
setContentView(webView);
|
setContentView(webView);
|
||||||
|
|
@ -40,12 +43,25 @@ public class SignupActivity extends Activity {
|
||||||
intent.putExtra("Redirected", true);
|
intent.putExtra("Redirected", true);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Log.d("SignupActivity", "Not overriding URL, URL is: " + url);
|
Log.d("SignupActivity", "Not overriding URL, URL is: " + url);
|
||||||
|
otherPage = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (otherPage == true) {
|
||||||
|
Intent intent = new Intent(this, SignupActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
|
||||||
|
intent.putExtra("Redirected", true);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue