mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-02-09 08:38:38 +01:00
profile bug fix
This commit is contained in:
parent
5315d6707a
commit
9d61caacbf
6
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
6
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AndroidLintNewerVersionAvailable" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
@ -1,5 +1,6 @@
|
||||
package org.nuclearfog.twidda.backend;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
@ -17,6 +18,7 @@ import org.nuclearfog.twidda.backend.listitems.TwitterUser;
|
||||
import org.nuclearfog.twidda.database.DatabaseAdapter;
|
||||
import org.nuclearfog.twidda.database.GlobalSettings;
|
||||
import org.nuclearfog.twidda.viewadapter.TimelineAdapter;
|
||||
import org.nuclearfog.twidda.window.UserDetail;
|
||||
import org.nuclearfog.twidda.window.UserProfile;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
@ -158,9 +160,10 @@ public class ProfileLoader extends AsyncTask<Long, Long, Long> {
|
||||
|
||||
List<Tweet> tweets = mTwitter.getUserTweets(UID, id, page);
|
||||
homeTl.addNew(tweets);
|
||||
publishProgress(GET_TWEETS);
|
||||
database.storeUserTweets(tweets);
|
||||
}
|
||||
publishProgress(GET_TWEETS);
|
||||
|
||||
if ((MODE == GET_FAVORS || homeFav.getItemCount() == 0) && access) {
|
||||
long id = 1L;
|
||||
if (homeFav.getItemCount() > 0)
|
||||
@ -168,9 +171,9 @@ public class ProfileLoader extends AsyncTask<Long, Long, Long> {
|
||||
|
||||
List<Tweet> favors = mTwitter.getUserFavs(UID, id, page);
|
||||
homeFav.addNew(favors);
|
||||
publishProgress(GET_FAVORS);
|
||||
database.storeUserFavs(favors, UID);
|
||||
}
|
||||
publishProgress(GET_FAVORS);
|
||||
}
|
||||
} catch (TwitterException err) {
|
||||
returnCode = err.getErrorCode();
|
||||
@ -225,19 +228,39 @@ public class ProfileLoader extends AsyncTask<Long, Long, Long> {
|
||||
if (user.isVerified) {
|
||||
ui.get().findViewById(R.id.profile_verify).setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (user.isLocked) {
|
||||
ui.get().findViewById(R.id.profile_locked).setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (isFollowed) {
|
||||
ui.get().findViewById(R.id.followback).setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (imgEnabled) {
|
||||
Picasso.get().load(user.profileImg + "_bigger").into(profile);
|
||||
}
|
||||
if (user.isLocked) {
|
||||
ui.get().findViewById(R.id.profile_locked).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
txtFollowing.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent following = new Intent(ui.get(), UserDetail.class);
|
||||
following.putExtra("userID", user.userID);
|
||||
following.putExtra("mode", 0);
|
||||
ui.get().startActivity(following);
|
||||
}
|
||||
});
|
||||
txtFollower.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent follower = new Intent(ui.get(), UserDetail.class);
|
||||
follower.putExtra("userID", user.userID);
|
||||
follower.putExtra("mode", 1);
|
||||
ui.get().startActivity(follower);
|
||||
}
|
||||
});
|
||||
}
|
||||
profile.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new ImagePopup(ui.get()).execute(user.profileImg);
|
||||
if (getStatus() == Status.FINISHED)
|
||||
new ImagePopup(ui.get()).execute(user.profileImg);
|
||||
}
|
||||
});
|
||||
|
||||
@ -245,7 +268,6 @@ public class ProfileLoader extends AsyncTask<Long, Long, Long> {
|
||||
SwipeRefreshLayout homeReload = ui.get().findViewById(R.id.hometweets);
|
||||
homeReload.setRefreshing(false);
|
||||
homeTl.notifyDataSetChanged();
|
||||
|
||||
} else if (MODE == GET_FAVORS) {
|
||||
SwipeRefreshLayout favReload = ui.get().findViewById(R.id.homefavorits);
|
||||
favReload.setRefreshing(false);
|
||||
@ -288,11 +310,6 @@ public class ProfileLoader extends AsyncTask<Long, Long, Long> {
|
||||
default:
|
||||
Toast.makeText(ui.get(), errMsg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
SwipeRefreshLayout tweetsReload = ui.get().findViewById(R.id.hometweets);
|
||||
SwipeRefreshLayout favoriteReload = ui.get().findViewById(R.id.homefavorits);
|
||||
tweetsReload.setRefreshing(false);
|
||||
favoriteReload.setRefreshing(false);
|
||||
}
|
||||
if (!isHome) {
|
||||
ui.get().setConnection(isFollowing, isMuted, isBlocked, canDm);
|
||||
|
@ -11,7 +11,6 @@ import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
@ -34,7 +33,7 @@ import static android.os.AsyncTask.Status.RUNNING;
|
||||
*
|
||||
* @see ProfileLoader
|
||||
*/
|
||||
public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
public class UserProfile extends AppCompatActivity implements
|
||||
OnRefreshListener, OnTabChangeListener, OnItemClicked {
|
||||
|
||||
private ProfileLoader mProfile;
|
||||
@ -79,8 +78,6 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
favoriteList.setLayoutManager(new LinearLayoutManager(this));
|
||||
favoriteList.setBackgroundColor(background);
|
||||
|
||||
View txtFollowing = findViewById(R.id.following);
|
||||
View txtFollower = findViewById(R.id.follower);
|
||||
mTab = findViewById(R.id.profile_tab);
|
||||
mTab.setup();
|
||||
TabHost.TabSpec tab1 = mTab.newTabSpec("tweets");
|
||||
@ -94,8 +91,6 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
lastTab = mTab.getCurrentView();
|
||||
|
||||
mTab.setOnTabChangedListener(this);
|
||||
txtFollowing.setOnClickListener(this);
|
||||
txtFollower.setOnClickListener(this);
|
||||
homeReload.setOnRefreshListener(this);
|
||||
favoriteReload.setOnRefreshListener(this);
|
||||
}
|
||||
@ -223,25 +218,6 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.following:
|
||||
Intent following = new Intent(this, UserDetail.class);
|
||||
following.putExtra("userID", userId);
|
||||
following.putExtra("mode", 0);
|
||||
startActivity(following);
|
||||
break;
|
||||
case R.id.follower:
|
||||
Intent follower = new Intent(this, UserDetail.class);
|
||||
follower.putExtra("userID", userId);
|
||||
follower.putExtra("mode", 1);
|
||||
startActivity(follower);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
if (mProfile != null && mProfile.getStatus() == RUNNING)
|
||||
|
Loading…
x
Reference in New Issue
Block a user