mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Switch the main activity to be the LoginActivity
This commit is contained in:
parent
364199dcb2
commit
367228d758
4 changed files with 24 additions and 14 deletions
|
|
@ -31,6 +31,10 @@
|
|||
<activity
|
||||
android:name=".auth.LoginActivity"
|
||||
>
|
||||
<intent-filter>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".WelcomeActivity"
|
||||
|
|
@ -66,10 +70,6 @@
|
|||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
>
|
||||
<intent-filter>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".settings.SettingsActivity"
|
||||
|
|
|
|||
|
|
@ -166,7 +166,10 @@ public class CommonsApplication extends Application {
|
|||
public MWApi getApi() {
|
||||
return api;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Accout|null
|
||||
*/
|
||||
public Account getCurrentAccount() {
|
||||
if(currentAccount == null) {
|
||||
AccountManager accountManager = AccountManager.get(this);
|
||||
|
|
|
|||
|
|
@ -17,10 +17,8 @@ import android.widget.EditText;
|
|||
import android.widget.TextView;
|
||||
|
||||
import android.widget.Toast;
|
||||
import fr.free.nrw.commons.BuildConfig;
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.Utils;
|
||||
import fr.free.nrw.commons.WelcomeActivity;
|
||||
import fr.free.nrw.commons.*;
|
||||
import fr.free.nrw.commons.contributions.ContributionsActivity;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
||||
|
|
@ -36,10 +34,14 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
EditText twoFactorEdit;
|
||||
ProgressDialog progressDialog;
|
||||
|
||||
private CommonsApplication app;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
app = (CommonsApplication) getApplicationContext();
|
||||
|
||||
setContentView(R.layout.activity_login);
|
||||
final LoginActivity that = this;
|
||||
|
||||
|
|
@ -116,6 +118,9 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
this.startWelcomeIntent();
|
||||
prefs.edit().putBoolean("firstrun", false).apply();
|
||||
}
|
||||
if (app.getCurrentAccount() != null) {
|
||||
startMainActivity();
|
||||
}
|
||||
}
|
||||
|
||||
private void startWelcomeIntent() {
|
||||
|
|
@ -208,4 +213,10 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
twoFactorEdit.setText("");
|
||||
}
|
||||
|
||||
public void startMainActivity() {
|
||||
Intent intent = new Intent(this, ContributionsActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import android.os.Bundle;
|
|||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.EventLog;
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.contributions.ContributionsActivity;
|
||||
import timber.log.Timber;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -90,10 +89,7 @@ class LoginTask extends AsyncTask<String, String, String> {
|
|||
}
|
||||
|
||||
AccountUtil.createAccount( response, username, password );
|
||||
|
||||
Intent intent = new Intent(loginActivity, ContributionsActivity.class);
|
||||
loginActivity.startActivity(intent);
|
||||
loginActivity.finish();
|
||||
loginActivity.startMainActivity();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue