Base 1.1
This commit is contained in:
parent
2535a1bc55
commit
5d819cedea
|
@ -20,26 +20,31 @@
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".Window.Profile"
|
android:name=".Window.Profile"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:screenOrientation="portrait">
|
android:screenOrientation="portrait"/>
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".Window.TweetWindow"
|
android:name=".Window.TweetWindow"
|
||||||
android:theme="@style/Transparency"
|
android:theme="@style/Transparency"
|
||||||
android:screenOrientation="portrait">
|
android:screenOrientation="portrait"/>
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".Window.Settings"
|
android:name=".Window.Settings"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:screenOrientation="portrait">
|
android:screenOrientation="portrait"/>
|
||||||
</activity>
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".Window.Tweet"
|
android:name=".Window.Tweet"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:screenOrientation="portrait"/>
|
android:screenOrientation="portrait"/>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".Window.TwitterSearch"
|
||||||
|
android:theme="@style/AppTheme"
|
||||||
|
android:screenOrientation="portrait"/>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
|
@ -11,7 +11,7 @@ public class AppDatabase extends SQLiteOpenHelper
|
||||||
private Context c;
|
private Context c;
|
||||||
|
|
||||||
private AppDatabase(Context context) {
|
private AppDatabase(Context context) {
|
||||||
super(context, "twitter.sqlite",null, 1);
|
super(context, context.getString(R.string.database),null, 1);
|
||||||
c = context;
|
c = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,15 @@ public class TweetDatabase {
|
||||||
public static final int FAV_TL = 1;
|
public static final int FAV_TL = 1;
|
||||||
public static final int USER_TL = 2;
|
public static final int USER_TL = 2;
|
||||||
public static final int GET_TWEET = 3;
|
public static final int GET_TWEET = 3;
|
||||||
|
public static final int GET_MENT = 4;
|
||||||
|
|
||||||
private AppDatabase dataHelper;
|
private AppDatabase dataHelper;
|
||||||
private List<String> user,tweet,noRT,noFav,noAns,pbLink;
|
private List<String> user,scrname, tweet,noRT,noFav,noAns,pbLink;
|
||||||
private List<Long> userId,tweetId,timeMillis;
|
private List<Long> userId,tweetId,timeMillis;
|
||||||
private List<Status> stats;
|
private List<Status> stats;
|
||||||
private int size = 0;
|
private int size = 0;
|
||||||
private int mode = 0;
|
private int mode = 0;
|
||||||
private int length = 50;
|
private int limit;
|
||||||
private long CurrentId = 0;
|
private long CurrentId = 0;
|
||||||
private SharedPreferences settings;
|
private SharedPreferences settings;
|
||||||
|
|
||||||
|
@ -40,9 +41,7 @@ public class TweetDatabase {
|
||||||
this.stats=stats;
|
this.stats=stats;
|
||||||
this.CurrentId = CurrentId;
|
this.CurrentId = CurrentId;
|
||||||
this.mode=mode;
|
this.mode=mode;
|
||||||
dataHelper = AppDatabase.getInstance(context);
|
initialize(context);
|
||||||
settings = context.getSharedPreferences("settings", 0);
|
|
||||||
initArray();
|
|
||||||
store();
|
store();
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
@ -56,9 +55,7 @@ public class TweetDatabase {
|
||||||
public TweetDatabase(Context context, final int mode, long CurrentId) {
|
public TweetDatabase(Context context, final int mode, long CurrentId) {
|
||||||
this.CurrentId=CurrentId;
|
this.CurrentId=CurrentId;
|
||||||
this.mode=mode;
|
this.mode=mode;
|
||||||
dataHelper = AppDatabase.getInstance(context);
|
initialize(context);
|
||||||
settings = context.getSharedPreferences("settings", 0);
|
|
||||||
initArray();
|
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +65,7 @@ public class TweetDatabase {
|
||||||
ContentValues tweet = new ContentValues();
|
ContentValues tweet = new ContentValues();
|
||||||
ContentValues home = new ContentValues();
|
ContentValues home = new ContentValues();
|
||||||
ContentValues fav = new ContentValues();
|
ContentValues fav = new ContentValues();
|
||||||
|
ContentValues ment = new ContentValues();
|
||||||
|
|
||||||
for(int pos = 0; pos < stats.size(); pos++) {
|
for(int pos = 0; pos < stats.size(); pos++) {
|
||||||
Status stat = stats.get(pos);
|
Status stat = stats.get(pos);
|
||||||
|
@ -75,6 +73,7 @@ public class TweetDatabase {
|
||||||
|
|
||||||
user.put("userID",usr.getId());
|
user.put("userID",usr.getId());
|
||||||
user.put("username", usr.getName());
|
user.put("username", usr.getName());
|
||||||
|
user.put("scrname",'@'+usr.getScreenName());
|
||||||
user.put("pbLink", usr.getProfileImageURL());
|
user.put("pbLink", usr.getProfileImageURL());
|
||||||
user.put("banner", usr.getProfileBannerURL());
|
user.put("banner", usr.getProfileBannerURL());
|
||||||
user.put("bio",usr.getDescription());
|
user.put("bio",usr.getDescription());
|
||||||
|
@ -93,6 +92,8 @@ public class TweetDatabase {
|
||||||
fav.put("tweetID", stat.getId());
|
fav.put("tweetID", stat.getId());
|
||||||
fav.put("ownerID", CurrentId);
|
fav.put("ownerID", CurrentId);
|
||||||
|
|
||||||
|
ment.put("mTweetID",stat.getId());
|
||||||
|
|
||||||
db.insertWithOnConflict("user",null, user,SQLiteDatabase.CONFLICT_IGNORE);
|
db.insertWithOnConflict("user",null, user,SQLiteDatabase.CONFLICT_IGNORE);
|
||||||
db.insertWithOnConflict("tweet",null, tweet,SQLiteDatabase.CONFLICT_IGNORE);
|
db.insertWithOnConflict("tweet",null, tweet,SQLiteDatabase.CONFLICT_IGNORE);
|
||||||
|
|
||||||
|
@ -103,6 +104,9 @@ public class TweetDatabase {
|
||||||
else if(mode == FAV_TL) {
|
else if(mode == FAV_TL) {
|
||||||
db.insertWithOnConflict("favorit",null,fav,SQLiteDatabase.CONFLICT_IGNORE);
|
db.insertWithOnConflict("favorit",null,fav,SQLiteDatabase.CONFLICT_IGNORE);
|
||||||
}
|
}
|
||||||
|
else if(mode == GET_MENT) {
|
||||||
|
db.insertWithOnConflict("timeline",null,ment,SQLiteDatabase.CONFLICT_IGNORE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
db.close();
|
db.close();
|
||||||
|
@ -129,6 +133,10 @@ public class TweetDatabase {
|
||||||
} else if(mode==GET_TWEET) {
|
} else if(mode==GET_TWEET) {
|
||||||
SQL_GET_HOME = "SELECT * FROM user INNER JOIN tweet ON user.userID = tweet.userID " +
|
SQL_GET_HOME = "SELECT * FROM user INNER JOIN tweet ON user.userID = tweet.userID " +
|
||||||
"WHERE tweet.tweetID = "+CurrentId+" ORDER BY tweet.time DESC";
|
"WHERE tweet.tweetID = "+CurrentId+" ORDER BY tweet.time DESC";
|
||||||
|
} else if(mode==GET_MENT){
|
||||||
|
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";
|
||||||
}
|
}
|
||||||
|
|
||||||
Cursor cursor = db.rawQuery(SQL_GET_HOME,null);
|
Cursor cursor = db.rawQuery(SQL_GET_HOME,null);
|
||||||
|
@ -147,6 +155,8 @@ public class TweetDatabase {
|
||||||
noAns.add(cursor.getString(index));
|
noAns.add(cursor.getString(index));
|
||||||
index = cursor.getColumnIndex("username"); // user
|
index = cursor.getColumnIndex("username"); // user
|
||||||
user.add(cursor.getString(index) );
|
user.add(cursor.getString(index) );
|
||||||
|
index = cursor.getColumnIndex("scrname"); // username
|
||||||
|
scrname.add(cursor.getString(index) );
|
||||||
index = cursor.getColumnIndex("pbLink"); // image
|
index = cursor.getColumnIndex("pbLink"); // image
|
||||||
pbLink.add(cursor.getString(index) );
|
pbLink.add(cursor.getString(index) );
|
||||||
index = cursor.getColumnIndex("userID"); // UserID
|
index = cursor.getColumnIndex("userID"); // UserID
|
||||||
|
@ -154,7 +164,7 @@ public class TweetDatabase {
|
||||||
index = cursor.getColumnIndex("tweetID"); // tweetID
|
index = cursor.getColumnIndex("tweetID"); // tweetID
|
||||||
tweetId.add(cursor.getLong(index) );
|
tweetId.add(cursor.getLong(index) );
|
||||||
size++;
|
size++;
|
||||||
} while(cursor.moveToNext() && size < length);
|
} while(cursor.moveToNext() && size < limit);
|
||||||
}
|
}
|
||||||
cursor.close();
|
cursor.close();
|
||||||
db.close();
|
db.close();
|
||||||
|
@ -167,6 +177,7 @@ public class TweetDatabase {
|
||||||
public long getTweetId(int pos){return tweetId.get(pos);}
|
public long getTweetId(int pos){return tweetId.get(pos);}
|
||||||
public long getTime(int pos){return timeMillis.get(pos);}
|
public long getTime(int pos){return timeMillis.get(pos);}
|
||||||
public String getUsername(int pos){return user.get(pos);}
|
public String getUsername(int pos){return user.get(pos);}
|
||||||
|
public String getScreenname(int pos){return scrname.get(pos);}
|
||||||
public String getTweet(int pos){return tweet.get(pos);}
|
public String getTweet(int pos){return tweet.get(pos);}
|
||||||
public String getRetweet(int pos){return noRT.get(pos);}
|
public String getRetweet(int pos){return noRT.get(pos);}
|
||||||
public String getFavorite(int pos){return noFav.get(pos);}
|
public String getFavorite(int pos){return noFav.get(pos);}
|
||||||
|
@ -203,8 +214,16 @@ public class TweetDatabase {
|
||||||
return "vor "+seconds+" s";
|
return "vor "+seconds+" s";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initialize(Context c){
|
||||||
|
dataHelper = AppDatabase.getInstance(c);
|
||||||
|
settings = c.getSharedPreferences("settings", 0);
|
||||||
|
limit = settings.getInt("limit", 50);
|
||||||
|
initArray();
|
||||||
|
}
|
||||||
|
|
||||||
private void initArray() {
|
private void initArray() {
|
||||||
user = new ArrayList<>();
|
user = new ArrayList<>();
|
||||||
|
scrname = new ArrayList<>();
|
||||||
tweet = new ArrayList<>();
|
tweet = new ArrayList<>();
|
||||||
noRT = new ArrayList<>();
|
noRT = new ArrayList<>();
|
||||||
noFav = new ArrayList<>();
|
noFav = new ArrayList<>();
|
||||||
|
|
|
@ -57,11 +57,11 @@ public class ProfileTweets extends AsyncTask<Long, Void, Void> {
|
||||||
protected void onPostExecute(Void v) {
|
protected void onPostExecute(Void v) {
|
||||||
if(homeTl != null){
|
if(homeTl != null){
|
||||||
profileTweets.setAdapter(homeTl);
|
profileTweets.setAdapter(homeTl);
|
||||||
|
tweetsReload.setRefreshing(false);
|
||||||
}
|
}
|
||||||
else if(homeFav != null){
|
else if(homeFav != null){
|
||||||
profileFavorits.setAdapter(homeFav);
|
profileFavorits.setAdapter(homeFav);
|
||||||
|
favoritsReload.setRefreshing(false);
|
||||||
}
|
}
|
||||||
tweetsReload.setRefreshing(false);
|
|
||||||
favoritsReload.setRefreshing(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,12 @@ public class RegisterAccount extends AsyncTask<String, Void, String>
|
||||||
private Button verifierButton, loginButton;
|
private Button verifierButton, loginButton;
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register App for Account access
|
||||||
|
* @see MainActivity
|
||||||
|
* @see TwitterStore used to Store Twitter instance
|
||||||
|
* @param context current Activity's Context.
|
||||||
|
*/
|
||||||
public RegisterAccount( Context context ){
|
public RegisterAccount( Context context ){
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
@ -46,10 +52,10 @@ public class RegisterAccount extends AsyncTask<String, Void, String>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(String msg) {
|
protected void onPostExecute(String msg) {
|
||||||
if( msg=="success" ) {
|
if( msg.equals("success") ) {
|
||||||
verifierButton.setVisibility(Button.INVISIBLE);
|
verifierButton.setVisibility(Button.INVISIBLE);
|
||||||
loginButton.setVisibility(Button.VISIBLE);
|
loginButton.setVisibility(Button.VISIBLE);
|
||||||
loginButton.setBackgroundColor(0xFFFF0000);//todo
|
loginButton.setBackgroundColor(0xFFFF0000);
|
||||||
} else if( !msg.trim().isEmpty() ) {
|
} else if( !msg.trim().isEmpty() ) {
|
||||||
Toast.makeText(context,"Fehler: "+msg,Toast.LENGTH_LONG).show();
|
Toast.makeText(context,"Fehler: "+msg,Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,18 +16,21 @@ import android.os.AsyncTask;
|
||||||
import twitter4j.Twitter;
|
import twitter4j.Twitter;
|
||||||
import twitter4j.TwitterException;
|
import twitter4j.TwitterException;
|
||||||
|
|
||||||
public class TwitterEngine extends AsyncTask<Integer, Void, Void>
|
public class TwitterEngine extends AsyncTask<Integer, Void, Boolean>
|
||||||
{
|
{
|
||||||
private final String ERR_MSG = "Fehler bei der Verbindung";
|
|
||||||
private TwitterStore twitterStore;
|
private TwitterStore twitterStore;
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
private SwipeRefreshLayout timelineRefresh, trendRefresh, mentionRefresh;
|
private SwipeRefreshLayout timelineRefresh, trendRefresh, mentionRefresh;
|
||||||
private ListView timelineList, trendList, mentionList;
|
private ListView timelineList, trendList, mentionList;
|
||||||
private TimelineAdapter timelineAdapter;
|
private TimelineAdapter timelineAdapter, mentionAdapter;
|
||||||
private TrendsAdapter trendsAdapter;
|
private TrendsAdapter trendsAdapter;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main View
|
||||||
|
* @see MainActivity
|
||||||
|
*/
|
||||||
public TwitterEngine(Context context) {
|
public TwitterEngine(Context context) {
|
||||||
this.context=context;
|
this.context=context;
|
||||||
twitterStore = TwitterStore.getInstance(context);
|
twitterStore = TwitterStore.getInstance(context);
|
||||||
|
@ -49,10 +52,10 @@ public class TwitterEngine extends AsyncTask<Integer, Void, Void>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param args [0] Executing Mode: (0)HomeTL, (1)Trend, (2)Mention
|
* @param args [0] Executing Mode: (0)HomeTL, (1)Trend, (2)Mention
|
||||||
*
|
* @return success
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Integer... args) {
|
protected Boolean doInBackground(Integer... args) {
|
||||||
Twitter twitter = twitterStore.getTwitter();
|
Twitter twitter = twitterStore.getTwitter();
|
||||||
try {
|
try {
|
||||||
if(args[0]==0) {
|
if(args[0]==0) {
|
||||||
|
@ -63,24 +66,31 @@ public class TwitterEngine extends AsyncTask<Integer, Void, Void>
|
||||||
TrendDatabase trend = new TrendDatabase(twitter.getPlaceTrends(23424829),context); //Germany by default
|
TrendDatabase trend = new TrendDatabase(twitter.getPlaceTrends(23424829),context); //Germany by default
|
||||||
trendsAdapter = new TrendsAdapter(context,trend);
|
trendsAdapter = new TrendsAdapter(context,trend);
|
||||||
}
|
}
|
||||||
else if(args[0]==2) { //TODO
|
else if(args[0]==2) {
|
||||||
// twitter.getMentionsTimeline()
|
TweetDatabase mention = new TweetDatabase(twitter.getMentionsTimeline(), context,TweetDatabase.GET_MENT,0);
|
||||||
|
mentionAdapter = new TimelineAdapter(context,mention);
|
||||||
}
|
}
|
||||||
} catch (TwitterException e) {
|
} catch (TwitterException e) {
|
||||||
Toast.makeText(context, ERR_MSG, Toast.LENGTH_LONG).show();
|
return false;
|
||||||
} catch (Exception e){ e.printStackTrace(); }
|
} catch (Exception e){
|
||||||
return null;
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Refresh List in a new Thread
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void v) {
|
protected void onPostExecute(Boolean success) {
|
||||||
if(timelineAdapter != null)
|
if(success) {
|
||||||
timelineList.setAdapter(timelineAdapter);
|
if(timelineAdapter != null)
|
||||||
else if(trendsAdapter != null)
|
timelineList.setAdapter(timelineAdapter);
|
||||||
trendList.setAdapter(trendsAdapter);
|
else if(trendsAdapter != null)
|
||||||
|
trendList.setAdapter(trendsAdapter);
|
||||||
|
else if(mentionAdapter != null)
|
||||||
|
mentionList.setAdapter(mentionAdapter);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(context, context.getString(R.string.connection_failure), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
if(timelineRefresh.isRefreshing())
|
if(timelineRefresh.isRefreshing())
|
||||||
timelineRefresh.setRefreshing(false);
|
timelineRefresh.setRefreshing(false);
|
||||||
else if(mentionRefresh.isRefreshing())
|
else if(mentionRefresh.isRefreshing())
|
||||||
|
|
|
@ -241,13 +241,25 @@ public class MainActivity extends AppCompatActivity
|
||||||
trendList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
trendList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
System.out.println("1 klick: "+position); //TODO
|
TrendDatabase trend = new TrendDatabase(con);
|
||||||
|
trend.getTrendname(position);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mentionList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
mentionList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
System.out.println("2 klick"+position); //TODO
|
if(!mentionReload.isRefreshing()) {
|
||||||
|
TweetDatabase tweetDeck = new TweetDatabase(con,TweetDatabase.GET_MENT, 0L);
|
||||||
|
int index = mentionList.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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class TimelineAdapter extends ArrayAdapter {
|
||||||
v = inf.inflate(R.layout.tweet, parent,false);
|
v = inf.inflate(R.layout.tweet, parent,false);
|
||||||
}
|
}
|
||||||
((TextView) v.findViewById(R.id.username)).setText(mTweets.getUsername(position));
|
((TextView) v.findViewById(R.id.username)).setText(mTweets.getUsername(position));
|
||||||
|
((TextView) v.findViewById(R.id.screenname)).setText(mTweets.getScreenname(position));
|
||||||
((TextView) v.findViewById(R.id.tweettext)).setText(mTweets.getTweet(position));
|
((TextView) v.findViewById(R.id.tweettext)).setText(mTweets.getTweet(position));
|
||||||
((TextView) v.findViewById(R.id.answer_number)).setText(mTweets.getAnswer(position));
|
((TextView) v.findViewById(R.id.answer_number)).setText(mTweets.getAnswer(position));
|
||||||
((TextView) v.findViewById(R.id.retweet_number)).setText(mTweets.getRetweet(position));
|
((TextView) v.findViewById(R.id.retweet_number)).setText(mTweets.getRetweet(position));
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.nuclearfog.twidda.ViewAdapter.TimelineAdapter;
|
||||||
|
|
||||||
public class Profile extends AppCompatActivity {
|
public class Profile extends AppCompatActivity {
|
||||||
|
|
||||||
|
private SwipeRefreshLayout homeReload, favoriteReload;
|
||||||
private ListView homeTweets, homeFavorits;
|
private ListView homeTweets, homeFavorits;
|
||||||
private long userId;
|
private long userId;
|
||||||
|
|
||||||
|
@ -64,7 +65,6 @@ public class Profile extends AppCompatActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init Tab Listener
|
* Init Tab Listener
|
||||||
*/
|
*/
|
||||||
|
@ -84,7 +84,10 @@ public class Profile extends AppCompatActivity {
|
||||||
// Listener
|
// Listener
|
||||||
mTab.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
|
mTab.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onTabChanged(String tabId) { }
|
public void onTabChanged(String tabId) {
|
||||||
|
homeReload.setRefreshing(false);
|
||||||
|
favoriteReload.setRefreshing(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,15 +95,15 @@ public class Profile extends AppCompatActivity {
|
||||||
* Init SwipeRefresh
|
* Init SwipeRefresh
|
||||||
*/
|
*/
|
||||||
private void initSwipe(){
|
private void initSwipe(){
|
||||||
SwipeRefreshLayout homeReload = (SwipeRefreshLayout) findViewById(R.id.hometweets);
|
homeReload = (SwipeRefreshLayout) findViewById(R.id.hometweets);
|
||||||
homeReload.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
homeReload.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
getTweets(0L);
|
getTweets(0L);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
SwipeRefreshLayout favoritReload = (SwipeRefreshLayout) findViewById(R.id.homefavorits);
|
favoriteReload = (SwipeRefreshLayout) findViewById(R.id.homefavorits);
|
||||||
favoritReload.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
favoriteReload.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
getTweets(1L);
|
getTweets(1L);
|
||||||
|
|
|
@ -6,6 +6,8 @@ import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
|
@ -35,8 +37,13 @@ public class Settings extends AppCompatActivity {
|
||||||
e.apply();
|
e.apply();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Button delButon = (Button) findViewById(R.id.delete_db);
|
||||||
|
delButon.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
getApplicationContext().deleteDatabase(getApplicationContext().getString(R.string.database));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,24 +28,24 @@ public class Tweet extends AppCompatActivity {
|
||||||
|
|
||||||
ImageView pb = (ImageView) findViewById(R.id.profileimage_detail);
|
ImageView pb = (ImageView) findViewById(R.id.profileimage_detail);
|
||||||
pb.setOnClickListener(new View.OnClickListener() {
|
pb.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent profile = new Intent(getApplicationContext(), Profile.class);
|
Intent profile = new Intent(getApplicationContext(), Profile.class);
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putLong("userID",userID);
|
bundle.putLong("userID",userID);
|
||||||
profile.putExtras(bundle);
|
profile.putExtras(bundle);
|
||||||
startActivity(profile);
|
startActivity(profile);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setContent();
|
setContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void setContent() {
|
private void setContent() {
|
||||||
mTweet = new TweetDatabase(getApplicationContext(),TweetDatabase.GET_TWEET,tweetID);
|
mTweet = new TweetDatabase(getApplicationContext(),TweetDatabase.GET_TWEET,tweetID);
|
||||||
|
String scrName = mTweet.getUsername(0)+" "+mTweet.getScreenname(0);
|
||||||
tweet.setText(mTweet.getTweet(0));
|
tweet.setText(mTweet.getTweet(0));
|
||||||
username.setText(mTweet.getUsername(0));
|
username.setText(scrName);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.nuclearfog.twidda.Window;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
|
||||||
|
|
||||||
|
public class TwitterSearch extends AppCompatActivity {
|
||||||
|
|
||||||
|
private String keyWord;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle bundle){
|
||||||
|
super.onCreate(bundle);
|
||||||
|
keyWord = getIntent().getExtras().getString("search");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical" android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -15,11 +15,21 @@
|
||||||
android:id="@+id/toggleImg"
|
android:id="@+id/toggleImg"
|
||||||
android:layout_width="180dp"
|
android:layout_width="180dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="20dp"
|
||||||
android:text="@string/image" />
|
android:text="@string/image" />
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/location_list"
|
android:id="@+id/location_list"
|
||||||
android:layout_width="180dp"
|
android:layout_width="180dp"
|
||||||
android:layout_height="wrap_content"></Spinner>
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="20dp"></Spinner>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/delete_db"
|
||||||
|
android:layout_width="180dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:background="@android:color/holo_red_dark"
|
||||||
|
android:text="@string/delete_database" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -19,6 +19,11 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/screenname"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/time"
|
android:id="@+id/time"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -42,12 +43,25 @@
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:layout_marginTop="5dp" />
|
android:layout_marginTop="5dp"
|
||||||
|
android:autoLink="web"
|
||||||
|
android:linksClickable="true"
|
||||||
|
android:textSize="24sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/tweet_img"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:contentDescription="@string/tweet_image"
|
||||||
|
android:visibility="invisible"
|
||||||
|
app:srcCompat="@android:color/darker_gray" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/actionbar"
|
android:id="@+id/actionbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="20dp"
|
android:layout_height="20dp"
|
||||||
|
android:layout_margin="5dp"
|
||||||
android:addStatesFromChildren="false"
|
android:addStatesFromChildren="false"
|
||||||
android:gravity="right"
|
android:gravity="right"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
|
@ -14,14 +14,16 @@
|
||||||
<string name="tweet">Tweet</string>
|
<string name="tweet">Tweet</string>
|
||||||
<string name="settings">Einstellungen</string>
|
<string name="settings">Einstellungen</string>
|
||||||
<string name="back">Back</string>
|
<string name="back">Back</string>
|
||||||
<string name="datei">timeline.db</string>
|
<string name="database">database.db</string>
|
||||||
<string name="image">Bilder Laden</string>
|
<string name="image">Bilder Laden</string>
|
||||||
|
<string name="delete_database">Datenbank Löschen</string>
|
||||||
|
<string name="connection_failure">Fehler beim Abruf der Daten!</string>
|
||||||
|
|
||||||
<string name="tableUser">
|
<string name="tableUser">
|
||||||
CREATE TABLE IF NOT EXISTS user (
|
CREATE TABLE IF NOT EXISTS user (
|
||||||
userID INTEGER PRIMARY KEY,
|
userID INTEGER PRIMARY KEY,
|
||||||
username TEXT,
|
username TEXT,
|
||||||
|
scrname TEXT,
|
||||||
pbLink TEXT,
|
pbLink TEXT,
|
||||||
banner TEXT,
|
banner TEXT,
|
||||||
bio TEXT,
|
bio TEXT,
|
||||||
|
@ -52,7 +54,9 @@
|
||||||
<string name="tableHome">
|
<string name="tableHome">
|
||||||
CREATE TABLE IF NOT EXISTS timeline (
|
CREATE TABLE IF NOT EXISTS timeline (
|
||||||
tweetID INTEGER UNIQUE,
|
tweetID INTEGER UNIQUE,
|
||||||
FOREIGN KEY (tweetID) REFERENCES tweet(tweetID));
|
mTweetID INTEGER UNIQUE,
|
||||||
|
FOREIGN KEY (tweetID) REFERENCES tweet(tweetID));
|
||||||
|
FOREIGN KEY (mTweetID) REFERENCES tweet(tweetID));
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<string name="tableTrend">
|
<string name="tableTrend">
|
||||||
|
@ -61,4 +65,10 @@
|
||||||
trendname TEXT,
|
trendname TEXT,
|
||||||
trendlink TEXT);
|
trendlink TEXT);
|
||||||
</string>
|
</string>
|
||||||
|
<string name="tweet_image">TwitterBild</string>
|
||||||
|
|
||||||
|
<string-array name="countries">
|
||||||
|
<item>Deutschland</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue