Search in sources :

Example 26 with ImageButton

use of android.widget.ImageButton in project neo4j-mobile-android by neo4j-contrib.

the class RelationshipPropertiesActivity method addRelationshipPropertiesListItem.

private void addRelationshipPropertiesListItem(final String key, final Object value) {
    View propertyListItem = inflater.inflate(R.layout.property_listitem, null);
    TextView propertyKeyText = (TextView) propertyListItem.findViewById(R.id.propertyKeyText);
    propertyKeyText.setText(key);
    TextView propertyValueText = (TextView) propertyListItem.findViewById(R.id.propertyValueText);
    propertyValueText.setText("" + value);
    ImageButton propertyEditButton = (ImageButton) propertyListItem.findViewById(R.id.propertyEditButton);
    if (value instanceof String) {
        final String valueString = (String) value;
        propertyEditButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                askUpdateProperty(key, valueString);
            }
        });
    } else {
        propertyEditButton.setEnabled(false);
    }
    ImageButton propertyDeleteButton = (ImageButton) propertyListItem.findViewById(R.id.propertyDeleteButton);
    propertyDeleteButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            confirmDeletionOfProperty(key, value);
        }
    });
    relationshipPropertiesListLayout.addView(propertyListItem);
}
Also used : ImageButton(android.widget.ImageButton) TextView(android.widget.TextView) ContentView(roboguice.inject.ContentView) InjectView(roboguice.inject.InjectView) TextView(android.widget.TextView) View(android.view.View)

Example 27 with ImageButton

use of android.widget.ImageButton in project android-sms-relay by nyaruka.

the class ActionBarHelperBase method addActionItemCompatFromMenuItem.

/**
     * Adds an action button to the compatibility action bar, using menu information from a {@link
     * android.view.MenuItem}. If the menu item ID is <code>menu_refresh</code>, the menu item's
     * state can be changed to show a loading spinner using
     * {@link com.nyaruka.android.actionbarcompat.ActionBarHelperBase#setRefreshActionItemState(boolean)}.
     */
private View addActionItemCompatFromMenuItem(final MenuItem item) {
    final int itemId = item.getItemId();
    final ViewGroup actionBar = getActionBarCompat();
    if (actionBar == null) {
        return null;
    }
    // Create the button
    ImageButton actionButton = new ImageButton(mActivity, null, itemId == android.R.id.home ? R.attr.actionbarCompatItemHomeStyle : R.attr.actionbarCompatItemStyle);
    actionButton.setLayoutParams(new ViewGroup.LayoutParams((int) mActivity.getResources().getDimension(itemId == android.R.id.home ? R.dimen.actionbar_compat_button_home_width : R.dimen.actionbar_compat_button_width), ViewGroup.LayoutParams.FILL_PARENT));
    if (itemId == R.id.menu_refresh) {
        actionButton.setId(R.id.actionbar_compat_item_refresh);
    }
    actionButton.setImageDrawable(item.getIcon());
    actionButton.setScaleType(ImageView.ScaleType.CENTER);
    actionButton.setContentDescription(item.getTitle());
    actionButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View view) {
            mActivity.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, item);
        }
    });
    actionBar.addView(actionButton);
    if (item.getItemId() == R.id.menu_refresh) {
        // Refresh buttons should be stateful, and allow for indeterminate progress indicators,
        // so add those.
        ProgressBar indicator = new ProgressBar(mActivity, null, R.attr.actionbarCompatProgressIndicatorStyle);
        final int buttonWidth = mActivity.getResources().getDimensionPixelSize(R.dimen.actionbar_compat_button_width);
        final int buttonHeight = mActivity.getResources().getDimensionPixelSize(R.dimen.actionbar_compat_height);
        final int progressIndicatorWidth = buttonWidth / 2;
        LinearLayout.LayoutParams indicatorLayoutParams = new LinearLayout.LayoutParams(progressIndicatorWidth, progressIndicatorWidth);
        indicatorLayoutParams.setMargins((buttonWidth - progressIndicatorWidth) / 2, (buttonHeight - progressIndicatorWidth) / 2, (buttonWidth - progressIndicatorWidth) / 2, 0);
        indicator.setLayoutParams(indicatorLayoutParams);
        indicator.setVisibility(View.GONE);
        indicator.setId(R.id.actionbar_compat_item_refresh_progress);
        actionBar.addView(indicator);
    }
    return actionButton;
}
Also used : ImageButton(android.widget.ImageButton) ViewGroup(android.view.ViewGroup) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) ProgressBar(android.widget.ProgressBar) LinearLayout(android.widget.LinearLayout)

Example 28 with ImageButton

use of android.widget.ImageButton in project android-demos by novoda.

the class DynamicListItems method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dynamic_list);
    newValue = (EditText) findViewById(R.id.new_value_field);
    setListAdapter(new SimpleAdapter(this, list, R.layout.row, new String[] { ITEM_KEY }, new int[] { R.id.list_value }));
    ((ImageButton) findViewById(R.id.button)).setOnClickListener(getBtnClickListener());
}
Also used : ImageButton(android.widget.ImageButton) SimpleAdapter(android.widget.SimpleAdapter)

Example 29 with ImageButton

use of android.widget.ImageButton in project JamsMusicPlayer by psaravan.

the class AddMusicLibraryDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    libraryLabelID = "circle_blue_dark";
    View rootView = getActivity().getLayoutInflater().inflate(R.layout.dialog_add_music_library, null);
    TextView instructions = (TextView) rootView.findViewById(R.id.add_music_library_instructions);
    instructions.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    instructions.setPaintFlags(instructions.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    final ImageButton labelButton = (ImageButton) rootView.findViewById(R.id.add_music_library_label_button);
    final EditText musicLibraryName = (EditText) rootView.findViewById(R.id.add_music_library_text_field);
    musicLibraryName.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    musicLibraryName.setPaintFlags(musicLibraryName.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    labelButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            //Create a new array with a list of all the library labels.
            final Drawable[] labelsArray = { getActivity().getResources().getDrawable(R.drawable.circle_blue_dark), getActivity().getResources().getDrawable(R.drawable.circle_blue_light), getActivity().getResources().getDrawable(R.drawable.circle_green_dark), getActivity().getResources().getDrawable(R.drawable.circle_green_light), getActivity().getResources().getDrawable(R.drawable.circle_purple_dark), getActivity().getResources().getDrawable(R.drawable.circle_purple_light), getActivity().getResources().getDrawable(R.drawable.circle_red_dark), getActivity().getResources().getDrawable(R.drawable.circle_red_light), getActivity().getResources().getDrawable(R.drawable.circle_yellow_dark), getActivity().getResources().getDrawable(R.drawable.circle_yellow_light) };
            //Create a new array with a list of all the library labels.
            final String[] labelsIdsArray = { "circle_blue_dark", "circle_blue_light", "circle_green_dark", "circle_green_light", "circle_purple_dark", "circle_purple_light", "circle_red_dark", "circle_red_light", "circle_yellow_dark", "circle_yellow_light" };
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
            builder.setTitle(R.string.music_library_label);
            ArrayList<String> labelTitles = new ArrayList<String>();
            labelTitles.addAll(Arrays.asList(getActivity().getResources().getStringArray(R.array.library_labels)));
            builder.setAdapter(new LibraryLabelsAdapter(getActivity(), labelTitles), new OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    libraryLabelID = labelsIdsArray[which];
                    labelButton.setImageDrawable(labelsArray[which]);
                }
            });
            builder.create().show();
        }
    });
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    //Set the dialog title.
    builder.setTitle(R.string.add_music_library);
    builder.setView(rootView);
    builder.setPositiveButton(R.string.ok, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int arg1) {
            String libraryName = musicLibraryName.getText().toString();
            Intent intent = new Intent(getActivity(), MusicLibraryEditorActivity.class);
            Bundle bundle = new Bundle();
            bundle.putString("LIBRARY_NAME", libraryName);
            bundle.putString("LIBRARY_ICON", libraryLabelID);
            intent.putExtras(bundle);
            startActivity(intent);
            dialog.dismiss();
            getActivity().finish();
        }
    });
    builder.setNegativeButton(R.string.cancel, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int arg1) {
            dialog.dismiss();
            getActivity().finish();
        }
    });
    return builder.create();
}
Also used : EditText(android.widget.EditText) AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) Paint(android.graphics.Paint) ImageButton(android.widget.ImageButton) MusicLibraryEditorActivity(com.jams.music.player.MusicLibraryEditorActivity.MusicLibraryEditorActivity) LibraryLabelsAdapter(com.jams.music.player.MusicLibraryEditorActivity.LibraryLabelsAdapter) OnClickListener(android.content.DialogInterface.OnClickListener) TextView(android.widget.TextView)

Example 30 with ImageButton

use of android.widget.ImageButton in project weiciyuan by qii.

the class DMConversationListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.dmconversationlistfragment_layout, container, false);
    empty = (TextView) view.findViewById(R.id.empty);
    //dirty hack.....in other list, progressbar is used to indicate loading local data; but in this list,
    //use a progressbar to indicate loading new data first time, maybe be refactored at 0.50 version
    progressBar = new ProgressBar(getActivity());
    dmProgressBar = (ProgressBar) view.findViewById(R.id.progressbar);
    pullToRefreshListView = (PullToRefreshListView) view.findViewById(R.id.listView);
    pullToRefreshListView.setMode(PullToRefreshBase.Mode.BOTH);
    pullToRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {

        @Override
        public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
            loadOldMsg(null);
        }

        @Override
        public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
            loadNewMsg();
        }
    });
    getListView().setScrollingCacheEnabled(false);
    getListView().setHeaderDividersEnabled(false);
    getListView().setStackFromBottom(true);
    footerView = inflater.inflate(R.layout.listview_footer_layout, null);
    getListView().addFooterView(footerView);
    dismissFooterView();
    et = (EditText) view.findViewById(R.id.content);
    view.findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            send();
        }
    });
    ImageButton emoticon = (ImageButton) view.findViewById(R.id.emoticon);
    emoticon.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (smiley.isShown()) {
                hideSmileyPicker(true);
            } else {
                showSmileyPicker(SmileyPickerUtility.isKeyBoardShow(getActivity()));
            }
        }
    });
    smiley = (SmileyPicker) view.findViewById(R.id.smiley_picker);
    smiley.setEditText(getActivity(), (ViewGroup) view.findViewById(R.id.root_layout), et);
    mContainer = (LinearLayout) view.findViewById(R.id.container);
    et.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            hideSmileyPicker(true);
        }
    });
    buildListAdapter();
    return view;
}
Also used : ImageButton(android.widget.ImageButton) PullToRefreshListView(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView) ListView(android.widget.ListView) PullToRefreshBase(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshBase) View(android.view.View) AdapterView(android.widget.AdapterView) PullToRefreshListView(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView) TextView(android.widget.TextView) ListView(android.widget.ListView) ProgressBar(android.widget.ProgressBar)

Aggregations

ImageButton (android.widget.ImageButton)149 View (android.view.View)105 TextView (android.widget.TextView)83 ImageView (android.widget.ImageView)51 Button (android.widget.Button)26 ListView (android.widget.ListView)24 AdapterView (android.widget.AdapterView)23 OnClickListener (android.view.View.OnClickListener)21 LinearLayout (android.widget.LinearLayout)19 Intent (android.content.Intent)18 RelativeLayout (android.widget.RelativeLayout)13 DialogInterface (android.content.DialogInterface)11 Bundle (android.os.Bundle)11 LayoutInflater (android.view.LayoutInflater)11 EditText (android.widget.EditText)11 ViewGroup (android.view.ViewGroup)10 ArrayList (java.util.ArrayList)10 Builder (android.app.AlertDialog.Builder)7 MenuItem (android.view.MenuItem)7 Drawable (android.graphics.drawable.Drawable)6