mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-11-04 00:33:55 +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
				
			
		| 
						 | 
				
			
			@ -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