Search in sources :

Example 36 with ImageView

use of android.widget.ImageView in project glitch-hq-android by tinyspeck.

the class EncyclopediaSkillsInCategoryListViewAdapter method getView.

public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    if (convertView != null) {
        holder = (ViewHolder) convertView.getTag();
    }
    if (holder == null) {
        convertView = m_inflater.inflate(R.layout.encyclopedia_skills_in_category_list_item, null);
        holder = new ViewHolder();
        holder.name = (TextView) convertView.findViewById(R.id.encyclopedia_skills_in_category_name);
        holder.name.setTypeface(m_application.m_vagFont);
        holder.icon = (ImageView) convertView.findViewById(R.id.encyclopedia_skills_in_category_icon);
        holder.whole = (View) convertView.findViewById(R.id.encyclopedia_skills_in_category_item);
        convertView.setTag(holder);
    }
    holder = (ViewHolder) convertView.getTag();
    if (position < getCount()) {
        skillAvailable skill = m_skillsList.get(position);
        holder.name.setText(skill.item);
        DrawableURL.Show(holder.icon, skill.icon, false);
        holder.whole.setTag(position);
        holder.whole.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                skillAvailable skill = m_skillsList.get((Integer) v.getTag());
                SkillDetailFragment f = new SkillDetailFragment(m_bf, skill.id);
                ((HomeScreen) m_act).setCurrentFragment(f, true);
            }
        });
    }
    return convertView;
}
Also used : BaseFragment.skillAvailable(com.tinyspeck.glitchhq.BaseFragment.skillAvailable) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) ImageView(android.widget.ImageView) View(android.view.View)

Example 37 with ImageView

use of android.widget.ImageView in project glitch-hq-android by tinyspeck.

the class MailChooseRecipientFragment method init.

private void init(View root) {
    boolean bUpdateData = m_recipientsList == null;
    if (bUpdateData)
        m_recipientsList = new Vector<glitchFriend>();
    m_filterText = (EditText) root.findViewById(R.id.recipients_search_box);
    m_filterText.addTextChangedListener(filterTextWatcher);
    m_filterClearImg = (ImageView) root.findViewById(R.id.recipients_filter_clear);
    m_filterClearImg.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            m_filterText.setText("");
        }
    });
    m_btnClose = (Button) root.findViewById(R.id.btnCloseRecipientChooser);
    m_btnClose.setVisibility(View.VISIBLE);
    m_btnClose.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            FragmentManager fm = getFragmentManager();
            fm.popBackStack();
        }
    });
    m_btnSidebar = (Button) root.findViewById(R.id.btnSidebar);
    m_btnSidebar.setVisibility(View.GONE);
    m_adapter = new FriendsListViewAdapter(this, m_recipientsList);
    m_listView = (LinearListView) root.findViewById(R.id.RecipientsListView);
    m_listView.setAdapter(m_adapter);
    if (bUpdateData) {
        getRecipients();
    } else {
        updateRecipients();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) OnClickListener(android.view.View.OnClickListener) Vector(java.util.Vector) ImageView(android.widget.ImageView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) View(android.view.View)

Example 38 with ImageView

use of android.widget.ImageView in project glitch-hq-android by tinyspeck.

the class SkillDetailFragment method setSkillDetailView.

void setSkillDetailView() {
    ImageView icon = (ImageView) m_root.findViewById(R.id.skill_detail_icon);
    //DrawableURL.Show( icon, m_currentSkill.icon, false );
    m_application.Download(m_currentSkill.icon, icon, MyApplication.DOWNLOAD_TYPE_NORMAL);
    TextView nameTv = (TextView) m_root.findViewById(R.id.skill_detail_name);
    nameTv.setTypeface(m_application.m_vagFont);
    nameTv.setText(m_currentSkill.item);
    TextView tv = (TextView) m_root.findViewById(R.id.caption_status);
    tv.setTypeface(m_application.m_vagFont);
    tv = (TextView) m_root.findViewById(R.id.caption_giant);
    tv.setTypeface(m_application.m_vagFont);
    tv = (TextView) m_root.findViewById(R.id.caption_needed);
    tv.setTypeface(m_application.m_vagFont);
    tv = (TextView) m_root.findViewById(R.id.caption_reqs);
    tv.setTypeface(m_application.m_vagFont);
    TextView timeTv = (TextView) m_root.findViewById(R.id.skill_detail_time);
    if (!(m_bf instanceof EncyclopediaSkillsInCategoryFragment) && !(m_bf instanceof EncyclopediaCategoriesFragment)) {
        if (m_currentSkill.learning && !m_currentSkill.paused && !m_currentSkill.got)
            timeTv.setText(R.string.str_you_are_learning);
        else if (m_currentSkill.unlearning && m_fromUnlearn)
            timeTv.setText(R.string.str_you_are_unlearning);
        else
            timeTv.setText(Util.TimeToString(m_currentSkill.totalTime, false));
    } else {
        nameTv.setTextSize(20);
        timeTv.setVisibility(View.GONE);
    }
    tv = (TextView) m_root.findViewById(R.id.skill_detail_description);
    tv.setText(m_currentSkill.description);
    Button btnLearn = (Button) m_root.findViewById(R.id.btn_learn_this_skill);
    btnLearn.setTypeface(m_application.m_vagFont);
    btnLearn.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {
            FlurryAgent.logEvent("Skill Detail - Tapped learn button");
            learnSkill();
        }
    });
    Button btnUnlearn = (Button) m_root.findViewById(R.id.btn_unlearn_this_skill);
    btnUnlearn.setTypeface(m_application.m_vagFont);
    btnUnlearn.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {
            FlurryAgent.logEvent("Skill Detail - Tapped unlearn button");
            unlearnSkill();
        }
    });
    Button btnCancelUnlearn = (Button) m_root.findViewById(R.id.btn_cancel_unlearning_this_skill);
    btnCancelUnlearn.setTypeface(m_application.m_vagFont);
    btnCancelUnlearn.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {
            FlurryAgent.logEvent("Skill Detail - Tapped cancel unlearn button");
            if (m_RemainingTimer != null) {
                m_RemainingTimer.cancel();
                m_RemainingTimer = null;
            }
            cancelUnlearning();
        }
    });
    View v_learn = m_root.findViewById(R.id.learning_process_bar);
    View v_unlearn = m_root.findViewById(R.id.unlearning_process_bar);
    if (m_bf instanceof EncyclopediaSkillsInCategoryFragment) {
        btnLearn.setVisibility(View.GONE);
        btnUnlearn.setVisibility(View.GONE);
        btnCancelUnlearn.setVisibility(View.GONE);
        v_learn.setVisibility(View.GONE);
        v_unlearn.setVisibility(View.GONE);
    } else if (m_currentSkill.learning && !m_currentSkill.paused && !m_currentSkill.got && !m_fromUnlearn) {
        btnLearn.setVisibility(View.GONE);
        btnUnlearn.setVisibility(View.GONE);
        btnCancelUnlearn.setVisibility(View.GONE);
        v_learn.setVisibility(View.VISIBLE);
        v_unlearn.setVisibility(View.GONE);
        UpdateSkillDetailProgress();
        InitUpdateSkillRemainingTimer();
    } else if (m_currentSkill.unlearning && m_fromUnlearn) {
        btnUnlearn.setVisibility(View.GONE);
        btnLearn.setVisibility(View.GONE);
        btnCancelUnlearn.setVisibility(View.VISIBLE);
        v_learn.setVisibility(View.GONE);
        v_unlearn.setVisibility(View.VISIBLE);
        UpdateUnlearnDetailProgress();
        InitUpdateSkillRemainingTimer();
    } else if ((m_currentSkill.got || !m_currentSkill.can_learn) && !m_currentSkill.can_unlearn) {
        v_learn.setVisibility(View.GONE);
        v_unlearn.setVisibility(View.GONE);
        btnLearn.setVisibility(View.GONE);
        btnUnlearn.setVisibility(View.GONE);
        btnCancelUnlearn.setVisibility(View.GONE);
    } else {
        v_unlearn.setVisibility(View.GONE);
        v_learn.setVisibility(View.GONE);
        btnCancelUnlearn.setVisibility(View.GONE);
        if (m_currentSkill.can_unlearn && m_fromUnlearn) {
            btnUnlearn.setVisibility(View.VISIBLE);
            btnLearn.setVisibility(View.GONE);
        } else {
            btnUnlearn.setVisibility(View.GONE);
            btnLearn.setVisibility(View.VISIBLE);
        }
    }
    View mLayout = m_root.findViewById(R.id.requirement_layout);
    LinearLayout lreq = (LinearLayout) m_root.findViewById(R.id.requirements);
    if (!addTextViewToLinearLayout(lreq, m_currentSkill.requirements, true))
        mLayout.setVisibility(View.GONE);
    else
        mLayout.setVisibility(View.VISIBLE);
    mLayout = m_root.findViewById(R.id.need_for_layout);
    LinearLayout ll = (LinearLayout) m_root.findViewById(R.id.post_request_panel);
    if (!addTextViewToLinearLayout(ll, m_currentSkill.postRequests, false))
        mLayout.setVisibility(View.GONE);
    else
        mLayout.setVisibility(View.VISIBLE);
    mLayout = m_root.findViewById(R.id.giant_layout);
    ll = (LinearLayout) m_root.findViewById(R.id.giant_panel);
    if (!addGiantToLinearLayout(ll, m_currentSkill.giants))
        mLayout.setVisibility(View.GONE);
    else
        mLayout.setVisibility(View.VISIBLE);
    tv = (TextView) m_root.findViewById(R.id.skill_status);
    if (m_currentSkill.learning && !m_currentSkill.paused && !m_currentSkill.got && !m_fromUnlearn)
        tv.setText(R.string.str_you_are_learning);
    else if (m_currentSkill.paused)
        tv.setText(R.string.str_skill_status_started);
    else if (m_currentSkill.unlearning && m_fromUnlearn)
        tv.setText(R.string.str_you_are_unlearning);
    else if (m_currentSkill.can_unlearn)
        tv.setText(R.string.str_you_can_unlearn);
    else if (m_currentSkill.got)
        tv.setText(R.string.str_you_have_skill);
    else if (!m_currentSkill.can_learn)
        tv.setText(R.string.str_you_can_not_learn);
    else
        tv.setText(R.string.str_skill_status_can_learn);
    m_root.scrollTo(0, 0);
}
Also used : Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 39 with ImageView

use of android.widget.ImageView in project glitch-hq-android by tinyspeck.

the class SnapDetailFragment method setSnapDetailView.

protected void setSnapDetailView(View root) {
    OnClickListener lsn = new OnClickListener() {

        public void onClick(View v) {
            String playerId = (String) v.getTag();
            ProfileFragment f = new ProfileFragment(m_this, playerId, true);
            ((HomeScreen) getActivity()).setCurrentFragment(f, true);
        }
    };
    TextView ownerName = (TextView) root.findViewById(R.id.snap_owner_name);
    ownerName.setTypeface(m_application.m_vagFont);
    ownerName.setText(m_currentSnap.who);
    ownerName.setTag(m_currentSnap.playerID);
    ownerName.setOnClickListener(lsn);
    ImageView goArrow = (ImageView) root.findViewById(R.id.snap_go_arrow);
    goArrow.setTag(m_currentSnap.playerID);
    goArrow.setOnClickListener(lsn);
    ImageView snapPhoto = (ImageView) root.findViewById(R.id.snap_detail_photo);
    m_application.Download(m_currentSnap.image, snapPhoto, MyApplication.DOWNLOAD_TYPE_NORMAL);
    snapPhoto.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            WebViewFragment f = new WebViewFragment(m_currentSnap.image_orig, "Snap", true);
            ((HomeScreen) getActivity()).setCurrentFragment(f, true);
        }
    });
    TextView snapDetail = (TextView) root.findViewById(R.id.snap_detail_text);
    snapDetail.setText(Html.fromHtml(m_currentSnap.what));
    snapDetail.setVisibility((m_currentSnap.what != null && m_currentSnap.what.length() > 0) ? View.VISIBLE : View.GONE);
    TextView snapTime = (TextView) root.findViewById(R.id.snap_detail_time);
    snapTime.setTypeface(m_application.m_vagLightFont);
    snapTime.setText(m_currentSnap.when);
    if (!m_currentSnap.when.equalsIgnoreCase("just now"))
        snapTime.setText(m_currentSnap.when + " ago");
    else
        snapTime.setText(m_currentSnap.when);
    TextView snapViews = (TextView) root.findViewById(R.id.snap_detail_views);
    snapViews.setTypeface(m_application.m_vagLightFont);
    if (m_currentSnap.views == 1)
        snapViews.setText(String.valueOf(m_currentSnap.views) + " view");
    else
        snapViews.setText(String.valueOf(m_currentSnap.views) + " views");
    EditText snapCommentEditor = (EditText) root.findViewById(R.id.snap_comment_editor);
    snapCommentEditor.setHint("Comment on " + m_currentSnap.who + "'s snap...");
    snapCommentEditor.setImeActionLabel("Done", EditorInfo.IME_ACTION_DONE);
    snapCommentEditor.setImeOptions(EditorInfo.IME_ACTION_DONE);
    snapCommentEditor.setOnEditorActionListener(new OnEditorActionListener() {

        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_NULL || actionId == EditorInfo.IME_ACTION_DONE) {
                postSnapComment(v.getText().toString());
                v.setText("");
                InputMethodManager mgr = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
                mgr.hideSoftInputFromWindow(v.getWindowToken(), 0);
            }
            return false;
        }
    });
    LinearLayout snapCommentsView = (LinearLayout) root.findViewById(R.id.snap_comments_view);
    if (m_currentSnap.comments != null && m_currentSnap.comments.size() > 0)
        snapCommentsView.setVisibility(View.VISIBLE);
    else
        snapCommentsView.setVisibility(View.GONE);
}
Also used : EditText(android.widget.EditText) InputMethodManager(android.view.inputmethod.InputMethodManager) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) KeyEvent(android.view.KeyEvent) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) OnEditorActionListener(android.widget.TextView.OnEditorActionListener) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Example 40 with ImageView

use of android.widget.ImageView in project glitch-hq-android by tinyspeck.

the class QuestsListViewAdapter method createRequirementView.

private View createRequirementView(glitchQuestRequirement req) {
    int id = 1;
    RelativeLayout holder = new RelativeLayout(m_act);
    LinearLayout.LayoutParams holderParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    holderParams.setMargins(10, 0, 0, 0);
    holder.setLayoutParams(holderParams);
    ImageView icon = new ImageView(m_act);
    icon.setId(id++);
    RelativeLayout.LayoutParams iconParams = new RelativeLayout.LayoutParams(23, 22);
    iconParams.setMargins(2, 0, 0, 5);
    iconParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    iconParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    icon.setLayoutParams(iconParams);
    if (req.icon != null) {
        DrawableURL.Show(icon, req.icon, false);
    } else {
        icon.setImageBitmap(BitmapFactory.decodeResource(m_act.getResources(), R.drawable.quest_requirement));
    }
    holder.addView(icon, iconParams);
    TextView last = new TextView(m_act);
    last.setId(id++);
    if (req.isCount) {
        TextView got = new TextView(m_act);
        got.setId(id++);
        RelativeLayout.LayoutParams gotParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        gotParams.addRule(RelativeLayout.RIGHT_OF, icon.getId());
        gotParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        gotParams.setMargins(4, 0, 0, 0);
        got.setLayoutParams(gotParams);
        got.setTextAppearance(m_act.getApplicationContext(), R.style.MoodTextStyle);
        got.setTypeface(null, Typeface.BOLD);
        got.setText(String.valueOf(req.gotNum));
        holder.addView(got, gotParams);
        RelativeLayout.LayoutParams lastParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        lastParams.addRule(RelativeLayout.RIGHT_OF, got.getId());
        lastParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        lastParams.setMargins(0, 0, 0, 0);
        last.setLayoutParams(lastParams);
        last.setTextAppearance(m_act.getApplicationContext(), R.style.MoodTextStyle);
        last.setText("/" + String.valueOf(req.needNum));
        holder.addView(last, lastParams);
    } else {
        RelativeLayout.LayoutParams lastParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        lastParams.addRule(RelativeLayout.RIGHT_OF, icon.getId());
        lastParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        lastParams.setMargins(4, 0, 0, 0);
        last.setLayoutParams(lastParams);
        last.setTextAppearance(m_act.getApplicationContext(), R.style.MoodTextStyle);
        last.setText(req.desc);
        holder.addView(last, lastParams);
    }
    if (req.completed) {
        ImageView check = new ImageView(m_act);
        RelativeLayout.LayoutParams checkParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        checkParams.addRule(RelativeLayout.ALIGN_LEFT, last.getId());
        checkParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        checkParams.setMargins(4, 0, 0, 0);
        check.setLayoutParams(checkParams);
        check.setImageBitmap(BitmapFactory.decodeResource(m_act.getResources(), R.drawable.checkmark_small));
        holder.addView(check, checkParams);
    }
    return holder;
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) RelativeLayout(android.widget.RelativeLayout) TextView(android.widget.TextView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Aggregations

ImageView (android.widget.ImageView)2260 View (android.view.View)1147 TextView (android.widget.TextView)1005 Intent (android.content.Intent)201 Drawable (android.graphics.drawable.Drawable)197 LinearLayout (android.widget.LinearLayout)194 Bitmap (android.graphics.Bitmap)178 ViewGroup (android.view.ViewGroup)163 LayoutInflater (android.view.LayoutInflater)159 OnClickListener (android.view.View.OnClickListener)145 AdapterView (android.widget.AdapterView)111 ListView (android.widget.ListView)103 RecyclerView (android.support.v7.widget.RecyclerView)102 FrameLayout (android.widget.FrameLayout)97 Button (android.widget.Button)83 Bundle (android.os.Bundle)81 BitmapDrawable (android.graphics.drawable.BitmapDrawable)80 RelativeLayout (android.widget.RelativeLayout)72 Test (org.junit.Test)70 Context (android.content.Context)69