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
public void onTabSelected(TabLayout.Tab tab) {
public void onTabSelected(Tab tab) {
tabIndex = tab.getPosition();
invalidateOptionsMenu();
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
public void onTabUnselected(Tab tab) {
adapter.scrollToTop(tab.getPosition());
}
@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
public void onStop() {
if (tweetTask != null && tweetTask.getStatus() == RUNNING)

View File

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

View File

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