Bugfix
This commit is contained in:
parent
fb1793f228
commit
6654c2c335
|
@ -11,7 +11,6 @@
|
|||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:theme="@style/AppTheme"
|
||||
android:screenOrientation="portrait"
|
||||
android:label="@string/app_name">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
|
|
|
@ -170,7 +170,7 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte
|
|||
Bundle bundle = new Bundle();
|
||||
bundle.putString("search", search);
|
||||
if(search.startsWith("#")) {
|
||||
bundle.putString("Hashtag", search);
|
||||
bundle.putString("Addition", search);
|
||||
}
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
|
|
|
@ -50,12 +50,10 @@ public class ProfileAction extends AsyncTask<Long,Void,Long>
|
|||
|
||||
/**
|
||||
* @param context Context to Activity
|
||||
* @param tool Actionbar
|
||||
* @see UserProfile
|
||||
*/
|
||||
public ProfileAction(Context context, Toolbar tool) {
|
||||
public ProfileAction(Context context) {
|
||||
this.context=context;
|
||||
this.tool = tool;
|
||||
SharedPreferences settings = context.getSharedPreferences("settings", 0);
|
||||
imgEnabled = settings.getBoolean("image_load",false);
|
||||
}
|
||||
|
@ -80,6 +78,7 @@ public class ProfileAction extends AsyncTask<Long,Void,Long>
|
|||
favoritsReload = (SwipeRefreshLayout)((UserProfile)context).findViewById(R.id.homefavorits);
|
||||
profileTweets = (ListView)((UserProfile)context).findViewById(R.id.ht_list);
|
||||
profileFavorits = (ListView)((UserProfile)context).findViewById(R.id.hf_list);
|
||||
tool = (Toolbar) ((UserProfile)context).findViewById(R.id.profile_toolbar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -311,9 +311,9 @@ public class ShowStatus extends AsyncTask<Long, Void, Long> {
|
|||
marked = false;
|
||||
break;
|
||||
}
|
||||
if(i == tweet.length()-1 && marked) {
|
||||
sTweet.setSpan(new ForegroundColorSpan(highlight),start,tweet.length()-1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
if(marked) {
|
||||
sTweet.setSpan(new ForegroundColorSpan(highlight),start,tweet.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
return sTweet;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class SearchWindow extends AppCompatActivity implements AdapterView.OnIte
|
|||
Bundle b = new Bundle();
|
||||
b.putLong("TweetID", -1);
|
||||
if(search.startsWith("#")) {
|
||||
b.putString("Hashtag", search);
|
||||
b.putString("Addition", search);
|
||||
}
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
|
|
|
@ -28,17 +28,17 @@ public class TweetPopup extends AppCompatActivity implements View.OnClickListene
|
|||
|
||||
private ImageView tweetImg1,tweetImg2,tweetImg3,tweetImg4;
|
||||
private EditText tweetfield;
|
||||
private long inReplyId;
|
||||
private String imgPath, hashtag="";
|
||||
private long inReplyId =-1L;
|
||||
private String imgPath, addition="";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle SavedInstance) {
|
||||
super.onCreate(SavedInstance);
|
||||
setContentView(R.layout.tweetwindow);
|
||||
|
||||
if(getIntent().hasExtra("TweetID"))
|
||||
inReplyId = getIntent().getExtras().getLong("TweetID");
|
||||
if(getIntent().hasExtra("Hashtag"))
|
||||
hashtag = getIntent().getExtras().getString("Hashtag");
|
||||
if(getIntent().hasExtra("Addition"))
|
||||
addition = getIntent().getExtras().getString("Addition");
|
||||
|
||||
final int size = LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||
getWindow().setLayout(size, size);
|
||||
|
@ -59,7 +59,7 @@ public class TweetPopup extends AppCompatActivity implements View.OnClickListene
|
|||
LinearLayout root = (LinearLayout) findViewById(R.id.tweet_popup);
|
||||
ColorPreferences mColor = ColorPreferences.getInstance(this);
|
||||
root.setBackgroundColor(mColor.getColor(ColorPreferences.TWEET_COLOR));
|
||||
tweetfield.setText(hashtag);
|
||||
tweetfield.setText(addition);
|
||||
}
|
||||
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class TweetPopup extends AppCompatActivity implements View.OnClickListene
|
|||
}
|
||||
|
||||
private void showClosingMsg() {
|
||||
if( !hashtag.equals(tweetfield.getText().toString()) ){
|
||||
if( !addition.equals(tweetfield.getText().toString()) ){
|
||||
AlertDialog.Builder alerta = new AlertDialog.Builder(this);
|
||||
alerta.setMessage("Tweet verwerfen?");
|
||||
alerta.setPositiveButton(R.string.yes_confirm, this);
|
||||
|
|
|
@ -28,9 +28,9 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||
AdapterView.OnItemClickListener, SwipeRefreshLayout.OnRefreshListener,
|
||||
TabHost.OnTabChangeListener, AppBarLayout.OnOffsetChangedListener {
|
||||
|
||||
private ProfileAction mProfile, mTweets, mFavorits;
|
||||
private SwipeRefreshLayout homeReload, favoriteReload;
|
||||
private ListView homeTweets, homeFavorits;
|
||||
private Toolbar tool;
|
||||
private long userId;
|
||||
private boolean home;
|
||||
private String currentTab = "tweets";
|
||||
|
@ -39,7 +39,7 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||
protected void onCreate(Bundle savedInstance) {
|
||||
super.onCreate(savedInstance);
|
||||
setContentView(R.layout.profile);
|
||||
tool = (Toolbar) findViewById(R.id.profile_toolbar);
|
||||
Toolbar tool = (Toolbar) findViewById(R.id.profile_toolbar);
|
||||
setSupportActionBar(tool);
|
||||
if(getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
|
@ -53,18 +53,7 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||
homeReload = (SwipeRefreshLayout) findViewById(R.id.hometweets);
|
||||
favoriteReload = (SwipeRefreshLayout) findViewById(R.id.homefavorits);
|
||||
TabHost mTab = (TabHost)findViewById(R.id.profile_tab);
|
||||
mTab.setup();
|
||||
// Tab #1
|
||||
TabHost.TabSpec tab1 = mTab.newTabSpec("tweets");
|
||||
tab1.setContent(R.id.hometweets);
|
||||
tab1.setIndicator("",getResources().getDrawable(R.drawable.home));
|
||||
mTab.addTab(tab1);
|
||||
// Tab #2
|
||||
TabHost.TabSpec tab2 = mTab.newTabSpec("favorites");
|
||||
tab2.setContent(R.id.homefavorits);
|
||||
tab2.setIndicator("",getResources().getDrawable(R.drawable.favorite));
|
||||
mTab.addTab(tab2);
|
||||
|
||||
setTabs(mTab);
|
||||
mTab.setOnTabChangedListener(this);
|
||||
txtFollowing.setOnClickListener(this);
|
||||
txtFollower.setOnClickListener(this);
|
||||
|
@ -76,6 +65,14 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||
getContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
mProfile.cancel(true);
|
||||
mTweets.cancel(true);
|
||||
mFavorits.cancel(true);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu m) {
|
||||
getMenuInflater().inflate(R.menu.profile, m);
|
||||
|
@ -89,28 +86,17 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
Intent intent;
|
||||
ProfileAction action = new ProfileAction(this, tool);
|
||||
mProfile = new ProfileAction(this);
|
||||
switch(item.getItemId()) {
|
||||
case R.id.profile_tweet:
|
||||
intent = new Intent(this, TweetPopup.class);
|
||||
Bundle b = new Bundle();
|
||||
if(home) {
|
||||
b.putLong("TweetID", -1);
|
||||
} else {
|
||||
b.putLong("TweetID", userId);
|
||||
}
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.profile_follow:
|
||||
if(!home) {
|
||||
action.execute(userId, ProfileAction.ACTION_FOLLOW);
|
||||
}
|
||||
mProfile.execute(userId, ProfileAction.ACTION_FOLLOW);
|
||||
return true;
|
||||
case R.id.profile_block:
|
||||
if(!home) {
|
||||
action.execute(userId, ProfileAction.ACTION_MUTE);
|
||||
}
|
||||
mProfile.execute(userId, ProfileAction.ACTION_MUTE);
|
||||
return true;
|
||||
default: return false;
|
||||
}
|
||||
|
@ -164,13 +150,14 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
ProfileAction tweets = new ProfileAction(this, tool);
|
||||
switch(currentTab) {
|
||||
case "tweets":
|
||||
tweets.execute(userId, ProfileAction.GET_TWEETS,1L);
|
||||
mTweets = new ProfileAction(this);
|
||||
mTweets.execute(userId, ProfileAction.GET_TWEETS,1L);
|
||||
break;
|
||||
case "favorites":
|
||||
tweets.execute(userId, ProfileAction.GET_FAVS,1L);
|
||||
mFavorits = new ProfileAction(this);
|
||||
mFavorits.execute(userId, ProfileAction.GET_FAVS,1L);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -194,21 +181,37 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||
}
|
||||
}
|
||||
|
||||
private void setTabs(TabHost mTab) {
|
||||
mTab.setup();
|
||||
// Tab #1
|
||||
TabHost.TabSpec tab1 = mTab.newTabSpec("tweets");
|
||||
tab1.setContent(R.id.hometweets);
|
||||
tab1.setIndicator("",getResources().getDrawable(R.drawable.home));
|
||||
mTab.addTab(tab1);
|
||||
// Tab #2
|
||||
TabHost.TabSpec tab2 = mTab.newTabSpec("favorites");
|
||||
tab2.setContent(R.id.homefavorits);
|
||||
tab2.setIndicator("",getResources().getDrawable(R.drawable.favorite));
|
||||
mTab.addTab(tab2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tab Content
|
||||
*/
|
||||
private void getContent() {
|
||||
TweetDatabase mTweet = new TweetDatabase(UserProfile.this, TweetDatabase.USER_TL, userId);
|
||||
TweetDatabase fTweet = new TweetDatabase(UserProfile.this, TweetDatabase.FAV_TL, userId);
|
||||
mTweets = new ProfileAction(this);
|
||||
mFavorits = new ProfileAction(this);
|
||||
if( mTweet.getSize() > 0 ) {
|
||||
homeTweets.setAdapter(new TimelineAdapter(UserProfile.this,mTweet));
|
||||
}else {
|
||||
new ProfileAction(this, tool).execute(userId, ProfileAction.GET_TWEETS,1L);
|
||||
mTweets.execute(userId, ProfileAction.GET_TWEETS,1L);
|
||||
}
|
||||
if( fTweet.getSize() > 0 ) {
|
||||
homeFavorits.setAdapter(new TimelineAdapter(UserProfile.this,fTweet));
|
||||
} else {
|
||||
new ProfileAction(this, tool).execute(userId, ProfileAction.GET_FAVS,1L);
|
||||
mFavorits.execute(userId, ProfileAction.GET_FAVS,1L);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,7 +219,8 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||
* Profile Information
|
||||
*/
|
||||
private void initElements() {
|
||||
new ProfileAction(this, tool).execute(userId, ProfileAction.GET_INFORMATION,1L);
|
||||
mProfile = new ProfileAction(this);
|
||||
mProfile.execute(userId, ProfileAction.GET_INFORMATION,1L);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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="M14.69,2.661c-1.894,-1.379 -3.242,-1.349 -3.754,-1.266c-0.144,0.023 -0.265,0.106 -0.35,0.223l-4.62,6.374l-2.263,3.123c-0.277,0.382 -0.437,0.836 -0.462,1.307l-0.296,5.624c-0.021,0.405 0.382,0.698 0.76,0.553l5.256,-2.01c0.443,-0.17 0.828,-0.465 1.106,-0.849l1.844,-2.545l5.036,-6.949c0.089,-0.123 0.125,-0.273 0.1,-0.423C16.963,5.297 16.56,4.021 14.69,2.661zM8.977,15.465l-2.043,0.789c-0.08,0.031 -0.169,0.006 -0.221,-0.062c-0.263,-0.335 -0.576,-0.667 -1.075,-1.03c-0.499,-0.362 -0.911,-0.558 -1.31,-0.706c-0.08,-0.03 -0.131,-0.106 -0.126,-0.192l0.122,-2.186l0.549,-0.755c0,0 1.229,-0.169 2.833,0.998c1.602,1.166 1.821,2.388 1.821,2.388L8.977,15.465z"/>
|
||||
</vector>
|
|
@ -1,10 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<menu xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_tweet"
|
||||
android:icon="@drawable/tweet_icon"
|
||||
android:icon="@drawable/tweet"
|
||||
android:title="@string/tweet"
|
||||
app:showAsAction="always" />
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<item
|
||||
android:id="@+id/search_tweet"
|
||||
android:icon="@drawable/tweet_icon"
|
||||
android:icon="@drawable/tweet"
|
||||
android:title="@string/tweet"
|
||||
app:showAsAction="always" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue