Fix some formatting across the java code

A good reference is:
https://google-styleguide.googlecode.com/svn/trunk/javaguide.html

Unfortunately, since there is no checkstyle file for it, we can't check for it
programmatically.
This commit is contained in:
Daniel Martí 2014-10-16 17:15:47 +02:00
parent 93c9abb887
commit 2fd8982485
20 changed files with 31 additions and 31 deletions

View File

@ -165,7 +165,7 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
public ApkListAdapter(Context context, App app) {
super(context, 0);
List<Apk> apks = ApkProvider.Helper.findByApp(context, app.id);
for (Apk apk : apks ) {
for (Apk apk : apks) {
if (apk.compatible || Preferences.get().showIncompatibleVersions()) {
add(apk);
}
@ -1169,7 +1169,7 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
TextView permissionHeader = (TextView) view.findViewById(R.id.permissions);
boolean curApkCompatible = curApk != null && curApk.compatible;
if (prefs.showPermissions() && !getApks().isEmpty() &&
( curApkCompatible || prefs.showIncompatibleVersions() ) ) {
(curApkCompatible || prefs.showIncompatibleVersions())) {
CommaSeparatedList permsList = getApks().getItem(0).permissions;
if (permsList == null) {

View File

@ -278,7 +278,7 @@ public class FDroid extends ActionBarActivity {
viewPager = (ViewPager)findViewById(R.id.main_pager);
AppListFragmentPagerAdapter viewPagerAdapter = new AppListFragmentPagerAdapter(this);
viewPager.setAdapter(viewPagerAdapter);
viewPager.setOnPageChangeListener( new ViewPager.SimpleOnPageChangeListener() {
viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
getTabManager().selectTab(position);

View File

@ -33,7 +33,7 @@ abstract class PackageReceiver extends BroadcastReceiver {
abstract protected void handle(Context context, String appId);
protected PackageInfo getPackageInfo(Context context, String appId) {
for( PackageInfo info : context.getPackageManager().getInstalledPackages(0)) {
for (PackageInfo info : context.getPackageManager().getInstalledPackages(0)) {
if (info.packageName.equals(appId)) {
return info;
}

View File

@ -215,27 +215,27 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
uninitialize(key);
if (key.equals(PREF_COMPACT_LAYOUT)) {
for ( ChangeListener listener : compactLayoutListeners ) {
for (ChangeListener listener : compactLayoutListeners) {
listener.onPreferenceChange();
}
} else if (key.equals(PREF_ROOTED)) {
for ( ChangeListener listener : filterAppsRequiringRootListeners ) {
for (ChangeListener listener : filterAppsRequiringRootListeners) {
listener.onPreferenceChange();
}
} else if (key.equals(PREF_UPD_HISTORY)) {
for ( ChangeListener listener : updateHistoryListeners ) {
for (ChangeListener listener : updateHistoryListeners) {
listener.onPreferenceChange();
}
} else if (key.equals(PREF_LOCAL_REPO_BONJOUR)) {
for ( ChangeListener listener : localRepoBonjourListeners ) {
for (ChangeListener listener : localRepoBonjourListeners) {
listener.onPreferenceChange();
}
} else if (key.equals(PREF_LOCAL_REPO_NAME)) {
for ( ChangeListener listener : localRepoNameListeners ) {
for (ChangeListener listener : localRepoNameListeners) {
listener.onPreferenceChange();
}
} else if (key.equals(PREF_LOCAL_REPO_HTTPS)) {
for ( ChangeListener listener : localRepoHttpsListeners ) {
for (ChangeListener listener : localRepoHttpsListeners) {
listener.onPreferenceChange();
}
}

View File

@ -43,7 +43,7 @@ public class PreferencesActivity extends ActionBarActivity {
// a (bug?) thing in 3.0, 3.1 which requires setContentView to be invoked before
// the actionbar is played with:
// http://blog.perpetumdesign.com/2011/08/strange-case-of-dr-action-and-mr-bar.html
setContentView( new LinearLayout(this) );
setContentView(new LinearLayout(this));
PreferenceFragment preferenceFragment = new PreferenceFragment();
fm.beginTransaction()

View File

@ -50,7 +50,7 @@ public class SearchResults extends ActionBarActivity {
// a (bug?) thing in 3.0, 3.1 which requires setContentView to be invoked before
// the actionbar is played with:
// http://blog.perpetumdesign.com/2011/08/strange-case-of-dr-action-and-mr-bar.html
setContentView( new LinearLayout(this) );
setContentView(new LinearLayout(this));
SearchResultsFragment fragment = new SearchResultsFragment();
fm.beginTransaction().add(android.R.id.content, fragment).commit();

View File

@ -369,7 +369,7 @@ public final class Utils {
return null;
else {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < list.size(); i ++) {
for (int i = 0; i < list.size(); i++) {
if (i > 0) {
sb.append(',');
}

View File

@ -18,7 +18,7 @@ public abstract class ContextCompat extends Compatibility {
protected final Context context;
public ContextCompat(Context context ) {
public ContextCompat(Context context) {
this.context = context;
}

View File

@ -62,7 +62,7 @@ public class Apk extends ValueObject implements Comparable<Apk> {
checkCursorPosition(cursor);
for(int i = 0; i < cursor.getColumnCount(); i ++ ) {
for (int i = 0; i < cursor.getColumnCount(); i++) {
String column = cursor.getColumnName(i);
if (column.equals(ApkProvider.DataColumns.HASH)) {
hash = cursor.getString(i);

View File

@ -110,7 +110,7 @@ public class App extends ValueObject implements Comparable<App> {
checkCursorPosition(cursor);
for(int i = 0; i < cursor.getColumnCount(); i ++ ) {
for (int i = 0; i < cursor.getColumnCount(); i++) {
String column = cursor.getColumnName(i);
if (column.equals(AppProvider.DataColumns.IS_COMPATIBLE)) {
compatible = cursor.getInt(i) == 1;

View File

@ -122,7 +122,7 @@ public class DBHelper extends SQLiteOpenHelper {
ContentValues values = new ContentValues(1);
String name = Repo.addressToName(address);
values.put("name", name);
String[] args = { Long.toString( id ) };
String[] args = { Long.toString(id) };
Log.i("FDroid", "Setting repo name to '" + name + "' for repo " + address);
db.update(TABLE_REPO, values, "_id = ?", args);
cursor.moveToNext();
@ -442,7 +442,7 @@ public class DBHelper extends SQLiteOpenHelper {
private static boolean columnExists(SQLiteDatabase db,
String table, String column) {
return (db.rawQuery( "select * from " + table + " limit 0,1", null )
return (db.rawQuery("select * from " + table + " limit 0,1", null)
.getColumnIndex(column) != -1);
}

View File

@ -119,7 +119,7 @@ public class InstalledAppCacheUpdater {
}
if (cachedInfo.size() > 0) {
for (Map.Entry<String, Integer> entry : cachedInfo.entrySet() ) {
for (Map.Entry<String, Integer> entry : cachedInfo.entrySet()) {
toDelete.add(entry.getKey());
}
}

View File

@ -124,11 +124,11 @@ public class InstalledAppProvider extends FDroidProvider {
}
private QuerySelection queryApp(String appId) {
return new QuerySelection("appId = ?", new String[] { appId } );
return new QuerySelection("appId = ?", new String[]{ appId });
}
private QuerySelection querySearch(String keywords) {
return new QuerySelection("applicationLabel LIKE ?", new String[] { "%" + keywords + "%" } );
return new QuerySelection("applicationLabel LIKE ?", new String[]{ "%" + keywords + "%" });
}
@Override

View File

@ -27,7 +27,7 @@ public class QuerySelection {
public QuerySelection(String selection, List<String> args) {
this.args = new String[ args.size() ];
args.toArray( this.args );
args.toArray(this.args);
this.selection = selection;
}
@ -57,7 +57,7 @@ public class QuerySelection {
s = " (" + this.selection + ") AND (" + query.getSelection() + ") ";
} else if (this.hasSelection()) {
s = this.selection;
} else if (query.hasSelection() ) {
} else if (query.hasSelection()) {
s = query.selection;
}

View File

@ -37,7 +37,7 @@ public class Repo extends ValueObject {
checkCursorPosition(cursor);
for(int i = 0; i < cursor.getColumnCount(); i ++ ) {
for (int i = 0; i < cursor.getColumnCount(); i++) {
String column = cursor.getColumnName(i);
if (column.equals(RepoProvider.DataColumns._ID)) {
id = cursor.getInt(i);

View File

@ -32,10 +32,10 @@ public class AppListFragmentPagerAdapter extends FragmentPagerAdapter {
@Override
public Fragment getItem(int i) {
if ( i == 0 ) {
if (i == 0) {
return new AvailableAppsFragment();
}
if ( i == 1 ) {
if (i == 1) {
return new InstalledAppsFragment();
}
return new CanUpdateAppsFragment();

View File

@ -44,7 +44,7 @@ public class RepoDetailsActivity extends ActionBarActivity {
// a (bug?) thing in 3.0, 3.1 which requires setContentView to be invoked before
// the actionbar is played with:
// http://blog.perpetumdesign.com/2011/08/strange-case-of-dr-action-and-mr-bar.html
setContentView( new LinearLayout(this) );
setContentView(new LinearLayout(this));
RepoDetailsFragment fragment = new RepoDetailsFragment();
fragment.setArguments(getIntent().getExtras());

View File

@ -75,7 +75,7 @@ public class AvailableAppsFragment extends AppListFragment implements
// Wanted to just do this update here, but android tells
// me that "Only the original thread that created a view
// hierarchy can touch its views."
getActivity().runOnUiThread( new Runnable() {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
adapter.clear();

View File

@ -275,7 +275,7 @@ public class RepoDetailsFragment extends Fragment {
update.setIcon(R.drawable.ic_menu_refresh);
MenuItemCompat.setShowAsAction(update,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS |
MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT );
MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
MenuItem delete = menu.add(Menu.NONE, DELETE, 0, R.string.delete);
delete.setIcon(android.R.drawable.ic_menu_delete);

View File

@ -41,7 +41,7 @@ public class SearchResultsFragment extends ListFragment implements LoaderManager
query = data.getQueryParameter("q");
if (query != null && query.startsWith("pname:"))
query = query.substring(6);
} else if (data!= null ) {
} else if (data!= null) {
query = data.getEncodedSchemeSpecificPart();
}
}