fixed profile toolbar

This commit is contained in:
NudeDude 2018-08-15 19:26:49 +02:00
parent 0d4e9bab5e
commit d8f2a68ce8
2 changed files with 32 additions and 20 deletions

View File

@ -25,7 +25,7 @@
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@ -1,6 +1,7 @@
package org.nuclearfog.twidda.window; package org.nuclearfog.twidda.window;
import android.content.Intent; import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
@ -128,7 +129,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
mProfile = new ProfileLoader(this); if (mProfile != null && mProfile.getStatus() != AsyncTask.Status.RUNNING) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.profile_tweet: case R.id.profile_tweet:
Intent intent = new Intent(this, TweetPopup.class); Intent intent = new Intent(this, TweetPopup.class);
@ -138,20 +139,23 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
return true; return true;
case R.id.profile_follow: case R.id.profile_follow:
mProfile = new ProfileLoader(this);
mProfile.execute(userId, ProfileLoader.ACTION_FOLLOW); mProfile.execute(userId, ProfileLoader.ACTION_FOLLOW);
return true; return true;
case R.id.profile_block: case R.id.profile_block:
mProfile = new ProfileLoader(this);
mProfile.execute(userId, ProfileLoader.ACTION_BLOCK); mProfile.execute(userId, ProfileLoader.ACTION_BLOCK);
return true; return true;
case R.id.profile_mute: case R.id.profile_mute:
mProfile = new ProfileLoader(this);
mProfile.execute(userId, ProfileLoader.ACTION_MUTE); mProfile.execute(userId, ProfileLoader.ACTION_MUTE);
return true; return true;
default: return false;
} }
} }
return false;
}
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -183,6 +187,14 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
public void onTabChanged(String tabId) { public void onTabChanged(String tabId) {
animate(); animate();
tabIndex = mTab.getCurrentTab(); tabIndex = mTab.getCurrentTab();
switch (tabIndex) {
case 0:
favoriteList.smoothScrollToPosition(0);
break;
case 1:
homeList.smoothScrollToPosition(0);
break;
}
} }
@Override @Override