reformat code

This commit is contained in:
nuclearfog 2019-10-13 12:06:38 +02:00
parent 585f131bd0
commit f35f3112b8
No known key found for this signature in database
GPG Key ID: ED35E22099354A64
6 changed files with 24 additions and 37 deletions

View File

@ -204,19 +204,19 @@ public class MainActivity extends AppCompatActivity implements TabLayout.OnTabSe
@Override @Override
public void onTabSelected(TabLayout.Tab tab) { public void onTabSelected(Tab tab) {
tabIndex = tab.getPosition(); tabIndex = tab.getPosition();
invalidateOptionsMenu(); invalidateOptionsMenu();
} }
@Override @Override
public void onTabUnselected(TabLayout.Tab tab) { public void onTabUnselected(Tab tab) {
adapter.scrollToTop(tab.getPosition()); adapter.scrollToTop(tab.getPosition());
} }
@Override @Override
public void onTabReselected(TabLayout.Tab tab) { public void onTabReselected(Tab tab) {
} }
} }

View File

@ -197,7 +197,6 @@ public class ProfileLoader extends AsyncTask<Long, TwitterUser, UserBundle> {
} }
}); });
} }
ui.get().setTweetCount(user.getTweetCount(), user.getFavorCount());
} }
} }

View File

@ -104,14 +104,6 @@ public class TweetListFragment extends Fragment implements OnRefreshListener, On
} }
@Override
public void onResume() {
super.onResume();
if (tweetTask == null)
load();
}
@Override @Override
public void onStop() { public void onStop() {
if (tweetTask != null && tweetTask.getStatus() == RUNNING) if (tweetTask != null && tweetTask.getStatus() == RUNNING)

View File

@ -5,7 +5,6 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener; import android.content.DialogInterface.OnDismissListener;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@ -53,6 +52,7 @@ public class AppSettings extends AppCompatActivity implements OnClickListener,
private static final int FONTCOLOR = 1; private static final int FONTCOLOR = 1;
private static final int HIGHLIGHT = 2; private static final int HIGHLIGHT = 2;
private static final int POPUPCOLOR = 3; private static final int POPUPCOLOR = 3;
private static final int INVERT = 0xffffff;
private GlobalSettings settings; private GlobalSettings settings;
private ConnectivityManager mConnect; private ConnectivityManager mConnect;
@ -124,10 +124,10 @@ public class AppSettings extends AppCompatActivity implements OnClickListener,
colorButton2.setBackgroundColor(settings.getFontColor()); colorButton2.setBackgroundColor(settings.getFontColor());
colorButton3.setBackgroundColor(settings.getPopupColor()); colorButton3.setBackgroundColor(settings.getPopupColor());
colorButton4.setBackgroundColor(settings.getHighlightColor()); colorButton4.setBackgroundColor(settings.getHighlightColor());
colorButton1.setTextColor(settings.getBackgroundColor() ^ Color.WHITE); colorButton1.setTextColor(settings.getBackgroundColor() ^ INVERT);
colorButton2.setTextColor(settings.getFontColor() ^ Color.WHITE); colorButton2.setTextColor(settings.getFontColor() ^ INVERT);
colorButton3.setTextColor(settings.getPopupColor() ^ Color.WHITE); colorButton3.setTextColor(settings.getPopupColor() ^ INVERT);
colorButton4.setTextColor(settings.getHighlightColor() ^ Color.WHITE); colorButton4.setTextColor(settings.getHighlightColor() ^ INVERT);
proxyAddr.setText(settings.getProxyHost()); proxyAddr.setText(settings.getProxyHost());
proxyPort.setText(settings.getProxyPort()); proxyPort.setText(settings.getProxyPort());
proxyUser.setText(settings.getProxyUser()); proxyUser.setText(settings.getProxyUser());
@ -271,25 +271,25 @@ public class AppSettings extends AppCompatActivity implements OnClickListener,
root.setBackgroundColor(color); root.setBackgroundColor(color);
settings.setBackgroundColor(color); settings.setBackgroundColor(color);
colorButton1.setBackgroundColor(color); colorButton1.setBackgroundColor(color);
colorButton1.setTextColor(color ^ Color.WHITE); colorButton1.setTextColor(color ^ INVERT);
break; break;
case FONTCOLOR: case FONTCOLOR:
settings.setFontColor(color); settings.setFontColor(color);
colorButton2.setBackgroundColor(color); colorButton2.setBackgroundColor(color);
colorButton2.setTextColor(color ^ Color.WHITE); colorButton2.setTextColor(color ^ INVERT);
break; break;
case POPUPCOLOR: case POPUPCOLOR:
settings.setPopupColor(color); settings.setPopupColor(color);
colorButton3.setBackgroundColor(color); colorButton3.setBackgroundColor(color);
colorButton3.setTextColor(color ^ Color.WHITE); colorButton3.setTextColor(color ^ INVERT);
break; break;
case HIGHLIGHT: case HIGHLIGHT:
settings.setHighlightColor(color); settings.setHighlightColor(color);
colorButton4.setBackgroundColor(color); colorButton4.setBackgroundColor(color);
colorButton4.setTextColor(color ^ Color.WHITE); colorButton4.setTextColor(color ^ INVERT);
break; break;
} }
} }

View File

@ -129,20 +129,20 @@ public class SearchPage extends AppCompatActivity implements OnTabSelectedListen
@Override @Override
public void onTabSelected(TabLayout.Tab tab) { public void onTabSelected(Tab tab) {
tabIndex = tab.getPosition(); tabIndex = tab.getPosition();
invalidateOptionsMenu(); invalidateOptionsMenu();
} }
@Override @Override
public void onTabUnselected(TabLayout.Tab tab) { public void onTabUnselected(Tab tab) {
adapter.scrollToTop(tab.getPosition()); adapter.scrollToTop(tab.getPosition());
} }
@Override @Override
public void onTabReselected(TabLayout.Tab tab) { public void onTabReselected(Tab tab) {
} }

View File

@ -65,6 +65,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
private ProfileLoader profileAsync; private ProfileLoader profileAsync;
private FragmentAdapter adapter; private FragmentAdapter adapter;
private TextView tweetTabTxt, favorTabTxt; private TextView tweetTabTxt, favorTabTxt;
private NumberFormat formatter;
private ViewPager pager; private ViewPager pager;
private View follow_back; private View follow_back;
@ -97,13 +98,13 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
pager = findViewById(R.id.profile_pager); pager = findViewById(R.id.profile_pager);
tweetTabTxt = new TextView(getApplicationContext()); tweetTabTxt = new TextView(getApplicationContext());
favorTabTxt = new TextView(getApplicationContext()); favorTabTxt = new TextView(getApplicationContext());
formatter = NumberFormat.getIntegerInstance();
setSupportActionBar(tool); setSupportActionBar(tool);
if (getSupportActionBar() != null) if (getSupportActionBar() != null)
getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayShowTitleEnabled(false);
GlobalSettings settings = GlobalSettings.getInstance(this); GlobalSettings settings = GlobalSettings.getInstance(this);
bioTxt.setMovementMethod(LinkMovementMethod.getInstance()); bioTxt.setMovementMethod(LinkMovementMethod.getInstance());
tab.setSelectedTabIndicatorColor(settings.getHighlightColor()); tab.setSelectedTabIndicatorColor(settings.getHighlightColor());
bioTxt.setLinkTextColor(settings.getHighlightColor()); bioTxt.setLinkTextColor(settings.getHighlightColor());
@ -360,31 +361,26 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
@Override @Override
public void onTabSelected(TabLayout.Tab tab) { public void onTabSelected(Tab tab) {
tabIndex = tab.getPosition(); tabIndex = tab.getPosition();
} }
@Override @Override
public void onTabUnselected(TabLayout.Tab tab) { public void onTabUnselected(Tab tab) {
adapter.scrollToTop(tab.getPosition()); adapter.scrollToTop(tab.getPosition());
} }
@Override @Override
public void onTabReselected(TabLayout.Tab tab) { public void onTabReselected(Tab tab) {
} }
public void setTweetCount(int tweets, int favors) { public void setConnection(UserBundle userBundle) {
NumberFormat formatter = NumberFormat.getIntegerInstance(); this.userBundle = userBundle;
tweetTabTxt.setText(formatter.format(tweets)); tweetTabTxt.setText(formatter.format(userBundle.getUser().getTweetCount()));
favorTabTxt.setText(formatter.format(favors)); favorTabTxt.setText(formatter.format(userBundle.getUser().getFavorCount()));
}
public void setConnection(UserBundle mUser) {
this.userBundle = mUser;
invalidateOptionsMenu(); invalidateOptionsMenu();
} }
} }