Skip to content

Commit ca986ec

Browse files
committed
Auto-format, anotations for member variables on same line.
1 parent 8c2b5cd commit ca986ec

23 files changed

+86
-68
lines changed

app/src/main/java/com/donnfelker/android/bootstrap/BootstrapModule.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@
2525
* Register all of your entry points below.
2626
*/
2727
@Module(
28-
complete = false,
29-
30-
injects = {
31-
BootstrapApplication.class,
32-
BootstrapAuthenticatorActivity.class,
33-
CarouselActivity.class,
34-
BootstrapTimerActivity.class,
35-
CheckInsListFragment.class,
36-
NewsActivity.class,
37-
NewsListFragment.class,
38-
UserActivity.class,
39-
UserListFragment.class,
40-
TimerService.class
41-
}
28+
complete = false,
29+
30+
injects = {
31+
BootstrapApplication.class,
32+
BootstrapAuthenticatorActivity.class,
33+
CarouselActivity.class,
34+
BootstrapTimerActivity.class,
35+
CheckInsListFragment.class,
36+
NewsActivity.class,
37+
NewsListFragment.class,
38+
UserActivity.class,
39+
UserListFragment.class,
40+
TimerService.class
41+
}
4242
)
4343
public class BootstrapModule {
4444

app/src/main/java/com/donnfelker/android/bootstrap/RootModule.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
* Add all the other modules to this one.
77
*/
88
@Module(
9-
includes = {
10-
AndroidModule.class,
11-
BootstrapModule.class
12-
}
9+
includes = {
10+
AndroidModule.class,
11+
BootstrapModule.class
12+
}
1313
)
1414
public class RootModule {
1515
}

app/src/main/java/com/donnfelker/android/bootstrap/authenticator/LogoutService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public Boolean call() throws Exception {
4747
if (aMngrWithContext != null) {
4848
final Account[] accounts = aMngrWithContext
4949
.getAccountsByType(Constants.Auth.BOOTSTRAP_ACCOUNT_TYPE);
50-
if(accounts.length > 0) {
50+
if (accounts.length > 0) {
5151
final AccountManagerFuture<Boolean> removeAccountFuture
5252
= aMngrWithContext.removeAccount(accounts[0], null, null);
5353

app/src/main/java/com/donnfelker/android/bootstrap/authenticator/SherlockAccountAuthenticatorActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
* The activity then sets the result that is to be handed to the response via
3737
* {@link #setAccountAuthenticatorResult(android.os.Bundle)}.
3838
* This result will be sent as the result of the request when the activity finishes. If this
39-
* is never set or if it is set to null then error {@link android.accounts.AccountManager#ERROR_CODE_CANCELED}
39+
* is never set or if it is set to null then error
40+
* {@link android.accounts.AccountManager#ERROR_CODE_CANCELED}
4041
* will be called on the response.
4142
*/
4243
public class SherlockAccountAuthenticatorActivity extends ActionBarActivity {

app/src/main/java/com/donnfelker/android/bootstrap/core/BootstrapService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ public class BootstrapService {
2727

2828
/**
2929
* GSON instance to use for all request with date format set up for proper parsing.
30-
*
30+
* <p/>
3131
* You can also configure GSON with different naming policies for your API.
3232
* Maybe your API is Rails API and all json values are lower case with an underscore,
3333
* like this "first_name" instead of "firstName".
3434
* You can configure GSON as such below.
35+
* <p/>
3536
*
3637
* public static final Gson GSON = new GsonBuilder().setDateFormat("yyyy-MM-dd")
3738
* .setFieldNamingPolicy(LOWER_CASE_WITH_UNDERSCORES).create();
@@ -118,7 +119,7 @@ private HttpRequest configure(final HttpRequest request) {
118119
request.connectTimeout(TIMEOUT).readTimeout(TIMEOUT);
119120
request.userAgent(mUserAgentProvider.get());
120121

121-
if(isPostOrPut(request)) {
122+
if (isPostOrPut(request)) {
122123
// All PUT & POST requests to Parse.com api must be in JSON
123124
// https://www.parse.com/docs/rest#general-requests
124125
request.contentType(Constants.Http.CONTENT_TYPE_JSON);

app/src/main/java/com/donnfelker/android/bootstrap/core/TimerService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void onDestroy() {
6969
@Override
7070
public int onStartCommand(Intent intent, int flags, int startId) {
7171

72-
if(!timerStarted) {
72+
if (!timerStarted) {
7373

7474
timerStarted = true;
7575

app/src/main/java/com/donnfelker/android/bootstrap/core/TimerTickEvent.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public long getSeconds() {
2121
return (millis / 1000);
2222
}
2323

24-
2524
@Override
2625
public String toString() {
2726
return new StringBuilder("")

app/src/main/java/com/donnfelker/android/bootstrap/core/User.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class User implements Serializable {
88

99
private static final long serialVersionUID = -7495897652017488896L;
1010

11+
//TODO rename member variables
1112
protected String firstName;
1213
protected String lastName;
1314
protected String username;

app/src/main/java/com/donnfelker/android/bootstrap/core/UserAgentProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818

1919
public class UserAgentProvider implements Provider<String> {
2020

21+
private static final String APP_NAME = "Android Bootstrap";
22+
2123
@Inject protected ApplicationInfo appInfo;
2224
@Inject protected PackageInfo info;
2325
@Inject protected TelephonyManager telephonyManager;
2426
@Inject protected ClassLoader classLoader;
2527

2628
protected String userAgent;
2729

28-
private static final String APP_NAME = "Android Bootstrap";
29-
3030
@Override
3131
public String get() {
3232
if (userAgent == null) {

app/src/main/java/com/donnfelker/android/bootstrap/ui/AlternatingColorListAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public AlternatingColorListAdapter(final int layoutId, final LayoutInflater infl
4242
* @param selectable
4343
*/
4444
public AlternatingColorListAdapter(final int layoutId,
45-
final LayoutInflater inflater, final List<V> items, final boolean selectable) {
45+
final LayoutInflater inflater, final List<V> items, final boolean selectable) {
4646
super(inflater, layoutId);
4747

4848
if (selectable) {

app/src/main/java/com/donnfelker/android/bootstrap/ui/BootstrapTimerActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void onClick(View v) {
8383
* Starts the timer service
8484
*/
8585
private void startTimer() {
86-
if(!isTimerServiceRunning()) {
86+
if (!isTimerServiceRunning()) {
8787
final Intent i = new Intent(this, TimerService.class);
8888
startService(i);
8989

@@ -116,12 +116,12 @@ private void produceResumeEvent() {
116116

117117
@Subscribe
118118
public void onTimerPausedEvent(final TimerPausedEvent event) {
119-
if(event.isTimerIsPaused()) {
119+
if (event.isTimerIsPaused()) {
120120
mResume.setVisibility(View.VISIBLE);
121121
mStop.setVisibility(View.VISIBLE);
122122
mPause.setVisibility(View.GONE);
123123
mStart.setVisibility(View.GONE);
124-
} else if(isTimerServiceRunning()) {
124+
} else if (isTimerServiceRunning()) {
125125
mPause.setVisibility(View.VISIBLE);
126126
mStop.setVisibility(View.VISIBLE);
127127
mResume.setVisibility(View.GONE);

app/src/main/java/com/donnfelker/android/bootstrap/ui/CarouselActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void onConfigurationChanged(Configuration newConfig) {
102102

103103

104104
private void initScreen() {
105-
if(mIsUserAuthenticated) {
105+
if (mIsUserAuthenticated) {
106106
mPager.setAdapter(new BootstrapPagerAdapter(getResources(),
107107
getSupportFragmentManager()));
108108

app/src/main/java/com/donnfelker/android/bootstrap/ui/CheckInsListAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class CheckInsListAdapter extends AlternatingColorListAdapter<CheckIn> {
1515
* @param selectable
1616
*/
1717
public CheckInsListAdapter(final LayoutInflater inflater, final List<CheckIn> items,
18-
final boolean selectable) {
18+
final boolean selectable) {
1919
super(R.layout.checkin_list_item, inflater, items, selectable);
2020
}
2121

app/src/main/java/com/donnfelker/android/bootstrap/ui/CheckInsListFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public Loader<List<CheckIn>> onCreateLoader(final int id, final Bundle args) {
6464
@Override
6565
public List<CheckIn> loadData() throws Exception {
6666
try {
67-
if(getActivity() != null) {
67+
if (getActivity() != null) {
6868
return mServiceProvider.getService(getActivity()).getCheckIns();
6969
} else {
7070
return Collections.emptyList();

app/src/main/java/com/donnfelker/android/bootstrap/ui/HeaderFooterListAdapter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public HeaderFooterListAdapter(final ListView view, final E adapter) {
3737
}
3838

3939
private HeaderFooterListAdapter(final ArrayList<FixedViewInfo> headerViewInfos,
40-
final ArrayList<FixedViewInfo> footerViewInfos, final ListView view, final E adapter) {
40+
final ArrayList<FixedViewInfo> footerViewInfos, final ListView view, final E adapter) {
4141
super(headerViewInfos, footerViewInfos, adapter);
4242

4343
mHeaders = headerViewInfos;
@@ -66,7 +66,7 @@ public HeaderFooterListAdapter<E> addHeader(final View view) {
6666
* @return this adapter
6767
*/
6868
public HeaderFooterListAdapter<E> addHeader(final View view, final Object data,
69-
final boolean isSelectable) {
69+
final boolean isSelectable) {
7070
final FixedViewInfo info = mList.new FixedViewInfo();
7171
info.view = view;
7272
info.data = data;
@@ -97,7 +97,7 @@ public HeaderFooterListAdapter<E> addFooter(final View view) {
9797
* @return this adapter
9898
*/
9999
public HeaderFooterListAdapter<E> addFooter(final View view, final Object data,
100-
final boolean isSelectable) {
100+
final boolean isSelectable) {
101101
final FixedViewInfo info = mList.new FixedViewInfo();
102102
info.view = view;
103103
info.data = data;

app/src/main/java/com/donnfelker/android/bootstrap/ui/ItemListFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void onActivityCreated(final Bundle savedInstanceState) {
9191

9292
@Override
9393
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
94-
final Bundle savedInstanceState) {
94+
final Bundle savedInstanceState) {
9595
return inflater.inflate(layout.item_list, null);
9696
}
9797

app/src/main/java/com/donnfelker/android/bootstrap/ui/NewsListFragment.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@
2424

2525
public class NewsListFragment extends ItemListFragment<News> {
2626

27-
@Inject
28-
protected BootstrapServiceProvider serviceProvider;
29-
@Inject
30-
protected LogoutService logoutService;
31-
27+
@Inject protected BootstrapServiceProvider serviceProvider;
28+
@Inject protected LogoutService logoutService;
3229

3330
@Override
3431
public void onCreate(Bundle savedInstanceState) {
@@ -41,8 +38,6 @@ public void onActivityCreated(Bundle savedInstanceState) {
4138
super.onActivityCreated(savedInstanceState);
4239

4340
setEmptyText(R.string.no_news);
44-
45-
4641
}
4742

4843
@Override

app/src/main/java/com/donnfelker/android/bootstrap/ui/ThrowableLoader.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
*/
1414
public abstract class ThrowableLoader<D> extends AsyncLoader<D> {
1515

16-
1716
private final D mData;
1817

1918
private Exception mException;

app/src/main/java/com/donnfelker/android/bootstrap/ui/UserListFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public List<User> loadData() throws Exception {
6767
try {
6868
List<User> latest = null;
6969

70-
if(getActivity() != null) {
70+
if (getActivity() != null) {
7171
latest = mServiceProvider.getService(getActivity()).getUsers();
7272
}
7373

app/src/main/java/com/donnfelker/android/bootstrap/ui/view/CapitalizedTextView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
*/
1717
public class CapitalizedTextView extends Button {
1818

19-
private static final boolean IS_GINGERBREAD = Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD;
19+
private static final boolean IS_GINGERBREAD
20+
= Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD;
2021

2122
private static final String TAG = "Typefaces";
2223
private static final Hashtable<String, Typeface> cache = new Hashtable<String, Typeface>();

app/src/main/java/com/donnfelker/android/bootstrap/util/Ln.java

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010

1111
/**
12-
* Originally from RoboGuice: https://github.com/roboguice/roboguice/blob/master/roboguice/src/main/java/roboguice/util/Ln.java
12+
* Originally from RoboGuice:
13+
* https://github.com/roboguice/roboguice/blob/master/roboguice/src/main/java/roboguice/util/Ln.java
1314
* <p/>
1415
* A more natural android logging facility.
1516
* <p/>
@@ -75,7 +76,8 @@ private Ln() {
7576

7677

7778
public static int v(Throwable t) {
78-
return config.minimumLogLevel <= Log.VERBOSE ? print.println(Log.VERBOSE, Log.getStackTraceString(t)) : 0;
79+
return config.minimumLogLevel <= Log.VERBOSE ? print.println(Log.VERBOSE,
80+
Log.getStackTraceString(t)) : 0;
7981
}
8082

8183
public static int v(Object s1, Object... args) {
@@ -92,12 +94,14 @@ public static int v(Throwable throwable, Object s1, Object... args) {
9294
return 0;
9395

9496
final String s = Strings.toString(s1);
95-
final String message = (args.length > 0 ? String.format(s, args) : s) + '\n' + Log.getStackTraceString(throwable);
97+
final String message = (args.length > 0 ? String.format(s, args) : s) + '\n' +
98+
Log.getStackTraceString(throwable);
9699
return print.println(Log.VERBOSE, message);
97100
}
98101

99102
public static int d(Throwable t) {
100-
return config.minimumLogLevel <= Log.DEBUG ? print.println(Log.DEBUG, Log.getStackTraceString(t)) : 0;
103+
return config.minimumLogLevel <= Log.DEBUG ? print.println(Log.DEBUG,
104+
Log.getStackTraceString(t)) : 0;
101105
}
102106

103107
public static int d(Object s1, Object... args) {
@@ -114,12 +118,14 @@ public static int d(Throwable throwable, Object s1, Object... args) {
114118
return 0;
115119

116120
final String s = Strings.toString(s1);
117-
final String message = (args.length > 0 ? String.format(s, args) : s) + '\n' + Log.getStackTraceString(throwable);
121+
final String message = (args.length > 0 ? String.format(s, args) : s) + '\n' +
122+
Log.getStackTraceString(throwable);
118123
return print.println(Log.DEBUG, message);
119124
}
120125

121126
public static int i(Throwable t) {
122-
return config.minimumLogLevel <= Log.INFO ? print.println(Log.INFO, Log.getStackTraceString(t)) : 0;
127+
return config.minimumLogLevel <= Log.INFO ? print.println(Log.INFO,
128+
Log.getStackTraceString(t)) : 0;
123129
}
124130

125131
public static int i(Object s1, Object... args) {
@@ -136,12 +142,14 @@ public static int i(Throwable throwable, Object s1, Object... args) {
136142
return 0;
137143

138144
final String s = Strings.toString(s1);
139-
final String message = (args.length > 0 ? String.format(s, args) : s) + '\n' + Log.getStackTraceString(throwable);
145+
final String message = (args.length > 0 ? String.format(s, args) : s) + '\n' +
146+
Log.getStackTraceString(throwable);
140147
return print.println(Log.INFO, message);
141148
}
142149

143150
public static int w(Throwable t) {
144-
return config.minimumLogLevel <= Log.WARN ? print.println(Log.WARN, Log.getStackTraceString(t)) : 0;
151+
return config.minimumLogLevel <= Log.WARN ? print.println(Log.WARN,
152+
Log.getStackTraceString(t)) : 0;
145153
}
146154

147155
public static int w(Object s1, Object... args) {
@@ -158,12 +166,14 @@ public static int w(Throwable throwable, Object s1, Object... args) {
158166
return 0;
159167

160168
final String s = Strings.toString(s1);
161-
final String message = (args.length > 0 ? String.format(s, args) : s) + '\n' + Log.getStackTraceString(throwable);
169+
final String message = (args.length > 0 ? String.format(s, args) : s) + '\n' +
170+
Log.getStackTraceString(throwable);
162171
return print.println(Log.WARN, message);
163172
}
164173

165174
public static int e(Throwable t) {
166-
return config.minimumLogLevel <= Log.ERROR ? print.println(Log.ERROR, Log.getStackTraceString(t)) : 0;
175+
return config.minimumLogLevel <= Log.ERROR ? print.println(Log.ERROR,
176+
Log.getStackTraceString(t)) : 0;
167177
}
168178

169179
public static int e(Object s1, Object... args) {
@@ -180,7 +190,8 @@ public static int e(Throwable throwable, Object s1, Object... args) {
180190
return 0;
181191

182192
final String s = Strings.toString(s1);
183-
final String message = (args.length > 0 ? String.format(s, args) : s) + '\n' + Log.getStackTraceString(throwable);
193+
final String message = (args.length > 0 ? String.format(s, args) : s) + '\n' +
194+
Log.getStackTraceString(throwable);
184195
return print.println(Log.ERROR, message);
185196
}
186197

@@ -215,11 +226,14 @@ protected BaseConfig() {
215226
public BaseConfig(Application context) {
216227
try {
217228
packageName = context.getPackageName();
218-
final int flags = context.getPackageManager().getApplicationInfo(packageName, 0).flags;
219-
minimumLogLevel = (flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 ? Log.VERBOSE : Log.INFO;
229+
final int flags = context.getPackageManager()
230+
.getApplicationInfo(packageName, 0).flags;
231+
minimumLogLevel = (flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0
232+
? Log.VERBOSE : Log.INFO;
220233
scope = packageName.toUpperCase();
221234

222-
Ln.d("Configuring Logging, minimum log level is %s", logLevelToString(minimumLogLevel));
235+
Ln.d("Configuring Logging, minimum log level is %s",
236+
logLevelToString(minimumLogLevel));
223237

224238
} catch (Exception e) {
225239
try {

0 commit comments

Comments
 (0)