Skip to content
Browse files

Format code with using Android format standart for Eclipse (formattin…

…g.xml)
  • Loading branch information...
1 parent 07b8b78 commit 7dc595f602369c74a91d9125e2c5d1622345a342 Prototik committed Oct 31, 2012
Showing with 9,655 additions and 9,346 deletions.
  1. +185 −184 demo/src/org/holoeverywhere/demo/DemoActivity.java
  2. +8 −7 demo/src/org/holoeverywhere/demo/DemoApplication.java
  3. +53 −50 demo/src/org/holoeverywhere/demo/fragments/AboutFragment.java
  4. +12 −11 demo/src/org/holoeverywhere/demo/fragments/CalendarFragment.java
  5. +68 −65 demo/src/org/holoeverywhere/demo/fragments/MainFragment.java
  6. +6 −5 demo/src/org/holoeverywhere/demo/fragments/PreferenceFragment.java
  7. +57 −56 demo/src/org/holoeverywhere/demo/widget/OtherButton.java
  8. +48 −47 demo/src/org/holoeverywhere/demo/widget/WidgetContainer.java
  9. +252 −0 formatting.xml
  10. +87 −86 library/src/android/support/v4/app/_HoloActivity.java
  11. +43 −42 library/src/android/support/v4/app/_HoloFragment.java
  12. +63 −62 library/src/com/actionbarsherlock/internal/view/menu/ContextMenuBuilder.java
  13. +94 −93 library/src/com/actionbarsherlock/internal/view/menu/ContextMenuDecorView.java
  14. +9 −8 library/src/com/actionbarsherlock/internal/view/menu/ContextMenuItemWrapper.java
  15. +8 −7 library/src/com/actionbarsherlock/internal/view/menu/ContextMenuListener.java
  16. +47 −46 library/src/com/actionbarsherlock/internal/view/menu/ContextMenuWrapper.java
  17. +40 −39 library/src/com/actionbarsherlock/internal/view/menu/ExpandedMenuView.java
  18. +241 −240 library/src/com/actionbarsherlock/internal/view/menu/HoloListMenuItemView.java
  19. +235 −234 library/src/com/actionbarsherlock/internal/view/menu/ListMenuPresenter.java
  20. +108 −107 library/src/com/actionbarsherlock/internal/view/menu/MenuDialogHelper.java
  21. +8 −7 library/src/com/actionbarsherlock/view/ContextMenu.java
  22. +305 −304 library/src/org/holoeverywhere/ArrayAdapter.java
  23. +161 −160 library/src/org/holoeverywhere/FontLoader.java
  24. +246 −245 library/src/org/holoeverywhere/LayoutInflater.java
  25. +274 −273 library/src/org/holoeverywhere/Setting.java
  26. +62 −62 library/src/org/holoeverywhere/SystemServiceManager.java
  27. +356 −355 library/src/org/holoeverywhere/ThemeManager.java
  28. +215 −214 library/src/org/holoeverywhere/app/Activity.java
  29. +430 −429 library/src/org/holoeverywhere/app/AlertDialog.java
  30. +204 −204 library/src/org/holoeverywhere/app/Application.java
  31. +14 −13 library/src/org/holoeverywhere/app/Base.java
  32. +12 −11 library/src/org/holoeverywhere/app/BaseFragment.java
  33. +114 −113 library/src/org/holoeverywhere/app/DatePickerDialog.java
  34. +38 −38 library/src/org/holoeverywhere/app/Dialog.java
  35. +310 −314 library/src/org/holoeverywhere/app/DialogFragment.java
  36. +92 −91 library/src/org/holoeverywhere/app/ExpandableListActivity.java
  37. +141 −140 library/src/org/holoeverywhere/app/Fragment.java
  38. +94 −93 library/src/org/holoeverywhere/app/ListActivity.java
  39. +200 −199 library/src/org/holoeverywhere/app/ListFragment.java
  40. +294 −293 library/src/org/holoeverywhere/app/ProgressDialog.java
  41. +76 −75 library/src/org/holoeverywhere/app/TimePickerDialog.java
  42. +259 −258 library/src/org/holoeverywhere/drawable/RotateDrawable.java
  43. +749 −744 library/src/org/holoeverywhere/internal/AlertController.java
  44. +49 −48 library/src/org/holoeverywhere/internal/ContentResolverCompat.java
  45. +38 −37 library/src/org/holoeverywhere/internal/DialogTitle.java
  46. +232 −230 library/src/org/holoeverywhere/internal/GenericInflater.java
  47. +11 −11 library/src/org/holoeverywhere/internal/NumberPickerEditText.java
  48. +226 −225 library/src/org/holoeverywhere/internal/RingtonePicker.java
  49. +3 −2 library/src/org/holoeverywhere/internal/ViewCompat.java
  50. +16 −15 library/src/org/holoeverywhere/internal/WindowCompat.java
  51. +463 −463 library/src/org/holoeverywhere/internal/_SharedPreferencesImpl_JSON.java
  52. +318 −318 library/src/org/holoeverywhere/internal/_SharedPreferencesImpl_XML.java
  53. +28 −27 library/src/org/holoeverywhere/preference/CheckBoxPreference.java
  54. +261 −260 library/src/org/holoeverywhere/preference/DialogPreference.java
  55. +140 −139 library/src/org/holoeverywhere/preference/EditTextPreference.java
  56. +190 −189 library/src/org/holoeverywhere/preference/ListPreference.java
  57. +176 −175 library/src/org/holoeverywhere/preference/MultiSelectListPreference.java
  58. +232 −231 library/src/org/holoeverywhere/preference/NumberPickerPreference.java
  59. +3 −2 library/src/org/holoeverywhere/preference/OnDependencyChangeListener.java
  60. +951 −950 library/src/org/holoeverywhere/preference/Preference.java
Sorry, we could not display the entire diff because it was too big.
View
369 demo/src/org/holoeverywhere/demo/DemoActivity.java
@@ -1,3 +1,4 @@
+
package org.holoeverywhere.demo;
import org.holoeverywhere.ArrayAdapter;
@@ -35,187 +36,187 @@
@Holo(forceThemeApply = true, layout = R.layout.content)
public class DemoActivity extends SActivity {
- private final class FragmentListener implements TabListener {
- private final Class<? extends Fragment> clazz;
- private Fragment fragment;
-
- public FragmentListener(Class<? extends Fragment> clazz) {
- this.clazz = clazz;
- }
-
- @Override
- public void onTabReselected(Tab tab, FragmentTransaction ft) {
-
- }
-
- @Override
- public void onTabSelected(Tab tab, FragmentTransaction ft) {
- if (fragment == null) {
- try {
- fragment = clazz.newInstance();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- ft.replace(R.id.content, fragment);
- ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
- findViewById(R.id.themeButtonsBar).setVisibility(View.VISIBLE);
- }
-
- @Override
- public void onTabUnselected(Tab tab, FragmentTransaction ft) {
-
- }
- }
-
- private void addTab(Class<? extends Fragment> clazz, String title) {
- Tab tab = getSupportActionBar().newTab();
- tab.setText(title);
- tab.setTabListener(new FragmentListener(clazz));
- getSupportActionBar().addTab(tab);
- }
-
- public void closeCalendar(View v) {
- replaceFragment(R.id.content, MainFragment.getInstance());
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- if (isABSSupport()) {
- getSupportActionBar().setDisplayShowTitleEnabled(false);
- getSupportActionBar().setDisplayShowHomeEnabled(false);
- getSupportActionBar().setNavigationMode(
- ActionBar.NAVIGATION_MODE_TABS);
- addTab(MainFragment.class, "Holo Demo");
- addTab(PreferenceFragment.class, "Settings");
- addTab(AboutFragment.class, "About");
- } else {
- replaceFragment(R.id.content, MainFragment.getInstance());
- }
- }
-
- public void replaceFragment(int resId, Fragment fragment) {
- replaceFragment(resId, fragment, null);
- }
-
- public void replaceFragment(int resId, Fragment fragment,
- String backStackName) {
- FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
- ft.replace(resId, fragment);
- ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
- if (backStackName != null) {
- ft.addToBackStack(backStackName);
- }
- ft.commit();
- }
-
- public void setDarkTheme(View v) {
- ThemeManager.restartWithDarkTheme(this);
- }
-
- public void setLightTheme(View v) {
- ThemeManager.restartWithLightTheme(this);
- }
-
- public void setMixedTheme(View v) {
- ThemeManager.restartWithLightWithDarkActionBarTheme(this);
- }
-
- public void showAbout(View v) {
- replaceFragment(R.id.content, new AboutFragment(), "about");
- }
-
- public void showAlertDialog(View v) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle("AlertDialog");
- builder.setIcon(R.drawable.alert_dialog);
- builder.setMessage("Is fully-working port of AlertDialog from Android Jelly Bean\n"
- + "Yes, I know it's a long text. At the same time check that part.");
- builder.setPositiveButton("Positive", null);
- builder.setNegativeButton("Negative", null);
- builder.setNeutralButton("Neutral", null);
- builder.show();
- }
-
- public void showCalendar(View v) {
- replaceFragment(R.id.content, CalendarFragment.getInstance(),
- isABSSupport() ? null : "calendar");
- }
-
- public void showContextMenu(View v) {
- MainFragment.getInstance().showContextMenu(v);
- }
-
- public void showDatePicker(View v) {
- new DatePickerDialog(this, null, 2012, 11, 21).show();
- }
-
- @SuppressLint("NewApi")
- public void showListPopupWindow(View v) {
- final ListPopupWindow w = new ListPopupWindow(this);
- w.setAnchorView(v);
- w.setAdapter(ArrayAdapter.createFromResource(this, R.array.countries,
- R.layout.list_popup_window_row));
- w.setOnItemClickListener(new OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
- long arg3) {
- w.dismiss();
- }
- });
- w.show();
- }
-
- public void showNumberPicker(View v) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle("Select number");
- View view = LayoutInflater.inflate(this, R.layout.number_picker_demo);
- NumberPicker picker = (NumberPicker) view
- .findViewById(R.id.numberPicker);
- picker.setMinValue(1);
- picker.setMaxValue(15);
- picker.setValue(3);
- builder.setView(view);
- builder.setNegativeButton(android.R.string.cancel, null);
- builder.show();
- }
-
- public void showPopupWindow(View v) {
- View content = LayoutInflater.inflate(this, R.layout.popup_window);
- final PopupWindow w = new PopupWindow(content,
- LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
- w.setBackgroundDrawable(getResources().getDrawable(
- ThemeManager.isLight(this) ? R.drawable.dialog_full_holo_light
- : R.drawable.dialog_full_holo_dark));
- content.findViewById(R.id.imageButton).setOnClickListener(
- new OnClickListener() {
- @Override
- public void onClick(View v) {
- w.dismiss();
- }
- });
- w.setFocusable(true);
- w.showAtLocation(getWindow().getDecorView(), Gravity.CENTER, 0, 0);
- }
-
- public void showPreferences(View v) {
- replaceFragment(android.R.id.content, new PreferenceFragment(), "prefs");
- }
-
- public void showProgressDialog(View v) {
- ProgressDialog dialog = new ProgressDialog(this);
- dialog.setCancelable(true);
- dialog.setIndeterminate(true);
- dialog.setMessage("I can close!");
- dialog.show();
- }
-
- public void showTimePicker(View v) {
- new TimePickerDialog(this, null, 12, 34, false).show();
- }
-
- public void showToast(View v) {
- Toast.makeText(this, "Toast example", Toast.LENGTH_LONG).show();
- }
-}
+ private final class FragmentListener implements TabListener {
+ private final Class<? extends Fragment> clazz;
+ private Fragment fragment;
+
+ public FragmentListener(Class<? extends Fragment> clazz) {
+ this.clazz = clazz;
+ }
+
+ @Override
+ public void onTabReselected(Tab tab, FragmentTransaction ft) {
+
+ }
+
+ @Override
+ public void onTabSelected(Tab tab, FragmentTransaction ft) {
+ if (fragment == null) {
+ try {
+ fragment = clazz.newInstance();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ ft.replace(R.id.content, fragment);
+ ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
+ findViewById(R.id.themeButtonsBar).setVisibility(View.VISIBLE);
+ }
+
+ @Override
+ public void onTabUnselected(Tab tab, FragmentTransaction ft) {
+
+ }
+ }
+
+ private void addTab(Class<? extends Fragment> clazz, String title) {
+ Tab tab = getSupportActionBar().newTab();
+ tab.setText(title);
+ tab.setTabListener(new FragmentListener(clazz));
+ getSupportActionBar().addTab(tab);
+ }
+
+ public void closeCalendar(View v) {
+ replaceFragment(R.id.content, MainFragment.getInstance());
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (isABSSupport()) {
+ getSupportActionBar().setDisplayShowTitleEnabled(false);
+ getSupportActionBar().setDisplayShowHomeEnabled(false);
+ getSupportActionBar().setNavigationMode(
+ ActionBar.NAVIGATION_MODE_TABS);
+ addTab(MainFragment.class, "Holo Demo");
+ addTab(PreferenceFragment.class, "Settings");
+ addTab(AboutFragment.class, "About");
+ } else {
+ replaceFragment(R.id.content, MainFragment.getInstance());
+ }
+ }
+
+ public void replaceFragment(int resId, Fragment fragment) {
+ replaceFragment(resId, fragment, null);
+ }
+
+ public void replaceFragment(int resId, Fragment fragment,
+ String backStackName) {
+ FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
+ ft.replace(resId, fragment);
+ ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
+ if (backStackName != null) {
+ ft.addToBackStack(backStackName);
+ }
+ ft.commit();
+ }
+
+ public void setDarkTheme(View v) {
+ ThemeManager.restartWithDarkTheme(this);
+ }
+
+ public void setLightTheme(View v) {
+ ThemeManager.restartWithLightTheme(this);
+ }
+
+ public void setMixedTheme(View v) {
+ ThemeManager.restartWithLightWithDarkActionBarTheme(this);
+ }
+
+ public void showAbout(View v) {
+ replaceFragment(R.id.content, new AboutFragment(), "about");
+ }
+
+ public void showAlertDialog(View v) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle("AlertDialog");
+ builder.setIcon(R.drawable.alert_dialog);
+ builder.setMessage("Is fully-working port of AlertDialog from Android Jelly Bean\n"
+ + "Yes, I know it's a long text. At the same time check that part.");
+ builder.setPositiveButton("Positive", null);
+ builder.setNegativeButton("Negative", null);
+ builder.setNeutralButton("Neutral", null);
+ builder.show();
+ }
+
+ public void showCalendar(View v) {
+ replaceFragment(R.id.content, CalendarFragment.getInstance(),
+ isABSSupport() ? null : "calendar");
+ }
+
+ public void showContextMenu(View v) {
+ MainFragment.getInstance().showContextMenu(v);
+ }
+
+ public void showDatePicker(View v) {
+ new DatePickerDialog(this, null, 2012, 11, 21).show();
+ }
+
+ @SuppressLint("NewApi")
+ public void showListPopupWindow(View v) {
+ final ListPopupWindow w = new ListPopupWindow(this);
+ w.setAnchorView(v);
+ w.setAdapter(ArrayAdapter.createFromResource(this, R.array.countries,
+ R.layout.list_popup_window_row));
+ w.setOnItemClickListener(new OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
+ long arg3) {
+ w.dismiss();
+ }
+ });
+ w.show();
+ }
+
+ public void showNumberPicker(View v) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle("Select number");
+ View view = LayoutInflater.inflate(this, R.layout.number_picker_demo);
+ NumberPicker picker = (NumberPicker) view
+ .findViewById(R.id.numberPicker);
+ picker.setMinValue(1);
+ picker.setMaxValue(15);
+ picker.setValue(3);
+ builder.setView(view);
+ builder.setNegativeButton(android.R.string.cancel, null);
+ builder.show();
+ }
+
+ public void showPopupWindow(View v) {
+ View content = LayoutInflater.inflate(this, R.layout.popup_window);
+ final PopupWindow w = new PopupWindow(content,
+ LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+ w.setBackgroundDrawable(getResources().getDrawable(
+ ThemeManager.isLight(this) ? R.drawable.dialog_full_holo_light
+ : R.drawable.dialog_full_holo_dark));
+ content.findViewById(R.id.imageButton).setOnClickListener(
+ new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ w.dismiss();
+ }
+ });
+ w.setFocusable(true);
+ w.showAtLocation(getWindow().getDecorView(), Gravity.CENTER, 0, 0);
+ }
+
+ public void showPreferences(View v) {
+ replaceFragment(android.R.id.content, new PreferenceFragment(), "prefs");
+ }
+
+ public void showProgressDialog(View v) {
+ ProgressDialog dialog = new ProgressDialog(this);
+ dialog.setCancelable(true);
+ dialog.setIndeterminate(true);
+ dialog.setMessage("I can close!");
+ dialog.show();
+ }
+
+ public void showTimePicker(View v) {
+ new TimePickerDialog(this, null, 12, 34, false).show();
+ }
+
+ public void showToast(View v) {
+ Toast.makeText(this, "Toast example", Toast.LENGTH_LONG).show();
+ }
+}
View
15 demo/src/org/holoeverywhere/demo/DemoApplication.java
@@ -1,15 +1,16 @@
+
package org.holoeverywhere.demo;
import org.holoeverywhere.LayoutInflater;
import org.holoeverywhere.ThemeManager;
import org.holoeverywhere.app.Application;
public class DemoApplication extends Application {
- static {
- getConfig().setUseThemeManager(true).setAlwaysUseParentTheme(true)
- .setDebugMode(true);
- LayoutInflater.remap(getConfig().getHoloEverywherePackage()
- + ".demo.widget", "WidgetContainer", "OtherButton");
- ThemeManager.modify(ThemeManager.FULLSCREEN);
- }
+ static {
+ getConfig().setUseThemeManager(true).setAlwaysUseParentTheme(true)
+ .setDebugMode(true);
+ LayoutInflater.remap(getConfig().getHoloEverywherePackage()
+ + ".demo.widget", "WidgetContainer", "OtherButton");
+ ThemeManager.modify(ThemeManager.FULLSCREEN);
+ }
}
View
103 demo/src/org/holoeverywhere/demo/fragments/AboutFragment.java
@@ -1,3 +1,4 @@
+
package org.holoeverywhere.demo.fragments;
import org.holoeverywhere.LayoutInflater;
@@ -12,63 +13,65 @@
import android.view.ViewGroup;
public class AboutFragment extends SFragment {
- private final class EmailListener implements OnClickListener {
- private final String subject, to;
+ private final class EmailListener implements OnClickListener {
+ private final String subject, to;
- public EmailListener(String to, String subject) {
- this.to = to;
- this.subject = subject;
- }
+ public EmailListener(String to, String subject) {
+ this.to = to;
+ this.subject = subject;
+ }
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(Intent.ACTION_SEND);
- intent.setType("message/rfc822");
- intent.putExtra(Intent.EXTRA_EMAIL, new String[] { to });
- intent.putExtra(Intent.EXTRA_SUBJECT, subject);
- intent = Intent.createChooser(intent, "Select a email program");
- if (intent != null) {
- getActivity().startActivity(intent);
- }
- }
- }
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(Intent.ACTION_SEND);
+ intent.setType("message/rfc822");
+ intent.putExtra(Intent.EXTRA_EMAIL, new String[] {
+ to
+ });
+ intent.putExtra(Intent.EXTRA_SUBJECT, subject);
+ intent = Intent.createChooser(intent, "Select a email program");
+ if (intent != null) {
+ getActivity().startActivity(intent);
+ }
+ }
+ }
- private final class UrlListener implements OnClickListener {
- private final Uri uri;
+ private final class UrlListener implements OnClickListener {
+ private final Uri uri;
- public UrlListener(String url) {
- uri = Uri.parse(url);
- }
+ public UrlListener(String url) {
+ uri = Uri.parse(url);
+ }
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(Intent.ACTION_VIEW, uri);
- intent = Intent.createChooser(intent, "Select a browser");
- if (intent != null) {
- getActivity().startActivity(intent);
- }
- }
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+ intent = Intent.createChooser(intent, "Select a browser");
+ if (intent != null) {
+ getActivity().startActivity(intent);
+ }
+ }
- }
+ }
- private final OnClickListener emailListener = new EmailListener(
- "prototypegamez@gmail.com", "HoloEverywhere");
- private final OnClickListener githubListener = new UrlListener(
- "https://github.com/ChristopheVersieux/HoloEverywhere");
- private final OnClickListener gplusListener = new UrlListener(
- "https://plus.google.com/108315424589085456181");
+ private final OnClickListener emailListener = new EmailListener(
+ "prototypegamez@gmail.com", "HoloEverywhere");
+ private final OnClickListener githubListener = new UrlListener(
+ "https://github.com/ChristopheVersieux/HoloEverywhere");
+ private final OnClickListener gplusListener = new UrlListener(
+ "https://plus.google.com/108315424589085456181");
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- return inflater.inflate(R.layout.about);
- }
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.about);
+ }
- @Override
- public void onViewCreated(View view) {
- super.onViewCreated(view);
- view.findViewById(R.id.github).setOnClickListener(githubListener);
- view.findViewById(R.id.google_plus).setOnClickListener(gplusListener);
- view.findViewById(R.id.email).setOnClickListener(emailListener);
- }
+ @Override
+ public void onViewCreated(View view) {
+ super.onViewCreated(view);
+ view.findViewById(R.id.github).setOnClickListener(githubListener);
+ view.findViewById(R.id.google_plus).setOnClickListener(gplusListener);
+ view.findViewById(R.id.email).setOnClickListener(emailListener);
+ }
}
View
23 demo/src/org/holoeverywhere/demo/fragments/CalendarFragment.java
@@ -1,3 +1,4 @@
+
package org.holoeverywhere.demo.fragments;
import org.holoeverywhere.LayoutInflater;
@@ -9,17 +10,17 @@
import android.view.ViewGroup;
public class CalendarFragment extends SFragment {
- private static final class CalendarFragmentHolder {
- private static final CalendarFragment instance = new CalendarFragment();
- }
+ private static final class CalendarFragmentHolder {
+ private static final CalendarFragment instance = new CalendarFragment();
+ }
- public static CalendarFragment getInstance() {
- return CalendarFragmentHolder.instance;
- }
+ public static CalendarFragment getInstance() {
+ return CalendarFragmentHolder.instance;
+ }
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- return inflater.inflate(R.layout.calendar);
- }
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.calendar);
+ }
}
View
133 demo/src/org/holoeverywhere/demo/fragments/MainFragment.java
@@ -1,3 +1,4 @@
+
package org.holoeverywhere.demo.fragments;
import org.holoeverywhere.LayoutInflater;
@@ -14,77 +15,79 @@
import com.actionbarsherlock.view.MenuItem;
public class MainFragment extends SFragment {
- private static MainFragment instance;
+ private static MainFragment instance;
- public static MainFragment getInstance() {
- if (MainFragment.instance == null) {
- return new MainFragment();
- }
- return MainFragment.instance;
- }
+ public static MainFragment getInstance() {
+ if (MainFragment.instance == null) {
+ return new MainFragment();
+ }
+ return MainFragment.instance;
+ }
- private int[] contextItemIds = new int[] { R.id.item3, R.id.item4,
- R.id.item5 };
- private int contextItemSelected = 0;
+ private int[] contextItemIds = new int[] {
+ R.id.item3, R.id.item4,
+ R.id.item5
+ };
+ private int contextItemSelected = 0;
- public MainFragment() {
- MainFragment.instance = this;
- }
+ public MainFragment() {
+ MainFragment.instance = this;
+ }
- @Override
- public boolean onContextItemSelected(MenuItem item) {
- String text;
- switch (item.getItemId()) {
- case R.id.item1:
- text = "Toast 1";
- break;
- case R.id.item2:
- text = "Toast 2";
- break;
- case R.id.item3:
- text = "Toggle to first item";
- contextItemSelected = 0;
- break;
- case R.id.item4:
- text = "Toggle to second item";
- contextItemSelected = 1;
- break;
- case R.id.item5:
- text = "Toggle to third item";
- contextItemSelected = 2;
- break;
- default:
- return super.onContextItemSelected(item);
- }
- Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
- return true;
- }
+ @Override
+ public boolean onContextItemSelected(MenuItem item) {
+ String text;
+ switch (item.getItemId()) {
+ case R.id.item1:
+ text = "Toast 1";
+ break;
+ case R.id.item2:
+ text = "Toast 2";
+ break;
+ case R.id.item3:
+ text = "Toggle to first item";
+ contextItemSelected = 0;
+ break;
+ case R.id.item4:
+ text = "Toggle to second item";
+ contextItemSelected = 1;
+ break;
+ case R.id.item5:
+ text = "Toggle to third item";
+ contextItemSelected = 2;
+ break;
+ default:
+ return super.onContextItemSelected(item);
+ }
+ Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
+ return true;
+ }
- @Override
- public void onCreateContextMenu(ContextMenu menu, View v,
- ContextMenuInfo menuInfo) {
- getMenuInflater().inflate(R.menu.menu, menu);
- menu.findItem(contextItemIds[contextItemSelected]).setChecked(true);
- }
+ @Override
+ public void onCreateContextMenu(ContextMenu menu, View v,
+ ContextMenuInfo menuInfo) {
+ getMenuInflater().inflate(R.menu.menu, menu);
+ menu.findItem(contextItemIds[contextItemSelected]).setChecked(true);
+ }
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- return inflater.inflate(R.layout.main);
- }
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.main);
+ }
- @Override
- public void onViewCreated(View view) {
- super.onViewCreated(view);
- if (isABSSupport()) {
- view.findViewById(R.id.showPreferences).setVisibility(View.GONE);
- view.findViewById(R.id.showAbout).setVisibility(View.GONE);
- }
- }
+ @Override
+ public void onViewCreated(View view) {
+ super.onViewCreated(view);
+ if (isABSSupport()) {
+ view.findViewById(R.id.showPreferences).setVisibility(View.GONE);
+ view.findViewById(R.id.showAbout).setVisibility(View.GONE);
+ }
+ }
- public void showContextMenu(View v) {
- registerForContextMenu(v);
- openContextMenu(v);
- unregisterForContextMenu(v);
- }
+ public void showContextMenu(View v) {
+ registerForContextMenu(v);
+ openContextMenu(v);
+ unregisterForContextMenu(v);
+ }
}
View
11 demo/src/org/holoeverywhere/demo/fragments/PreferenceFragment.java
@@ -1,3 +1,4 @@
+
package org.holoeverywhere.demo.fragments;
import org.holoeverywhere.demo.R;
@@ -6,9 +7,9 @@
import android.os.Bundle;
public class PreferenceFragment extends SPreferenceFragment {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.preferences);
- }
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ addPreferencesFromResource(R.xml.preferences);
+ }
}
View
113 demo/src/org/holoeverywhere/demo/widget/OtherButton.java
@@ -1,3 +1,4 @@
+
package org.holoeverywhere.demo.widget;
import org.holoeverywhere.LayoutInflater;
@@ -12,69 +13,69 @@
import android.widget.ImageView;
public class OtherButton extends LinearLayout {
- private ImageView icon;
- private OnClickListener onClickListener;
- private Button text;
+ private ImageView icon;
+ private OnClickListener onClickListener;
+ private Button text;
- public OtherButton(Context context) {
- super(context);
- }
+ public OtherButton(Context context) {
+ super(context);
+ }
- public OtherButton(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
+ public OtherButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
- public OtherButton(Context context, AttributeSet attrs, int defStyleRes) {
- super(context, attrs, defStyleRes);
- }
+ public OtherButton(Context context, AttributeSet attrs, int defStyleRes) {
+ super(context, attrs, defStyleRes);
+ }
- @Override
- protected void init(AttributeSet attrs, int defStyleRes) {
- super.init(attrs, defStyleRes);
- LayoutInflater.inflate(getContext(), R.layout.other_button, this, true);
- text = (Button) findViewById(R.id.text);
- icon = (ImageView) findViewById(R.id.icon);
- if (onClickListener != null) {
- text.setOnClickListener(onClickListener);
- }
- TypedArray a = getContext().obtainStyledAttributes(attrs,
- R.styleable.OtherButton);
- String textR = a.getString(R.styleable.OtherButton_android_text);
- Drawable iconR = a.getDrawable(R.styleable.OtherButton_android_icon);
- a.recycle();
- setClickable(true);
- setFocusable(true);
- setFocusableInTouchMode(true);
- if (textR != null) {
- text.setText(textR);
- }
- if (iconR != null) {
- icon.setImageDrawable(iconR);
- }
- }
+ @Override
+ protected void init(AttributeSet attrs, int defStyleRes) {
+ super.init(attrs, defStyleRes);
+ LayoutInflater.inflate(getContext(), R.layout.other_button, this, true);
+ text = (Button) findViewById(R.id.text);
+ icon = (ImageView) findViewById(R.id.icon);
+ if (onClickListener != null) {
+ text.setOnClickListener(onClickListener);
+ }
+ TypedArray a = getContext().obtainStyledAttributes(attrs,
+ R.styleable.OtherButton);
+ String textR = a.getString(R.styleable.OtherButton_android_text);
+ Drawable iconR = a.getDrawable(R.styleable.OtherButton_android_icon);
+ a.recycle();
+ setClickable(true);
+ setFocusable(true);
+ setFocusableInTouchMode(true);
+ if (textR != null) {
+ text.setText(textR);
+ }
+ if (iconR != null) {
+ icon.setImageDrawable(iconR);
+ }
+ }
- public void setIcon(Drawable drawable) {
- icon.setImageDrawable(drawable);
- }
+ public void setIcon(Drawable drawable) {
+ icon.setImageDrawable(drawable);
+ }
- public void setIcon(int resId) {
- icon.setImageResource(resId);
- }
+ public void setIcon(int resId) {
+ icon.setImageResource(resId);
+ }
- @Override
- public void setOnClickListener(OnClickListener l) {
- if (text == null) {
- onClickListener = l;
- } else {
- text.setOnClickListener(l);
- }
- }
+ @Override
+ public void setOnClickListener(OnClickListener l) {
+ if (text == null) {
+ onClickListener = l;
+ } else {
+ text.setOnClickListener(l);
+ }
+ }
- public void setText(CharSequence s) {
- text.setText(s);
- }
+ public void setText(CharSequence s) {
+ text.setText(s);
+ }
- public void setText(int resId) {
- text.setText(resId);
- }
+ public void setText(int resId) {
+ text.setText(resId);
+ }
}
View
95 demo/src/org/holoeverywhere/demo/widget/WidgetContainer.java
@@ -1,3 +1,4 @@
+
package org.holoeverywhere.demo.widget;
import org.holoeverywhere.LayoutInflater;
@@ -12,56 +13,56 @@
import android.view.ViewGroup;
public class WidgetContainer extends LinearLayout {
- private View titleView;
+ private View titleView;
- public WidgetContainer(Context context) {
- this(context, null);
- }
+ public WidgetContainer(Context context) {
+ this(context, null);
+ }
- public WidgetContainer(Context context, AttributeSet attrs) {
- super(context, attrs);
- setOrientation(android.widget.LinearLayout.VERTICAL);
- TypedArray a = context.obtainStyledAttributes(attrs,
- R.styleable.WidgetContainer);
- int layout = a.getResourceId(
- R.styleable.WidgetContainer_android_layout, -1);
- int titleLayout = a.getResourceId(
- R.styleable.WidgetContainer_titleLayout,
- R.layout.widget_container_title);
- String title = a.getString(R.styleable.WidgetContainer_android_text);
- a.recycle();
- if (layout > 0) {
- View view = LayoutInflater.inflate(context, layout);
- if (view instanceof ViewGroup) {
- ViewGroup group = (ViewGroup) view;
- for (int i = 0; i < group.getChildCount(); i++) {
- View v = group.getChildAt(i);
- group.removeViewAt(i);
- addView(v);
- }
- } else {
- addView(view);
- }
- }
- addView(titleView = LayoutInflater.inflate(context, titleLayout), 0);
- if (title != null && title.length() > 0) {
- setTitle(title);
- }
- }
+ public WidgetContainer(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setOrientation(android.widget.LinearLayout.VERTICAL);
+ TypedArray a = context.obtainStyledAttributes(attrs,
+ R.styleable.WidgetContainer);
+ int layout = a.getResourceId(
+ R.styleable.WidgetContainer_android_layout, -1);
+ int titleLayout = a.getResourceId(
+ R.styleable.WidgetContainer_titleLayout,
+ R.layout.widget_container_title);
+ String title = a.getString(R.styleable.WidgetContainer_android_text);
+ a.recycle();
+ if (layout > 0) {
+ View view = LayoutInflater.inflate(context, layout);
+ if (view instanceof ViewGroup) {
+ ViewGroup group = (ViewGroup) view;
+ for (int i = 0; i < group.getChildCount(); i++) {
+ View v = group.getChildAt(i);
+ group.removeViewAt(i);
+ addView(v);
+ }
+ } else {
+ addView(view);
+ }
+ }
+ addView(titleView = LayoutInflater.inflate(context, titleLayout), 0);
+ if (title != null && title.length() > 0) {
+ setTitle(title);
+ }
+ }
- public WidgetContainer(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs);
- }
+ public WidgetContainer(Context context, AttributeSet attrs, int defStyleAttr) {
+ this(context, attrs);
+ }
- public void setTitle(CharSequence title) {
- TextView textView = (TextView) titleView
- .findViewById(android.R.id.text1);
- if (textView != null) {
- textView.setText(title);
- }
- }
+ public void setTitle(CharSequence title) {
+ TextView textView = (TextView) titleView
+ .findViewById(android.R.id.text1);
+ if (textView != null) {
+ textView.setText(title);
+ }
+ }
- public void setTitle(int title) {
- setTitle(getResources().getText(title));
- }
+ public void setTitle(int title) {
+ setTitle(getResources().getText(title));
+ }
}
View
252 formatting.xml
@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profiles version="10">
+<profile name="Android" version="10">
+<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="100"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
+<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="false"/>
+</profile>
+</profiles>
View
173 library/src/android/support/v4/app/_HoloActivity.java
@@ -1,3 +1,4 @@
+
package android.support.v4.app;
import org.holoeverywhere.SystemServiceManager.SuperSystemService;
@@ -16,90 +17,90 @@
import com.actionbarsherlock.view.MenuItem;
public abstract class _HoloActivity extends Watson implements
- ContextMenuListener, SuperSystemService {
- protected final String TAG = getClass().getSimpleName();
-
- @Override
- public MenuInflater getSupportMenuInflater() {
- return null;
- }
-
- @Override
- public void invalidateOptionsMenu() {
- supportInvalidateOptionsMenu();
- }
-
- @Override
- public final boolean onContextItemSelected(android.view.MenuItem item) {
- return onContextItemSelected(new ContextMenuItemWrapper(item));
- }
-
- @Override
- public boolean onContextItemSelected(MenuItem item) {
- if (item instanceof ContextMenuItemWrapper) {
- return super.onContextItemSelected(((ContextMenuItemWrapper) item)
- .unwrap());
- }
- return false;
- }
-
- @Override
- public final void onContextMenuClosed(android.view.Menu menu) {
- if (menu instanceof android.view.ContextMenu) {
- onContextMenuClosed(new ContextMenuWrapper(
- (android.view.ContextMenu) menu));
- } else {
- Log.w(TAG, "onContextMenuClosed: menu is not ContextMenu instance");
- super.onContextMenuClosed(menu);
- }
- }
-
- @Override
- public void onContextMenuClosed(ContextMenu menu) {
- if (menu instanceof ContextMenuWrapper) {
- super.onContextMenuClosed(((ContextMenuWrapper) menu).unwrap());
- }
- }
-
- @Override
- public final void onCreateContextMenu(android.view.ContextMenu menu,
- View v, ContextMenuInfo menuInfo) {
- onCreateContextMenu(new ContextMenuWrapper(menu), v, menuInfo);
- }
-
- @Override
- public void onCreateContextMenu(ContextMenu menu, View view,
- ContextMenuInfo menuInfo) {
- if (menu instanceof ContextMenuWrapper) {
- super.onCreateContextMenu(((ContextMenuWrapper) menu).unwrap(),
- view, menuInfo);
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- return false;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- return false;
- }
-
- @Override
- public boolean onPrepareOptionsMenu(Menu menu) {
- return false;
- }
-
- @Override
- public Object superGetSystemService(String name) {
- return super.getSystemService(name);
- }
-
- @Override
- public void supportInvalidateOptionsMenu() {
- if (VERSION.SDK_INT >= 11) {
- super.invalidateOptionsMenu();
- }
- }
+ ContextMenuListener, SuperSystemService {
+ protected final String TAG = getClass().getSimpleName();
+
+ @Override
+ public MenuInflater getSupportMenuInflater() {
+ return null;
+ }
+
+ @Override
+ public void invalidateOptionsMenu() {
+ supportInvalidateOptionsMenu();
+ }
+
+ @Override
+ public final boolean onContextItemSelected(android.view.MenuItem item) {
+ return onContextItemSelected(new ContextMenuItemWrapper(item));
+ }
+
+ @Override
+ public boolean onContextItemSelected(MenuItem item) {
+ if (item instanceof ContextMenuItemWrapper) {
+ return super.onContextItemSelected(((ContextMenuItemWrapper) item)
+ .unwrap());
+ }
+ return false;
+ }
+
+ @Override
+ public final void onContextMenuClosed(android.view.Menu menu) {
+ if (menu instanceof android.view.ContextMenu) {
+ onContextMenuClosed(new ContextMenuWrapper(
+ (android.view.ContextMenu) menu));
+ } else {
+ Log.w(TAG, "onContextMenuClosed: menu is not ContextMenu instance");
+ super.onContextMenuClosed(menu);
+ }
+ }
+
+ @Override
+ public void onContextMenuClosed(ContextMenu menu) {
+ if (menu instanceof ContextMenuWrapper) {
+ super.onContextMenuClosed(((ContextMenuWrapper) menu).unwrap());
+ }
+ }
+
+ @Override
+ public final void onCreateContextMenu(android.view.ContextMenu menu,
+ View v, ContextMenuInfo menuInfo) {
+ onCreateContextMenu(new ContextMenuWrapper(menu), v, menuInfo);
+ }
+
+ @Override
+ public void onCreateContextMenu(ContextMenu menu, View view,
+ ContextMenuInfo menuInfo) {
+ if (menu instanceof ContextMenuWrapper) {
+ super.onCreateContextMenu(((ContextMenuWrapper) menu).unwrap(),
+ view, menuInfo);
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ return false;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ return false;
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ return false;
+ }
+
+ @Override
+ public Object superGetSystemService(String name) {
+ return super.getSystemService(name);
+ }
+
+ @Override
+ public void supportInvalidateOptionsMenu() {
+ if (VERSION.SDK_INT >= 11) {
+ super.invalidateOptionsMenu();
+ }
+ }
}
View
85 library/src/android/support/v4/app/_HoloFragment.java
@@ -1,3 +1,4 @@
+
package android.support.v4.app;
import android.view.ContextMenu.ContextMenuInfo;
@@ -11,46 +12,46 @@
import com.actionbarsherlock.view.MenuItem;
public abstract class _HoloFragment extends Fragment implements
- ContextMenuListener {
- protected int getContainerId() {
- return mContainerId;
- }
-
- @Override
- public final boolean onContextItemSelected(android.view.MenuItem item) {
- return onContextItemSelected(new ContextMenuItemWrapper(item));
- }
-
- @Override
- public boolean onContextItemSelected(MenuItem item) {
- if (item instanceof MenuItemWrapper) {
- return super.onContextItemSelected(((ContextMenuItemWrapper) item)
- .unwrap());
- }
- return false;
- }
-
- @Override
- public void onContextMenuClosed(ContextMenu menu) {
-
- }
-
- @Override
- public final void onCreateContextMenu(android.view.ContextMenu menu,
- View v, ContextMenuInfo menuInfo) {
- onCreateContextMenu(new ContextMenuWrapper(menu), v, menuInfo);
- }
-
- @Override
- public void onCreateContextMenu(ContextMenu menu, View v,
- ContextMenuInfo menuInfo) {
- if (menu instanceof ContextMenuWrapper) {
- super.onCreateContextMenu(((ContextMenuWrapper) menu).unwrap(), v,
- menuInfo);
- }
- }
-
- public boolean openContextMenu(View v) {
- return v.showContextMenu();
- }
+ ContextMenuListener {
+ protected int getContainerId() {
+ return mContainerId;
+ }
+
+ @Override
+ public final boolean onContextItemSelected(android.view.MenuItem item) {
+ return onContextItemSelected(new ContextMenuItemWrapper(item));
+ }
+
+ @Override
+ public boolean onContextItemSelected(MenuItem item) {
+ if (item instanceof MenuItemWrapper) {
+ return super.onContextItemSelected(((ContextMenuItemWrapper) item)
+ .unwrap());
+ }
+ return false;
+ }
+
+ @Override
+ public void onContextMenuClosed(ContextMenu menu) {
+
+ }
+
+ @Override
+ public final void onCreateContextMenu(android.view.ContextMenu menu,
+ View v, ContextMenuInfo menuInfo) {
+ onCreateContextMenu(new ContextMenuWrapper(menu), v, menuInfo);
+ }
+
+ @Override
+ public void onCreateContextMenu(ContextMenu menu, View v,
+ ContextMenuInfo menuInfo) {
+ if (menu instanceof ContextMenuWrapper) {
+ super.onCreateContextMenu(((ContextMenuWrapper) menu).unwrap(), v,
+ menuInfo);
+ }
+ }
+
+ public boolean openContextMenu(View v) {
+ return v.showContextMenu();
+ }
}
View
125 library/src/com/actionbarsherlock/internal/view/menu/ContextMenuBuilder.java
@@ -1,3 +1,4 @@
+
package com.actionbarsherlock.internal.view.menu;
import java.lang.reflect.Method;
@@ -17,74 +18,74 @@
import com.actionbarsherlock.view.ContextMenu;
public class ContextMenuBuilder extends MenuBuilder implements ContextMenu {
- private final ContextMenuListener listener;
+ private final ContextMenuListener listener;
- private final String TAG = getClass().getSimpleName();
+ private final String TAG = getClass().getSimpleName();
- public ContextMenuBuilder(Context context, ContextMenuListener listener) {
- super(context);
- if (listener == null) {
- throw new IllegalArgumentException(
- "ContextMenuListener can't be null");
- }
- this.listener = listener;
- }
+ public ContextMenuBuilder(Context context, ContextMenuListener listener) {
+ super(context);
+ if (listener == null) {
+ throw new IllegalArgumentException(
+ "ContextMenuListener can't be null");
+ }
+ this.listener = listener;
+ }
- private ContextMenuInfo getContextMenuInfo(View view) {
- ContextMenuInfo menuInfo = null;
- try {
- Class<?> clazz = view.getClass();
- while (clazz != View.class) {
- clazz = clazz.getSuperclass();
- }
- Method method = clazz.getDeclaredMethod("getContextMenuInfo");
- method.setAccessible(true);
- menuInfo = (ContextMenuInfo) method.invoke(view);
- } catch (Exception e) {
- if (Application.isDebugMode()) {
- Log.e(TAG, "getContextMenuInfo error", e);
- }
- }
- return menuInfo;
- }
+ private ContextMenuInfo getContextMenuInfo(View view) {
+ ContextMenuInfo menuInfo = null;
+ try {
+ Class<?> clazz = view.getClass();
+ while (clazz != View.class) {
+ clazz = clazz.getSuperclass();
+ }
+ Method method = clazz.getDeclaredMethod("getContextMenuInfo");
+ method.setAccessible(true);
+ menuInfo = (ContextMenuInfo) method.invoke(view);
+ } catch (Exception e) {
+ if (Application.isDebugMode()) {
+ Log.e(TAG, "getContextMenuInfo error", e);
+ }
+ }
+ return menuInfo;
+ }
- @Override
- public ContextMenu setHeaderIcon(Drawable icon) {
- return (ContextMenu) super.setHeaderIconInt(icon);
- }
+ @Override
+ public ContextMenu setHeaderIcon(Drawable icon) {
+ return (ContextMenu) super.setHeaderIconInt(icon);
+ }
- @Override
- public ContextMenu setHeaderIcon(int iconRes) {
- return (ContextMenu) super.setHeaderIconInt(iconRes);
- }
+ @Override
+ public ContextMenu setHeaderIcon(int iconRes) {
+ return (ContextMenu) super.setHeaderIconInt(iconRes);
+ }
- @Override
- public ContextMenu setHeaderTitle(CharSequence title) {
- return (ContextMenu) super.setHeaderTitleInt(title);
- }
+ @Override
+ public ContextMenu setHeaderTitle(CharSequence title) {
+ return (ContextMenu) super.setHeaderTitleInt(title);
+ }
- @Override
- public ContextMenu setHeaderTitle(int titleRes) {
- return (ContextMenu) super.setHeaderTitleInt(titleRes);
- }
+ @Override
+ public ContextMenu setHeaderTitle(int titleRes) {
+ return (ContextMenu) super.setHeaderTitleInt(titleRes);
+ }
- @Override
- public ContextMenu setHeaderView(View view) {
- return (ContextMenu) super.setHeaderViewInt(view);
- }
+ @Override
+ public ContextMenu setHeaderView(View view) {
+ return (ContextMenu) super.setHeaderViewInt(view);
+ }
- @SuppressLint("NewApi")
- public MenuDialogHelper show(View originalView, IBinder token) {
- listener.createContextMenu(this, originalView,
- getContextMenuInfo(originalView), listener);
- if (getVisibleItems().size() > 0) {
- if (VERSION.SDK_INT >= 8) {
- EventLog.writeEvent(50001, 1);
- }
- MenuDialogHelper helper = new MenuDialogHelper(this);
- helper.show(token);
- return helper;
- }
- return null;
- }
-}
+ @SuppressLint("NewApi")
+ public MenuDialogHelper show(View originalView, IBinder token) {
+ listener.createContextMenu(this, originalView,
+ getContextMenuInfo(originalView), listener);
+ if (getVisibleItems().size() > 0) {
+ if (VERSION.SDK_INT >= 8) {
+ EventLog.writeEvent(50001, 1);
+ }
+ MenuDialogHelper helper = new MenuDialogHelper(this);
+ helper.show(token);
+ return helper;
+ }
+ return null;
+ }
+}
View
187 library/src/com/actionbarsherlock/internal/view/menu/ContextMenuDecorView.java
@@ -1,3 +1,4 @@
+
package com.actionbarsherlock.internal.view.menu;
import org.holoeverywhere.app.Application;
@@ -13,97 +14,97 @@
import com.actionbarsherlock.view.MenuItem;
public final class ContextMenuDecorView extends FrameLayout {
- private static final class InternalWrapper implements
- MenuPresenter.Callback, MenuBuilder.Callback {
- private final ContextMenuListener listener;
- private final String TAG = getClass().getSimpleName();
-
- public InternalWrapper(ContextMenuListener listener) {
- if (listener == null) {
- throw new IllegalArgumentException("Listener is null",
- new NullPointerException());
- }
- this.listener = listener;
- if (Application.isDebugMode()) {
- Log.v(TAG, "Create new InternalWrapper with listener: "
- + listener);
- }
- }
-
- @Override
- public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
- if (Application.isDebugMode()) {
- Log.v(TAG, "Calling onContextMenuClosed on " + listener);
- }
- listener.onContextMenuClosed((ContextMenu) menu);
- }
-
- @Override
- public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
- if (Application.isDebugMode()) {
- Log.v(TAG, "Calling onContextItemSelected on " + listener);
- }
- return listener.onContextItemSelected(item);
- }
-
- @Override
- public void onMenuModeChange(MenuBuilder menu) {
-
- }
-
- @Override
- public boolean onOpenSubMenu(MenuBuilder subMenu) {
- return false;
- }
-
- public ContextMenuListener unwrap() {
- return listener;
- }
- }
-
- private ContextMenuBuilder contextMenu;
-
- private final InternalWrapper listener;
- private MenuDialogHelper menuDialogHelper;
- private final View view;
-
- public ContextMenuDecorView(Context context, View view,
- ContextMenuListener listener) {
- super(context);
- this.listener = new InternalWrapper(listener);
- if (view != null) {
- ViewParent parent = view.getParent();
- if (parent != null && parent instanceof ViewGroup) {
- ((ViewGroup) parent).removeView(view);
- }
- addView(view, android.view.ViewGroup.LayoutParams.MATCH_PARENT,
- android.view.ViewGroup.LayoutParams.MATCH_PARENT);
- }
- this.view = view;
- }
-
- @Override
- public boolean showContextMenuForChild(View originalView) {
- if (Application.getConfig().isDisableContextMenu()) {
- return super.showContextMenuForChild(originalView);
- }
- if (contextMenu == null) {
- contextMenu = new ContextMenuBuilder(getContext(),
- listener.unwrap());
- contextMenu.setCallback(listener);
- } else {
- contextMenu.clearAll();
- }
- final MenuDialogHelper helper = contextMenu.show(originalView,
- originalView.getWindowToken());
- if (helper != null) {
- helper.setPresenterCallback(listener);
- }
- menuDialogHelper = helper;
- return menuDialogHelper != null;
- }
-
- public View unwrap() {
- return view;
- }
+ private static final class InternalWrapper implements
+ MenuPresenter.Callback, MenuBuilder.Callback {
+ private final ContextMenuListener listener;
+ private final String TAG = getClass().getSimpleName();
+
+ public InternalWrapper(ContextMenuListener listener) {
+ if (listener == null) {
+ throw new IllegalArgumentException("Listener is null",
+ new NullPointerException());
+ }
+ this.listener = listener;
+ if (Application.isDebugMode()) {
+ Log.v(TAG, "Create new InternalWrapper with listener: "
+ + listener);
+ }
+ }
+
+ @Override
+ public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
+ if (Application.isDebugMode()) {
+ Log.v(TAG, "Calling onContextMenuClosed on " + listener);
+ }
+ listener.onContextMenuClosed((ContextMenu) menu);
+ }
+
+ @Override
+ public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
+ if (Application.isDebugMode()) {
+ Log.v(TAG, "Calling onContextItemSelected on " + listener);
+ }
+ return listener.onContextItemSelected(item);
+ }
+
+ @Override
+ public void onMenuModeChange(MenuBuilder menu) {
+
+ }
+
+ @Override
+ public boolean onOpenSubMenu(MenuBuilder subMenu) {
+ return false;
+ }
+
+ public ContextMenuListener unwrap() {
+ return listener;
+ }
+ }
+
+ private ContextMenuBuilder contextMenu;
+
+ private final InternalWrapper listener;
+ private MenuDialogHelper menuDialogHelper;
+ private final View view;
+
+ public ContextMenuDecorView(Context context, View view,
+ ContextMenuListener listener) {
+ super(context);
+ this.listener = new InternalWrapper(listener);
+ if (view != null) {
+ ViewParent parent = view.getParent();
+ if (parent != null && parent instanceof ViewGroup) {
+ ((ViewGroup) parent).removeView(view);
+ }
+ addView(view, android.view.ViewGroup.LayoutParams.MATCH_PARENT,
+ android.view.ViewGroup.LayoutParams.MATCH_PARENT);
+ }
+ this.view = view;
+ }
+
+ @Override
+ public boolean showContextMenuForChild(View originalView) {
+ if (Application.getConfig().isDisableContextMenu()) {
+ return super.showContextMenuForChild(originalView);
+ }
+ if (contextMenu == null) {
+ contextMenu = new ContextMenuBuilder(getContext(),
+ listener.unwrap());
+ contextMenu.setCallback(listener);
+ } else {
+ contextMenu.clearAll();
+ }
+ final MenuDialogHelper helper = contextMenu.show(originalView,
+ originalView.getWindowToken());
+ if (helper != null) {
+ helper.setPresenterCallback(listener);
+ }
+ menuDialogHelper = helper;
+ return menuDialogHelper != null;
+ }
+
+ public View unwrap() {
+ return view;
+ }
}
View
17 library/src/com/actionbarsherlock/internal/view/menu/ContextMenuItemWrapper.java
@@ -1,16 +1,17 @@
+
package com.actionbarsherlock.internal.view.menu;
import android.view.MenuItem;
public class ContextMenuItemWrapper extends MenuItemWrapper {
- private final MenuItem nativeItem;
+ private final MenuItem nativeItem;
- public ContextMenuItemWrapper(MenuItem nativeItem) {
- super(nativeItem);
- this.nativeItem = nativeItem;
- }
+ public ContextMenuItemWrapper(MenuItem nativeItem) {
+ super(nativeItem);
+ this.nativeItem = nativeItem;
+ }
- public MenuItem unwrap() {
- return nativeItem;
- }
+ public MenuItem unwrap() {
+ return nativeItem;
+ }
}
View
15 library/src/com/actionbarsherlock/internal/view/menu/ContextMenuListener.java
@@ -1,3 +1,4 @@
+
package com.actionbarsherlock.internal.view.menu;
import android.view.ContextMenu.ContextMenuInfo;
@@ -7,13 +8,13 @@
import com.actionbarsherlock.view.MenuItem;
public interface ContextMenuListener {
- public void createContextMenu(ContextMenuBuilder contextMenuBuilder,
- View view, ContextMenuInfo menuInfo, ContextMenuListener listener);
+ public void createContextMenu(ContextMenuBuilder contextMenuBuilder,
+ View view, ContextMenuInfo menuInfo, ContextMenuListener listener);
- public boolean onContextItemSelected(MenuItem item);
+ public boolean onContextItemSelected(MenuItem item);
- public void onContextMenuClosed(ContextMenu menu);
+ public void onContextMenuClosed(ContextMenu menu);
- public void onCreateContextMenu(ContextMenu menu, View view,
- ContextMenuInfo menuInfo);
-}
+ public void onCreateContextMenu(ContextMenu menu, View view,
+ ContextMenuInfo menuInfo);
+}
View
93 library/src/com/actionbarsherlock/internal/view/menu/ContextMenuWrapper.java
@@ -1,3 +1,4 @@
+
package com.actionbarsherlock.internal.view.menu;
import android.graphics.drawable.Drawable;
@@ -6,50 +7,50 @@
import com.actionbarsherlock.view.ContextMenu;
public class ContextMenuWrapper extends MenuWrapper implements ContextMenu {
- private android.view.ContextMenu nativeMenu;
-
- public ContextMenuWrapper(android.view.ContextMenu nativeMenu) {
- super(nativeMenu);
- this.nativeMenu = nativeMenu;
- }
-
- @Override
- public void clearHeader() {
- nativeMenu.clearHeader();