Base 1.1
This commit is contained in:
parent
703311a47e
commit
360c64640a
|
@ -31,7 +31,7 @@ import org.nuclearfog.twidda.window.TweetDetail;
|
|||
import org.nuclearfog.twidda.window.TweetPopup;
|
||||
import org.nuclearfog.twidda.window.TwitterSearch;
|
||||
|
||||
public class MainActivity extends AppCompatActivity
|
||||
public class MainActivity extends AppCompatActivity implements AdapterView.OnItemClickListener, SwipeRefreshLayout.OnRefreshListener
|
||||
{
|
||||
private SwipeRefreshLayout timelineReload,trendReload,mentionReload;
|
||||
private ListView timelineList, trendList,mentionList;
|
||||
|
@ -42,6 +42,7 @@ public class MainActivity extends AppCompatActivity
|
|||
private Context con;
|
||||
private Toolbar toolbar;
|
||||
private boolean login;
|
||||
private String currentTab;
|
||||
|
||||
/**
|
||||
* Create Activity
|
||||
|
@ -78,7 +79,6 @@ public class MainActivity extends AppCompatActivity
|
|||
search = m.findItem(R.id.action_search);
|
||||
setting = m.findItem(R.id.action_settings);
|
||||
searchQuery = (SearchView)m.findItem(R.id.action_search).getActionView();
|
||||
|
||||
searchQuery.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String s) {
|
||||
|
@ -109,11 +109,15 @@ public class MainActivity extends AppCompatActivity
|
|||
intent = new Intent(this, UserProfile.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("userID",settings.getLong("userID", -1));
|
||||
bundle.putBoolean("home", true);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.action_tweet:
|
||||
intent = new Intent(this, TweetPopup.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putLong("TweetID", -1);
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.action_settings:
|
||||
|
@ -135,10 +139,70 @@ public class MainActivity extends AppCompatActivity
|
|||
if(login) {
|
||||
setTabContent();
|
||||
}
|
||||
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
switch(parent.getId()) {
|
||||
case R.id.tl_list:
|
||||
if(!timelineReload.isRefreshing()) {
|
||||
TimelineAdapter tlAdp = (TimelineAdapter) timelineList.getAdapter();
|
||||
TweetDatabase twDB = tlAdp.getAdapter();
|
||||
long tweetID = twDB.getTweetId(position);
|
||||
long userID = twDB.getUserID(position);
|
||||
Intent intent = new Intent(con, TweetDetail.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("tweetID",tweetID);
|
||||
bundle.putLong("userID",userID);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
break;
|
||||
case R.id.tr_list:
|
||||
if(!trendReload.isRefreshing()) {
|
||||
TrendAdapter trend = (TrendAdapter) trendList.getAdapter();
|
||||
String search = trend.getDatabase().getTrendname(position);
|
||||
Intent intent = new Intent(con, TwitterSearch.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("search", search);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
break;
|
||||
case R.id.mention:
|
||||
if(!mentionReload.isRefreshing()) {
|
||||
TimelineAdapter tlAdp = (TimelineAdapter) timelineList.getAdapter();
|
||||
TweetDatabase twDB = tlAdp.getAdapter();
|
||||
long tweetID = twDB.getTweetId(position);
|
||||
long userID = twDB.getUserID(position);
|
||||
Intent intent = new Intent(con, TweetDetail.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("tweetID",tweetID);
|
||||
bundle.putLong("userID",userID);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
MainPage homeView = new MainPage(MainActivity.this);
|
||||
switch (currentTab) {
|
||||
case "timeline":
|
||||
homeView.execute(0);
|
||||
break;
|
||||
case "trends":
|
||||
homeView.execute(1);
|
||||
break;
|
||||
case "mention":
|
||||
homeView.execute(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Preferences
|
||||
*/
|
||||
|
@ -171,13 +235,19 @@ public class MainActivity extends AppCompatActivity
|
|||
timelineReload = (SwipeRefreshLayout) findViewById(R.id.timeline);
|
||||
trendReload = (SwipeRefreshLayout) findViewById(R.id.trends);
|
||||
mentionReload = (SwipeRefreshLayout) findViewById(R.id.mention);
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
toolbar = (Toolbar) findViewById(R.id.profile_toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
setRefreshListener();
|
||||
|
||||
timelineList.setOnItemClickListener(this);
|
||||
trendList.setOnItemClickListener(this);
|
||||
mentionList.setOnItemClickListener(this);
|
||||
timelineReload.setOnRefreshListener(this);
|
||||
trendReload.setOnRefreshListener(this);
|
||||
mentionReload.setOnRefreshListener(this);
|
||||
|
||||
setTabListener();
|
||||
setTabContent();
|
||||
setListViewListener();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -202,6 +272,7 @@ public class MainActivity extends AppCompatActivity
|
|||
tab3.setContent(R.id.mention);
|
||||
tab3.setIndicator("",getResources().getDrawable(R.drawable.mention_icon));
|
||||
tabhost.addTab(tab3);
|
||||
currentTab = "timeline";
|
||||
tabhost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
|
||||
@Override
|
||||
public void onTabChanged(String tabId) {
|
||||
|
@ -210,6 +281,7 @@ public class MainActivity extends AppCompatActivity
|
|||
timelineReload.setRefreshing(false);
|
||||
searchQuery.onActionViewCollapsed();
|
||||
setVisibility(tabId);
|
||||
currentTab = tabId;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -227,85 +299,6 @@ public class MainActivity extends AppCompatActivity
|
|||
trendList.setAdapter(trendAdp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Swipe To Refresh Listener
|
||||
*/
|
||||
private void setRefreshListener() {
|
||||
timelineReload.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
MainPage homeView = new MainPage(MainActivity.this);
|
||||
homeView.execute(0);
|
||||
}
|
||||
});
|
||||
trendReload.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
MainPage homeView = new MainPage(MainActivity.this);
|
||||
homeView.execute(1);
|
||||
}
|
||||
});
|
||||
mentionReload.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
MainPage homeView = new MainPage(MainActivity.this);
|
||||
homeView.execute(2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set On Item Click Listener for the main Listviews
|
||||
*/
|
||||
private void setListViewListener() {
|
||||
timelineList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
if(!timelineReload.isRefreshing()) {
|
||||
TimelineAdapter tlAdp = (TimelineAdapter) timelineList.getAdapter();
|
||||
TweetDatabase twDB = tlAdp.getAdapter();
|
||||
long tweetID = twDB.getTweetId(position);
|
||||
long userID = twDB.getUserID(position);
|
||||
Intent intent = new Intent(con, TweetDetail.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("tweetID",tweetID);
|
||||
bundle.putLong("userID",userID);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
trendList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
TrendAdapter trend = (TrendAdapter) trendList.getAdapter();
|
||||
String search = trend.getDatabase().getTrendname(position);
|
||||
Intent intent = new Intent(con, TwitterSearch.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("search", search);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
mentionList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
if(!mentionReload.isRefreshing()) {
|
||||
TimelineAdapter tlAdp = (TimelineAdapter) timelineList.getAdapter();
|
||||
TweetDatabase twDB = tlAdp.getAdapter();
|
||||
long tweetID = twDB.getTweetId(position);
|
||||
long userID = twDB.getUserID(position);
|
||||
Intent intent = new Intent(con, TweetDetail.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("tweetID",tweetID);
|
||||
bundle.putLong("userID",userID);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Toolbar Items
|
||||
* @param currentTab 3 Tabs "timeline" , "trends" , "mention"
|
||||
|
|
|
@ -4,35 +4,38 @@ import android.content.Context;
|
|||
import android.os.AsyncTask;
|
||||
import android.widget.Toast;
|
||||
|
||||
import twitter4j.GeoLocation;
|
||||
import twitter4j.StatusUpdate;
|
||||
import twitter4j.Twitter;
|
||||
|
||||
public class SendStatus extends AsyncTask<String, Void, Boolean> {
|
||||
public class SendStatus extends AsyncTask<Object, Void, Boolean> {
|
||||
|
||||
public static final String SEND_STATUS="stats";
|
||||
|
||||
private Context context;
|
||||
private Twitter twitter;
|
||||
|
||||
public SendStatus(Context context){
|
||||
public SendStatus(Context context) {
|
||||
this.context = context;
|
||||
twitter = TwitterResource.getInstance(context).getTwitter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args Argument + Text
|
||||
* args[0] = Mode
|
||||
* args[1] = Data
|
||||
* args[0] = TWEET TEXT
|
||||
* args[1] = REPLY TWEET ID
|
||||
*/
|
||||
@Override
|
||||
protected Boolean doInBackground(String... args) {
|
||||
protected Boolean doInBackground(Object... args) {
|
||||
try {
|
||||
switch(args[0]) {
|
||||
case(SEND_STATUS):
|
||||
String tweet = args[1];
|
||||
TwitterResource mTwitter = TwitterResource.getInstance(context);
|
||||
mTwitter.init();
|
||||
Twitter twitter = mTwitter.getTwitter();
|
||||
twitter.tweets().updateStatus(tweet);
|
||||
return true;
|
||||
}
|
||||
String tweet = (String) args[0];
|
||||
StatusUpdate mStatus = new StatusUpdate(tweet);
|
||||
if(args.length > 1)
|
||||
mStatus.setInReplyToStatusId((Long)args[1]);
|
||||
|
||||
twitter.tweets().updateStatus(mStatus);
|
||||
return true;
|
||||
|
||||
} catch(Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ public class Follower extends AppCompatActivity {
|
|||
Intent intent = new Intent(context, UserProfile.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("userID",userID);
|
||||
bundle.putBoolean("home", false);//todo
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package org.nuclearfog.twidda.window;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
|
||||
|
@ -14,10 +14,9 @@ import org.nuclearfog.twidda.database.TweetDatabase;
|
|||
import org.nuclearfog.twidda.R;
|
||||
import org.nuclearfog.twidda.viewadapter.TimelineAdapter;
|
||||
|
||||
public class TweetDetail extends AppCompatActivity {
|
||||
public class TweetDetail extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemClickListener {
|
||||
|
||||
private ListView answer_list;
|
||||
private Context context;
|
||||
private long tweetID;
|
||||
private long userID;
|
||||
|
||||
|
@ -29,19 +28,17 @@ public class TweetDetail extends AppCompatActivity {
|
|||
userID = getIntent().getExtras().getLong("userID");
|
||||
|
||||
answer_list = (ListView) findViewById(R.id.answer_list);
|
||||
Button answer = (Button) findViewById(R.id.answer_button);
|
||||
Button retweet = (Button) findViewById(R.id.rt_button);
|
||||
Button favorite = (Button) findViewById(R.id.fav_button);
|
||||
ImageView pb = (ImageView) findViewById(R.id.profileimage_detail);
|
||||
pb.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent profile = new Intent(getApplicationContext(), UserProfile.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("userID",userID);
|
||||
profile.putExtras(bundle);
|
||||
startActivity(profile);
|
||||
}
|
||||
});
|
||||
|
||||
answer_list.setOnItemClickListener(this);
|
||||
answer.setOnClickListener(this);
|
||||
retweet.setOnClickListener(this);
|
||||
favorite.setOnClickListener(this);
|
||||
pb.setOnClickListener(this);
|
||||
setContent();
|
||||
setListViewListener();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,23 +46,41 @@ public class TweetDetail extends AppCompatActivity {
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
private void setListViewListener() {
|
||||
context = getApplicationContext();
|
||||
answer_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
TimelineAdapter tlAdp = (TimelineAdapter) answer_list.getAdapter();
|
||||
TweetDatabase twDB = tlAdp.getAdapter();
|
||||
long userID = twDB.getUserID(position);
|
||||
long tweetID = twDB.getTweetId(position);
|
||||
Intent intent = new Intent(context, TweetDetail.class);
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch(v.getId()) {
|
||||
case R.id.answer_button:
|
||||
//todo
|
||||
break;
|
||||
case R.id.rt_button:
|
||||
//todo
|
||||
break;
|
||||
case R.id.fav_button:
|
||||
//todo
|
||||
break;
|
||||
case R.id.profileimage_detail:
|
||||
Intent profile = new Intent(getApplicationContext(), UserProfile.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("userID",userID);
|
||||
bundle.putLong("tweetID",tweetID);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
bundle.putBoolean("home", false);//todo
|
||||
profile.putExtras(bundle);
|
||||
startActivity(profile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
TimelineAdapter tlAdp = (TimelineAdapter) answer_list.getAdapter();
|
||||
TweetDatabase twDB = tlAdp.getAdapter();
|
||||
long userID = twDB.getUserID(position);
|
||||
long tweetID = twDB.getTweetId(position);
|
||||
Intent intent = new Intent(getApplicationContext(), TweetDetail.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("userID",userID);
|
||||
bundle.putLong("tweetID",tweetID);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private void setContent() {
|
||||
|
|
|
@ -13,12 +13,17 @@ import org.nuclearfog.twidda.R;
|
|||
public class TweetPopup extends AppCompatActivity {
|
||||
|
||||
private EditText tweetfield;
|
||||
private long inReplyId;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle SavedInstance) {
|
||||
super.onCreate(SavedInstance);
|
||||
getWindow().setLayout(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
setContentView(R.layout.tweetwindow);
|
||||
|
||||
inReplyId = getIntent().getExtras().getLong("TweetID");
|
||||
|
||||
getWindow().setLayout(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
tweetfield = (EditText) findViewById(R.id.tweet_input);
|
||||
|
||||
Button closeButton = (Button) findViewById(R.id.close);
|
||||
|
@ -41,7 +46,10 @@ public class TweetPopup extends AppCompatActivity {
|
|||
private void send() {
|
||||
String tweet = tweetfield.getText().toString();
|
||||
SendStatus sendTweet = new SendStatus(getApplicationContext());
|
||||
sendTweet.execute(SendStatus.SEND_STATUS, tweet);
|
||||
if(inReplyId > 0)
|
||||
sendTweet.execute(tweet, inReplyId);
|
||||
else
|
||||
sendTweet.execute(tweet);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.view.Menu;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TabHost;
|
||||
import android.widget.TextView;
|
||||
|
@ -20,12 +19,13 @@ import org.nuclearfog.twidda.backend.ProfileTweets;
|
|||
import org.nuclearfog.twidda.R;
|
||||
import org.nuclearfog.twidda.viewadapter.TimelineAdapter;
|
||||
|
||||
public class UserProfile extends AppCompatActivity {
|
||||
public class UserProfile extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemClickListener {
|
||||
|
||||
private SwipeRefreshLayout homeReload, favoriteReload;
|
||||
private ListView homeTweets, homeFavorits;
|
||||
private TextView txtFollowing, txtFollower;
|
||||
private long userId;
|
||||
private long userId, tweetId;
|
||||
private boolean home;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstance){
|
||||
|
@ -35,21 +35,32 @@ public class UserProfile extends AppCompatActivity {
|
|||
setSupportActionBar(tool);
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
userId = getIntent().getExtras().getLong("userID");
|
||||
home = getIntent().getExtras().getBoolean("home");
|
||||
homeTweets = (ListView)findViewById(R.id.ht_list);
|
||||
homeFavorits = (ListView)findViewById(R.id.hf_list);
|
||||
txtFollowing = (TextView)findViewById(R.id.following);
|
||||
txtFollower = (TextView)findViewById(R.id.follower);
|
||||
homeReload = (SwipeRefreshLayout) findViewById(R.id.hometweets);
|
||||
favoriteReload = (SwipeRefreshLayout) findViewById(R.id.homefavorits);
|
||||
|
||||
txtFollowing.setOnClickListener(this);
|
||||
txtFollower.setOnClickListener(this);
|
||||
homeTweets.setOnItemClickListener(this);
|
||||
homeFavorits.setOnItemClickListener(this);
|
||||
|
||||
initElements();
|
||||
initTabs();
|
||||
initSwipe();
|
||||
getContent();
|
||||
setListener();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu m) {
|
||||
getMenuInflater().inflate(R.menu.home, m);
|
||||
m.findItem(R.id.action_profile).setVisible(false);
|
||||
getMenuInflater().inflate(R.menu.profile, m);
|
||||
if(!home) {
|
||||
m.findItem(R.id.profile_follow).setVisible(true);
|
||||
m.findItem(R.id.profile_block).setVisible(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -57,18 +68,70 @@ public class UserProfile extends AppCompatActivity {
|
|||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
Intent intent;
|
||||
switch(item.getItemId()) {
|
||||
case R.id.action_tweet:
|
||||
case R.id.profile_tweet:
|
||||
intent = new Intent(this, TweetPopup.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putLong("TweetID", -1); //todo
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
break;
|
||||
case R.id.action_settings:
|
||||
intent = new Intent(this,AppSettings.class);
|
||||
startActivity(intent);
|
||||
case R.id.profile_follow:
|
||||
//TODO
|
||||
break;
|
||||
case R.id.profile_block:
|
||||
//TODO
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch(v.getId()) {
|
||||
case R.id.following:
|
||||
getFollows(0L);
|
||||
break;
|
||||
case R.id.follower:
|
||||
getFollows(1L);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
switch(parent.getId()) {
|
||||
case R.id.ht_list:
|
||||
if(!homeReload.isRefreshing()) {
|
||||
TimelineAdapter tlAdp = (TimelineAdapter) homeTweets.getAdapter();
|
||||
TweetDatabase twDB = tlAdp.getAdapter();
|
||||
long tweetID = twDB.getTweetId(position);
|
||||
long userID = twDB.getUserID(position);
|
||||
Intent intent = new Intent(getApplicationContext(), TweetDetail.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("tweetID",tweetID);
|
||||
bundle.putLong("userID",userID);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
break;
|
||||
case R.id.hf_list:
|
||||
if(!favoriteReload.isRefreshing()) {
|
||||
TimelineAdapter tlAdp = (TimelineAdapter) homeFavorits.getAdapter();
|
||||
TweetDatabase twDB = tlAdp.getAdapter();
|
||||
long tweetID = twDB.getTweetId(position);
|
||||
long userID = twDB.getUserID(position);
|
||||
Intent intent = new Intent(getApplicationContext(), TweetDetail.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("tweetID",tweetID);
|
||||
bundle.putLong("userID",userID);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Init Tab Listener
|
||||
*/
|
||||
|
@ -98,15 +161,13 @@ public class UserProfile extends AppCompatActivity {
|
|||
/**
|
||||
* Init SwipeRefresh
|
||||
*/
|
||||
private void initSwipe(){
|
||||
homeReload = (SwipeRefreshLayout) findViewById(R.id.hometweets);
|
||||
private void initSwipe() {
|
||||
homeReload.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
getTweets(0L);
|
||||
}
|
||||
});
|
||||
favoriteReload = (SwipeRefreshLayout) findViewById(R.id.homefavorits);
|
||||
favoriteReload.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
|
@ -149,59 +210,6 @@ public class UserProfile extends AppCompatActivity {
|
|||
mProfile.execute(userId, mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set On Item Click Listener
|
||||
*/
|
||||
private void setListener(){
|
||||
homeTweets.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
if(!homeReload.isRefreshing()) {
|
||||
TimelineAdapter tlAdp = (TimelineAdapter) homeTweets.getAdapter();
|
||||
TweetDatabase twDB = tlAdp.getAdapter();
|
||||
long tweetID = twDB.getTweetId(position);
|
||||
long userID = twDB.getUserID(position);
|
||||
Intent intent = new Intent(getApplicationContext(), TweetDetail.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("tweetID",tweetID);
|
||||
bundle.putLong("userID",userID);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
homeFavorits.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
if(!favoriteReload.isRefreshing()) {
|
||||
TimelineAdapter tlAdp = (TimelineAdapter) homeFavorits.getAdapter();
|
||||
TweetDatabase twDB = tlAdp.getAdapter();
|
||||
long tweetID = twDB.getTweetId(position);
|
||||
long userID = twDB.getUserID(position);
|
||||
Intent intent = new Intent(getApplicationContext(), TweetDetail.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("tweetID",tweetID);
|
||||
bundle.putLong("userID",userID);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
txtFollowing.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getFollows(0L);
|
||||
}
|
||||
});
|
||||
txtFollower.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getFollows(1L);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getFollows(long mode){
|
||||
Intent intent = new Intent(getApplicationContext(), Follower.class);
|
||||
Bundle bundle = new Bundle();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:id="@+id/profile_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize" />
|
||||
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/twitterBlau"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/profile_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize" />
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/profile_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
|
@ -26,7 +26,7 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
|
@ -59,72 +59,66 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/location_img"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@string/location"
|
||||
android:visibility="invisible"
|
||||
app:srcCompat="@drawable/location" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bio"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/location"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/link_img"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:contentDescription="@string/link"
|
||||
android:visibility="invisible"
|
||||
app:srcCompat="@drawable/link" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/location_img"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@string/location"
|
||||
android:visibility="invisible"
|
||||
app:srcCompat="@drawable/location" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/location"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_img"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:contentDescription="@string/link"
|
||||
android:visibility="invisible"
|
||||
app:srcCompat="@drawable/link" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/links"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/following"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/follower"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/links"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/following"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/follower"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TabHost
|
||||
android:id="@+id/profile_tab"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -132,7 +126,7 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TabWidget
|
||||
|
@ -165,12 +159,13 @@
|
|||
android:id="@+id/hf_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</TabHost>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -67,7 +67,7 @@
|
|||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/answer_detail"
|
||||
android:id="@+id/answer_button"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:background="@drawable/chat" />
|
||||
|
@ -79,7 +79,7 @@
|
|||
android:ems="10" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/rt_detail"
|
||||
android:id="@+id/rt_button"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:background="@drawable/retweet" />
|
||||
|
@ -91,7 +91,7 @@
|
|||
android:ems="10" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/fav_detail"
|
||||
android:id="@+id/fav_button"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:background="@drawable/favorite" />
|
||||
|
|
Loading…
Reference in New Issue