Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

2.7.6 /2015-07-14/

  • Loading branch information...
commit 2e2a89d132d3ea740e9bdf49cef206edad296550 2 parents 406b424 + 88faba6
@yanchenko authored
Showing with 653 additions and 1,125 deletions.
  1. +4 −0 CHANGES
  2. +3 −5 droidparts-samples/DroidPartsGram/src/org/droidparts/gram/activity/PopularImageListActivity.java
  3. +1 −2  droidparts-samples/DroidPartsGram/src/org/droidparts/gram/activity/SettingsActivity.java
  4. +2 −4 droidparts-samples/DroidPartsGram/src/org/droidparts/gram/adapter/ImageListAdapter.java
  5. +3 −6 droidparts-samples/DroidPartsGram/src/org/droidparts/gram/fragment/ImageDetailFragment.java
  6. +1 −2  droidparts-samples/DroidPartsGram/src/org/droidparts/gram/fragment/ImageListFragment.java
  7. +1 −2  droidparts-samples/DroidPartsGram/src/org/droidparts/gram/persist/FilterEntityManager.java
  8. +4 −8 droidparts-samples/DroidPartsGram/src/org/droidparts/gram/persist/PrefsManager.java
  9. +4 −9 droidparts-samples/DroidPartsGram/src/org/droidparts/gram/service/ImageIntentService.java
  10. +1 −2  droidparts-samples/droidparts-sample/src/org/droidparts/sample/adapter/EntryListAdapter.java
  11. +1 −1  droidparts-support/pom.xml
  12. +2 −4 droidparts-support/src/org/droidparts/activity/support/v4/FragmentActivity.java
  13. +2 −4 droidparts-support/src/org/droidparts/activity/support/v4/SingleFragmentActivity.java
  14. +3 −6 droidparts-support/src/org/droidparts/activity/support/v7/ActionBarActivity.java
  15. +2 −4 droidparts-support/src/org/droidparts/activity/support/v7/SingleFragmentActionBarActivity.java
  16. +2 −4 droidparts-support/src/org/droidparts/activity/support/v7/TabbedActionBarActivity.java
  17. +3 −6 droidparts-support/src/org/droidparts/fragment/support/v4/DialogFragment.java
  18. +2 −4 droidparts-support/src/org/droidparts/fragment/support/v4/Fragment.java
  19. +2 −4 droidparts-support/src/org/droidparts/fragment/support/v4/ListFragment.java
  20. +5 −6 droidparts-support/src/org/droidparts/inner/fragments/SecretFragmentsSupportUtil.java
  21. +2 −4 droidparts-support/src/org/droidparts/inner/reader/SupportFragmentsReader.java
  22. +1 −2  droidparts-support/src/org/droidparts/net/image/cache/SupportBitmapLruCache.java
  23. +1 −1  droidparts-test/pom.xml
  24. +2 −4 droidparts-test/src/org/droidparts/test/persist/DBOpenHelper.java
  25. +5 −8 droidparts-test/src/org/droidparts/test/persist/sql/AlbumManager.java
  26. +16 −31 droidparts-test/src/org/droidparts/test/testcase/EntityTestCase.java
  27. +2 −4 droidparts-test/src/org/droidparts/test/testcase/TestActivityTestCase.java
  28. +4 −8 droidparts-test/src/org/droidparts/test/testcase/rest/RESTClientPostMultipart.java
  29. +5 −10 droidparts-test/src/org/droidparts/test/testcase/serialize/JSONTestCase.java
  30. +5 −10 droidparts-test/src/org/droidparts/test/testcase/serialize/XMLTestCase.java
  31. +1 −1  droidparts/pom.xml
  32. +8 −12 droidparts/src/org/droidparts/Injector.java
  33. +3 −6 droidparts/src/org/droidparts/activity/Activity.java
  34. +2 −4 droidparts/src/org/droidparts/activity/SingleFragmentActivity.java
  35. +2 −4 droidparts/src/org/droidparts/activity/TabbedFragmentActivity.java
  36. +1 −2  droidparts/src/org/droidparts/activity/legacy/ListActivity.java
  37. +1 −2  droidparts/src/org/droidparts/activity/legacy/PreferenceActivity.java
  38. +4 −6 droidparts/src/org/droidparts/adapter/cursor/EntityCursorAdapter.java
  39. +2 −4 droidparts/src/org/droidparts/adapter/widget/ArrayAdapter.java
  40. +1 −2  droidparts/src/org/droidparts/adapter/widget/StringSpinnerAdapter.java
  41. +1 −2  droidparts/src/org/droidparts/adapter/widget/TextWatcherAdapter.java
  42. +1 −1  droidparts/src/org/droidparts/annotation/bus/ReceiveEvents.java
  43. +9 −18 droidparts/src/org/droidparts/bus/EventBus.java
  44. +5 −10 droidparts/src/org/droidparts/concurrent/service/IntentService.java
  45. +3 −4 droidparts/src/org/droidparts/concurrent/task/AsyncTask.java
  46. +2 −4 droidparts/src/org/droidparts/concurrent/task/SimpleAsyncTask.java
  47. +1 −2  droidparts/src/org/droidparts/concurrent/thread/BackgroundThreadExecutor.java
  48. +3 −6 droidparts/src/org/droidparts/fragment/DialogFragment.java
  49. +2 −4 droidparts/src/org/droidparts/fragment/Fragment.java
  50. +2 −4 droidparts/src/org/droidparts/fragment/ListFragment.java
  51. +2 −4 droidparts/src/org/droidparts/fragment/PreferenceFragment.java
  52. +1 −2  droidparts/src/org/droidparts/inner/AnnotationElementsReader.java
  53. +6 −11 droidparts/src/org/droidparts/inner/BitmapFactoryUtils.java
  54. +10 −21 droidparts/src/org/droidparts/inner/ClassSpecRegistry.java
  55. +2 −4 droidparts/src/org/droidparts/inner/ConverterRegistry.java
  56. +1 −2  droidparts/src/org/droidparts/inner/ManifestMetaData.java
  57. +28 −46 droidparts/src/org/droidparts/inner/PersistUtils.java
  58. +8 −15 droidparts/src/org/droidparts/inner/ReflectionUtils.java
  59. +8 −16 droidparts/src/org/droidparts/inner/TypeHelper.java
  60. +1 −2  droidparts/src/org/droidparts/inner/ann/inject/InjectSystemServiceAnn.java
  61. +18 −30 droidparts/src/org/droidparts/inner/converter/ArrayCollectionConverter.java
  62. +5 −8 droidparts/src/org/droidparts/inner/converter/BitmapConverter.java
  63. +5 −8 droidparts/src/org/droidparts/inner/converter/BooleanConverter.java
  64. +5 −8 droidparts/src/org/droidparts/inner/converter/ByteArrayConverter.java
  65. +6 −8 droidparts/src/org/droidparts/inner/converter/ByteConverter.java
  66. +6 −8 droidparts/src/org/droidparts/inner/converter/CharacterConverter.java
  67. +10 −15 droidparts/src/org/droidparts/inner/converter/Converter.java
  68. +8 −10 droidparts/src/org/droidparts/inner/converter/DateConverter.java
  69. +5 −8 droidparts/src/org/droidparts/inner/converter/DoubleConverter.java
  70. +4 −6 droidparts/src/org/droidparts/inner/converter/EntityConverter.java
  71. +7 −10 droidparts/src/org/droidparts/inner/converter/EnumConverter.java
  72. +6 −8 droidparts/src/org/droidparts/inner/converter/FloatConverter.java
  73. +5 −8 droidparts/src/org/droidparts/inner/converter/IntegerConverter.java
  74. +9 −11 droidparts/src/org/droidparts/inner/converter/JSONArrayConverter.java
  75. +9 −12 droidparts/src/org/droidparts/inner/converter/JSONObjectConverter.java
  76. +6 −8 droidparts/src/org/droidparts/inner/converter/LongConverter.java
  77. +12 −17 droidparts/src/org/droidparts/inner/converter/ModelConverter.java
  78. +6 −8 droidparts/src/org/droidparts/inner/converter/ShortConverter.java
  79. +5 −8 droidparts/src/org/droidparts/inner/converter/StringConverter.java
  80. +8 −10 droidparts/src/org/droidparts/inner/converter/UUIDConverter.java
  81. +8 −10 droidparts/src/org/droidparts/inner/converter/UriConverter.java
  82. +4 −6 droidparts/src/org/droidparts/inner/fragments/SecretFragmentsStockUtil.java
  83. +3 −3 droidparts/src/org/droidparts/inner/fragments/SecretFragmentsUtil.java
  84. +2 −4 droidparts/src/org/droidparts/inner/reader/BundleExtraReader.java
  85. +7 −15 droidparts/src/org/droidparts/inner/reader/DependencyReader.java
  86. +2 −4 droidparts/src/org/droidparts/inner/reader/FragmentsReader.java
  87. +5 −9 droidparts/src/org/droidparts/inner/reader/LegacyReader.java
  88. +2 −4 droidparts/src/org/droidparts/inner/reader/ResourceReader.java
  89. +3 −6 droidparts/src/org/droidparts/inner/reader/SystemServiceReader.java
  90. +4 −8 droidparts/src/org/droidparts/inner/reader/ValueReader.java
  91. +8 −15 droidparts/src/org/droidparts/inner/reader/ViewAndPreferenceReader.java
  92. +9 −18 droidparts/src/org/droidparts/net/http/CookieJar.java
  93. +17 −32 droidparts/src/org/droidparts/net/http/RESTClient.java
  94. +7 −14 droidparts/src/org/droidparts/net/http/RESTClient2.java
  95. +2 −3 droidparts/src/org/droidparts/net/http/UserAgent.java
  96. +5 −10 droidparts/src/org/droidparts/net/http/worker/HTTPInputStream.java
  97. +2 −4 droidparts/src/org/droidparts/net/http/worker/HTTPWorker.java
  98. +8 −16 droidparts/src/org/droidparts/net/http/worker/HttpClientWorker.java
  99. +11 −19 droidparts/src/org/droidparts/net/http/worker/HttpURLConnectionWorker.java
  100. +1 −2  droidparts/src/org/droidparts/net/http/worker/wrapper/HttpMimeWrapper.java
  101. +2 −4 droidparts/src/org/droidparts/net/image/AbstractImageReshaper.java
  102. +1 −2  droidparts/src/org/droidparts/net/image/ImageFetchListener.java
  103. +29 −55 droidparts/src/org/droidparts/net/image/ImageFetcher.java
  104. +6 −10 droidparts/src/org/droidparts/net/image/cache/BitmapDiskCache.java
  105. +1 −2  droidparts/src/org/droidparts/net/image/cache/BitmapLruCache.java
  106. +4 −8 droidparts/src/org/droidparts/net/image/cache/BitmapMemoryCache.java
  107. +4 −8 droidparts/src/org/droidparts/persist/AbstractPrefsManager.java
  108. +2 −4 droidparts/src/org/droidparts/persist/serializer/AbstractSerializer.java
  109. +10 −19 droidparts/src/org/droidparts/persist/serializer/JSONSerializer.java
  110. +1 −2  droidparts/src/org/droidparts/persist/serializer/SerializerException.java
  111. +16 −28 droidparts/src/org/droidparts/persist/serializer/XMLSerializer.java
  112. +10 −18 droidparts/src/org/droidparts/persist/sql/AbstractDBOpenHelper.java
  113. +2 −4 droidparts/src/org/droidparts/persist/sql/AbstractEntityManager.java
  114. +20 −37 droidparts/src/org/droidparts/persist/sql/EntityManager.java
  115. +2 −4 droidparts/src/org/droidparts/persist/sql/stmt/Delete.java
  116. +1 −2  droidparts/src/org/droidparts/persist/sql/stmt/MergeSelect.java
  117. +10 −14 droidparts/src/org/droidparts/persist/sql/stmt/Select.java
  118. +4 −6 droidparts/src/org/droidparts/persist/sql/stmt/Statement.java
  119. +4 −8 droidparts/src/org/droidparts/persist/sql/stmt/Update.java
  120. +1 −2  droidparts/src/org/droidparts/persist/sql/stmt/Where.java
  121. +10 −20 droidparts/src/org/droidparts/util/AppUtils.java
  122. +1 −2  droidparts/src/org/droidparts/util/Arrays2.java
  123. +2 −4 droidparts/src/org/droidparts/util/IOUtils.java
  124. +2 −4 droidparts/src/org/droidparts/util/L.java
  125. +5 −8 droidparts/src/org/droidparts/util/ResourceUtils.java
  126. +2 −4 droidparts/src/org/droidparts/util/Strings.java
  127. +2 −2 droidparts/src/org/droidparts/util/intent/IntentFactory.java
  128. +4 −9 droidparts/src/org/droidparts/util/intent/IntentHelper.java
  129. +6 −12 droidparts/src/org/droidparts/util/ui/EditTextValidator.java
  130. +7 −2 droidparts/src/org/droidparts/util/ui/ViewUtils.java
  131. +4 −8 droidparts/src/org/droidparts/widget/ClearableEditText.java
  132. +10 −15 droidparts/src/org/droidparts/widget/MultiSelectListPreference.java
  133. +1 −1  pom.xml
View
4 CHANGES
@@ -1,3 +1,7 @@
+2.7.6 /2015-07-14/:
+ * ViewUtils: getRootView(Window w).
+ * Minor stuff.
+
2.7.5 /2015-06-07/:
* DependencyReader: correctly init after tearDown() /kudos to @vovan888/.
* RESTClient: improved log messages.
View
8 ...rts-samples/DroidPartsGram/src/org/droidparts/gram/activity/PopularImageListActivity.java
@@ -31,9 +31,8 @@
import android.view.Menu;
import android.view.MenuItem;
-public class PopularImageListActivity extends
- SingleFragmentActivity<ImageListFragment> implements
- ImageListFragment.Listener {
+public class PopularImageListActivity extends SingleFragmentActivity<ImageListFragment>
+ implements ImageListFragment.Listener {
@InjectDependency
private ImageEntityManager imageEntityManager;
@@ -64,8 +63,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_refresh:
setActionBarLoadingIndicatorVisible(true);
- intent = ImageIntentService.getUpdatePicsIntent(this,
- refreshResultReceiver);
+ intent = ImageIntentService.getUpdatePicsIntent(this, refreshResultReceiver);
startService(intent);
return true;
case R.id.menu_settings:
View
3  droidparts-samples/DroidPartsGram/src/org/droidparts/gram/activity/SettingsActivity.java
@@ -29,8 +29,7 @@
import android.preference.Preference.OnPreferenceChangeListener;
import android.view.MenuItem;
-public class SettingsActivity extends PreferenceActivity implements
- OnPreferenceChangeListener {
+public class SettingsActivity extends PreferenceActivity implements OnPreferenceChangeListener {
public static Intent getIntent(Context ctx) {
return new Intent(ctx, SettingsActivity.class);
View
6 droidparts-samples/DroidPartsGram/src/org/droidparts/gram/adapter/ImageListAdapter.java
@@ -35,8 +35,7 @@
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
-public class ImageListAdapter extends EntityCursorAdapter<Image> implements
- OnScrollListener {
+public class ImageListAdapter extends EntityCursorAdapter<Image>implements OnScrollListener {
@InjectDependency
private ImageFetcher imageFetcher;
@@ -88,8 +87,7 @@ public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
- public void onScroll(AbsListView view, int firstVisibleItem,
- int visibleItemCount, int totalItemCount) {
+ public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
// n/a
}
View
9 droidparts-samples/DroidPartsGram/src/org/droidparts/gram/fragment/ImageDetailFragment.java
@@ -37,8 +37,7 @@
import android.widget.ProgressBar;
import android.widget.TextView;
-public class ImageDetailFragment extends DialogFragment implements
- ImageFetchListener {
+public class ImageDetailFragment extends DialogFragment implements ImageFetchListener {
private static final String EXTRA_IMAGE = "img";
@@ -67,8 +66,7 @@ public static ImageDetailFragment newInstance(Image img) {
private TextView tagsView;
@Override
- public View onCreateView(Bundle savedInstanceState,
- LayoutInflater inflater, ViewGroup container) {
+ public View onCreateView(Bundle savedInstanceState, LayoutInflater inflater, ViewGroup container) {
return inflater.inflate(R.layout.dialog_image, null);
}
@@ -93,8 +91,7 @@ public void onFetchAdded(ImageView imageView, String imgUrl) {
}
@Override
- public void onFetchProgressChanged(ImageView imageView, String imgUrl,
- int kBTotal, int kBReceived) {
+ public void onFetchProgressChanged(ImageView imageView, String imgUrl, int kBTotal, int kBReceived) {
int progress = (int) ((float) kBReceived / kBTotal * 100);
progressBarView.setProgress(progress);
}
View
3  droidparts-samples/DroidPartsGram/src/org/droidparts/gram/fragment/ImageListFragment.java
@@ -23,8 +23,7 @@
import android.view.View;
import android.widget.ListView;
-public class ImageListFragment extends ListFragment implements
- AlterableContent<ImageListAdapter> {
+public class ImageListFragment extends ListFragment implements AlterableContent<ImageListAdapter> {
public interface Listener {
View
3  droidparts-samples/DroidPartsGram/src/org/droidparts/gram/persist/FilterEntityManager.java
@@ -32,8 +32,7 @@ public FilterEntityManager(Context ctx) {
}
public void setIdOrCreateForName(Filter filter) {
- Select<Filter> select = select().columns(ID).where(NAME, Is.EQUAL,
- filter.name);
+ Select<Filter> select = select().columns(ID).where(NAME, Is.EQUAL, filter.name);
if (select.count() == 1) {
filter.id = readFirst(select).id;
} else {
View
12 droidparts-samples/DroidPartsGram/src/org/droidparts/gram/persist/PrefsManager.java
@@ -33,20 +33,16 @@ public PrefsManager(Context ctx) {
}
public boolean isShowDetailFilter() {
- return getShowDetailVaules().contains(
- getContext().getString(R.string.pref_filter));
+ return getShowDetailVaules().contains(getContext().getString(R.string.pref_filter));
}
public boolean isShowDetailTags() {
- return getShowDetailVaules().contains(
- getContext().getString(R.string.pref_tags));
+ return getShowDetailVaules().contains(getContext().getString(R.string.pref_tags));
}
private HashSet<String> getShowDetailVaules() {
- String str = readString(R.string.pref_show_detail,
- R.string.pref_show_detail);
- String[] arr = MultiSelectListPreference
- .fromPersistedPreferenceValue(str);
+ String str = readString(R.string.pref_show_detail, R.string.pref_show_detail);
+ String[] arr = MultiSelectListPreference.fromPersistedPreferenceValue(str);
return new HashSet<String>(Arrays.asList(arr));
}
View
13 droidparts-samples/DroidPartsGram/src/org/droidparts/gram/service/ImageIntentService.java
@@ -38,10 +38,8 @@
private static final String ACTION_REFRESH = "refresh";
- public static Intent getUpdatePicsIntent(Context ctx,
- ResultReceiver resultReceiver) {
- return getIntent(ctx, ImageIntentService.class, ACTION_REFRESH,
- resultReceiver);
+ public static Intent getUpdatePicsIntent(Context ctx, ResultReceiver resultReceiver) {
+ return getIntent(ctx, ImageIntentService.class, ACTION_REFRESH, resultReceiver);
}
private final Uri refreshUri;
@@ -53,11 +51,8 @@ public static Intent getUpdatePicsIntent(Context ctx,
public ImageIntentService() {
super(ImageIntentService.class.getSimpleName());
- refreshUri = Uri
- .parse(Instagram.Url.POPULAR_MEDIA)
- .buildUpon()
- .appendQueryParameter(Instagram.Param.CLIENT_ID,
- Instagram.CLIENT_ID).build();
+ refreshUri = Uri.parse(Instagram.Url.POPULAR_MEDIA).buildUpon()
+ .appendQueryParameter(Instagram.Param.CLIENT_ID, Instagram.CLIENT_ID).build();
}
@Override
View
3  droidparts-samples/droidparts-sample/src/org/droidparts/sample/adapter/EntryListAdapter.java
@@ -37,8 +37,7 @@ public EntryListAdapter(Context ctx, Select<Entry> select) {
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
- View v = getLayoutInflater().inflate(
- android.R.layout.simple_list_item_2, null);
+ View v = getLayoutInflater().inflate(android.R.layout.simple_list_item_2, null);
Text2Holder holder = new Text2Holder(v);
v.setTag(holder);
return v;
View
2  droidparts-support/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.droidparts</groupId>
<artifactId>droidparts-parent</artifactId>
- <version>2.7.5</version>
+ <version>2.7.6</version>
</parent>
<artifactId>droidparts-support</artifactId>
View
6 droidparts-support/src/org/droidparts/activity/support/v4/FragmentActivity.java
@@ -23,8 +23,7 @@
import android.os.Bundle;
import android.support.v4.app.Fragment;
-public abstract class FragmentActivity extends
- android.support.v4.app.FragmentActivity implements Injectable {
+public abstract class FragmentActivity extends android.support.v4.app.FragmentActivity implements Injectable {
@Override
public void onPreInject() {
@@ -50,8 +49,7 @@ protected void onPause() {
}
public void setFragmentVisible(boolean visible, Fragment... fragments) {
- SecretFragmentsSupportUtil.fragmentActivitySetFragmentVisible(this,
- visible, fragments);
+ SecretFragmentsSupportUtil.fragmentActivitySetFragmentVisible(this, visible, fragments);
}
}
View
6 droidparts-support/src/org/droidparts/activity/support/v4/SingleFragmentActivity.java
@@ -20,8 +20,7 @@
import android.os.Bundle;
import android.support.v4.app.Fragment;
-public abstract class SingleFragmentActivity<F extends Fragment> extends
- FragmentActivity {
+public abstract class SingleFragmentActivity<F extends Fragment> extends FragmentActivity {
private F fragment;
@@ -34,8 +33,7 @@ public void onPreInject() {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
fragment = onCreateFragment();
- SecretFragmentsSupportUtil
- .singleFragmentActivityAddFragmentToContentView(this, fragment);
+ SecretFragmentsSupportUtil.singleFragmentActivityAddFragmentToContentView(this, fragment);
}
protected F getFragment() {
View
9 droidparts-support/src/org/droidparts/activity/support/v7/ActionBarActivity.java
@@ -25,8 +25,7 @@
import android.view.MenuItem;
import android.view.View;
-public abstract class ActionBarActivity extends
- android.support.v7.app.ActionBarActivity implements Injectable {
+public abstract class ActionBarActivity extends android.support.v7.app.ActionBarActivity implements Injectable {
private MenuItem reloadMenuItem;
private View loadingIndicator;
@@ -68,15 +67,13 @@ public final void setActionBarLoadingIndicatorVisible(boolean visible) {
public final void setActionBarReloadMenuItem(MenuItem menuItem) {
this.reloadMenuItem = menuItem;
if (menuItem != null && loadingIndicator == null) {
- loadingIndicator = SecretFragmentsSupportUtil
- .fragmentActivityBuildLoadingIndicator(this);
+ loadingIndicator = SecretFragmentsSupportUtil.fragmentActivityBuildLoadingIndicator(this);
}
setActionBarLoadingIndicatorVisible(isLoading);
}
public void setFragmentVisible(boolean visible, Fragment... fragments) {
- SecretFragmentsSupportUtil.fragmentActivitySetFragmentVisible(this,
- visible, fragments);
+ SecretFragmentsSupportUtil.fragmentActivitySetFragmentVisible(this, visible, fragments);
}
}
View
6 ...parts-support/src/org/droidparts/activity/support/v7/SingleFragmentActionBarActivity.java
@@ -20,8 +20,7 @@
import android.os.Bundle;
import android.support.v4.app.Fragment;
-public abstract class SingleFragmentActionBarActivity<F extends Fragment>
- extends ActionBarActivity {
+public abstract class SingleFragmentActionBarActivity<F extends Fragment> extends ActionBarActivity {
private F fragment;
@@ -34,8 +33,7 @@ public void onPreInject() {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
fragment = onCreateFragment();
- SecretFragmentsSupportUtil
- .singleFragmentActivityAddFragmentToContentView(this, fragment);
+ SecretFragmentsSupportUtil.singleFragmentActivityAddFragmentToContentView(this, fragment);
}
protected F getFragment() {
View
6 droidparts-support/src/org/droidparts/activity/support/v7/TabbedActionBarActivity.java
@@ -78,8 +78,7 @@ public void addTab(ActionBar.Tab tab, Fragment... tabFragments) {
addTab(fragmentsOnTab.size(), tab, tabFragments);
}
- public void addTab(int position, ActionBar.Tab tab,
- Fragment... tabFragments) {
+ public void addTab(int position, ActionBar.Tab tab, Fragment... tabFragments) {
tab.setTabListener(tabListener);
getSupportActionBar().addTab(tab, position);
fragmentsOnTab.add(position, tabFragments);
@@ -111,8 +110,7 @@ public void setFragmentVisible(boolean visible, Fragment... fragments) {
for (Fragment fragment : fragments) {
if (visible) {
manuallyHiddenFragments.remove(fragment);
- Fragment[] currTabFragments = fragmentsOnTab
- .get(getCurrentTab());
+ Fragment[] currTabFragments = fragmentsOnTab.get(getCurrentTab());
for (Fragment currTabFragment : currTabFragments) {
if (fragment == currTabFragment) {
super.setFragmentVisible(true, fragment);
View
9 droidparts-support/src/org/droidparts/fragment/support/v4/DialogFragment.java
@@ -29,8 +29,7 @@
private boolean injected;
@Override
- public final View onCreateView(LayoutInflater inflater,
- ViewGroup container, Bundle savedInstanceState) {
+ public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = onCreateView(savedInstanceState, inflater, container);
if (view != null) {
Injector.inject(view, this);
@@ -41,8 +40,7 @@ public final View onCreateView(LayoutInflater inflater,
return view;
}
- public View onCreateView(Bundle savedInstanceState,
- LayoutInflater inflater, ViewGroup container) {
+ public View onCreateView(Bundle savedInstanceState, LayoutInflater inflater, ViewGroup container) {
return super.onCreateView(inflater, container, savedInstanceState);
}
@@ -51,8 +49,7 @@ public final boolean isInjected() {
}
public void show(FragmentActivity activity) {
- SecretFragmentsSupportUtil.dialogFragmentShowDialogFragment(activity,
- this);
+ SecretFragmentsSupportUtil.dialogFragmentShowDialogFragment(activity, this);
}
}
View
6 droidparts-support/src/org/droidparts/fragment/support/v4/Fragment.java
@@ -27,16 +27,14 @@
private boolean injected;
@Override
- public final View onCreateView(LayoutInflater inflater,
- ViewGroup container, Bundle savedInstanceState) {
+ public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = onCreateView(savedInstanceState, inflater, container);
Injector.inject(view, this);
injected = true;
return view;
}
- public View onCreateView(Bundle savedInstanceState,
- LayoutInflater inflater, ViewGroup container) {
+ public View onCreateView(Bundle savedInstanceState, LayoutInflater inflater, ViewGroup container) {
return super.onCreateView(inflater, container, savedInstanceState);
}
View
6 droidparts-support/src/org/droidparts/fragment/support/v4/ListFragment.java
@@ -27,16 +27,14 @@
private boolean injected;
@Override
- public final View onCreateView(LayoutInflater inflater,
- ViewGroup container, Bundle savedInstanceState) {
+ public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = onCreateView(savedInstanceState, inflater, container);
Injector.inject(view, this);
injected = true;
return view;
}
- public View onCreateView(Bundle savedInstanceState,
- LayoutInflater inflater, ViewGroup container) {
+ public View onCreateView(Bundle savedInstanceState, LayoutInflater inflater, ViewGroup container) {
return super.onCreateView(inflater, container, savedInstanceState);
}
View
11 droidparts-support/src/org/droidparts/inner/fragments/SecretFragmentsSupportUtil.java
@@ -23,8 +23,7 @@
public class SecretFragmentsSupportUtil extends SecretFragmentsUtil {
- public static void fragmentActivitySetFragmentVisible(
- FragmentActivity fragmentActivity, boolean visible,
+ public static void fragmentActivitySetFragmentVisible(FragmentActivity fragmentActivity, boolean visible,
Fragment... fragments) {
FragmentManager fm = fragmentActivity.getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
@@ -38,16 +37,16 @@ public static void fragmentActivitySetFragmentVisible(
ft.commit();
}
- public static void singleFragmentActivityAddFragmentToContentView(
- FragmentActivity fragmentActivity, Fragment fragment) {
+ public static void singleFragmentActivityAddFragmentToContentView(FragmentActivity fragmentActivity,
+ Fragment fragment) {
FragmentManager fm = fragmentActivity.getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.add(CONTENT_VIEW_ID, fragment);
ft.commit();
}
- public static void dialogFragmentShowDialogFragment(
- FragmentActivity fragmentActivity, DialogFragment dialogFragment) {
+ public static void dialogFragmentShowDialogFragment(FragmentActivity fragmentActivity,
+ DialogFragment dialogFragment) {
FragmentManager fm = fragmentActivity.getSupportFragmentManager();
String tag = dialogFragment.getClass().getName();
FragmentTransaction ft = fm.beginTransaction();
View
6 droidparts-support/src/org/droidparts/inner/reader/SupportFragmentsReader.java
@@ -37,14 +37,12 @@ public Activity getParentActivity(Object fragmentObj) {
}
@Override
- public Fragment getFragment(Object fragmentActivityObj, int fragmentId,
- String valName) {
+ public Fragment getFragment(Object fragmentActivityObj, int fragmentId, String valName) {
FragmentActivity fragmentActivity = (FragmentActivity) fragmentActivityObj;
if (fragmentId == 0) {
fragmentId = ResourceUtils.getResourceId(fragmentActivity, valName);
}
- return fragmentActivity.getSupportFragmentManager().findFragmentById(
- fragmentId);
+ return fragmentActivity.getSupportFragmentManager().findFragmentById(fragmentId);
}
@Override
View
3  droidparts-support/src/org/droidparts/net/image/cache/SupportBitmapLruCache.java
@@ -18,8 +18,7 @@
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
-public class SupportBitmapLruCache extends LruCache<String, Bitmap> implements
- BitmapMemoryCache.Delegate {
+public class SupportBitmapLruCache extends LruCache<String, Bitmap>implements BitmapMemoryCache.Delegate {
public SupportBitmapLruCache(int maxSize) {
super(maxSize);
View
2  droidparts-test/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.droidparts</groupId>
<artifactId>droidparts-parent</artifactId>
- <version>2.7.5</version>
+ <version>2.7.6</version>
</parent>
<artifactId>droidparts-test</artifactId>
View
6 droidparts-test/src/org/droidparts/test/persist/DBOpenHelper.java
@@ -34,10 +34,8 @@ public DBOpenHelper(Context ctx) {
@SuppressWarnings("unchecked")
@Override
protected void onCreateTables(SQLiteDatabase db) {
- createTables(db, Primitives.class, Tag.class, Album.class, Track.class,
- AlbumToTag.class);
- createIndex(db, Table.ALBUM_TO_TAG, true, Column.ALBUM_ID,
- Column.TAG_ID);
+ createTables(db, Primitives.class, Tag.class, Album.class, Track.class, AlbumToTag.class);
+ createIndex(db, Table.ALBUM_TO_TAG, true, Column.ALBUM_ID, Column.TAG_ID);
}
@Override
View
13 droidparts-test/src/org/droidparts/test/persist/sql/AlbumManager.java
@@ -28,7 +28,7 @@
import android.content.Context;
-public class AlbumManager extends EntityManager<Album> implements DB {
+public class AlbumManager extends EntityManager<Album>implements DB {
private final EntityManager<AlbumToTag> albumToTagManager;
private final EntityManager<Tag> tagManager;
@@ -41,8 +41,7 @@ public AlbumManager(Context ctx) {
public ArrayList<Tag> getTags(long albumId) {
ArrayList<Tag> tags = new ArrayList<Tag>();
- Select<Tag> select = tagManager.select().where(Column.ID, Is.IN,
- getTagIds(albumId));
+ Select<Tag> select = tagManager.select().where(Column.ID, Is.IN, getTagIds(albumId));
tags = tagManager.readAll(select);
return tags;
}
@@ -52,8 +51,7 @@ public void addTags(long albumId, Collection<Tag> tags) {
for (Tag tag : tags) {
boolean success = tagManager.create(tag);
if (!success) {
- Select<Tag> select = tagManager.select().where(Column.NAME,
- Is.EQUAL, tag.name);
+ Select<Tag> select = tagManager.select().where(Column.NAME, Is.EQUAL, tag.name);
tag = tagManager.readFirst(select);
}
albumToTagManager.create(new AlbumToTag(album, tag));
@@ -61,9 +59,8 @@ public void addTags(long albumId, Collection<Tag> tags) {
}
public long[] getTagIds(long albumId) {
- Select<AlbumToTag> select = albumToTagManager.select()
- .columns(Column.TAG_ID)
- .where(Column.ALBUM_ID, Is.EQUAL, albumId);
+ Select<AlbumToTag> select = albumToTagManager.select().columns(Column.TAG_ID).where(Column.ALBUM_ID, Is.EQUAL,
+ albumId);
return albumToTagManager.readIds(select);
}
}
View
47 droidparts-test/src/org/droidparts/test/testcase/EntityTestCase.java
@@ -39,10 +39,9 @@
private static final String[] ALBUMS = new String[] { "Diamond", "Iris" };
private static final int[] YEARS = new int[] { 2007, 2009 };
- private static final String[] TRACKS = new String[] { "Diamond",
- "Beautiful", "Stay", "Secret Desire", "The Sun", "Buddha" };
- private static final String[] TAGS = new String[] { "downtempo", "lounge",
- "chillout" };
+ private static final String[] TRACKS = new String[] { "Diamond", "Beautiful", "Stay", "Secret Desire", "The Sun",
+ "Buddha" };
+ private static final String[] TAGS = new String[] { "downtempo", "lounge", "chillout" };
private EntityManager<Primitives> primitivesManager;
private EntityManager<AlbumToTag> albumToTagManager;
@@ -53,10 +52,8 @@
@Override
protected void setUp() {
if (primitivesManager == null) {
- primitivesManager = new EntityManager<Primitives>(Primitives.class,
- getContext());
- albumToTagManager = new EntityManager<AlbumToTag>(AlbumToTag.class,
- getContext());
+ primitivesManager = new EntityManager<Primitives>(Primitives.class, getContext());
+ albumToTagManager = new EntityManager<AlbumToTag>(AlbumToTag.class, getContext());
tagManager = new EntityManager<Tag>(Tag.class, getContext());
albumManager = new AlbumManager(getContext());
trackManager = new TrackManager(getContext());
@@ -118,8 +115,7 @@ public void testUniqueAndNull() {
int count = albumManager.select().whereId(album1.id).count();
assertEquals(1, count);
- Cursor cursor = albumManager.select()
- .where(Column.COMMENT, Is.NOT_NULL).execute();
+ Cursor cursor = albumManager.select().where(Column.COMMENT, Is.NOT_NULL).execute();
assertEquals(1, cursor.getCount());
cursor.moveToFirst();
Album album11 = albumManager.readRow(cursor);
@@ -142,8 +138,7 @@ public void testModel() {
n.str = str;
album.nestedList.add(n);
}
- album.nestedArr = album.nestedList.toArray(new Nested[album.nestedList
- .size()]);
+ album.nestedArr = album.nestedList.toArray(new Nested[album.nestedList.size()]);
albumManager.update(album);
album = albumManager.read(album.id);
assertEquals("str", album.nested.str);
@@ -203,11 +198,9 @@ public void testWhereId() {
public void testBetween() {
createAlbums(20);
//
- int count = albumManager.select().where(Column.ID, Is.BETWEEN, 5, 10)
- .count();
+ int count = albumManager.select().where(Column.ID, Is.BETWEEN, 5, 10).count();
assertEquals(6, count);
- count = albumManager.select().where(Column.ID, Is.NOT_BETWEEN, 5, 10)
- .count();
+ count = albumManager.select().where(Column.ID, Is.NOT_BETWEEN, 5, 10).count();
assertEquals(14, count);
}
@@ -229,11 +222,9 @@ public void testLike() {
list.add(album);
}
albumManager.create(list);
- int count = albumManager.select()
- .where(Column.NAME, Is.LIKE, "%%udd%%").count();
+ int count = albumManager.select().where(Column.NAME, Is.LIKE, "%%udd%%").count();
assertEquals(1, count);
- count = albumManager.select()
- .where(Column.NAME, Is.NOT_LIKE, "%%udd%%").count();
+ count = albumManager.select().where(Column.NAME, Is.NOT_LIKE, "%%udd%%").count();
assertEquals(TRACKS.length - 1, count);
}
@@ -245,9 +236,7 @@ public void testForeignKeys() {
track.name = name;
trackManager.create(track);
}
- assertEquals(TRACKS.length,
- trackManager.select()
- .where(Column.ALBUM_ID, Is.EQUAL, album.id).count());
+ assertEquals(TRACKS.length, trackManager.select().where(Column.ALBUM_ID, Is.EQUAL, album.id).count());
albumManager.delete(album.id);
assertEquals(0, trackManager.select().count());
}
@@ -298,18 +287,14 @@ public void testOffsetLimit() {
createAlbums(count);
assertEquals(count, albumManager.select().count());
assertEquals(limit, albumManager.select().limit(limit).count());
- assertEquals(limit, albumManager.select().offset(offset).limit(limit)
- .count());
- assertEquals(count - offset, albumManager.select().offset(offset)
- .count());
+ assertEquals(limit, albumManager.select().offset(offset).limit(limit).count());
+ assertEquals(count - offset, albumManager.select().offset(offset).count());
}
public void testWhere() {
Album album = createAlbum();
- assertEquals(1, albumManager.select().where("_id = ?", album.id)
- .count());
- assertEquals(1, albumManager.select().where("_id = " + album.id)
- .count());
+ assertEquals(1, albumManager.select().where("_id = ?", album.id).count());
+ assertEquals(1, albumManager.select().where("_id = " + album.id).count());
}
public void testM2M() {
View
6 droidparts-test/src/org/droidparts/test/testcase/TestActivityTestCase.java
@@ -23,8 +23,7 @@
import android.content.Context;
import android.test.ActivityInstrumentationTestCase2;
-public class TestActivityTestCase extends
- ActivityInstrumentationTestCase2<TestActivity> {
+public class TestActivityTestCase extends ActivityInstrumentationTestCase2<TestActivity> {
public TestActivityTestCase() {
super(TestActivity.class);
@@ -42,8 +41,7 @@ public void testInjection() throws Exception {
public void testInjection2() {
Class<AbstractDBOpenHelper> cls = AbstractDBOpenHelper.class;
- AbstractDBOpenHelper dependency = Injector.getDependency(getActivity(),
- cls);
+ AbstractDBOpenHelper dependency = Injector.getDependency(getActivity(), cls);
assertNotNull(dependency);
assertTrue(cls.isAssignableFrom(dependency.getClass()));
}
View
12 droidparts-test/src/org/droidparts/test/testcase/rest/RESTClientPostMultipart.java
@@ -41,8 +41,7 @@
private static final String CONTENT_TYPE = "text/plain";
public void testPostMultipartURLConnection() throws Exception {
- HTTPWorker worker = new HttpURLConnectionWorker(getContext(),
- UserAgent.getDefault());
+ HTTPWorker worker = new HttpURLConnectionWorker(getContext(), UserAgent.getDefault());
testPostMultipartFile(worker);
testPostMultipartBytes(worker);
}
@@ -70,12 +69,10 @@ private void testPostMultipartBytes(HTTPWorker worker) throws Exception {
RESTClient2 client = new RESTClient2(getContext(), worker);
byte[] fileBytes = FILE_BODY.getBytes();
// Without content type
- HTTPResponse resp = client.postMultipart(URL, FILE_NAME, FILE_NAME,
- fileBytes);
+ HTTPResponse resp = client.postMultipart(URL, FILE_NAME, FILE_NAME, fileBytes);
assertPostMultipartResponse(resp);
// With content type
- resp = client.postMultipart(URL, FILE_NAME, CONTENT_TYPE, FILE_NAME,
- fileBytes);
+ resp = client.postMultipart(URL, FILE_NAME, CONTENT_TYPE, FILE_NAME, fileBytes);
assertPostMultipartResponse(resp);
}
@@ -87,8 +84,7 @@ private File writeTestFile(String data) throws IOException {
return file;
}
- private void assertPostMultipartResponse(HTTPResponse response)
- throws HTTPException {
+ private void assertPostMultipartResponse(HTTPResponse response) throws HTTPException {
assertNotNull(response);
String body = response.body;
View
15 droidparts-test/src/org/droidparts/test/testcase/serialize/JSONTestCase.java
@@ -37,8 +37,7 @@
public class JSONTestCase extends AndroidTestCase {
public void testPrimitives() throws Exception {
- JSONSerializer<Primitives> serializer = new JSONSerializer<Primitives>(
- Primitives.class, getContext());
+ JSONSerializer<Primitives> serializer = new JSONSerializer<Primitives>(Primitives.class, getContext());
Primitives primitives = serializer.deserialize(getPrimitives());
assertNotNull(primitives.strArr);
//
@@ -58,8 +57,7 @@ public void testPrimitives() throws Exception {
}
public void testAlbums() throws Exception {
- JSONSerializer<Album> serializer = new JSONSerializer<Album>(
- Album.class, getContext());
+ JSONSerializer<Album> serializer = new JSONSerializer<Album>(Album.class, getContext());
ArrayList<Album> albums = serializer.deserializeAll(getAlbums());
assertEquals(2, albums.size());
assertEquals("Diamond", albums.get(0).name);
@@ -68,8 +66,7 @@ public void testAlbums() throws Exception {
public void testNestedKeys() throws Exception {
assertEquals("obj->key", join(new String[] { "obj", "key" }, JSON.SUB));
- JSONSerializer<Nested> serializer = new JSONSerializer<Nested>(
- Nested.class, getContext());
+ JSONSerializer<Nested> serializer = new JSONSerializer<Nested>(Nested.class, getContext());
Nested model = serializer.deserialize(getNested());
assertEquals("str", model.str);
JSONObject obj = serializer.serialize(model);
@@ -80,10 +77,8 @@ public void testNestedKeys() throws Exception {
public void testCollectionsFail() throws Exception {
try {
- JSONSerializer<Collections> ser = new JSONSerializer<Collections>(
- Collections.class, getContext());
- ser.deserialize(new JSONObject(
- getJSONString(R.raw.collections_fail_json)));
+ JSONSerializer<Collections> ser = new JSONSerializer<Collections>(Collections.class, getContext());
+ ser.deserialize(new JSONObject(getJSONString(R.raw.collections_fail_json)));
} catch (Exception e) {
assertTrue(e instanceof SerializerException);
return;
View
15 droidparts-test/src/org/droidparts/test/testcase/serialize/XMLTestCase.java
@@ -36,8 +36,7 @@
public void testAlbums() throws Exception {
Document albumsDoc = getXMLDocument(R.raw.albums_xml);
NodeList nl = albumsDoc.getElementsByTagName("album");
- XMLSerializer<Album> serializer = new XMLSerializer<Album>(Album.class,
- getContext());
+ XMLSerializer<Album> serializer = new XMLSerializer<Album>(Album.class, getContext());
ArrayList<Album> albums = serializer.deserializeAll(nl);
assertEquals(2, albums.size());
assertEquals("Diamond", albums.get(0).name);
@@ -46,8 +45,7 @@ public void testAlbums() throws Exception {
public void testAlbum2() throws Exception {
Document albumDoc = getXMLDocument(R.raw.album2);
- XMLSerializer<Album2> serializer = new XMLSerializer<Album2>(
- Album2.class, getContext());
+ XMLSerializer<Album2> serializer = new XMLSerializer<Album2>(Album2.class, getContext());
Album2 a2 = serializer.deserialize(albumDoc);
assertEquals("Iris", a2.name);
assertEquals(2009, a2.year);
@@ -63,8 +61,7 @@ public void testAlbum2() throws Exception {
public void testFail() throws Exception {
Document albumDoc = getXMLDocument(R.raw.album2);
- XMLSerializer<AlbumFail> serializer = new XMLSerializer<AlbumFail>(
- AlbumFail.class, getContext());
+ XMLSerializer<AlbumFail> serializer = new XMLSerializer<AlbumFail>(AlbumFail.class, getContext());
try {
serializer.deserialize(albumDoc);
assertTrue(false);
@@ -78,8 +75,7 @@ public void testFail() throws Exception {
public void testCollectionsFail() throws Exception {
try {
Document doc = getXMLDocument(R.raw.collections_fail_xml);
- XMLSerializer<Collections> ser = new XMLSerializer<Collections>(
- Collections.class, getContext());
+ XMLSerializer<Collections> ser = new XMLSerializer<Collections>(Collections.class, getContext());
ser.deserialize(doc);
} catch (Exception e) {
assertTrue(e instanceof SerializerException);
@@ -91,8 +87,7 @@ public void testCollectionsFail() throws Exception {
//
private Document getXMLDocument(int resId) throws Exception {
- String xml = IOUtils.readToString(getContext().getResources()
- .openRawResource(resId));
+ String xml = IOUtils.readToString(getContext().getResources().openRawResource(resId));
return XMLSerializer.parseDocument(xml);
}
View
2  droidparts/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.droidparts</groupId>
<artifactId>droidparts-parent</artifactId>
- <version>2.7.5</version>
+ <version>2.7.6</version>
</parent>
<artifactId>droidparts</artifactId>
View
20 droidparts/src/org/droidparts/Injector.java
@@ -16,6 +16,7 @@
package org.droidparts;
import static org.droidparts.inner.ReflectionUtils.setFieldVal;
+import static org.droidparts.util.ui.ViewUtils.getRootView;
import org.droidparts.inner.ClassSpecRegistry;
import org.droidparts.inner.ann.FieldSpec;
@@ -31,15 +32,14 @@
import android.view.View;
/**
- * <meta-data android:name="droidparts_dependency_provider"
- * android:value="com.yanchenko.android.sample.DependencyProvider" />
+ * <meta-data android:name="droidparts_dependency_provider" android:value=
+ * "com.yanchenko.android.sample.DependencyProvider" />
*/
public class Injector {
public static void inject(Activity act) {
setContext(act);
- View root = act.findViewById(android.R.id.content).getRootView();
- inject(act, root, act);
+ inject(act, getRootView(act.getWindow()), act);
}
public static void inject(Service serv) {
@@ -53,8 +53,7 @@ public static void inject(Context ctx, Object target) {
}
public static void inject(Dialog dialog, Object target) {
- View root = dialog.findViewById(android.R.id.content).getRootView();
- inject(root, target);
+ inject(getRootView(dialog.getWindow()), target);
}
public static void inject(View view, Object target) {
@@ -63,8 +62,7 @@ public static void inject(View view, Object target) {
inject(ctx, view, target);
}
- public static <T> T getDependency(Context ctx, Class<T> cls)
- throws RuntimeException {
+ public static <T> T getDependency(Context ctx, Class<T> cls) throws RuntimeException {
setContext(ctx);
return DependencyReader.readVal(ctx, cls);
}
@@ -102,13 +100,11 @@ private static void inject(Context ctx, View root, Object target) {
setFieldVal(target, spec.field, val);
}
} catch (Throwable e) {
- L.w("Failed to inject %s#%s: %s.", cls.getSimpleName(),
- spec.field.getName(), e.getMessage());
+ L.w("Failed to inject %s#%s: %s.", cls.getSimpleName(), spec.field.getName(), e.getMessage());
L.d(e);
}
}
- L.i("Injected into %s in %d ms.", cls.getSimpleName(),
- (System.currentTimeMillis() - start));
+ L.i("Injected into %s in %d ms.", cls.getSimpleName(), (System.currentTimeMillis() - start));
}
private Injector() {
View
9 droidparts/src/org/droidparts/activity/Activity.java
@@ -25,8 +25,7 @@
import android.view.MenuItem;
import android.view.View;
-public abstract class Activity extends android.app.Activity implements
- Injectable {
+public abstract class Activity extends android.app.Activity implements Injectable {
private MenuItem reloadMenuItem;
private View loadingIndicator;
@@ -68,15 +67,13 @@ public final void setActionBarLoadingIndicatorVisible(boolean visible) {
public final void setActionBarReloadMenuItem(MenuItem menuItem) {
this.reloadMenuItem = menuItem;
if (menuItem != null && loadingIndicator == null) {
- loadingIndicator = SecretFragmentsStockUtil
- .fragmentActivityBuildLoadingIndicator(this);
+ loadingIndicator = SecretFragmentsStockUtil.fragmentActivityBuildLoadingIndicator(this);
}
setActionBarLoadingIndicatorVisible(isLoading);
}
public void setFragmentVisible(boolean visible, Fragment... fragments) {
- SecretFragmentsStockUtil.fragmentActivitySetFragmentVisible(this,
- visible, fragments);
+ SecretFragmentsStockUtil.fragmentActivitySetFragmentVisible(this, visible, fragments);
}
}
View
6 droidparts/src/org/droidparts/activity/SingleFragmentActivity.java
@@ -20,8 +20,7 @@
import android.app.Fragment;
import android.os.Bundle;
-public abstract class SingleFragmentActivity<F extends Fragment> extends
- Activity {
+public abstract class SingleFragmentActivity<F extends Fragment> extends Activity {
private F fragment;
@@ -34,8 +33,7 @@ public void onPreInject() {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
fragment = onCreateFragment();
- SecretFragmentsStockUtil
- .singleFragmentActivityAddFragmentToContentView(this, fragment);
+ SecretFragmentsStockUtil.singleFragmentActivityAddFragmentToContentView(this, fragment);
}
protected F getFragment() {
View
6 droidparts/src/org/droidparts/activity/TabbedFragmentActivity.java
@@ -78,8 +78,7 @@ public void addTab(ActionBar.Tab tab, Fragment... tabFragments) {
addTab(fragmentsOnTab.size(), tab, tabFragments);
}
- public void addTab(int position, ActionBar.Tab tab,
- Fragment... tabFragments) {
+ public void addTab(int position, ActionBar.Tab tab, Fragment... tabFragments) {
tab.setTabListener(tabListener);
getActionBar().addTab(tab, position);
fragmentsOnTab.add(position, tabFragments);
@@ -111,8 +110,7 @@ public void setFragmentVisible(boolean visible, Fragment... fragments) {
for (Fragment fragment : fragments) {
if (visible) {
manuallyHiddenFragments.remove(fragment);
- Fragment[] currTabFragments = fragmentsOnTab
- .get(getCurrentTab());
+ Fragment[] currTabFragments = fragmentsOnTab.get(getCurrentTab());
for (Fragment currTabFragment : currTabFragments) {
if (fragment == currTabFragment) {
super.setFragmentVisible(true, fragment);
View
3  droidparts/src/org/droidparts/activity/legacy/ListActivity.java
@@ -21,8 +21,7 @@
import android.os.Bundle;
-public abstract class ListActivity extends android.app.ListActivity implements
- Injectable {
+public abstract class ListActivity extends android.app.ListActivity implements Injectable {
@Override
public void onPreInject() {
View
3  droidparts/src/org/droidparts/activity/legacy/PreferenceActivity.java
@@ -21,8 +21,7 @@
import android.os.Bundle;
-public abstract class PreferenceActivity extends
- android.preference.PreferenceActivity implements Injectable {
+public abstract class PreferenceActivity extends android.preference.PreferenceActivity implements Injectable {
@Override
public void onPreInject() {
View
10 droidparts/src/org/droidparts/adapter/cursor/EntityCursorAdapter.java
@@ -24,8 +24,8 @@
import android.database.Cursor;
import android.view.View;
-public abstract class EntityCursorAdapter<EntityType extends Entity> extends
- CursorAdapter implements AlterableContent<AbstractSelect<EntityType>> {
+public abstract class EntityCursorAdapter<EntityType extends Entity> extends CursorAdapter
+ implements AlterableContent<AbstractSelect<EntityType>> {
protected final EntityManager<EntityType> entityManager;
@@ -33,13 +33,11 @@ public EntityCursorAdapter(Context ctx, Class<EntityType> entityCls) {
this(ctx, entityCls, null);
}
- public EntityCursorAdapter(Context ctx, Class<EntityType> entityCls,
- AbstractSelect<EntityType> select) {
+ public EntityCursorAdapter(Context ctx, Class<EntityType> entityCls, AbstractSelect<EntityType> select) {
this(ctx, new EntityManager<EntityType>(entityCls, ctx), select);
}
- public EntityCursorAdapter(Context ctx,
- EntityManager<EntityType> entityManager,
+ public EntityCursorAdapter(Context ctx, EntityManager<EntityType> entityManager,
AbstractSelect<EntityType> select) {
super(ctx, (select != null) ? select.execute() : null);
this.entityManager = entityManager;
View
6 droidparts/src/org/droidparts/adapter/widget/ArrayAdapter.java
@@ -26,8 +26,7 @@
import android.content.Context;
import android.view.LayoutInflater;
-public class ArrayAdapter<T> extends android.widget.ArrayAdapter<T> implements
- AlterableContent<Collection<T>> {
+public class ArrayAdapter<T> extends android.widget.ArrayAdapter<T>implements AlterableContent<Collection<T>> {
@InjectSystemService
private LayoutInflater layoutInflater;
@@ -44,8 +43,7 @@ public ArrayAdapter(Context ctx, int rowResId, List<T> objects) {
this(ctx, rowResId, android.R.id.text1, objects);
}
- public ArrayAdapter(Context ctx, int rowResId, int textViewResId,
- List<T> objects) {
+ public ArrayAdapter(Context ctx, int rowResId, int textViewResId, List<T> objects) {
super(ctx, rowResId, textViewResId, objects);
Injector.inject(ctx, this);
}
View
3  droidparts/src/org/droidparts/adapter/widget/StringSpinnerAdapter.java
@@ -23,8 +23,7 @@
public class StringSpinnerAdapter extends SpinnerAdapter<String> {
public StringSpinnerAdapter(Spinner spinner, int stringArrResId) {
- this(spinner, spinner.getContext().getResources()
- .getStringArray(stringArrResId));
+ this(spinner, spinner.getContext().getResources().getStringArray(stringArrResId));
}
public StringSpinnerAdapter(Spinner spinner, String[] arr) {
View
3  droidparts/src/org/droidparts/adapter/widget/TextWatcherAdapter.java
@@ -41,8 +41,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
- public void beforeTextChanged(CharSequence s, int start, int count,
- int after) {
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// pass
}
View
2  droidparts/src/org/droidparts/annotation/bus/ReceiveEvents.java
@@ -25,6 +25,6 @@
@Target(METHOD)
public @interface ReceiveEvents {
- String[] name() default "";
+ String[]name() default "";
}
View
27 droidparts/src/org/droidparts/bus/EventBus.java
@@ -60,8 +60,7 @@ public static void clearStickyEvents(String... eventNames) {
if (allEvents) {
stickyEvents.clear();
} else {
- HashSet<String> nameSet = new HashSet<String>(
- Arrays.asList(eventNames));
+ HashSet<String> nameSet = new HashSet<String>(Arrays.asList(eventNames));
for (String eventName : stickyEvents.keySet()) {
if (nameSet.contains(eventName)) {
stickyEvents.remove(eventName);
@@ -71,8 +70,7 @@ public static void clearStickyEvents(String... eventNames) {
}
}
- public static void registerReceiver(EventReceiver<?> receiver,
- String... eventNames) {
+ public static void registerReceiver(EventReceiver<?> receiver, String... eventNames) {
@SuppressWarnings("unchecked")
EventReceiver<Object> rec = (EventReceiver<Object>) receiver;
boolean allEvents = (eventNames.length == 0);
@@ -98,8 +96,7 @@ public static void registerReceiver(EventReceiver<?> receiver,
public static void unregisterReceiver(EventReceiver<?> receiver) {
receiversForEventName(ALL).remove(receiver);
for (String eventName : eventNameToReceivers.keySet()) {
- ConcurrentHashMap<EventReceiver<Object>, Boolean> receivers = eventNameToReceivers
- .get(eventName);
+ ConcurrentHashMap<EventReceiver<Object>, Boolean> receivers = eventNameToReceivers.get(eventName);
receivers.remove(receiver);
if (receivers.isEmpty()) {
eventNameToReceivers.remove(eventName);
@@ -108,16 +105,14 @@ public static void unregisterReceiver(EventReceiver<?> receiver) {
}
public static void registerAnnotatedReceiver(Object obj) {
- MethodSpec<ReceiveEventsAnn>[] specs = getReceiveEventsSpecs(obj
- .getClass());
+ MethodSpec<ReceiveEventsAnn>[] specs = getReceiveEventsSpecs(obj.getClass());
for (MethodSpec<ReceiveEventsAnn> spec : specs) {
registerReceiver(new ReflectiveReceiver(obj, spec), spec.ann.names);
}
}
public static void unregisterAnnotatedReceiver(Object obj) {
- for (ConcurrentHashMap<EventReceiver<Object>, Boolean> receivers : eventNameToReceivers
- .values()) {
+ for (ConcurrentHashMap<EventReceiver<Object>, Boolean> receivers : eventNameToReceivers.values()) {
for (EventReceiver<Object> receiver : receivers.keySet()) {
if (receiver instanceof ReflectiveReceiver) {
if (obj == ((ReflectiveReceiver) receiver).objectRef.get()) {
@@ -128,10 +123,8 @@ public static void unregisterAnnotatedReceiver(Object obj) {
}
}
- private static ConcurrentHashMap<EventReceiver<Object>, Boolean> receiversForEventName(
- String name) {
- ConcurrentHashMap<EventReceiver<Object>, Boolean> map = eventNameToReceivers
- .get(name);
+ private static ConcurrentHashMap<EventReceiver<Object>, Boolean> receiversForEventName(String name) {
+ ConcurrentHashMap<EventReceiver<Object>, Boolean> map = eventNameToReceivers.get(name);
if (map == null) {
map = new ConcurrentHashMap<EventReceiver<Object>, Boolean>();
eventNameToReceivers.put(name, map);
@@ -139,13 +132,11 @@ public static void unregisterAnnotatedReceiver(Object obj) {
return map;
}
- private static void notifyReceiver(EventReceiver<Object> receiver,
- String event, Object data) {
+ private static void notifyReceiver(EventReceiver<Object> receiver, String event, Object data) {
try {
receiver.onEvent(event, data);
} catch (IllegalArgumentException e) {
- L.w(format("Failed to deliver event %s to %s: %s.", event, receiver
- .getClass().getName(), e.getMessage()));
+ L.w(format("Failed to deliver event %s to %s: %s.", event, receiver.getClass().getName(), e.getMessage()));
} catch (Exception e) {
L.w(e);
L.w("Receiver unregistered.");
View
15 droidparts/src/org/droidparts/concurrent/service/IntentService.java
@@ -39,15 +39,13 @@
public static final String EXTRA_ACTION = "__action__";
public static final String EXTRA_EXCEPTION = "__exception__";
- public static final Intent getIntent(Context ctx,
- Class<? extends IntentService> cls, String action) {
+ public static final Intent getIntent(Context ctx, Class<? extends IntentService> cls, String action) {
Intent intent = new Intent(ctx, cls);
intent.setAction(action);
return intent;
}
- public static final Intent getIntent(Context ctx,
- Class<? extends IntentService> cls, String action,
+ public static final Intent getIntent(Context ctx, Class<? extends IntentService> cls, String action,
ResultReceiver resultReceiver) {
Intent intent = getIntent(ctx, cls, action);
intent.putExtra(EXTRA_RESULT_RECEIVER, resultReceiver);
@@ -71,8 +69,7 @@ protected final void onHandleIntent(Intent intent) {
if (data == null) {
data = new Bundle();
}
- ResultReceiver resultReceiver = data
- .getParcelable(EXTRA_RESULT_RECEIVER);
+ ResultReceiver resultReceiver = data.getParcelable(EXTRA_RESULT_RECEIVER);
data.putString(EXTRA_ACTION, action);
try {
data = onExecute(action, data);
@@ -95,8 +92,7 @@ public void removePendingIntents() {
}
}
- protected abstract Bundle onExecute(String action, Bundle data)
- throws Exception;
+ protected abstract Bundle onExecute(String action, Bundle data) throws Exception;
//
@@ -104,8 +100,7 @@ private Handler getHandler() {
Handler handler = null;
try {
if (mServiceHandlerField == null) {
- mServiceHandlerField = android.app.IntentService.class
- .getDeclaredField("mServiceHandler");
+ mServiceHandlerField = android.app.IntentService.class.getDeclaredField("mServiceHandler");
mServiceHandlerField.setAccessible(true);
}
handler = (Handler) mServiceHandlerField.get(this);
View
7 droidparts/src/org/droidparts/concurrent/task/AsyncTask.java
@@ -21,8 +21,8 @@
import android.content.Context;
import android.util.Pair;
-public abstract class AsyncTask<Params, Progress, Result> extends
- android.os.AsyncTask<Params, Progress, Pair<Exception, Result>> {
+public abstract class AsyncTask<Params, Progress, Result>
+ extends android.os.AsyncTask<Params, Progress, Pair<Exception, Result>> {
private final Context ctx;
private final AsyncTaskResultListener<Result> resultListener;
@@ -48,8 +48,7 @@ protected Context getContext() {
try {
long start = System.currentTimeMillis();
res = onExecute(params);
- L.i("Executed %s in %d ms.", getClass().getSimpleName(),
- (System.currentTimeMillis() - start));
+ L.i("Executed %s in %d ms.", getClass().getSimpleName(), (System.currentTimeMillis() - start));
} catch (Exception e) {
L.d(e);
ex = e;
View
6 droidparts/src/org/droidparts/concurrent/task/SimpleAsyncTask.java
@@ -17,11 +17,9 @@
import android.content.Context;
-public abstract class SimpleAsyncTask<Result> extends
- AsyncTask<Void, Integer, Result> {
+public abstract class SimpleAsyncTask<Result> extends AsyncTask<Void, Integer, Result> {
- public SimpleAsyncTask(Context ctx,
- AsyncTaskResultListener<Result> resultListener) {
+ public SimpleAsyncTask(Context ctx, AsyncTaskResultListener<Result> resultListener) {
super(ctx, resultListener);
}
View
3  droidparts/src/org/droidparts/concurrent/thread/BackgroundThreadExecutor.java
@@ -23,8 +23,7 @@
public class BackgroundThreadExecutor extends ThreadPoolExecutor {
public BackgroundThreadExecutor(int nThreads, String name) {
- super(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS,
- new LinkedBlockingQueue<Runnable>(),
+ super(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(),
new BackgroundThreadFactory(name));
}
View
9 droidparts/src/org/droidparts/fragment/DialogFragment.java
@@ -29,8 +29,7 @@
private boolean injected;
@Override
- public final View onCreateView(LayoutInflater inflater,
- ViewGroup container, Bundle savedInstanceState) {
+ public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = onCreateView(savedInstanceState, inflater, container);
if (view != null) {
Injector.inject(view, this);
@@ -41,8 +40,7 @@ public final View onCreateView(LayoutInflater inflater,
return view;
}
- public View onCreateView(Bundle savedInstanceState,
- LayoutInflater inflater, ViewGroup container) {
+ public View onCreateView(Bundle savedInstanceState, LayoutInflater inflater, ViewGroup container) {
return super.onCreateView(inflater, container, savedInstanceState);
}
@@ -51,8 +49,7 @@ public final boolean isInjected() {
}
public void show(Activity activity) {
- SecretFragmentsStockUtil.dialogFragmentShowDialogFragment(activity,
- this);
+ SecretFragmentsStockUtil.dialogFragmentShowDialogFragment(activity, this);
}
}
View
6 droidparts/src/org/droidparts/fragment/Fragment.java
@@ -27,16 +27,14 @@
private boolean injected;
@Override
- public final View onCreateView(LayoutInflater inflater,
- ViewGroup container, Bundle savedInstanceState) {
+ public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = onCreateView(savedInstanceState, inflater, container);
Injector.inject(view, this);
injected = true;
return view;
}
- public View onCreateView(Bundle savedInstanceState,
- LayoutInflater inflater, ViewGroup container) {
+ public View onCreateView(Bundle savedInstanceState, LayoutInflater inflater, ViewGroup container) {
return super.onCreateView(inflater, container, savedInstanceState);
}
View
6 droidparts/src/org/droidparts/fragment/ListFragment.java
@@ -27,16 +27,14 @@
private boolean injected;
@Override
- public final View onCreateView(LayoutInflater inflater,
- ViewGroup container, Bundle savedInstanceState) {
+ public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = onCreateView(savedInstanceState, inflater, container);
Injector.inject(view, this);
injected = true;
return view;
}
- public View onCreateView(Bundle savedInstanceState,
- LayoutInflater inflater, ViewGroup container) {
+ public View onCreateView(Bundle savedInstanceState, LayoutInflater inflater, ViewGroup container) {
return super.onCreateView(inflater, container, savedInstanceState);
}
View
6 droidparts/src/org/droidparts/fragment/PreferenceFragment.java
@@ -27,16 +27,14 @@
private boolean injected;
@Override
- public final View onCreateView(LayoutInflater inflater,
- ViewGroup container, Bundle savedInstanceState) {
+ public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = onCreateView(savedInstanceState, inflater, container);
Injector.inject(view, this);
injected = true;
return view;
}
- public View onCreateView(Bundle savedInstanceState,
- LayoutInflater inflater, ViewGroup container) {
+ public View onCreateView(Bundle savedInstanceState, LayoutInflater inflater, ViewGroup container) {
return super.onCreateView(inflater, container, savedInstanceState);
}
View
3  droidparts/src/org/droidparts/inner/AnnotationElementsReader.java
@@ -28,8 +28,7 @@
private static Field nameField;
private static Method validateValueMethod;
- public static HashMap<String, Object> getElements(Annotation annotation)
- throws Exception {
+ public static HashMap<String, Object> getElements(Annotation annotation) throws Exception {
HashMap<String, Object> map = new HashMap<String, Object>();
InvocationHandler handler = Proxy.getInvocationHandler(annotation);
if (elementsField == null) {
View
17 droidparts/src/org/droidparts/inner/BitmapFactoryUtils.java
@@ -37,9 +37,8 @@ public static Point calcDecodeSizeHint(ImageView imageView) {
return p;
}
- public static Pair<Bitmap, BitmapFactory.Options> decodeScaled(byte[] data,
- int reqWidth, int reqHeight, Bitmap.Config config, Bitmap inBitmap)
- throws Exception {
+ public static Pair<Bitmap, BitmapFactory.Options> decodeScaled(byte[] data, int reqWidth, int reqHeight,
+ Bitmap.Config config, Bitmap inBitmap) throws Exception {
BitmapFactory.Options opts = new BitmapFactory.Options();
boolean gotSizeHint = (reqWidth > 0) || (reqHeight > 0);
boolean gotConfig = (config != null);
@@ -65,8 +64,7 @@ public static Point calcDecodeSizeHint(ImageView imageView) {
if (inBitmapSupported() && inBitmap != null) {
opts.inBitmap = null;
try {
- bm = BitmapFactory.decodeByteArray(data, 0, data.length,
- opts);
+ bm = BitmapFactory.decodeByteArray(data, 0, data.length, opts);
L.w(t);
} catch (Throwable th) {
System.gc();
@@ -79,8 +77,7 @@ public static Point calcDecodeSizeHint(ImageView imageView) {
if (bm == null) {
throw new IOException("BitmapFactory returned null.");
} else if (bm.getWidth() <= 0 || bm.getHeight() <= 0) {
- throw new IOException(String.format("Invalid Bitmap: w:%d, h:%d.",
- bm.getWidth(), bm.getHeight()));
+ throw new IOException(String.format("Invalid Bitmap: w:%d, h:%d.", bm.getWidth(), bm.getHeight()));
}
return Pair.create(bm, opts);
}
@@ -89,8 +86,7 @@ private static boolean inBitmapSupported() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
}
- private static int calcInSampleSize(BitmapFactory.Options opts,
- int reqWidth, int reqHeight) {
+ private static int calcInSampleSize(BitmapFactory.Options opts, int reqWidth, int reqHeight) {
int height = opts.outHeight;
int width = opts.outWidth;
int inSampleSize = 1;
@@ -103,8 +99,7 @@ private static int calcInSampleSize(BitmapFactory.Options opts,
if (reqWidth > 0) {
widthRatio = Math.round((float) width / (float) reqWidth);
}
- inSampleSize = (heightRatio < widthRatio) ? heightRatio
- : widthRatio;
+ inSampleSize = (heightRatio < widthRatio) ? heightRatio : widthRatio;
}
return inSampleSize;
}
View
31 droidparts/src/org/droidparts/inner/ClassSpecRegistry.java
@@ -80,8 +80,7 @@
// Bus
@SuppressWarnings("unchecked")
- public static MethodSpec<ReceiveEventsAnn>[] getReceiveEventsSpecs(
- Class<?> cls) {
+ public static MethodSpec<ReceiveEventsAnn>[] getReceiveEventsSpecs(Class<?> cls) {
MethodSpec<ReceiveEventsAnn>[] specs = RECEIVE_EVENTS_SPECS.get(cls);
if (specs == null) {
ArrayList<MethodSpec<ReceiveEventsAnn>> list = new ArrayList<MethodSpec<ReceiveEventsAnn>>();
@@ -117,8 +116,7 @@ public static String getTableName(Class<? extends Entity> cls) {
}
@SuppressWarnings("unchecked")
- public static FieldSpec<ColumnAnn>[] getTableColumnSpecs(
- Class<? extends Entity> cls) {
+ public static FieldSpec<ColumnAnn>[] getTableColumnSpecs(Class<? extends Entity> cls) {
FieldSpec<ColumnAnn>[] specs = COLUMN_SPECS.get(cls);
if (specs == null) {
ArrayList<FieldSpec<ColumnAnn>> list = new ArrayList<FieldSpec<ColumnAnn>>();
@@ -128,8 +126,7 @@ public static String getTableName(Class<? extends Entity> cls) {
if (ann != null) {
Class<?> componentType = getComponentType(field);
ann.name = getColumnName(ann, field);
- list.add(new FieldSpec<ColumnAnn>(field, componentType,
- ann));
+ list.add(new FieldSpec<ColumnAnn>(field, componentType, ann));
}
}
}
@@ -152,8 +149,7 @@ public static String getTableName(Class<? extends Entity> cls) {
if (ann != null) {
Class<?> componentType = getComponentType(field);
ann.key = getName(ann.key, field);
- list.add(new FieldSpec<JSONAnn>(field, componentType,
- ann));
+ list.add(new FieldSpec<JSONAnn>(field, componentType, ann));
}
}
}
@@ -175,8 +171,7 @@ public static String getTableName(Class<? extends Entity> cls) {
if (ann != null) {
Class<?> componentType = getComponentType(field);
ann.tag = getName(ann.tag, field);
- list.add(new FieldSpec<XMLAnn>(field, componentType,
- ann));
+ list.add(new FieldSpec<XMLAnn>(field, componentType, ann));
}
}
}
@@ -206,8 +201,7 @@ public static String getTableName(Class<? extends Entity> cls) {
componentType = getArrayComponentType(fieldType);
} else if (isCollection(fieldType)) {
Class<?>[] genericArgs = getFieldGenericArgs(field);
- componentType = (genericArgs.length > 0) ? genericArgs[0]
- : Object.class;
+ componentType = (genericArgs.length > 0) ? genericArgs[0] : Object.class;
}
return componentType;
}
@@ -236,18 +230,13 @@ private static String getColumnName(ColumnAnn ann, Field field) {
private static final String ID_AFFIX = "_id";
- private static void sanitizeSpecs(
- ArrayList<FieldSpec<ColumnAnn>> columnSpecs) {
+ private static void sanitizeSpecs(ArrayList<FieldSpec<ColumnAnn>> columnSpecs) {
for (FieldSpec<ColumnAnn> spec : columnSpecs) {
Class<?> fieldType = spec.field.getType();
if (spec.ann.nullable) {
- if (isBoolean(fieldType, false) || isInteger(fieldType, false)
- || isLong(fieldType, false)
- || isFloat(fieldType, false)
- || isDouble(fieldType, false)
- || isByte(fieldType, false)
- || isShort(fieldType, false)
- || isCharacter(fieldType, false)) {
+ if (isBoolean(fieldType, false) || isInteger(fieldType, false) || isLong(fieldType, false)
+ || isFloat(fieldType, false) || isDouble(fieldType, false) || isByte(fieldType, false)
+ || isShort(fieldType, false) || isCharacter(fieldType, false)) {
L.w("%s can't be null.", fieldType.getSimpleName());
spec.ann.nullable = false;
}
View
6 droidparts/src/org/droidparts/inner/ConverterRegistry.java
@@ -74,8 +74,7 @@ public static void registerConverter(Converter<?> converter) {
}
@SuppressWarnings("unchecked")
- public static <T> Converter<T> getConverter(Class<T> cls)
- throws IllegalArgumentException {
+ public static <T> Converter<T> getConverter(Class<T> cls) throws IllegalArgumentException {
Converter<?> converter = map.get(cls);
if (converter == null) {
for (Converter<?> conv : converters) {
@@ -89,8 +88,7 @@ public static void registerConverter(Converter<?> converter) {
if (converter != null) {
return (Converter<T>) converter;
} else {
- throw new IllegalArgumentException("No converter for '"
- + cls.getName() + "'.");
+ throw new IllegalArgumentException("No converter for '" + cls.getName() + "'.");
}
}
View
3  droidparts/src/org/droidparts/inner/ManifestMetaData.java
@@ -37,8 +37,7 @@
public static String get(Context ctx, String key) {
try {
- return ctx.getPackageManager().getApplicationInfo(
- ctx.getPackageName(), GET_META_DATA).metaData
+ return ctx.getPackageManager().getApplicationInfo(ctx.getPackageName(), GET_META_DATA).metaData
.getString(key);
} catch (Exception e) {
return null;
View
74 droidparts/src/org/droidparts/inner/PersistUtils.java
@@ -68,8 +68,7 @@ public static Object fromBytes(byte[] arr) throws Exception {
// JSON
- public static boolean hasNonNull(JSONObject obj, String key)
- throws JSONException {
+ public static boolean hasNonNull(JSONObject obj, String key) throws JSONException {
return obj.has(key) && !NULL.equals(obj.get(key));
}
@@ -94,8 +93,8 @@ public static String getNodeText(Node n) {
return arr;
}
- public static <EntityType extends Entity> EntityType readFirst(
- AbstractEntityManager<EntityType> entityManager, Cursor cursor) {
+ public static <EntityType extends Entity> EntityType readFirst(AbstractEntityManager<EntityType> entityManager,
+ Cursor cursor) {
EntityType item = null;
try {
if (cursor.moveToFirst()) {
@@ -154,22 +153,18 @@ public static String buildPlaceholders(int count) {
return sb.toString();
}
- public static int getRowCount(SQLiteDatabase db, boolean distinct,
- String table, String[] columns, String selection,
- String[] selectionArgs, String groupBy, String having,
- String orderBy, String limit) {
+ public static int getRowCount(SQLiteDatabase db, boolean distinct, String table, String[] columns, String selection,
+ String[] selectionArgs, String groupBy, String having, String orderBy, String limit) {
if (columns != null && columns.length > 0) {
columns = new String[] { columns[0] };
}
- String sql = SQLiteQueryBuilder.buildQueryString(distinct, table,
- columns, selection, groupBy, having, orderBy, limit);
+ String sql = SQLiteQueryBuilder.buildQueryString(distinct, table, columns, selection, groupBy, having, orderBy,
+ limit);
String countSelection = "SELECT count(*) FROM (" + sql + ")";
- return (int) DatabaseUtils.longForQuery(db, countSelection,
- selectionArgs);
+ return (int) DatabaseUtils.longForQuery(db, countSelection, selectionArgs);
}
- public static <Result> Result executeInTransaction(SQLiteDatabase db,
- Callable<Result> task) {
+ public static <Result> Result executeInTransaction(SQLiteDatabase db, Callable<Result> task) {
db.beginTransaction();
try {
Result result = task.call();
@@ -186,8 +181,7 @@ public static int getRowCount(SQLiteDatabase db, boolean distinct,
// DBOpenHelper
- public static boolean executeStatements(final SQLiteDatabase db,
- final ArrayList<String> statements) {
+ public static boolean executeStatements(final SQLiteDatabase db, final ArrayList<String> statements) {
Callable<Boolean> task = new Callable<Boolean>() {
@Override
@@ -203,8 +197,7 @@ public Boolean call() throws Exception {
return (result != null);
}
- public static ArrayList<String> getDropTables(SQLiteDatabase db,
- String... optionalTableNames) {
+ public static ArrayList<String> getDropTables(SQLiteDatabase db, String... optionalTableNames) {
HashSet<String> tableNames = new HashSet<String>();
if (optionalTableNames.length == 0) {
tableNames.addAll(getTableNames(db));
@@ -219,11 +212,10 @@ public Boolean call() throws Exception {
}
@SuppressWarnings("unchecked")
- public static <T> ArrayList<String> getAddMissingColumns(SQLiteDatabase db,
- Class<? extends Entity> cls) throws Exception {
+ public static <T> ArrayList<String> getAddMissingColumns(SQLiteDatabase db, Class<? extends Entity> cls)
+ throws Exception {
String tableName = getTableName(cls);
- FieldSpec<ColumnAnn>[] columnSpecs = ClassSpecRegistry
- .getTableColumnSpecs(cls);
+ FieldSpec<ColumnAnn>[] columnSpecs = ClassSpecRegistry.getTableColumnSpecs(cls);
ArrayList<String> presentColumns = getColumnNames(db, tableName);
ArrayList<FieldSpec<ColumnAnn>> columns = new ArrayList<FieldSpec<ColumnAnn>>();
@@ -236,26 +228,24 @@ public Boolean call() throws Exception {
ArrayList<String> statements = new ArrayList<String>();
for (FieldSpec<ColumnAnn> spec : columns) {
Entity entity = ReflectionUtils.newInstance(cls);
- Converter<T> converter = (Converter<T>) ConverterRegistry
- .getConverter(spec.field.getType());
+ Converter<T> converter = (Converter<T>) ConverterRegistry.getConverter(spec.field.getType());
Object defaultVal = ReflectionUtils.getFieldVal(entity, spec.field);
//
if (defaultVal != null) {
ContentValues cv = new ContentValues();
- converter.putToContentValues((Class<T>) spec.field.getType(),
- spec.componentType, cv, DEFAULT, (T) defaultVal);
+ converter.putToContentValues((Class<T>) spec.field.getType(), spec.componentType, cv, DEFAULT,
+ (T) defaultVal);
defaultVal = cv.get(DEFAULT);
}
//
- String statement = getAddColumn(tableName, spec.ann.name,
- converter.getDBColumnType(), spec.ann.nullable, defaultVal);
+ String statement = getAddColumn(tableName, spec.ann.name, converter.getDBColumnType(), spec.ann.nullable,
+ defaultVal);
statements.add(statement);
}
return statements;
}
- public static String getAddColumn(String table, String name, String type,
- boolean nullable, Object defaultVal) {
+ public static String getAddColumn(String table, String name, String type, boolean nullable, Object defaultVal) {
StringBuilder sb = new StringBuilder();
sb.append(ALTER_TABLE).append(table);
sb.append(ADD_COLUMN).append(name).append(type);
@@ -267,8 +257,7 @@ public static String getAddColumn(String table, String name, String type,
return sb.toString();