diff options
Diffstat (limited to 'samples/demos/src')
25 files changed, 0 insertions, 2029 deletions
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ActionItems.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ActionItems.java deleted file mode 100644 index 593a232..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/ActionItems.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import android.widget.TextView; - -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; - -public class ActionItems extends SherlockActivity { - @Override - public boolean onCreateOptionsMenu(Menu menu) { - //Used to put dark icons on light action bar - boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light; - - menu.add("Save") - .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Search") - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - menu.add("Refresh") - .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - return true; - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.text); - setContent((TextView)findViewById(R.id.text)); - } - - protected void setContent(TextView view) { - view.setText(R.string.action_items_content); - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ActionModes.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ActionModes.java deleted file mode 100644 index 58a01e7..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/ActionModes.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import android.view.View; -import android.widget.Button; -import android.widget.Toast; - -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.ActionMode; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; - -public class ActionModes extends SherlockActivity { - ActionMode mMode; - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.action_modes); - - ((Button)findViewById(R.id.start)).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mMode = startActionMode(new AnActionModeOfEpicProportions()); - } - }); - ((Button)findViewById(R.id.cancel)).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mMode != null) { - mMode.finish(); - } - } - }); - } - - private final class AnActionModeOfEpicProportions implements ActionMode.Callback { - @Override - public boolean onCreateActionMode(ActionMode mode, Menu menu) { - //Used to put dark icons on light action bar - boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light; - - menu.add("Save") - .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Search") - .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Refresh") - .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Save") - .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Search") - .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Refresh") - .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - return true; - } - - @Override - public boolean onPrepareActionMode(ActionMode mode, Menu menu) { - return false; - } - - @Override - public boolean onActionItemClicked(ActionMode mode, MenuItem item) { - Toast.makeText(ActionModes.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); - mode.finish(); - return true; - } - - @Override - public void onDestroyActionMode(ActionMode mode) { - } - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ActionModesNoActionBar.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ActionModesNoActionBar.java deleted file mode 100644 index 23c7a3b..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/ActionModesNoActionBar.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import android.view.View; -import android.widget.Button; -import android.widget.Toast; - -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.ActionMode; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; -import com.actionbarsherlock.view.Window; - -public class ActionModesNoActionBar extends SherlockActivity { - ActionMode mMode; - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - - //You could also use Theme.Sherlock.NoActionBar or Theme.Sherlock.Light.NoActionBar - requestWindowFeature(Window.FEATURE_NO_TITLE); - - super.onCreate(savedInstanceState); - setContentView(R.layout.action_modes); - - ((Button)findViewById(R.id.start)).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mMode = startActionMode(new AnActionModeOfEpicProportions()); - } - }); - ((Button)findViewById(R.id.cancel)).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mMode != null) { - mMode.finish(); - } - } - }); - } - - private final class AnActionModeOfEpicProportions implements ActionMode.Callback { - @Override - public boolean onCreateActionMode(ActionMode mode, Menu menu) { - //Used to put dark icons on light action bar - boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light; - - menu.add("Save") - .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Search") - .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Refresh") - .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Save") - .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Search") - .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Refresh") - .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - return true; - } - - @Override - public boolean onPrepareActionMode(ActionMode mode, Menu menu) { - return false; - } - - @Override - public boolean onActionItemClicked(ActionMode mode, MenuItem item) { - Toast.makeText(ActionModesNoActionBar.this, "Got click: " + item, Toast.LENGTH_SHORT).show(); - mode.finish(); - return true; - } - - @Override - public void onDestroyActionMode(ActionMode mode) { - } - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ActionProviders.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ActionProviders.java deleted file mode 100644 index d7de2d8..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/ActionProviders.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.actionbarsherlock.sample.demos; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.provider.Settings; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.ImageButton; -import android.widget.TextView; -import android.widget.Toast; - -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.ActionProvider; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; - -/** - * This activity demonstrates how to implement an {@link android.view.ActionProvider} - * for adding functionality to the Action Bar. In particular this demo creates an - * ActionProvider for launching the system settings and adds a menu item with that - * provider. - */ -public class ActionProviders extends SherlockActivity { - - @Override - public void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.text); - ((TextView)findViewById(R.id.text)).setText(R.string.action_providers_content); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean onCreateOptionsMenu(Menu menu) { - super.onCreateOptionsMenu(menu); - getSupportMenuInflater().inflate(R.menu.settings_action_provider, menu); - return true; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // If this callback does not handle the item click, onPerformDefaultAction - // of the ActionProvider is invoked. Hence, the provider encapsulates the - // complete functionality of the menu item. - Toast.makeText(this, "Handling in onOptionsItemSelected avoided", - Toast.LENGTH_SHORT).show(); - return false; - } - - public static class SettingsActionProvider extends ActionProvider { - - /** An intent for launching the system settings. */ - private static final Intent sSettingsIntent = new Intent(Settings.ACTION_SETTINGS); - - /** Context for accessing resources. */ - private final Context mContext; - - /** - * Creates a new instance. - * - * @param context Context for accessing resources. - */ - public SettingsActionProvider(Context context) { - super(context); - mContext = context; - } - - /** - * {@inheritDoc} - */ - @Override - public View onCreateActionView() { - // Inflate the action view to be shown on the action bar. - LayoutInflater layoutInflater = LayoutInflater.from(mContext); - View view = layoutInflater.inflate(R.layout.settings_action_provider, null); - ImageButton button = (ImageButton) view.findViewById(R.id.button); - // Attach a click listener for launching the system settings. - button.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mContext.startActivity(sSettingsIntent); - } - }); - return view; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean onPerformDefaultAction() { - // This is called if the host menu item placed in the overflow menu of the - // action bar is clicked and the host activity did not handle the click. - mContext.startActivity(sSettingsIntent); - return true; - } - } -}
\ No newline at end of file diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/CollapsibleActionItem.java b/samples/demos/src/com/actionbarsherlock/sample/demos/CollapsibleActionItem.java deleted file mode 100644 index 116545e..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/CollapsibleActionItem.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2012 Scott Kennedy - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import android.widget.TextView; - -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; - -public class CollapsibleActionItem extends SherlockActivity { - @Override - public boolean onCreateOptionsMenu(Menu menu) { - //Used to put dark icons on light action bar - boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light; - - menu.add("Search") - .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search) - .setActionView(R.layout.collapsible_edittext) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); - - return true; - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.text); - ((TextView)findViewById(R.id.text)).setText(R.string.collapsible_content); - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ContextMenus.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ContextMenus.java deleted file mode 100644 index 3f08bfe..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/ContextMenus.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import android.view.ContextMenu; -import android.view.View; -import android.widget.Toast; -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; - -public class ContextMenus extends SherlockActivity { - @Override - public boolean onCreateOptionsMenu(Menu menu) { - //Used to put dark icons on light action bar - boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light; - - menu.add("Save") - .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Search") - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - menu.add("Refresh") - .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - //This uses the imported MenuItem from ActionBarSherlock - Toast.makeText(this, "Got click: " + item.toString(), Toast.LENGTH_SHORT).show(); - return true; - } - - @Override - public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { - menu.add("One"); - menu.add("Two"); - menu.add("Three"); - menu.add("Four"); - } - - @Override - public boolean onContextItemSelected(android.view.MenuItem item) { - //Note how this callback is using the fully-qualified class name - Toast.makeText(this, "Got click: " + item.toString(), Toast.LENGTH_SHORT).show(); - return true; - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.context_menus); - registerForContextMenu(findViewById(R.id.show_context_menu)); - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/CustomNavigation.java b/samples/demos/src/com/actionbarsherlock/sample/demos/CustomNavigation.java deleted file mode 100644 index f9696fc..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/CustomNavigation.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.RadioGroup; -import android.widget.Toast; -import android.widget.RadioGroup.OnCheckedChangeListener; -import android.widget.TextView; - -import com.actionbarsherlock.app.SherlockActivity; - -public class CustomNavigation extends SherlockActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.text); - ((TextView)findViewById(R.id.text)).setText(R.string.custom_navigation_content); - - //Inflate the custom view - View customNav = LayoutInflater.from(this).inflate(R.layout.custom_view, null); - - //Bind to its state change - ((RadioGroup)customNav.findViewById(R.id.radio_nav)).setOnCheckedChangeListener(new OnCheckedChangeListener() { - @Override - public void onCheckedChanged(RadioGroup group, int checkedId) { - Toast.makeText(CustomNavigation.this, "Navigation selection changed.", Toast.LENGTH_SHORT).show(); - } - }); - - //Attach to the action bar - getSupportActionBar().setCustomView(customNav); - getSupportActionBar().setDisplayShowCustomEnabled(true); - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/Dialog.java b/samples/demos/src/com/actionbarsherlock/sample/demos/Dialog.java deleted file mode 100644 index a9dbaeb..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/Dialog.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockActivity; - -public class Dialog extends SherlockActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.text); - ((TextView)findViewById(R.id.text)).setText(R.string.dialog_content); - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/FeatureToggles.java b/samples/demos/src/com/actionbarsherlock/sample/demos/FeatureToggles.java deleted file mode 100644 index c9b99b9..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/FeatureToggles.java +++ /dev/null @@ -1,271 +0,0 @@ -package com.actionbarsherlock.sample.demos; - -import java.util.Random; - -import android.content.Context; -import android.os.Bundle; -import android.support.v4.app.FragmentTransaction; -import android.view.View; -import android.widget.ArrayAdapter; -import android.widget.Button; - -import com.actionbarsherlock.app.ActionBar; -import com.actionbarsherlock.app.ActionBar.Tab; -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; -import com.actionbarsherlock.view.Window; - -public class FeatureToggles extends SherlockActivity implements ActionBar.TabListener { - private static final Random RANDOM = new Random(); - - private int items = 0; - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - for (int i = 0; i < items; i++) { - menu.add("Text") - .setIcon(R.drawable.ic_title_share_default) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - } - - return super.onCreateOptionsMenu(menu); - } - - @Override - public void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - requestWindowFeature(Window.FEATURE_PROGRESS); - requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); - super.onCreate(savedInstanceState); - - setContentView(R.layout.feature_toggles); - setSupportProgressBarIndeterminateVisibility(false); - setSupportProgressBarVisibility(false); - - getSupportActionBar().setCustomView(R.layout.custom_view); - getSupportActionBar().setDisplayShowCustomEnabled(false); - - Context context = getSupportActionBar().getThemedContext(); - ArrayAdapter<CharSequence> listAdapter = ArrayAdapter.createFromResource(context, R.array.locations, R.layout.sherlock_spinner_item); - listAdapter.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item); - - getSupportActionBar().setListNavigationCallbacks(listAdapter, null); - - findViewById(R.id.display_progress_show).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - setSupportProgressBarVisibility(true); - setSupportProgressBarIndeterminateVisibility(false); - setSupportProgress(RANDOM.nextInt(8000) + 10); - } - }); - findViewById(R.id.display_progress_hide).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - setSupportProgressBarVisibility(false); - } - }); - findViewById(R.id.display_iprogress_show).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - //Hack to hide the regular progress bar - setSupportProgress(Window.PROGRESS_END); - setSupportProgressBarIndeterminateVisibility(true); - } - }); - findViewById(R.id.display_iprogress_hide).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - setSupportProgressBarIndeterminateVisibility(false); - } - }); - - findViewById(R.id.display_items_clear).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - items = 0; - invalidateOptionsMenu(); - } - }); - findViewById(R.id.display_items_add).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - items += 1; - invalidateOptionsMenu(); - } - }); - - findViewById(R.id.display_subtitle_show).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setSubtitle("The quick brown fox jumps over the lazy dog."); - } - }); - findViewById(R.id.display_subtitle_hide).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setSubtitle(null); - } - }); - - findViewById(R.id.display_title_show).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setDisplayShowTitleEnabled(true); - } - }); - findViewById(R.id.display_title_hide).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setDisplayShowTitleEnabled(false); - } - }); - - findViewById(R.id.display_custom_show).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setDisplayShowCustomEnabled(true); - } - }); - findViewById(R.id.display_custom_hide).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setDisplayShowCustomEnabled(false); - } - }); - - findViewById(R.id.navigation_standard).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); - } - }); - findViewById(R.id.navigation_list).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); - } - }); - findViewById(R.id.navigation_tabs).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); - } - }); - - findViewById(R.id.display_home_as_up_show).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - } - }); - findViewById(R.id.display_home_as_up_hide).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setDisplayHomeAsUpEnabled(false); - } - }); - - findViewById(R.id.display_logo_show).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setDisplayUseLogoEnabled(true); - } - }); - findViewById(R.id.display_logo_hide).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setDisplayUseLogoEnabled(false); - } - }); - - findViewById(R.id.display_home_show).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setDisplayShowHomeEnabled(true); - } - }); - findViewById(R.id.display_home_hide).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().setDisplayShowHomeEnabled(false); - } - }); - - findViewById(R.id.display_actionbar_show).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().show(); - } - }); - findViewById(R.id.display_actionbar_hide).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().hide(); - } - }); - - Button tabAdd = (Button)findViewById(R.id.display_tab_add); - tabAdd.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - ActionBar.Tab newTab = getSupportActionBar().newTab(); - - if (RANDOM.nextBoolean()) { - newTab.setCustomView(R.layout.tab_custom_view); - } else { - boolean icon = RANDOM.nextBoolean(); - if (icon) { - newTab.setIcon(R.drawable.ic_title_share_default); - } - if (!icon || RANDOM.nextBoolean()) { - newTab.setText("Text!"); - } - } - newTab.setTabListener(FeatureToggles.this); - getSupportActionBar().addTab(newTab); - } - }); - //Add some tabs - tabAdd.performClick(); - tabAdd.performClick(); - tabAdd.performClick(); - - findViewById(R.id.display_tab_select).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (getSupportActionBar().getTabCount() > 0) { - getSupportActionBar().selectTab( - getSupportActionBar().getTabAt( - RANDOM.nextInt(getSupportActionBar().getTabCount()) - ) - ); - } - } - }); - findViewById(R.id.display_tab_remove).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (getSupportActionBar().getTabCount() > 0) { - getSupportActionBar().removeTabAt(getSupportActionBar().getTabCount() - 1); - } - } - }); - findViewById(R.id.display_tab_remove_all).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getSupportActionBar().removeAllTabs(); - } - }); - } - - @Override - public void onTabSelected(Tab tab, FragmentTransaction transaction) {} - - @Override - public void onTabUnselected(Tab tab, FragmentTransaction transaction) {} - - @Override - public void onTabReselected(Tab tab, FragmentTransaction transaction) {} -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ForcedOverflowItem.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ForcedOverflowItem.java deleted file mode 100644 index 3c8e3f1..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/ForcedOverflowItem.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import android.widget.TextView; - -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; - -public class ForcedOverflowItem extends SherlockActivity { - @Override - public boolean onCreateOptionsMenu(Menu menu) { - //Used to put dark icons on light action bar - boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light; - - menu.add("Save") - .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Search") - .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Refresh") - .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Save") - .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Search") - .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - menu.add("Refresh") - .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - return true; - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - //Used for theme switching in samples - int theme = R.style.Theme_Sherlock_ForceOverflow; - if (SampleList.THEME == R.style.Theme_Sherlock_Light) { - theme = R.style.Theme_Sherlock_Light_ForceOverflow; - } else if (SampleList.THEME == R.style.Theme_Sherlock_Light_DarkActionBar) { - theme = R.style.Theme_Sherlock_Light_DarkActionBar_ForceOverflow; - } - setTheme(theme); - - super.onCreate(savedInstanceState); - setContentView(R.layout.text); - ((TextView)findViewById(R.id.text)).setText(R.string.forced_overflow_content); - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/IndeterminateProgress.java b/samples/demos/src/com/actionbarsherlock/sample/demos/IndeterminateProgress.java deleted file mode 100644 index 5d10d28..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/IndeterminateProgress.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import android.view.View; - -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Window; - -public class IndeterminateProgress extends SherlockActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - - //This has to be called before setContentView and you must use the - //class in com.actionbarsherlock.view and NOT android.view - requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); - - setContentView(R.layout.iprogress); - - findViewById(R.id.enable).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View arg0) { - setSupportProgressBarIndeterminateVisibility(true); - } - }); - findViewById(R.id.disable).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View arg0) { - setSupportProgressBarIndeterminateVisibility(false); - } - }); - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ListNavigation.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ListNavigation.java deleted file mode 100644 index e529de3..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/ListNavigation.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.actionbarsherlock.sample.demos;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.widget.ArrayAdapter;
-import android.widget.TextView;
-import com.actionbarsherlock.app.ActionBar;
-import com.actionbarsherlock.app.SherlockActivity;
-
-public class ListNavigation extends SherlockActivity implements ActionBar.OnNavigationListener {
- private TextView mSelected;
- private String[] mLocations;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- setTheme(SampleList.THEME); //Used for theme switching in samples
- super.onCreate(savedInstanceState);
-
- setContentView(R.layout.list_navigation);
- mSelected = (TextView)findViewById(R.id.text);
-
- mLocations = getResources().getStringArray(R.array.locations);
-
- Context context = getSupportActionBar().getThemedContext();
- ArrayAdapter<CharSequence> list = ArrayAdapter.createFromResource(context, R.array.locations, R.layout.sherlock_spinner_item);
- list.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
-
- getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
- getSupportActionBar().setListNavigationCallbacks(list, this);
- }
-
- @Override
- public boolean onNavigationItemSelected(int itemPosition, long itemId) {
- mSelected.setText("Selected: " + mLocations[itemPosition]);
- return true;
- }
-}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/Overlay.java b/samples/demos/src/com/actionbarsherlock/sample/demos/Overlay.java deleted file mode 100644 index 4bb37ea..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/Overlay.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Window; - -public class Overlay extends SherlockActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); - super.onCreate(savedInstanceState); - setContentView(R.layout.overlay); - - //Load partially transparent black background - getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_bg_black)); - - StringBuilder builder = new StringBuilder(); - for (int i = 0; i < 3; i++) { - for (String dialog : DIALOGUE) { - builder.append(dialog).append("\n\n"); - } - } - - TextView bunchOfText = (TextView)findViewById(R.id.bunch_of_text); - bunchOfText.setText(builder.toString()); - } - - public static final String[] DIALOGUE = new String[] { - "So shaken as we are, so wan with care," + - "Find we a time for frighted peace to pant," + - "And breathe short-winded accents of new broils" + - "To be commenced in strands afar remote." + - "No more the thirsty entrance of this soil" + - "Shall daub her lips with her own children's blood;" + - "Nor more shall trenching war channel her fields," + - "Nor bruise her flowerets with the armed hoofs" + - "Of hostile paces: those opposed eyes," + - "Which, like the meteors of a troubled heaven," + - "All of one nature, of one substance bred," + - "Did lately meet in the intestine shock" + - "And furious close of civil butchery" + - "Shall now, in mutual well-beseeming ranks," + - "March all one way and be no more opposed" + - "Against acquaintance, kindred and allies:" + - "The edge of war, like an ill-sheathed knife," + - "No more shall cut his master. Therefore, friends," + - "As far as to the sepulchre of Christ," + - "Whose soldier now, under whose blessed cross" + - "We are impressed and engaged to fight," + - "Forthwith a power of English shall we levy;" + - "Whose arms were moulded in their mothers' womb" + - "To chase these pagans in those holy fields" + - "Over whose acres walk'd those blessed feet" + - "Which fourteen hundred years ago were nail'd" + - "For our advantage on the bitter cross." + - "But this our purpose now is twelve month old," + - "And bootless 'tis to tell you we will go:" + - "Therefore we meet not now. Then let me hear" + - "Of you, my gentle cousin Westmoreland," + - "What yesternight our council did decree" + - "In forwarding this dear expedience.", - - "Hear him but reason in divinity," + - "And all-admiring with an inward wish" + - "You would desire the king were made a prelate:" + - "Hear him debate of commonwealth affairs," + - "You would say it hath been all in all his study:" + - "List his discourse of war, and you shall hear" + - "A fearful battle render'd you in music:" + - "Turn him to any cause of policy," + - "The Gordian knot of it he will unloose," + - "Familiar as his garter: that, when he speaks," + - "The air, a charter'd libertine, is still," + - "And the mute wonder lurketh in men's ears," + - "To steal his sweet and honey'd sentences;" + - "So that the art and practic part of life" + - "Must be the mistress to this theoric:" + - "Which is a wonder how his grace should glean it," + - "Since his addiction was to courses vain," + - "His companies unletter'd, rude and shallow," + - "His hours fill'd up with riots, banquets, sports," + - "And never noted in him any study," + - "Any retirement, any sequestration" + - "From open haunts and popularity.", - - "I come no more to make you laugh: things now," + - "That bear a weighty and a serious brow," + - "Sad, high, and working, full of state and woe," + - "Such noble scenes as draw the eye to flow," + - "We now present. Those that can pity, here" + - "May, if they think it well, let fall a tear;" + - "The subject will deserve it. Such as give" + - "Their money out of hope they may believe," + - "May here find truth too. Those that come to see" + - "Only a show or two, and so agree" + - "The play may pass, if they be still and willing," + - "I'll undertake may see away their shilling" + - "Richly in two short hours. Only they" + - "That come to hear a merry bawdy play," + - "A noise of targets, or to see a fellow" + - "In a long motley coat guarded with yellow," + - "Will be deceived; for, gentle hearers, know," + - "To rank our chosen truth with such a show" + - "As fool and fight is, beside forfeiting" + - "Our own brains, and the opinion that we bring," + - "To make that only true we now intend," + - "Will leave us never an understanding friend." + - "Therefore, for goodness' sake, and as you are known" + - "The first and happiest hearers of the town," + - "Be sad, as we would make ye: think ye see" + - "The very persons of our noble story" + - "As they were living; think you see them great," + - "And follow'd with the general throng and sweat" + - "Of thousand friends; then in a moment, see" + - "How soon this mightiness meets misery:" + - "And, if you can be merry then, I'll say" + - "A man may weep upon his wedding-day.", - - "First, heaven be the record to my speech!" + - "In the devotion of a subject's love," + - "Tendering the precious safety of my prince," + - "And free from other misbegotten hate," + - "Come I appellant to this princely presence." + - "Now, Thomas Mowbray, do I turn to thee," + - "And mark my greeting well; for what I speak" + - "My body shall make good upon this earth," + - "Or my divine soul answer it in heaven." + - "Thou art a traitor and a miscreant," + - "Too good to be so and too bad to live," + - "Since the more fair and crystal is the sky," + - "The uglier seem the clouds that in it fly." + - "Once more, the more to aggravate the note," + - "With a foul traitor's name stuff I thy throat;" + - "And wish, so please my sovereign, ere I move," + - "What my tongue speaks my right drawn sword may prove.", - - "Now is the winter of our discontent" + - "Made glorious summer by this sun of York;" + - "And all the clouds that lour'd upon our house" + - "In the deep bosom of the ocean buried." + - "Now are our brows bound with victorious wreaths;" + - "Our bruised arms hung up for monuments;" + - "Our stern alarums changed to merry meetings," + - "Our dreadful marches to delightful measures." + - "Grim-visaged war hath smooth'd his wrinkled front;" + - "And now, instead of mounting barded steeds" + - "To fright the souls of fearful adversaries," + - "He capers nimbly in a lady's chamber" + - "To the lascivious pleasing of a lute." + - "But I, that am not shaped for sportive tricks," + - "Nor made to court an amorous looking-glass;" + - "I, that am rudely stamp'd, and want love's majesty" + - "To strut before a wanton ambling nymph;" + - "I, that am curtail'd of this fair proportion," + - "Cheated of feature by dissembling nature," + - "Deformed, unfinish'd, sent before my time" + - "Into this breathing world, scarce half made up," + - "And that so lamely and unfashionable" + - "That dogs bark at me as I halt by them;" + - "Why, I, in this weak piping time of peace," + - "Have no delight to pass away the time," + - "Unless to spy my shadow in the sun" + - "And descant on mine own deformity:" + - "And therefore, since I cannot prove a lover," + - "To entertain these fair well-spoken days," + - "I am determined to prove a villain" + - "And hate the idle pleasures of these days." + - "Plots have I laid, inductions dangerous," + - "By drunken prophecies, libels and dreams," + - "To set my brother Clarence and the king" + - "In deadly hate the one against the other:" + - "And if King Edward be as true and just" + - "As I am subtle, false and treacherous," + - "This day should Clarence closely be mew'd up," + - "About a prophecy, which says that 'G'" + - "Of Edward's heirs the murderer shall be." + - "Dive, thoughts, down to my soul: here" + - "Clarence comes.", - - "To bait fish withal: if it will feed nothing else," + - "it will feed my revenge. He hath disgraced me, and" + - "hindered me half a million; laughed at my losses," + - "mocked at my gains, scorned my nation, thwarted my" + - "bargains, cooled my friends, heated mine" + - "enemies; and what's his reason? I am a Jew. Hath" + - "not a Jew eyes? hath not a Jew hands, organs," + - "dimensions, senses, affections, passions? fed with" + - "the same food, hurt with the same weapons, subject" + - "to the same diseases, healed by the same means," + - "warmed and cooled by the same winter and summer, as" + - "a Christian is? If you prick us, do we not bleed?" + - "if you tickle us, do we not laugh? if you poison" + - "us, do we not die? and if you wrong us, shall we not" + - "revenge? If we are like you in the rest, we will" + - "resemble you in that. If a Jew wrong a Christian," + - "what is his humility? Revenge. If a Christian" + - "wrong a Jew, what should his sufferance be by" + - "Christian example? Why, revenge. The villany you" + - "teach me, I will execute, and it shall go hard but I" + - "will better the instruction.", - - "Virtue! a fig! 'tis in ourselves that we are thus" + - "or thus. Our bodies are our gardens, to the which" + - "our wills are gardeners: so that if we will plant" + - "nettles, or sow lettuce, set hyssop and weed up" + - "thyme, supply it with one gender of herbs, or" + - "distract it with many, either to have it sterile" + - "with idleness, or manured with industry, why, the" + - "power and corrigible authority of this lies in our" + - "wills. If the balance of our lives had not one" + - "scale of reason to poise another of sensuality, the" + - "blood and baseness of our natures would conduct us" + - "to most preposterous conclusions: but we have" + - "reason to cool our raging motions, our carnal" + - "stings, our unbitted lusts, whereof I take this that" + - "you call love to be a sect or scion.", - - "Blow, winds, and crack your cheeks! rage! blow!" + - "You cataracts and hurricanoes, spout" + - "Till you have drench'd our steeples, drown'd the cocks!" + - "You sulphurous and thought-executing fires," + - "Vaunt-couriers to oak-cleaving thunderbolts," + - "Singe my white head! And thou, all-shaking thunder," + - "Smite flat the thick rotundity o' the world!" + - "Crack nature's moulds, an germens spill at once," + - "That make ingrateful man!" - }; -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/Preference.java b/samples/demos/src/com/actionbarsherlock/sample/demos/Preference.java deleted file mode 100644 index 27cfc7d..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/Preference.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import com.actionbarsherlock.app.SherlockPreferenceActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; - -public class Preference extends SherlockPreferenceActivity { - @Override - public boolean onCreateOptionsMenu(Menu menu) { - //Used to put dark icons on light action bar - boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light; - - menu.add("Save") - .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - menu.add("Search") - .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - menu.add("Refresh") - .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - return super.onCreateOptionsMenu(menu); - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.preferences); - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/Progress.java b/samples/demos/src/com/actionbarsherlock/sample/demos/Progress.java deleted file mode 100644 index f6b4b88..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/Progress.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import android.os.Handler; -import android.view.View; - -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Window; - -public class Progress extends SherlockActivity { - Handler mHandler = new Handler(); - Runnable mProgressRunner = new Runnable() { - @Override - public void run() { - mProgress += 2; - - //Normalize our progress along the progress bar's scale - int progress = (Window.PROGRESS_END - Window.PROGRESS_START) / 100 * mProgress; - setSupportProgress(progress); - - if (mProgress < 100) { - mHandler.postDelayed(mProgressRunner, 50); - } - } - }; - - private int mProgress = 100; - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - - //This has to be called before setContentView and you must use the - //class in com.actionbarsherlock.view and NOT android.view - requestWindowFeature(Window.FEATURE_PROGRESS); - - setContentView(R.layout.progress); - - findViewById(R.id.go).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View arg0) { - if (mProgress == 100) { - mProgress = 0; - mProgressRunner.run(); - } - } - }); - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/SampleList.java b/samples/demos/src/com/actionbarsherlock/sample/demos/SampleList.java deleted file mode 100644 index 38ef4c0..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/SampleList.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.actionbarsherlock.sample.demos; - -import java.text.Collator; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import android.content.Intent; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.os.Bundle; -import android.view.View; -import android.widget.ListView; -import android.widget.SimpleAdapter; -import android.widget.Toast; - -import com.actionbarsherlock.app.SherlockListActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; -import com.actionbarsherlock.view.SubMenu; - -public class SampleList extends SherlockListActivity { - public static int THEME = R.style.Theme_Sherlock; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - Intent intent = getIntent(); - String path = intent.getStringExtra("com.example.android.apis.Path"); - - if (path == null) { - path = ""; - } - - setListAdapter(new SimpleAdapter(this, getData(path), - android.R.layout.simple_list_item_1, new String[] { "title" }, - new int[] { android.R.id.text1 })); - getListView().setTextFilterEnabled(true); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - SubMenu sub = menu.addSubMenu("Theme"); - sub.add(0, R.style.Theme_Sherlock, 0, "Default"); - sub.add(0, R.style.Theme_Sherlock_Light, 0, "Light"); - sub.add(0, R.style.Theme_Sherlock_Light_DarkActionBar, 0, "Light (Dark Action Bar)"); - sub.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home || item.getItemId() == 0) { - return false; - } - THEME = item.getItemId(); - Toast.makeText(this, "Theme changed to \"" + item.getTitle() + "\"", Toast.LENGTH_SHORT).show(); - return true; - } - - protected List<Map<String, Object>> getData(String prefix) { - List<Map<String, Object>> myData = new ArrayList<Map<String, Object>>(); - - Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); - mainIntent.addCategory("com.actionbarsherlock.sample.demos.EXAMPLE"); - - PackageManager pm = getPackageManager(); - List<ResolveInfo> list = pm.queryIntentActivities(mainIntent, 0); - - if (null == list) - return myData; - - String[] prefixPath; - String prefixWithSlash = prefix; - - if (prefix.equals("")) { - prefixPath = null; - } else { - prefixPath = prefix.split("/"); - prefixWithSlash = prefix + "/"; - } - - int len = list.size(); - - Map<String, Boolean> entries = new HashMap<String, Boolean>(); - - for (int i = 0; i < len; i++) { - ResolveInfo info = list.get(i); - CharSequence labelSeq = info.loadLabel(pm); - String label = labelSeq != null - ? labelSeq.toString() - : info.activityInfo.name; - - if (prefixWithSlash.length() == 0 || label.startsWith(prefixWithSlash)) { - - String[] labelPath = label.split("/"); - - String nextLabel = prefixPath == null ? labelPath[0] : labelPath[prefixPath.length]; - - if ((prefixPath != null ? prefixPath.length : 0) == labelPath.length - 1) { - addItem(myData, nextLabel, activityIntent( - info.activityInfo.applicationInfo.packageName, - info.activityInfo.name)); - } else { - if (entries.get(nextLabel) == null) { - addItem(myData, nextLabel, browseIntent(prefix.equals("") ? nextLabel : prefix + "/" + nextLabel)); - entries.put(nextLabel, true); - } - } - } - } - - Collections.sort(myData, sDisplayNameComparator); - - return myData; - } - - private final static Comparator<Map<String, Object>> sDisplayNameComparator = - new Comparator<Map<String, Object>>() { - private final Collator collator = Collator.getInstance(); - - public int compare(Map<String, Object> map1, Map<String, Object> map2) { - return collator.compare(map1.get("title"), map2.get("title")); - } - }; - - protected Intent activityIntent(String pkg, String componentName) { - Intent result = new Intent(); - result.setClassName(pkg, componentName); - return result; - } - - protected Intent browseIntent(String path) { - Intent result = new Intent(); - result.setClass(this, SampleList.class); - result.putExtra("com.example.android.apis.Path", path); - return result; - } - - protected void addItem(List<Map<String, Object>> data, String name, Intent intent) { - Map<String, Object> temp = new HashMap<String, Object>(); - temp.put("title", name); - temp.put("intent", intent); - data.add(temp); - } - - @Override - @SuppressWarnings("unchecked") - protected void onListItemClick(ListView l, View v, int position, long id) { - Map<String, Object> map = (Map<String, Object>)l.getItemAtPosition(position); - - Intent intent = (Intent) map.get("intent"); - startActivity(intent); - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/ShareActionProviders.java b/samples/demos/src/com/actionbarsherlock/sample/demos/ShareActionProviders.java deleted file mode 100644 index 5b7ece2..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/ShareActionProviders.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.actionbarsherlock.sample.demos; - -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.widget.TextView; - -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; -import com.actionbarsherlock.widget.ShareActionProvider; - -/** - * This activity demonstrates how to use an {@link android.view.ActionProvider} - * for adding functionality to the Action Bar. In particular this demo is adding - * a menu item with ShareActionProvider as its action provider. The - * ShareActionProvider is responsible for managing the UI for sharing actions. - */ -public class ShareActionProviders extends SherlockActivity { - - private static final String SHARED_FILE_NAME = "shared.png"; - - @Override - public void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.text); - ((TextView)findViewById(R.id.text)).setText(R.string.share_action_providers_content); - copyPrivateRawResuorceToPubliclyAccessibleFile(); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate your menu. - getSupportMenuInflater().inflate(R.menu.share_action_provider, menu); - - // Set file with share history to the provider and set the share intent. - MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); - ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); - actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); - // Note that you can set/change the intent any time, - // say when the user has selected an image. - actionProvider.setShareIntent(createShareIntent()); - - //XXX: For now, ShareActionProviders must be displayed on the action bar - // Set file with share history to the provider and set the share intent. - //MenuItem overflowItem = menu.findItem(R.id.menu_item_share_action_provider_overflow); - //ShareActionProvider overflowProvider = - // (ShareActionProvider) overflowItem.getActionProvider(); - //overflowProvider.setShareHistoryFileName( - // ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); - // Note that you can set/change the intent any time, - // say when the user has selected an image. - //overflowProvider.setShareIntent(createShareIntent()); - - return true; - } - - /** - * Creates a sharing {@link Intent}. - * - * @return The sharing intent. - */ - private Intent createShareIntent() { - Intent shareIntent = new Intent(Intent.ACTION_SEND); - shareIntent.setType("image/*"); - Uri uri = Uri.fromFile(getFileStreamPath("shared.png")); - shareIntent.putExtra(Intent.EXTRA_STREAM, uri); - return shareIntent; - } - - /** - * Copies a private raw resource content to a publicly readable - * file such that the latter can be shared with other applications. - */ - private void copyPrivateRawResuorceToPubliclyAccessibleFile() { - InputStream inputStream = null; - FileOutputStream outputStream = null; - try { - inputStream = getResources().openRawResource(R.raw.robot); - outputStream = openFileOutput(SHARED_FILE_NAME, - Context.MODE_WORLD_READABLE | Context.MODE_APPEND); - byte[] buffer = new byte[1024]; - int length = 0; - try { - while ((length = inputStream.read(buffer)) > 0){ - outputStream.write(buffer, 0, length); - } - } catch (IOException ioe) { - /* ignore */ - } - } catch (FileNotFoundException fnfe) { - /* ignore */ - } finally { - try { - inputStream.close(); - } catch (IOException ioe) { - /* ignore */ - } - try { - outputStream.close(); - } catch (IOException ioe) { - /* ignore */ - } - } - } -}
\ No newline at end of file diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/Simple.java b/samples/demos/src/com/actionbarsherlock/sample/demos/Simple.java deleted file mode 100644 index a5eb843..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/Simple.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import android.widget.TextView; - -import com.actionbarsherlock.app.SherlockActivity; - -public class Simple extends SherlockActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.text); - ((TextView)findViewById(R.id.text)).setText(R.string.simple_content); - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionItems.java b/samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionItems.java deleted file mode 100644 index d155870..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionItems.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.widget.TextView; - -//We're the same! Manifest and content text changes only. -public class SplitActionItems extends ActionItems { - @Override - public void setContent(TextView view) { - view.setText(R.string.split_content); - } -}
\ No newline at end of file diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionModes.java b/samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionModes.java deleted file mode 100644 index e1d7850..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/SplitActionModes.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -//We're the same! Manifest changes only. -public class SplitActionModes extends ActionModes {} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/StaticAttachment.java b/samples/demos/src/com/actionbarsherlock/sample/demos/StaticAttachment.java deleted file mode 100644 index b48bf85..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/StaticAttachment.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import com.actionbarsherlock.ActionBarSherlock; -import com.actionbarsherlock.ActionBarSherlock.OnCreateOptionsMenuListener; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; -import android.app.Activity; -import android.content.pm.ActivityInfo; -import android.os.Bundle; -import android.widget.TextView; - -public class StaticAttachment extends Activity implements OnCreateOptionsMenuListener { - ActionBarSherlock mSherlock = ActionBarSherlock.wrap(this); - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - - /* - * Most interactions with what would otherwise be the system UI should - * now be done through this instance. Content, title, action bar, and - * menu inflation can all be done. - * - * All of the base activities use this class to provide the normal - * action bar functionality so everything that they can do is possible - * using this static attachment method. - * - * Calling something like setContentView or getActionBar on this - * instance is required in order to properly set up the wrapped layout - * and dispatch menu events (if they are needed). - */ - mSherlock.setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); - mSherlock.setContentView(R.layout.text); - - ((TextView)findViewById(R.id.text)).setText(R.string.static_attach_content); - } - - /* - * In order to use action items properly with static attachment you - * need to dispatch create, prepare, and selected events for the - * native type to the ActionBarSherlock instance. If for some reason - * you need to use static attachment you should probably create a - * common base activity that does this for all three methods. - */ - @Override - public boolean onCreateOptionsMenu(android.view.Menu menu) { - return mSherlock.dispatchCreateOptionsMenu(menu); - } - - /* - * In order to receive these events you need to implement an interface - * from ActionBarSherlock so it knows to dispatch to this callback. - * There are three possible interface you can implement, one for each - * menu event. - * - * Remember, there are no superclass implementations of these methods so - * you must return a value with meaning. - */ - @Override - public boolean onCreateOptionsMenu(Menu menu) { - //Used to put dark icons on light action bar - boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light; - - menu.add("Save") - .setIcon(isLight ? R.drawable.ic_compose_inverse : R.drawable.ic_compose) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - menu.add("Search") - .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - menu.add("Refresh") - .setIcon(isLight ? R.drawable.ic_refresh_inverse : R.drawable.ic_refresh) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - return true; - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/Styled.java b/samples/demos/src/com/actionbarsherlock/sample/demos/Styled.java deleted file mode 100644 index 4655e20..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/Styled.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.graphics.Shader.TileMode; -import android.graphics.drawable.BitmapDrawable; -import android.os.Build; -import android.os.Bundle; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; - -public class Styled extends SherlockActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.text); - ((TextView)findViewById(R.id.text)).setText(R.string.styled_content); - - //This is a workaround for http://b.android.com/15340 from http://stackoverflow.com/a/5852198/132047 - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - BitmapDrawable bg = (BitmapDrawable)getResources().getDrawable(R.drawable.bg_striped); - bg.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT); - getSupportActionBar().setBackgroundDrawable(bg); - - BitmapDrawable bgSplit = (BitmapDrawable)getResources().getDrawable(R.drawable.bg_striped_split_img); - bgSplit.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT); - getSupportActionBar().setSplitBackgroundDrawable(bgSplit); - } - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - menu.add("Save") - .setIcon(R.drawable.ic_compose) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - menu.add("Search") - .setIcon(R.drawable.ic_search) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - menu.add("Refresh") - .setIcon(R.drawable.ic_refresh) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - return super.onCreateOptionsMenu(menu); - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/SubMenus.java b/samples/demos/src/com/actionbarsherlock/sample/demos/SubMenus.java deleted file mode 100644 index 33e65a5..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/SubMenus.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2011 Jake Wharton - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.actionbarsherlock.sample.demos; - -import android.os.Bundle; -import android.widget.TextView; -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuItem; -import com.actionbarsherlock.view.SubMenu; - -public class SubMenus extends SherlockActivity { - @Override - public boolean onCreateOptionsMenu(Menu menu) { - - SubMenu subMenu1 = menu.addSubMenu("Action Item"); - subMenu1.add("Sample"); - subMenu1.add("Menu"); - subMenu1.add("Items"); - - MenuItem subMenu1Item = subMenu1.getItem(); - subMenu1Item.setIcon(R.drawable.ic_title_share_default); - subMenu1Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - SubMenu subMenu2 = menu.addSubMenu("Overflow Item"); - subMenu2.add("These"); - subMenu2.add("Are"); - subMenu2.add("Sample"); - subMenu2.add("Items"); - - MenuItem subMenu2Item = subMenu2.getItem(); - subMenu2Item.setIcon(R.drawable.ic_compose); - - return super.onCreateOptionsMenu(menu); - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(SampleList.THEME); //Used for theme switching in samples - super.onCreate(savedInstanceState); - setContentView(R.layout.text); - ((TextView)findViewById(R.id.text)).setText(R.string.submenus_content); - } -} diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigation.java b/samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigation.java deleted file mode 100644 index 19bc031..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigation.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.actionbarsherlock.sample.demos;
-
-import android.os.Bundle;
-import android.support.v4.app.FragmentTransaction;
-import android.widget.TextView;
-
-import com.actionbarsherlock.app.ActionBar;
-import com.actionbarsherlock.app.ActionBar.Tab;
-import com.actionbarsherlock.app.SherlockActivity;
-
-public class TabNavigation extends SherlockActivity implements ActionBar.TabListener {
- private TextView mSelected;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- setTheme(SampleList.THEME); //Used for theme switching in samples
- super.onCreate(savedInstanceState);
-
- setContentView(R.layout.tab_navigation);
- mSelected = (TextView)findViewById(R.id.text);
-
- getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
- for (int i = 1; i <= 3; i++) {
- ActionBar.Tab tab = getSupportActionBar().newTab();
- tab.setText("Tab " + i);
- tab.setTabListener(this);
- getSupportActionBar().addTab(tab);
- }
- }
-
- @Override
- public void onTabReselected(Tab tab, FragmentTransaction transaction) {
- }
-
- @Override
- public void onTabSelected(Tab tab, FragmentTransaction transaction) {
- mSelected.setText("Selected: " + tab.getText());
- }
-
- @Override
- public void onTabUnselected(Tab tab, FragmentTransaction transaction) {
- }
-}
diff --git a/samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigationCollapsed.java b/samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigationCollapsed.java deleted file mode 100644 index 033d2f5..0000000 --- a/samples/demos/src/com/actionbarsherlock/sample/demos/TabNavigationCollapsed.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.actionbarsherlock.sample.demos;
-
-import android.os.Bundle;
-
-public class TabNavigationCollapsed extends TabNavigation {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- //The following two options trigger the collapsing of the main action bar view.
- //See the parent activity for the rest of the implementation
- getSupportActionBar().setDisplayShowHomeEnabled(false);
- getSupportActionBar().setDisplayShowTitleEnabled(false);
- }
-}
|