Example usage for android.view View getTag

List of usage examples for android.view View getTag

Introduction

In this page you can find the example usage for android.view View getTag.

Prototype

@ViewDebug.ExportedProperty
public Object getTag() 

Source Link

Document

Returns this view's tag.

Usage

From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java

static void processTabClick(Activity a, View v, int current) {
    int id = v.getId();
    if (id == current) {
        return;//w  ww  .  j a v  a2s.com
    }

    final TabWidget ll = (TabWidget) a.findViewById(R.id.buttonbar);

    activateTab(a, id);
    if (id != R.id.nowplaying) {
        ll.setCurrentTab((Integer) v.getTag());
        setIntPref(a, "activetab", id);
    }
}

From source file:net.idlesoft.android.apps.github.adapters.BranchListAdapter.java

public View getView(final int index, View convertView, final ViewGroup parent) {
    ViewHolder holder;// w w  w.j a v  a 2s. com
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.branch_list_item, null);
        holder = new ViewHolder();
        holder.text = (TextView) convertView.findViewById(R.id.tv_branchListItem_branchName);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    try {
        holder.text.setText(mJson.names().getString(index));
    } catch (final JSONException e) {
        e.printStackTrace();
    }
    return convertView;
}

From source file:com.pyxistech.android.rabbitreminder.adaptaters.AlertListAdapter.java

public View getView(int position, View convertView, ViewGroup parent) {
    AlertViewWrapper wrapper = null;//from  w w  w.  j  a  v  a2 s .c  om
    if (convertView == null) {
        convertView = inflater.inflate(R.layout.alert_list_item, null);
        wrapper = new AlertViewWrapper(convertView);
        convertView.setTag(wrapper);
    } else {
        wrapper = (AlertViewWrapper) convertView.getTag();
    }

    setItemText(position, wrapper);

    checkItemIfDone(position, wrapper);
    strikeThroughtItemIfDone(position, wrapper);
    try {
        setNotificationModeText(position, wrapper);
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return convertView;
}

From source file:com.android.inputmethod.keyboard.emoji.EmojiPalettesView.java

/**
 * Called from {@link EmojiPageKeyboardView} through {@link android.view.View.OnClickListener}
 * interface to handle non-canceled touch-up events from View-based elements such as the space
 * bar./*from   w  w  w  .j  a v  a2  s  .co  m*/
 */
@Override
public void onClick(View v) {
    final Object tag = v.getTag();
    if (!(tag instanceof Integer)) {
        return;
    }
    final int code = (Integer) tag;
    mKeyboardActionListener.onCodeInput(code, NOT_A_COORDINATE, NOT_A_COORDINATE, false /* isKeyRepeat */);
    mKeyboardActionListener.onReleaseKey(code, false /* withSliding */);
}

From source file:com.awesome.byunghwa.app.popularmoviesapp2.adapter.MovieListRecyclerViewAdapter.java

@Override
public void onClick(final View v) {
    // Give some time to the ripple to finish the effect
    if (onItemClickListener != null) {
        new Handler().postDelayed(new Runnable() {
            @Override//from  ww  w. j a  va2  s .co m
            public void run() {
                LogUtil.log_i(TAG, "MovieListRecyclerViewAdapter Clicked Item Id: " + v.getTag());
                onItemClickListener.onItemClick(v, (Long) v.getTag(), getType());
            }
        }, 200);
    }
}

From source file:net.networksaremadeofstring.cyllell.ViewRoles_Fragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    list = (ListView) this.getActivity().findViewById(R.id.rolesListView);
    settings = this.getActivity().getSharedPreferences("Cyllell", 0);
    try {/*from   w ww  . ja v a 2s  .  com*/
        Cut = new Cuts(getActivity());
    } catch (Exception e) {
        e.printStackTrace();
    }

    dialog = new ProgressDialog(getActivity());
    dialog.setTitle("Contacting Chef");
    dialog.setMessage("Please wait: Prepping Authentication protocols");
    dialog.setIndeterminate(true);
    if (listOfRoles.size() < 1) {
        dialog.show();
    }

    updateListNotify = new Handler() {
        public void handleMessage(Message msg) {
            int tag = msg.getData().getInt("tag", 999999);

            if (msg.what == 0) {
                if (tag != 999999) {
                    listOfRoles.get(tag).SetSpinnerVisible();
                }
            } else if (msg.what == 1) {
                //Get rid of the lock
                CutInProgress = false;

                //the notifyDataSetChanged() will handle the rest
            } else if (msg.what == 99) {
                if (tag != 999999) {
                    Toast.makeText(ViewRoles_Fragment.this.getActivity(),
                            "An error occured during that operation.", Toast.LENGTH_LONG).show();
                    listOfRoles.get(tag).SetErrorState();
                }
            }
            RoleAdapter.notifyDataSetChanged();
        }
    };

    final Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            //Once we've checked the data is good to use start processing it
            if (msg.what == 0) {
                OnClickListener listener = new OnClickListener() {
                    public void onClick(View v) {
                        GetMoreDetails((Integer) v.getTag());
                    }
                };

                OnLongClickListener listenerLong = new OnLongClickListener() {
                    public boolean onLongClick(View v) {
                        selectForCAB((Integer) v.getTag());
                        return true;
                    }
                };

                RoleAdapter = new RoleListAdaptor(getActivity(), listOfRoles, listener, listenerLong);
                list = (ListView) getView().findViewById(R.id.rolesListView);
                if (list != null) {
                    if (RoleAdapter != null) {
                        list.setAdapter(RoleAdapter);
                    } else {
                        //Log.e("CookbookAdapter","CookbookAdapter is null");
                    }
                } else {
                    //Log.e("List","List is null");
                }

                dialog.dismiss();
            } else if (msg.what == 200) {
                dialog.setMessage("Sending request to Chef...");
            } else if (msg.what == 201) {
                dialog.setMessage("Parsing JSON.....");
            } else if (msg.what == 202) {
                dialog.setMessage("Populating UI!");
            } else {
                //Close the Progress dialog
                dialog.dismiss();

                //Alert the user that something went terribly wrong
                AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create();
                alertDialog.setTitle("API Error");
                alertDialog.setMessage("There was an error communicating with the API:\n"
                        + msg.getData().getString("exception"));
                alertDialog.setButton2("Back", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        //getActivity().finish();
                    }
                });
                alertDialog.setIcon(R.drawable.icon);
                alertDialog.show();
            }
        }
    };

    Thread dataPreload = new Thread() {
        public void run() {
            if (listOfRoles.size() > 0) {
                handler.sendEmptyMessage(0);
            } else {
                try {
                    handler.sendEmptyMessage(200);
                    Roles = Cut.GetRoles();
                    handler.sendEmptyMessage(201);

                    JSONArray Keys = Roles.names();

                    for (int i = 0; i < Keys.length(); i++) {
                        listOfRoles.add(new Role(Keys.getString(i), Roles.getString(Keys.getString(i))
                                .replaceFirst("^(https://|http://).*/roles/", "")));
                    }

                    handler.sendEmptyMessage(202);
                    handler.sendEmptyMessage(0);
                } catch (Exception e) {
                    Message msg = new Message();
                    Bundle data = new Bundle();
                    data.putString("exception", e.getMessage());
                    msg.setData(data);
                    msg.what = 1;
                    handler.sendMessage(msg);
                }
            }
            return;
        }
    };

    dataPreload.start();
    return inflater.inflate(R.layout.roles_landing, container, false);
}

From source file:li.klass.fhem.appwidget.view.widget.base.otherWidgets.OtherWidgetsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.other_widgets_list, container, false);

    ListView listView = (ListView) view.findViewById(R.id.list);
    listView.setOnItemClickListener(new OnItemClickListener() {
        @Override/*w w w .jav a2 s  .com*/
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            WidgetType widgetType = (WidgetType) view.getTag();
            OtherWidgetsFragment.this.onClick(widgetType);
        }
    });

    OtherWidgetsAdapter adapter = new OtherWidgetsAdapter(getActivity());
    listView.setAdapter(adapter);

    LinearLayout emptyView = (LinearLayout) view.findViewById(R.id.emptyView);
    fillEmptyView(emptyView, R.string.widgetNoOther, container);

    return view;
}

From source file:com.richtodd.android.quiltdesign.app.QuiltEditActivity.java

private void populateLayoutBlocks() {
    List<BlockContainerEntry> entries;
    try {/* www .j  a v  a2s . c o  m*/
        Repository repository = Repository.getDefaultRepository(this);
        BlockContainer blocks = repository.getBlocks();
        entries = blocks.getEntries(true);
    } catch (RepositoryException ex) {
        return;
    }

    LinearLayout layoutRow = null;

    for (BlockContainerEntry entry : entries) {
        View view = QuiltEditActivity.this.getLayoutInflater().inflate(R.layout.listentry_block_selector, null);

        ImageView image_thumbnail = (ImageView) view.findViewById(R.id.image_thumbnail);
        image_thumbnail.setImageBitmap(entry.getThumbnail());

        view.setTag(entry.getBlockName());
        view.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                String blockName = (String) v.getTag();
                try {
                    getQuiltEditFragment().setBlock(blockName);
                } catch (Exception e) {
                    Handle.asRuntimeError(e);
                }
            }
        });

        if (m_layout_blocks.getOrientation() == LinearLayout.HORIZONTAL) {
            m_layout_blocks.addView(view);
        } else {
            if (layoutRow != null && layoutRow.getChildCount() == m_layout_blocks.getNumColumns()) {
                layoutRow = null;
            }
            if (layoutRow == null) {
                layoutRow = new LinearLayout(this);
                layoutRow.setOrientation(LinearLayout.HORIZONTAL);
                m_layout_blocks.addView(layoutRow);
            }
            layoutRow.addView(view);
        }
    }
}

From source file:net.networksaremadeofstring.cyllell.ViewEnvironments_Fragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    list = (ListView) this.getActivity().findViewById(R.id.environmentsListView);
    settings = this.getActivity().getSharedPreferences("Cyllell", 0);
    try {//from w w  w .  j  a va 2  s.  c  o m
        Cut = new Cuts(getActivity());
    } catch (Exception e) {
        e.printStackTrace();
    }

    dialog = new ProgressDialog(getActivity());
    dialog.setTitle("Contacting Chef");
    dialog.setMessage("Please wait: Prepping Authentication protocols");
    dialog.setIndeterminate(true);
    if (listOfEnvironments.size() < 1) {
        dialog.show();
    }

    updateListNotify = new Handler() {
        public void handleMessage(Message msg) {
            int tag = msg.getData().getInt("tag", 999999);

            if (msg.what == 0) {
                if (tag != 999999) {
                    listOfEnvironments.get(tag).SetSpinnerVisible();
                }
            } else if (msg.what == 1) {
                //Get rid of the lock
                CutInProgress = false;

                //the notifyDataSetChanged() will handle the rest
            } else if (msg.what == 99) {
                if (tag != 999999) {
                    Toast.makeText(ViewEnvironments_Fragment.this.getActivity(),
                            "An error occured during that operation.", Toast.LENGTH_LONG).show();
                    listOfEnvironments.get(tag).SetErrorState();
                }
            }
            EnvironmentAdapter.notifyDataSetChanged();
        }
    };

    final Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            //Once we've checked the data is good to use start processing it
            if (msg.what == 0) {
                OnClickListener listener = new OnClickListener() {
                    public void onClick(View v) {
                        //Log.i("OnClick","Clicked");
                        GetMoreDetails((Integer) v.getTag());
                    }
                };

                OnLongClickListener listenerLong = new OnLongClickListener() {
                    public boolean onLongClick(View v) {
                        selectForCAB((Integer) v.getTag());
                        return true;
                    }
                };

                EnvironmentAdapter = new EnvironmentListAdaptor(getActivity().getBaseContext(),
                        listOfEnvironments, listener, listenerLong);
                list = (ListView) getView().findViewById(R.id.environmentsListView);
                if (list != null) {
                    if (EnvironmentAdapter != null) {
                        list.setAdapter(EnvironmentAdapter);
                    } else {
                        //Log.e("EnvironmentAdapter","EnvironmentAdapter is null");
                    }
                } else {
                    //Log.e("List","List is null");
                }

                dialog.dismiss();
            } else if (msg.what == 200) {
                dialog.setMessage("Sending request to Chef...");
            } else if (msg.what == 201) {
                dialog.setMessage("Parsing JSON.....");
            } else if (msg.what == 202) {
                dialog.setMessage("Populating UI!");
            } else {
                //Close the Progress dialog
                dialog.dismiss();

                //Alert the user that something went terribly wrong
                AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create();
                alertDialog.setTitle("API Error");
                alertDialog.setMessage("There was an error communicating with the API:\n"
                        + msg.getData().getString("exception"));
                alertDialog.setButton2("Back", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        getActivity().finish();
                    }
                });
                alertDialog.setIcon(R.drawable.icon);
                alertDialog.show();
            }
        }
    };

    Thread dataPreload = new Thread() {
        public void run() {
            if (listOfEnvironments.size() > 0) {
                handler.sendEmptyMessage(0);
            } else {
                try {
                    handler.sendEmptyMessage(200);
                    Environments = Cut.GetEnvironments();
                    handler.sendEmptyMessage(201);

                    JSONArray Keys = Environments.names();

                    for (int i = 0; i < Keys.length(); i++) {
                        listOfEnvironments.add(
                                new Environment(Keys.getString(i), Environments.getString(Keys.getString(i))
                                        .replaceFirst("^(https://|http://).*/environments/", "")));
                    }

                    handler.sendEmptyMessage(202);
                    handler.sendEmptyMessage(0);
                } catch (Exception e) {
                    Message msg = new Message();
                    Bundle data = new Bundle();
                    data.putString("exception", e.getMessage());
                    msg.setData(data);
                    msg.what = 1;
                    handler.sendMessage(msg);
                }
            }
            return;
        }
    };

    dataPreload.start();
    return inflater.inflate(R.layout.environments_landing, container, false);
}

From source file:at.ac.tuwien.detlef.fragments.EpisodeListFragment.java

/**
 * Handles clicks on the mark read/unread button
 *
 * @param v The view of the button/* ww  w .j a v a 2s.  c o  m*/
 */
public void onMarkReadUnreadClick(View v) {
    Episode episode = ((Episode) v.getTag());

    EpisodeDAO dao = Singletons.i().getEpisodeDAO();
    switch (episode.getActionState()) {
    case DOWNLOAD: // fall-through
    case NEW: // fall-through
    case PLAY:
        episode.setActionState(ActionState.DELETE);
        dao.update(episode);
        break;
    case DELETE:
        episode.setActionState(ActionState.NEW);
        dao.update(episode);
        break;
    default:
        Log.e(TAG, "Unknown action state encountered");
    }

    adapter.notifyDataSetChanged();
}