mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-12 03:07:11 +01:00
Cancel loading the user's info when there is nobody logging in. Delete a line which access a deleted string resource in manifest.
This commit is contained in:
parent
f2eb18749c
commit
b0e2e273a7
@ -44,7 +44,6 @@
|
||||
android:parentActivityName=".MainActivity" />
|
||||
<activity
|
||||
android:name=".ViewSubredditDetailActivity"
|
||||
android:label="@string/title_activity_view_subreddit_detail"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
</application>
|
||||
|
@ -69,6 +69,20 @@ public class MainActivity extends AppCompatActivity {
|
||||
drawer.addDrawerListener(toggle);
|
||||
toggle.syncState();
|
||||
|
||||
String accessToken = getSharedPreferences(SharedPreferencesUtils.AUTH_CODE_FILE_KEY, Context.MODE_PRIVATE).getString(SharedPreferencesUtils.ACCESS_TOKEN_KEY, "");
|
||||
if(accessToken.equals("")) {
|
||||
Intent loginIntent = new Intent(this, LoginActivity.class);
|
||||
startActivity(loginIntent);
|
||||
} else {
|
||||
if(savedInstanceState == null) {
|
||||
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
||||
mFragment = new BestPostFragment();
|
||||
fragmentTransaction.replace(R.id.frame_layout_content_main, mFragment).commit();
|
||||
} else {
|
||||
mFragment = getFragmentManager().getFragment(savedInstanceState, "outStateFragment");
|
||||
getFragmentManager().beginTransaction().replace(R.id.frame_layout_content_main, mFragment).commit();
|
||||
}
|
||||
|
||||
Calendar now = Calendar.getInstance();
|
||||
Calendar queryAccessTokenTime = Calendar.getInstance();
|
||||
queryAccessTokenTime.setTimeInMillis(getSharedPreferences(SharedPreferencesUtils.AUTH_CODE_FILE_KEY, Context.MODE_PRIVATE)
|
||||
@ -119,21 +133,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
glide.load(mBannerImageUrl).into(mBannerImageView);
|
||||
}
|
||||
|
||||
String accessToken = getSharedPreferences(SharedPreferencesUtils.AUTH_CODE_FILE_KEY, Context.MODE_PRIVATE).getString(SharedPreferencesUtils.ACCESS_TOKEN_KEY, "");
|
||||
if(accessToken.equals("")) {
|
||||
Intent loginIntent = new Intent(this, LoginActivity.class);
|
||||
startActivity(loginIntent);
|
||||
} else {
|
||||
if(savedInstanceState == null) {
|
||||
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
||||
mFragment = new BestPostFragment();
|
||||
fragmentTransaction.replace(R.id.frame_layout_content_main, mFragment).commit();
|
||||
} else {
|
||||
mFragment = getFragmentManager().getFragment(savedInstanceState, "outStateFragment");
|
||||
getFragmentManager().beginTransaction().replace(R.id.frame_layout_content_main, mFragment).commit();
|
||||
}
|
||||
}
|
||||
|
||||
if(savedInstanceState == null && !mFetchUserInfoSuccess) {
|
||||
new FetchUserInfo(this, Volley.newRequestQueue(this)).queryUserInfo(new FetchUserInfo.FetchUserInfoListener() {
|
||||
@Override
|
||||
@ -240,6 +239,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
|
Loading…
Reference in New Issue
Block a user