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