mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-31 19:34:55 +01:00
Raised SDK to 21
Added Scrollview
This commit is contained in:
parent
23b1cdde0f
commit
ca4f54778b
@ -140,8 +140,6 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
if(!searchQuery.isIconified())
|
||||
searchQuery.onActionViewCollapsed();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@ -307,7 +305,7 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte
|
||||
// Tab #3
|
||||
TabSpec tab3 = tabhost.newTabSpec("mention");
|
||||
tab3.setContent(R.id.mention);
|
||||
tab3.setIndicator("",getResources().getDrawable(R.drawable.mention_icon));
|
||||
tab3.setIndicator("",getResources().getDrawable(R.drawable.mention));
|
||||
tabhost.addTab(tab3);
|
||||
|
||||
tabhost.setOnTabChangedListener(this);
|
||||
|
@ -15,8 +15,12 @@ public class ImageDownloader extends AsyncTask<String, Void, Bitmap>
|
||||
{
|
||||
private final WeakReference<ImageView> imgReference ;
|
||||
|
||||
public ImageDownloader(ImageView imgView) {
|
||||
imgReference = new WeakReference<>(imgView);
|
||||
public ImageDownloader(WeakReference<ImageView> imgReference) {
|
||||
this.imgReference = imgReference;
|
||||
}
|
||||
|
||||
public ImageDownloader(ImageView img) {
|
||||
imgReference = new WeakReference<>(img);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -115,7 +115,7 @@ public class ProfileAction extends AsyncTask<Long,Void,Long>
|
||||
link = user.getURL();
|
||||
follower = "Follower: "+user.getFollowersCount();
|
||||
following = "Following: "+user.getFriendsCount();
|
||||
imageLink = user.getProfileImageURL();
|
||||
imageLink = user.getMiniProfileImageURL();
|
||||
bannerLink = user.getProfileBannerMobileURL();
|
||||
}
|
||||
else if(MODE == GET_TWEETS)
|
||||
|
@ -1,10 +1,13 @@
|
||||
package org.nuclearfog.twidda.backend;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
@ -35,15 +38,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, date;
|
||||
private TextView username,scrName, replyName, 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, dateString;
|
||||
private String ansStr, rtStr, favStr;
|
||||
private String ansStr, rtStr, favStr, repliedUsername;
|
||||
private boolean retweeted, favorited, toggleImg;
|
||||
private SharedPreferences settings;
|
||||
private int load, ansNo;
|
||||
private long userReply, tweetReplyID;
|
||||
private Date d;
|
||||
private Bitmap profile_btm, tweet_btm;
|
||||
|
||||
@ -64,7 +68,7 @@ public class ShowStatus extends AsyncTask<Long, Void, Boolean> {
|
||||
username = (TextView) ((TweetDetail)c).findViewById(R.id.usernamedetail);
|
||||
scrName = (TextView) ((TweetDetail)c).findViewById(R.id.scrnamedetail);
|
||||
date = (TextView) ((TweetDetail)c).findViewById(R.id.timedetail);
|
||||
|
||||
replyName = (TextView) ((TweetDetail)c).findViewById(R.id.answer_reference_detail);
|
||||
txtAns = (TextView) ((TweetDetail)c).findViewById(R.id.no_ans_detail);
|
||||
txtRet = (TextView) ((TweetDetail)c).findViewById(R.id.no_rt_detail);
|
||||
txtFav = (TextView) ((TweetDetail)c).findViewById(R.id.no_fav_detail);
|
||||
@ -78,6 +82,7 @@ public class ShowStatus extends AsyncTask<Long, Void, Boolean> {
|
||||
|
||||
/**
|
||||
* @param id [0] TWEET ID , [1] Mode
|
||||
* @returns false if Tweet is already loaded.
|
||||
*/
|
||||
@Override
|
||||
protected Boolean doInBackground(Long... id) {
|
||||
@ -86,12 +91,18 @@ public class ShowStatus extends AsyncTask<Long, Void, Boolean> {
|
||||
twitter4j.Status currentTweet = twitter.showStatus(tweetID);
|
||||
rtStr = Integer.toString(currentTweet.getRetweetCount());
|
||||
favStr = Integer.toString(currentTweet.getFavoriteCount());
|
||||
userReply = currentTweet.getInReplyToUserId();
|
||||
tweetReplyID = currentTweet.getInReplyToStatusId();
|
||||
|
||||
retweeted = currentTweet.isRetweetedByMe();
|
||||
favorited = currentTweet.isFavorited();
|
||||
if(id.length == 1) {
|
||||
tweetStr = currentTweet.getText();
|
||||
usernameStr = currentTweet.getUser().getName();
|
||||
scrNameStr = '@'+currentTweet.getUser().getScreenName();
|
||||
if(userReply > 0) {
|
||||
repliedUsername = "Antwort an @"+currentTweet.getInReplyToScreenName();
|
||||
}
|
||||
d = currentTweet.getCreatedAt();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss");
|
||||
dateString = sdf.format(d);
|
||||
@ -143,6 +154,11 @@ public class ShowStatus extends AsyncTask<Long, Void, Boolean> {
|
||||
scrName.setText(scrNameStr);
|
||||
txtAns.setText(ansStr);
|
||||
date.setText(dateString);
|
||||
if(repliedUsername != null) {
|
||||
replyName.setText(repliedUsername);
|
||||
replyName.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
TweetDatabase tweetDatabase = new TweetDatabase(answers,c);
|
||||
TimelineAdapter tlAdp = new TimelineAdapter(c, tweetDatabase);
|
||||
replyList.setAdapter(tlAdp);
|
||||
@ -151,10 +167,21 @@ public class ShowStatus extends AsyncTask<Long, Void, Boolean> {
|
||||
profile_img.setImageBitmap(profile_btm);
|
||||
tweet_img.setImageBitmap(tweet_btm);
|
||||
}
|
||||
|
||||
setIcons();
|
||||
txtRet.setText(rtStr);
|
||||
txtFav.setText(favStr);
|
||||
|
||||
replyName.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(c, TweetDetail.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("tweetID",tweetReplyID);
|
||||
bundle.putLong("userID",userReply);
|
||||
intent.putExtras(bundle);
|
||||
c.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setMedia(twitter4j.Status tweet) throws Exception {
|
||||
|
@ -12,7 +12,7 @@ public class AppDatabase extends SQLiteOpenHelper
|
||||
|
||||
private AppDatabase(Context context) {
|
||||
super(context, context.getString(R.string.database),null, 1);
|
||||
context = context;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -200,6 +200,7 @@ public class TweetDatabase {
|
||||
public String getDate(int pos){return timeToString(getTime(pos));}
|
||||
public String getPbImg (int pos){return pbLink.get(pos);}
|
||||
public boolean loadImages(){return toggleImg;}
|
||||
public Bitmap getProfileImg(int pos){return profileImg.get(pos);}
|
||||
|
||||
/**
|
||||
* Convert Time to String
|
||||
|
@ -15,6 +15,8 @@ import org.nuclearfog.twidda.backend.ImageDownloader;
|
||||
import org.nuclearfog.twidda.window.ColorPreferences;
|
||||
import org.nuclearfog.twidda.database.TweetDatabase;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public class TimelineAdapter extends ArrayAdapter implements View.OnClickListener {
|
||||
private TweetDatabase mTweets;
|
||||
private ViewGroup p;
|
||||
@ -60,10 +62,11 @@ public class TimelineAdapter extends ArrayAdapter implements View.OnClickListene
|
||||
((TextView) v.findViewById(R.id.favorite_number)).setText(favoriteStr);
|
||||
((TextView) v.findViewById(R.id.time)).setText(mTweets.getDate(position));
|
||||
((TextView) v.findViewById(R.id.tweettext)).setTextColor(textColor);
|
||||
|
||||
if(mTweets.loadImages()) {
|
||||
ImageView imgView = v.findViewById(R.id.tweetPb);
|
||||
imgView.setImageResource(R.mipmap.pb);
|
||||
if(mTweets.loadImages())
|
||||
new ImageDownloader(imgView).execute(mTweets.getPbImg(position));
|
||||
new ImageDownloader(new WeakReference<>(imgView)).execute(mTweets.getPbImg(position));
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,8 @@ import org.nuclearfog.twidda.window.ColorPreferences;
|
||||
import org.nuclearfog.twidda.database.UserDatabase;
|
||||
import org.nuclearfog.twidda.R;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public class UserAdapter extends ArrayAdapter implements View.OnClickListener {
|
||||
|
||||
private UserDatabase userDatabase;
|
||||
@ -56,7 +58,7 @@ public class UserAdapter extends ArrayAdapter implements View.OnClickListener {
|
||||
|
||||
|
||||
if(userDatabase.loadImages()) {
|
||||
ImageDownloader imgDl = new ImageDownloader(imgView);
|
||||
ImageDownloader imgDl = new ImageDownloader(new WeakReference<>(imgView));
|
||||
imgDl.execute(userDatabase.getProfileURL(position));
|
||||
} else {
|
||||
imgView.setImageResource(R.mipmap.pb);
|
||||
|
@ -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;
|
||||
@ -24,6 +25,7 @@ public class TweetDetail extends AppCompatActivity implements View.OnClickListen
|
||||
private ListView answer_list;
|
||||
private long tweetID;
|
||||
private long userID;
|
||||
private long replyID = -1;
|
||||
private boolean home = false;
|
||||
|
||||
@Override
|
||||
@ -31,10 +33,13 @@ public class TweetDetail extends AppCompatActivity implements View.OnClickListen
|
||||
super.onCreate(b);
|
||||
setContentView(R.layout.tweet_detail);
|
||||
tweetID = getIntent().getExtras().getLong("tweetID");
|
||||
userID = getIntent().getExtras().getLong("userID");//userID
|
||||
userID = getIntent().getExtras().getLong("userID");
|
||||
if(getIntent().hasExtra("home")) {
|
||||
home = getIntent().getExtras().getBoolean("home");
|
||||
}
|
||||
if(getIntent().hasExtra("replyID")) {
|
||||
replyID = getIntent().getExtras().getLong("replyID");
|
||||
}
|
||||
|
||||
answer_list = (ListView) findViewById(R.id.answer_list);
|
||||
Button answer = (Button) findViewById(R.id.answer_button);
|
||||
@ -43,9 +48,9 @@ public class TweetDetail extends AppCompatActivity implements View.OnClickListen
|
||||
ImageView pb = (ImageView) findViewById(R.id.profileimage_detail);
|
||||
|
||||
answer_list.setOnItemClickListener(this);
|
||||
answer.setOnClickListener(this);
|
||||
retweet.setOnClickListener(this);
|
||||
favorite.setOnClickListener(this);
|
||||
retweet.setOnClickListener(this);
|
||||
answer.setOnClickListener(this);
|
||||
pb.setOnClickListener(this);
|
||||
setContent();
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package org.nuclearfog.twidda.window;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.AppBarLayout;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
@ -66,7 +67,7 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
||||
// Tab #2
|
||||
TabHost.TabSpec tab2 = mTab.newTabSpec("favorites");
|
||||
tab2.setContent(R.id.homefavorits);
|
||||
tab2.setIndicator("",getResources().getDrawable(R.drawable.favorite_icon));
|
||||
tab2.setIndicator("",getResources().getDrawable(R.drawable.favorite));
|
||||
mTab.addTab(tab2);
|
||||
|
||||
mTab.setOnTabChangedListener(this);
|
||||
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/favorite" />
|
||||
</selector>
|
@ -1,4 +0,0 @@
|
||||
<vector android:height="24dp" android:viewportHeight="20.0"
|
||||
android:viewportWidth="20.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M10,17.5L3.5,11H7V3h6v8h3.5L10,17.5z"/>
|
||||
</vector>
|
@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
|
||||
</vector>
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/mention" />
|
||||
</selector>
|
@ -6,7 +6,7 @@
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:id="@+id/barlayout_profile"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
@ -141,6 +141,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
|
||||
|
@ -8,56 +8,66 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/user"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/screenname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingStart="5dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="end"
|
||||
android:textAlignment="gravity" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bulk"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tweetPb"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_margin="5dp"
|
||||
android:contentDescription="@string/profile_image" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:textAlignment="gravity" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/screenname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingStart="5dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tweettext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp" />
|
||||
|
||||
</LinearLayout>
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="5dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/actionbar"
|
||||
|
@ -29,7 +29,10 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
@ -42,7 +45,8 @@
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
@ -67,6 +71,14 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/answer_reference_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tweet_detailed"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -33,6 +33,7 @@
|
||||
<string name="woeid">WOEID Standort</string>
|
||||
<string name="get_link">Link</string>
|
||||
<string name="delete_tweet">Löschen</string>
|
||||
<string name="refresh_dummy">Aktualisieren</string>
|
||||
|
||||
<string name="tableUser">
|
||||
CREATE TABLE IF NOT EXISTS user (
|
||||
@ -80,6 +81,6 @@
|
||||
trendname TEXT,
|
||||
trendlink TEXT);
|
||||
</string>
|
||||
<string name="refresh_dummy">Aktualisieren</string>
|
||||
|
||||
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user