mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-31 19:34:55 +01:00
Added Picasso library
Minor Bugfixes
This commit is contained in:
parent
8d8a72ecf9
commit
8b80d11929
@ -47,7 +47,7 @@
|
||||
android:screenOrientation="portrait"/>
|
||||
|
||||
<activity
|
||||
android:name=".window.Follower"
|
||||
android:name=".window.UserDetail"
|
||||
android:theme="@style/AppTheme"
|
||||
android:screenOrientation="portrait"/>
|
||||
|
||||
|
@ -1,67 +0,0 @@
|
||||
package org.nuclearfog.twidda.backend;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.nuclearfog.twidda.database.UserDatabase;
|
||||
import org.nuclearfog.twidda.R;
|
||||
import org.nuclearfog.twidda.viewadapter.UserAdapter;
|
||||
import org.nuclearfog.twidda.window.Follower;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import twitter4j.Twitter;
|
||||
import twitter4j.User;
|
||||
|
||||
public class FollowStatus extends AsyncTask <Long, Void, Void> {
|
||||
|
||||
private Context context;
|
||||
private Twitter twitter;
|
||||
private UserAdapter usrAdp;
|
||||
private ListView followList;
|
||||
private SwipeRefreshLayout followReload;
|
||||
|
||||
/**
|
||||
*@see Follower
|
||||
*/
|
||||
public FollowStatus(Context context) {
|
||||
this.context=context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
twitter = TwitterResource.getInstance(context).getTwitter();
|
||||
followList = (ListView)((Follower)context).findViewById(R.id.followList);
|
||||
followReload = (SwipeRefreshLayout)((Follower)context).findViewById(R.id.follow_swipe);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param data [0] mode FollowStatus/Follower , [1] UserID
|
||||
*/
|
||||
@Override
|
||||
protected Void doInBackground(Long... data) {
|
||||
long mode = data[0];
|
||||
long userID = data[1];
|
||||
long cursor = -1L; //TODO
|
||||
List<User> userlist;
|
||||
try {
|
||||
if(mode == 1L) { //FOLLOWING
|
||||
userlist = twitter.getFollowersList(userID,cursor);
|
||||
} else { //Follower
|
||||
userlist = twitter.getFriendsList(userID,cursor);
|
||||
}
|
||||
usrAdp = new UserAdapter(context,new UserDatabase(context,userlist));
|
||||
} catch(Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void v) {
|
||||
followList.setAdapter(usrAdp);
|
||||
followReload.setRefreshing(false);
|
||||
}
|
||||
}
|
@ -110,7 +110,7 @@ public class ProfileAction extends AsyncTask<Long,Void,Long>
|
||||
description = user.getDescription();
|
||||
location = user.getLocation();
|
||||
link = user.getURL();
|
||||
follower = "Follower: "+user.getFollowersCount();
|
||||
follower = "UserDetail: "+user.getFollowersCount();
|
||||
following = "Following: "+user.getFriendsCount();
|
||||
imageLink = user.getProfileImageURL();
|
||||
bannerLink = user.getProfileBannerMobileURL();
|
||||
|
@ -4,7 +4,9 @@ import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import org.nuclearfog.twidda.database.TweetDatabase;
|
||||
import org.nuclearfog.twidda.R;
|
||||
@ -26,6 +28,7 @@ public class TwitterSearch extends AsyncTask<String, Void, String> {
|
||||
private UserAdapter uAdp;
|
||||
private SwipeRefreshLayout tweetReload, userReload;
|
||||
private ListView tweetSearch, userSearch;
|
||||
private ProgressBar circleLoad;
|
||||
private Context context;
|
||||
private Twitter twitter;
|
||||
private int load;
|
||||
@ -42,6 +45,7 @@ public class TwitterSearch extends AsyncTask<String, Void, String> {
|
||||
userSearch = (ListView) ((SearchWindow)context).findViewById(R.id.user_result);
|
||||
tweetReload = (SwipeRefreshLayout) ((SearchWindow)context).findViewById(R.id.searchtweets);
|
||||
userReload = (SwipeRefreshLayout) ((SearchWindow)context).findViewById(R.id.searchusers);
|
||||
circleLoad = (ProgressBar) ((SearchWindow)context).findViewById(R.id.search_progress);
|
||||
twitter = TwitterResource.getInstance(context).getTwitter();
|
||||
}
|
||||
|
||||
@ -70,6 +74,7 @@ public class TwitterSearch extends AsyncTask<String, Void, String> {
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String mode) {
|
||||
circleLoad.setVisibility(View.INVISIBLE);
|
||||
switch(mode) {
|
||||
case(TWEETS):
|
||||
tweetSearch.setAdapter(tlAdp);
|
||||
|
@ -0,0 +1,70 @@
|
||||
package org.nuclearfog.twidda.backend;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.nuclearfog.twidda.database.UserDatabase;
|
||||
import org.nuclearfog.twidda.R;
|
||||
import org.nuclearfog.twidda.viewadapter.UserAdapter;
|
||||
import org.nuclearfog.twidda.window.UserDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import twitter4j.Twitter;
|
||||
import twitter4j.User;
|
||||
|
||||
public class UserLists extends AsyncTask <Long, Void, Void> {
|
||||
|
||||
private Context context;
|
||||
private Twitter twitter;
|
||||
private UserAdapter usrAdp;
|
||||
private ListView userList;
|
||||
private SwipeRefreshLayout userReload;
|
||||
|
||||
/**
|
||||
*@see UserDetail
|
||||
*/
|
||||
public UserLists(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
twitter = TwitterResource.getInstance(context).getTwitter();
|
||||
userList = (ListView)((UserDetail)context).findViewById(R.id.followList);
|
||||
userReload = (SwipeRefreshLayout)((UserDetail)context).findViewById(R.id.follow_swipe);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param data [0] mode UserLists/UserDetail , [1] UserID
|
||||
*/
|
||||
@Override
|
||||
protected Void doInBackground(Long... data) {
|
||||
long mode = data[0];
|
||||
long id = data[1];
|
||||
long cursor = -1L; //TODO
|
||||
List<User> userlist = null;
|
||||
try {
|
||||
if(mode == 0L) { //FOLLOWING
|
||||
userlist = twitter.getFollowersList(id,cursor);
|
||||
} else if(mode == 1L) { //Follower
|
||||
userlist = twitter.getFriendsList(id,cursor);
|
||||
} else if(mode == 2L) { // Retweet TODO
|
||||
} else if(mode == 3L) { // Favorite TODO
|
||||
}
|
||||
if(userlist != null)
|
||||
usrAdp = new UserAdapter(context,new UserDatabase(context,userlist));
|
||||
} catch(Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void v) {
|
||||
userList.setAdapter(usrAdp);
|
||||
userReload.setRefreshing(false);
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ import org.nuclearfog.twidda.database.TweetDatabase;
|
||||
import org.nuclearfog.twidda.database.UserDatabase;
|
||||
import org.nuclearfog.twidda.viewadapter.TimelineAdapter;
|
||||
import org.nuclearfog.twidda.viewadapter.UserAdapter;
|
||||
import org.nuclearfog.twidda.backend.TwitterSearch;
|
||||
|
||||
/**
|
||||
* SearchWindow Tweets and Users
|
||||
@ -62,7 +63,8 @@ public class SearchWindow extends AppCompatActivity implements AdapterView.OnIte
|
||||
tweetReload.setOnRefreshListener(this);
|
||||
userReload.setOnRefreshListener(this);
|
||||
|
||||
getContent(org.nuclearfog.twidda.backend.TwitterSearch.TWEETS);
|
||||
getContent(TwitterSearch.TWEETS);
|
||||
getContent(TwitterSearch.USERS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -142,7 +144,6 @@ public class SearchWindow extends AppCompatActivity implements AdapterView.OnIte
|
||||
}
|
||||
|
||||
private void getContent(final String MODE) {
|
||||
org.nuclearfog.twidda.backend.TwitterSearch s = new org.nuclearfog.twidda.backend.TwitterSearch(SearchWindow.this);
|
||||
s.execute(MODE,search);
|
||||
new TwitterSearch(SearchWindow.this).execute(MODE,search);
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.nuclearfog.twidda.backend.ShowStatus;
|
||||
import org.nuclearfog.twidda.database.TweetDatabase;
|
||||
@ -38,10 +39,15 @@ public class TweetDetail extends AppCompatActivity implements View.OnClickListen
|
||||
Button favorite = (Button) findViewById(R.id.fav_button_detail);
|
||||
ImageView pb = (ImageView) findViewById(R.id.profileimage_detail);
|
||||
|
||||
TextView txtRt = (TextView) findViewById(R.id.no_rt_detail);
|
||||
TextView txtFav = (TextView) findViewById(R.id.no_fav_detail);
|
||||
|
||||
answer_list.setOnItemClickListener(this);
|
||||
favorite.setOnClickListener(this);
|
||||
retweet.setOnClickListener(this);
|
||||
answer.setOnClickListener(this);
|
||||
txtFav.setOnClickListener(this);
|
||||
txtRt.setOnClickListener(this);
|
||||
pb.setOnClickListener(this);
|
||||
setContent();
|
||||
}
|
||||
@ -75,6 +81,22 @@ public class TweetDetail extends AppCompatActivity implements View.OnClickListen
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
break;
|
||||
case R.id.no_rt_detail:
|
||||
intent = new Intent(getApplicationContext(), UserDetail.class);
|
||||
bundle.putLong("userID",userID);
|
||||
bundle.putLong("tweetID",tweetID);
|
||||
bundle.putLong("mode",2L);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
break;
|
||||
case R.id.no_fav_detail:
|
||||
intent = new Intent(getApplicationContext(), UserDetail.class);
|
||||
bundle.putLong("userID",userID);
|
||||
bundle.putLong("tweetID",tweetID);
|
||||
bundle.putLong("mode",3L);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,21 +10,21 @@ import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.nuclearfog.twidda.backend.FollowStatus;
|
||||
import org.nuclearfog.twidda.backend.UserLists;
|
||||
import org.nuclearfog.twidda.database.UserDatabase;
|
||||
import org.nuclearfog.twidda.R;
|
||||
import org.nuclearfog.twidda.viewadapter.UserAdapter;
|
||||
|
||||
/**
|
||||
* Get Follow Connections from an User
|
||||
* @see FollowStatus
|
||||
* @see UserLists
|
||||
*/
|
||||
public class Follower extends AppCompatActivity implements AdapterView.OnItemClickListener,
|
||||
public class UserDetail extends AppCompatActivity implements AdapterView.OnItemClickListener,
|
||||
SwipeRefreshLayout.OnRefreshListener {
|
||||
|
||||
private long userID;
|
||||
private long userID, tweetID;
|
||||
private long mode;
|
||||
private ListView follow;
|
||||
private ListView userListview;
|
||||
private SwipeRefreshLayout reload;
|
||||
private Toolbar toolbar;
|
||||
|
||||
@ -32,16 +32,20 @@ public class Follower extends AppCompatActivity implements AdapterView.OnItemCli
|
||||
protected void onCreate(Bundle b) {
|
||||
super.onCreate(b);
|
||||
setContentView(R.layout.follow);
|
||||
userID = getIntent().getExtras().getLong("userID");
|
||||
mode = getIntent().getExtras().getLong("mode");
|
||||
Intent i = getIntent();
|
||||
userID = i.getExtras().getLong("userID");
|
||||
mode = i.getExtras().getLong("mode");
|
||||
if(i.hasExtra("tweetID")){
|
||||
tweetID = i.getExtras().getLong("tweetID");
|
||||
}
|
||||
|
||||
follow = (ListView) findViewById(R.id.followList);
|
||||
userListview = (ListView) findViewById(R.id.followList);
|
||||
reload = (SwipeRefreshLayout) findViewById(R.id.follow_swipe);
|
||||
toolbar = (Toolbar) findViewById(R.id.follow_toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
setActionbarTitle(mode);
|
||||
|
||||
follow.setOnItemClickListener(this);
|
||||
userListview.setOnItemClickListener(this);
|
||||
reload.setOnRefreshListener(this);
|
||||
}
|
||||
|
||||
@ -54,7 +58,7 @@ public class Follower extends AppCompatActivity implements AdapterView.OnItemCli
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
if(!reload.isRefreshing()) {
|
||||
UserAdapter uAdp = (UserAdapter) follow.getAdapter();
|
||||
UserAdapter uAdp = (UserAdapter) userListview.getAdapter();
|
||||
UserDatabase uDB = uAdp.getAdapter();
|
||||
long userID = uDB.getUserID(position);
|
||||
Intent intent = new Intent(getApplicationContext(), UserProfile.class);
|
||||
@ -68,15 +72,29 @@ public class Follower extends AppCompatActivity implements AdapterView.OnItemCli
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
FollowStatus follow = new FollowStatus(Follower.this);
|
||||
follow.execute(mode, userID);
|
||||
getUsers();
|
||||
}
|
||||
|
||||
private void getUsers(){
|
||||
UserLists uList = new UserLists(UserDetail.this);
|
||||
if(mode == 0L || mode == 1L) {
|
||||
uList.execute(mode, userID);
|
||||
} else if(mode == 2L || mode == 3L) {
|
||||
uList.execute(mode, tweetID);
|
||||
}
|
||||
}
|
||||
|
||||
private void setActionbarTitle(long mode) {
|
||||
if(mode==1){
|
||||
getSupportActionBar().setTitle(R.string.follower);
|
||||
} else{
|
||||
if(getSupportActionBar() == null)
|
||||
return;
|
||||
if(mode == 0) {
|
||||
getSupportActionBar().setTitle(R.string.following);
|
||||
} else if(mode == 1) {
|
||||
getSupportActionBar().setTitle(R.string.follower);
|
||||
} else if(mode == 2) {
|
||||
getSupportActionBar().setTitle(R.string.retweet);
|
||||
} else if(mode == 3) {
|
||||
getSupportActionBar().setTitle(R.string.favorite);
|
||||
}
|
||||
}
|
||||
}
|
@ -211,10 +211,10 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mode 0L = Following , 1L Follower
|
||||
* @param mode 0L = Following , 1L UserDetail
|
||||
*/
|
||||
private void getFollows(long mode) {
|
||||
Intent intent = new Intent(getApplicationContext(), Follower.class);
|
||||
Intent intent = new Intent(getApplicationContext(), UserDetail.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("userID",userId);
|
||||
bundle.putLong("mode",mode);
|
||||
|
@ -7,7 +7,6 @@
|
||||
android:id="@+id/search_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="?attr/actionBarTheme" />
|
||||
|
||||
@ -62,6 +61,13 @@
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/search_progress"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
</TabHost>
|
||||
|
||||
|
||||
|
@ -20,6 +20,8 @@
|
||||
<string name="trend">Trends</string>
|
||||
<string name="following">Following</string>
|
||||
<string name="follower">Follower</string>
|
||||
<string name="retweet">Retweet</string>
|
||||
<string name="favorite">Favorite</string>
|
||||
<string name="woe_id">WOE ID</string>
|
||||
<string name="banner">Profilbanner</string>
|
||||
<string name="link">Webseite</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user