parent
dc4cdc9024
commit
9b1e04f03b
|
@ -320,9 +320,12 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte
|
|||
private void setTabContent() {
|
||||
TweetDatabase tweetDeck = new TweetDatabase(con,TweetDatabase.HOME_TL, 0L);
|
||||
TrendDatabase trendDeck = new TrendDatabase(con);
|
||||
TweetDatabase mentDeck = new TweetDatabase(con, TweetDatabase.GET_MENT, 0L);
|
||||
TimelineAdapter tlAdapt = new TimelineAdapter(this,tweetDeck);
|
||||
TrendAdapter trendAdp = new TrendAdapter(this,trendDeck);
|
||||
TimelineAdapter ment = new TimelineAdapter(this, mentDeck);
|
||||
timelineList.setAdapter(tlAdapt);
|
||||
trendList.setAdapter(trendAdp);
|
||||
mentionList.setAdapter(ment);
|
||||
}
|
||||
}
|
|
@ -103,15 +103,15 @@ public class ProfileAction extends AsyncTask<Long,Void,Long>
|
|||
if(MODE == GET_INFORMATION)
|
||||
{
|
||||
User user = twitter.showUser(userId);
|
||||
screenName = '@'+ user.getScreenName();
|
||||
screenName = '@'+user.getScreenName();
|
||||
username = user.getName();
|
||||
description = user.getDescription();
|
||||
location = user.getLocation();
|
||||
link = user.getURL();
|
||||
follower = "Follower: "+ user.getFollowersCount();
|
||||
follower = "Follower: "+user.getFollowersCount();
|
||||
following = "Following: "+user.getFriendsCount();
|
||||
imageLink = user.getProfileImageURL();
|
||||
bannerLink = user.getProfileBannerURL();
|
||||
bannerLink = user.getProfileBannerMobileURL();
|
||||
}
|
||||
else if(MODE == GET_TWEETS)
|
||||
{
|
||||
|
@ -154,9 +154,7 @@ public class ProfileAction extends AsyncTask<Long,Void,Long>
|
|||
|
||||
@Override
|
||||
protected void onPostExecute(Long mode) {
|
||||
if(mode == GET_INFORMATION)
|
||||
{
|
||||
ImageDownloader profileImg, bannerImg;
|
||||
if(mode == GET_INFORMATION) {
|
||||
txtUser.setText(username);
|
||||
txtScrName.setText(screenName);
|
||||
txtBio.setText(description);
|
||||
|
@ -170,11 +168,9 @@ public class ProfileAction extends AsyncTask<Long,Void,Long>
|
|||
txtLink.setText(link);
|
||||
linkIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
profileImg = new ImageDownloader(profile);
|
||||
bannerImg = new ImageDownloader(banner);
|
||||
if(imgEnabled) {
|
||||
profileImg.execute(imageLink);
|
||||
bannerImg.execute(bannerLink);
|
||||
new ImageDownloader(profile).execute(imageLink);
|
||||
//new ImageDownloader(banner).execute(bannerLink); TODO
|
||||
} else {
|
||||
profile.setImageResource(R.mipmap.pb);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,9 @@ import android.widget.TextView;
|
|||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import twitter4j.MediaEntity;
|
||||
|
@ -33,15 +35,16 @@ public class ShowStatus extends AsyncTask<Long, Void, Boolean> {
|
|||
private Context c;
|
||||
private Twitter twitter;
|
||||
private ListView replyList;
|
||||
private TextView username,scrName, tweet, txtAns, txtRet, txtFav;
|
||||
private TextView username,scrName, tweet, txtAns, txtRet, txtFav, date;
|
||||
private Button retweetButton, favoriteButton;
|
||||
private ImageView profile_img, tweet_img;
|
||||
private ArrayList<twitter4j.Status> answers;
|
||||
private String usernameStr, scrNameStr, tweetStr;
|
||||
private String usernameStr, scrNameStr, tweetStr, dateString;
|
||||
private String ansStr, rtStr, favStr;
|
||||
private boolean retweeted, favorited, toggleImg;
|
||||
private SharedPreferences settings;
|
||||
private int load, ansNo;
|
||||
private Date d;
|
||||
private Bitmap profile_btm, tweet_btm;
|
||||
|
||||
public ShowStatus(Context c) {
|
||||
|
@ -60,6 +63,7 @@ public class ShowStatus extends AsyncTask<Long, Void, Boolean> {
|
|||
tweet = (TextView) ((TweetDetail)c).findViewById(R.id.tweet_detailed);
|
||||
username = (TextView) ((TweetDetail)c).findViewById(R.id.usernamedetail);
|
||||
scrName = (TextView) ((TweetDetail)c).findViewById(R.id.scrnamedetail);
|
||||
date = (TextView) ((TweetDetail)c).findViewById(R.id.timedetail);
|
||||
|
||||
txtAns = (TextView) ((TweetDetail)c).findViewById(R.id.no_ans_detail);
|
||||
txtRet = (TextView) ((TweetDetail)c).findViewById(R.id.no_rt_detail);
|
||||
|
@ -88,6 +92,9 @@ public class ShowStatus extends AsyncTask<Long, Void, Boolean> {
|
|||
tweetStr = currentTweet.getText();
|
||||
usernameStr = currentTweet.getUser().getName();
|
||||
scrNameStr = '@'+currentTweet.getUser().getScreenName();
|
||||
d = currentTweet.getCreatedAt();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss");
|
||||
dateString = sdf.format(d);
|
||||
|
||||
Query query = new Query("to:"+scrNameStr+" since_id:"+tweetID+" -filter:retweets");
|
||||
query.setCount(load);
|
||||
|
@ -135,6 +142,7 @@ public class ShowStatus extends AsyncTask<Long, Void, Boolean> {
|
|||
username.setText(usernameStr);
|
||||
scrName.setText(scrNameStr);
|
||||
txtAns.setText(ansStr);
|
||||
date.setText(dateString);
|
||||
TweetDatabase tweetDatabase = new TweetDatabase(answers,c);
|
||||
TimelineAdapter tlAdp = new TimelineAdapter(c, tweetDatabase);
|
||||
replyList.setAdapter(tlAdp);
|
||||
|
|
|
@ -151,6 +151,7 @@ public class TweetDatabase {
|
|||
SQL_GET_HOME = "SELECT * FROM timeline " +
|
||||
"INNER JOIN tweet ON timeline.mTweetID = tweet.tweetID " +
|
||||
"INNER JOIN user ON tweet.userID=user.userID ORDER BY time DESC";
|
||||
limit = 5; //TODO 5 Mentions only!
|
||||
}
|
||||
|
||||
Cursor cursor = db.rawQuery(SQL_GET_HOME,null);
|
||||
|
|
|
@ -41,7 +41,7 @@ public class TrendAdapter extends ArrayAdapter {
|
|||
v = inf.inflate(R.layout.trend, parent,false);
|
||||
v.setBackgroundColor(background);
|
||||
}
|
||||
String trendPos = (1+Integer.toString(position))+'.';
|
||||
String trendPos = Integer.toString( (position+1) ) +'.';
|
||||
String trendName = trend.getTrendname(position);
|
||||
((TextView) v.findViewById(R.id.trendpos)).setText(trendPos);
|
||||
((TextView) v.findViewById(R.id.trendname)).setText(trendName);
|
||||
|
|
|
@ -24,7 +24,7 @@ public class TweetDetail extends AppCompatActivity implements View.OnClickListen
|
|||
private ListView answer_list;
|
||||
private long tweetID;
|
||||
private long userID;
|
||||
private long homeID;
|
||||
private boolean home = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle b) {
|
||||
|
@ -32,6 +32,9 @@ public class TweetDetail extends AppCompatActivity implements View.OnClickListen
|
|||
setContentView(R.layout.tweet_detail);
|
||||
tweetID = getIntent().getExtras().getLong("tweetID");
|
||||
userID = getIntent().getExtras().getLong("userID");//userID
|
||||
if(getIntent().hasExtra("home") ){
|
||||
home = getIntent().getExtras().getBoolean("home");
|
||||
}
|
||||
|
||||
answer_list = (ListView) findViewById(R.id.answer_list);
|
||||
Button answer = (Button) findViewById(R.id.answer_button);
|
||||
|
@ -97,7 +100,6 @@ public class TweetDetail extends AppCompatActivity implements View.OnClickListen
|
|||
ColorPreferences mColor = ColorPreferences.getInstance(getApplicationContext());
|
||||
LinearLayout background = (LinearLayout) findViewById(R.id.tweet_detail);
|
||||
background.setBackgroundColor(mColor.getColor(ColorPreferences.BACKGROUND));
|
||||
ShowStatus set = new ShowStatus(this);
|
||||
set.execute(tweetID);
|
||||
new ShowStatus(this).execute(tweetID);
|
||||
}
|
||||
}
|
|
@ -146,6 +146,7 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("tweetID",tweetID);
|
||||
bundle.putLong("userID",userID);
|
||||
bundle.putBoolean("home", true);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
@ -202,8 +203,7 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||
}
|
||||
|
||||
private void initElements() {
|
||||
ProfileAction profile = new ProfileAction(this, tool);
|
||||
profile.execute(userId, ProfileAction.GET_INFORMATION);
|
||||
new ProfileAction(this, tool).execute(userId, ProfileAction.GET_INFORMATION);
|
||||
}
|
||||
|
||||
private void getFollows(long mode) {
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:fitsSystemWindows="true">
|
||||
android:fitsSystemWindows="false">
|
||||
|
||||
<android.support.design.widget.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:contentScrim="?attr/colorPrimary"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed"
|
||||
app:toolbarId="@+id/toolbar">
|
||||
app:toolbarId="@+id/tweet_toolbar">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/trendpos"
|
||||
android:layout_width="48dp"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="5dp" />
|
||||
|
||||
|
|
|
@ -23,14 +23,15 @@
|
|||
android:id="@+id/screenname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="5dp" />
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingStart="5dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:gravity="right"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="end"
|
||||
android:textAlignment="gravity" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -63,10 +64,10 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:addStatesFromChildren="false"
|
||||
android:gravity="right"
|
||||
android:gravity="end"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
|
@ -79,6 +80,8 @@
|
|||
android:id="@+id/answer_number"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:ems="10" />
|
||||
|
||||
<Button
|
||||
|
@ -91,6 +94,8 @@
|
|||
android:id="@+id/retweet_number"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:ems="10" />
|
||||
|
||||
<Button
|
||||
|
@ -103,6 +108,8 @@
|
|||
android:id="@+id/favorite_number"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:ems="10" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -10,19 +10,19 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:fitsSystemWindows="true">
|
||||
android:fitsSystemWindows="false">
|
||||
|
||||
<android.support.design.widget.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:contentScrim="?attr/colorPrimary"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed|enterAlways"
|
||||
app:toolbarId="@+id/toolbar">
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed"
|
||||
app:toolbarId="@+id/tweet_toolbar">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tweet_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
@ -71,6 +71,7 @@
|
|||
android:id="@+id/tweet_detailed"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:autoLink="web"
|
||||
|
@ -94,6 +95,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:fitsSystemWindows="true"
|
||||
app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<resources>
|
||||
<string name="app_name">Shitter</string>
|
||||
|
||||
<!-- Strings related to login -->
|
||||
<string name="prompt_token">Pin eingeben</string>
|
||||
<string name="action_sign_in">Login</string>
|
||||
<string name="error_field_required">This field is required</string>
|
||||
|
@ -23,7 +21,18 @@
|
|||
<string name="trend">Trends</string>
|
||||
<string name="following">Following</string>
|
||||
<string name="follower">Follower</string>
|
||||
|
||||
<string name="woe_id">WOE ID</string>
|
||||
<string name="banner">Profilbanner</string>
|
||||
<string name="link">Webseite</string>
|
||||
<string name="location">Ort</string>
|
||||
<string name="save">Speichern</string>
|
||||
<string name="tweet_image_enclosure">Image Enclosure</string>
|
||||
<string name="background">Hintergrund</string>
|
||||
<string name="font">Schrift</string>
|
||||
<string name="popup">Popup</string>
|
||||
<string name="woeid">WOEID Standort</string>
|
||||
<string name="get_link">Link</string>
|
||||
<string name="delete_tweet">Löschen</string>
|
||||
|
||||
<string name="tableUser">
|
||||
CREATE TABLE IF NOT EXISTS user (
|
||||
|
@ -71,15 +80,5 @@
|
|||
trendname TEXT,
|
||||
trendlink TEXT);
|
||||
</string>
|
||||
<string name="woe_id">WOE ID</string>
|
||||
<string name="banner">Profilbanner</string>
|
||||
<string name="link">Webseite</string>
|
||||
<string name="location">Ort</string>
|
||||
<string name="save">Speichern</string>
|
||||
<string name="tweet_image_enclosure">Image Enclosure</string>
|
||||
<string name="background">Hintergrund</string>
|
||||
<string name="font">Schrift</string>
|
||||
<string name="popup">Popup</string>
|
||||
<string name="woeid">WOEID Standort</string>
|
||||
|
||||
</resources>
|
Loading…
Reference in New Issue