This commit is contained in:
NudeDude 2018-01-03 16:39:25 +01:00
parent e4532c4735
commit 6fd3df16d4
6 changed files with 19 additions and 14 deletions

View File

@ -35,7 +35,7 @@ public class MainActivity extends AppCompatActivity
{
private SwipeRefreshLayout timelineReload,trendReload,mentionReload;
private ListView timelineList, trendList,mentionList;
private MenuItem profile, tweet, search;
private MenuItem profile, tweet, search, setting;
private SharedPreferences settings;
private EditText pin;
private Context con;
@ -73,6 +73,7 @@ public class MainActivity extends AppCompatActivity
profile = m.findItem(R.id.action_profile);
tweet = m.findItem(R.id.action_tweet);
search = m.findItem(R.id.action_search);
setting = m.findItem(R.id.action_settings);
SearchView searchQuery = (SearchView)m.findItem(R.id.action_search).getActionView();
searchQuery.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@ -297,16 +298,19 @@ public class MainActivity extends AppCompatActivity
profile.setVisible(true);
search.setVisible(false);
tweet.setVisible(true);
setting.setVisible(false);
break;
case "trends":
profile.setVisible(false);
search.setVisible(true);
tweet.setVisible(false);
setting.setVisible(true);
break;
case "mention":
profile.setVisible(false);
search.setVisible(false);
tweet.setVisible(false);
setting.setVisible(true);
break;
}
}

View File

@ -3,6 +3,7 @@ package org.nuclearfog.twidda.backend;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.support.v4.widget.SwipeRefreshLayout;
import android.widget.ListView;
import org.nuclearfog.twidda.database.TweetDatabase;
@ -15,7 +16,9 @@ import twitter4j.QueryResult;
import twitter4j.Twitter;
public class Search extends AsyncTask<String, Void, Boolean> {
private TimelineAdapter tlAdp;
private SwipeRefreshLayout refresh;
private Context context;
private Twitter twitter;
private ListView tl;
@ -30,6 +33,7 @@ public class Search extends AsyncTask<String, Void, Boolean> {
@Override
protected void onPreExecute() {
tl = (ListView) ((TwitterSearch)context).findViewById(R.id.search_result);
refresh = (SwipeRefreshLayout) ((TwitterSearch)context).findViewById(R.id.search_refresh);
twitter = TwitterResource.getInstance(context).getTwitter();
}
@ -56,5 +60,6 @@ public class Search extends AsyncTask<String, Void, Boolean> {
@Override
protected void onPostExecute(Boolean result) {
tl.setAdapter(tlAdp);
refresh.setRefreshing(false);
}
}

View File

@ -47,7 +47,7 @@ public class TwitterSearch extends AppCompatActivity {
Intent intent;
int id = item.getItemId();
switch(id) {
case R.id.action_tweet:
case R.id.search_tweet:
intent = new Intent(this, TweetPopup.class);
startActivity(intent);
break;
@ -73,6 +73,12 @@ public class TwitterSearch extends AppCompatActivity {
}
}
});
search_refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
getContent();
}
});
}
private void getContent() {

View File

@ -13,7 +13,7 @@
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:layout_marginTop="5dip"
android:inputType="text" />
android:inputType="textMultiLine" />
<LinearLayout
android:layout_width="match_parent"

View File

@ -8,14 +8,4 @@
android:title="@string/tweet"
app:showAsAction="always" />
<item
android:id="@+id/search_new"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checkable="false"
android:icon="@drawable/search"
android:title="@string/search"
app:actionViewClass="android.widget.SearchView"
app:showAsAction="always" />
</menu>

View File

@ -5,5 +5,5 @@
<color name="colorAccent">#FF4081</color>
<color name="twitterBlau">#061a22</color>
<color name="soylentgreen">#76b900</color>
<color name="tweetwindow">#00d17f</color>
<color name="tweetwindow">#19aae8</color>
</resources>