mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Show contributions only after user has logged in
This commit is contained in:
parent
1ac8d3d879
commit
822f4eff50
2 changed files with 18 additions and 7 deletions
|
|
@ -10,7 +10,7 @@ import android.accounts.*;
|
|||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class AuthenticatedActivity extends SherlockActivity {
|
||||
public class AuthenticatedActivity extends SherlockFragmentActivity {
|
||||
|
||||
|
||||
String accountType;
|
||||
|
|
|
|||
|
|
@ -20,9 +20,15 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
|
|||
import org.wikimedia.commons.ImageLoaderTask;
|
||||
import org.wikimedia.commons.R;
|
||||
import org.wikimedia.commons.UploadService;
|
||||
import org.wikimedia.commons.auth.AuthenticatedActivity;
|
||||
import org.wikimedia.commons.auth.WikiAccountAuthenticator;
|
||||
|
||||
// Inherit from SherlockFragmentActivity but not use Fragments. Because Loaders are available only from FragmentActivities
|
||||
public class ContributionsActivity extends SherlockFragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> {
|
||||
public class ContributionsActivity extends AuthenticatedActivity implements LoaderManager.LoaderCallbacks<Cursor> {
|
||||
|
||||
public ContributionsActivity() {
|
||||
super(WikiAccountAuthenticator.COMMONS_ACCOUNT_TYPE);
|
||||
}
|
||||
|
||||
private class ContributionAdapter extends CursorAdapter {
|
||||
|
||||
|
|
@ -92,6 +98,15 @@ public class ContributionsActivity extends SherlockFragmentActivity implements L
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAuthCookieAcquired(String authCookie) {
|
||||
Cursor allContributions = getContentResolver().query(ContributionsContentProvider.BASE_URI, CONTRIBUTIONS_PROJECTION, CONTRIBUTION_SELECTION, null, CONTRIBUTION_SORT);
|
||||
contributionsAdapter = new ContributionAdapter(this, allContributions, 0);
|
||||
contributionsList.setAdapter(contributionsAdapter);
|
||||
|
||||
getSupportLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
@ -99,11 +114,7 @@ public class ContributionsActivity extends SherlockFragmentActivity implements L
|
|||
setContentView(R.layout.activity_contributions);
|
||||
contributionsList = (ListView)findViewById(R.id.contributionsList);
|
||||
|
||||
Cursor allContributions = getContentResolver().query(ContributionsContentProvider.BASE_URI, CONTRIBUTIONS_PROJECTION, CONTRIBUTION_SELECTION, null, CONTRIBUTION_SORT);
|
||||
contributionsAdapter = new ContributionAdapter(this, allContributions, 0);
|
||||
contributionsList.setAdapter(contributionsAdapter);
|
||||
|
||||
getSupportLoaderManager().initLoader(0, null, this);
|
||||
requestAuthToken();
|
||||
}
|
||||
|
||||
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue