This commit is contained in:
NudeDude 2017-12-29 23:05:28 +01:00
parent 430e0dc798
commit 2535a1bc55
5 changed files with 30 additions and 24 deletions

View File

@ -24,6 +24,7 @@ public class TweetDatabase {
private List<Status> stats;
private int size = 0;
private int mode = 0;
private int length = 50;
private long CurrentId = 0;
private SharedPreferences settings;
@ -153,7 +154,7 @@ public class TweetDatabase {
index = cursor.getColumnIndex("tweetID"); // tweetID
tweetId.add(cursor.getLong(index) );
size++;
} while(cursor.moveToNext());
} while(cursor.moveToNext() && size < length);
}
cursor.close();
db.close();

View File

@ -9,14 +9,9 @@ import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
@ -39,8 +34,6 @@ public class MainActivity extends AppCompatActivity
private SwipeRefreshLayout timelineReload,trendReload,mentionReload;
private ListView timelineList, trendList,mentionList;
private SharedPreferences settings;
private TweetDatabase tweetDeck;
private TrendDatabase trendDeck;
private EditText pin;
private Context con;
private Toolbar toolbar;
@ -188,8 +181,8 @@ public class MainActivity extends AppCompatActivity
* separate THREAD
*/
private void setTabContent() {
tweetDeck = new TweetDatabase(con,TweetDatabase.HOME_TL, 0L);
trendDeck = new TrendDatabase(con);
TweetDatabase tweetDeck = new TweetDatabase(con,TweetDatabase.HOME_TL, 0L);
TrendDatabase trendDeck = new TrendDatabase(con);
TimelineAdapter tlAdapt = new TimelineAdapter(con,tweetDeck);
TrendsAdapter trendAdp = new TrendsAdapter(con,trendDeck);
timelineList.setAdapter(tlAdapt);
@ -223,16 +216,23 @@ public class MainActivity extends AppCompatActivity
});
}
/**
* Item Listener for a Tweet
*/
private void setListViewListener() {
timelineList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if(!timelineReload.isRefreshing()) {
TweetDatabase tweetDeck = new TweetDatabase(con,TweetDatabase.HOME_TL, 0L);
int index = timelineList.getPositionForView(view);
long tweetID = tweetDeck.getTweetId(index);
long userID = tweetDeck.getUserID(index);
Intent intent = new Intent(con, Tweet.class);
Bundle bundle = new Bundle();
bundle.putLong("tweetID",tweetID);
bundle.putLong("userID",userID);
intent.putExtras(bundle);
startActivity(intent);
}
@ -275,5 +275,4 @@ public class MainActivity extends AppCompatActivity
break;
}
}
}

View File

@ -4,7 +4,6 @@ import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;

View File

@ -1,7 +1,9 @@
package org.nuclearfog.twidda.Window;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
@ -12,26 +14,30 @@ public class Tweet extends AppCompatActivity {
private TweetDatabase mTweet;
private TextView tweet, username;
private long tweetID;
private long userID;
@Override
protected void onCreate(Bundle b){
super.onCreate(b);
setContentView(R.layout.tweet_detail);
tweetID = getIntent().getExtras().getLong("tweetID");
userID = getIntent().getExtras().getLong("userID");
tweet = (TextView) findViewById(R.id.tweetdetail);
username = (TextView) findViewById(R.id.usernamedetail);
ImageView pb = (ImageView) findViewById(R.id.profileimage_detail);
tweetID = getIntent().getExtras().getLong("tweetID");
pb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent profile = new Intent(getApplicationContext(), Profile.class);
Bundle bundle = new Bundle();
bundle.putLong("userID",userID);
profile.putExtras(bundle);
startActivity(profile);
}
});
setContent();
}
@ -40,5 +46,6 @@ public class Tweet extends AppCompatActivity {
mTweet = new TweetDatabase(getApplicationContext(),TweetDatabase.GET_TWEET,tweetID);
tweet.setText(mTweet.getTweet(0));
username.setText(mTweet.getUsername(0));
}
}

View File

@ -1,4 +1,4 @@
<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,0.4c-5.303,0 -9.601,4.298 -9.601,9.6c0,5.303 4.298,9.601 9.601,9.601c5.301,0 9.6,-4.298 9.6,-9.601C19.6,4.698 15.301,0.4 10,0.4zM11,17.525V13H9v4.525C5.604,17.079 2.92,14.396 2.473,11H7V9H2.473C2.92,5.604 5.604,2.921 9,2.475V7h2V2.475c3.394,0.447 6.078,3.13 6.525,6.525H13v2h4.525C17.078,14.394 14.394,17.078 11,17.525z"/>
<vector android:height="24dp" android:viewportHeight="1000.0"
android:viewportWidth="1000.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M193.7,990c-5.4,0 -9.9,-1.9 -13.5,-5.7c-3.5,-3.8 -4.8,-8.7 -3.7,-14.7L214.2,745L71.3,745c-5.4,0 -9.9,-1.9 -13.5,-5.7c-3.5,-3.8 -4.8,-8.7 -3.7,-14.7l20.4,-122.5c1.1,-6 3.9,-10.9 8.6,-14.7s9.7,-5.7 15.1,-5.7l142.9,0l27.8,-163.3L126,418.4c-6,0 -10.6,-1.9 -13.9,-5.7c-3.3,-3.8 -4.4,-8.7 -3.3,-14.7l20.4,-122.5c0.5,-3.8 2,-7.2 4.5,-10.2c2.5,-3 5.3,-5.4 8.6,-7.4c3.3,-1.9 6.8,-2.9 10.6,-2.9l142.9,0l37.6,-224.6c1.1,-6 3.9,-10.9 8.6,-14.7c4.6,-3.8 9.7,-5.7 15.1,-5.7l122.5,0c5.4,0 9.9,1.9 13.5,5.7c3.5,3.8 4.8,8.7 3.7,14.7L459.2,255l163.3,0l37.6,-224.6c1.1,-6 3.9,-10.9 8.6,-14.7c4.6,-3.8 9.7,-5.7 15.1,-5.7l122.5,0c5.4,0 9.9,1.9 13.5,5.7c3.5,3.8 4.8,8.7 3.7,14.7L785.8,255l142.9,0c5.4,0 9.9,1.9 13.5,5.7c3.5,3.8 4.8,8.7 3.7,14.7l-20.4,122.5c-0.5,3.8 -2,7.2 -4.5,10.2c-2.4,3 -5.4,5.4 -9,7.4c-3.5,1.9 -6.9,2.9 -10.2,2.9L758.9,418.4l-27.8,163.3L874,581.7c3.8,0 7.2,1 10.2,2.9c3,1.9 5,4.4 6.1,7.3c1.1,3 1.4,6.4 0.8,10.2l-20.4,122.5c-1.1,6 -3.9,10.9 -8.6,14.7c-4.6,3.8 -9.7,5.7 -15.1,5.7L704.2,745L666.6,969.6c-0.5,3.8 -2,7.2 -4.5,10.2c-2.5,3 -5.3,5.4 -8.6,7.4c-3.3,1.9 -6.8,2.9 -10.6,2.9L520.4,990.1c-5.4,0 -9.9,-1.9 -13.5,-5.7c-3.5,-3.8 -4.8,-8.7 -3.7,-14.7L540.8,745L377.5,745L339.9,969.6c-1.1,6 -3.9,10.9 -8.6,14.7c-4.6,3.8 -9.7,5.7 -15.1,5.7L193.7,990zM404.4,581.7l163.3,0l27.8,-163.3L432.2,418.4L404.4,581.7z"/>
</vector>