Search in sources :

Example 1 with GlitchRequest

use of com.tinyspeck.android.GlitchRequest in project glitch-hq-android by tinyspeck.

the class ProfileFragment method init.

private void init(View root) {
    boolean bUpdateData = m_actList == null;
    View profileSelf = root.findViewById(R.id.profile_user_self);
    View profileOther = root.findViewById(R.id.profile_others);
    ImageView vbg = (ImageView) root.findViewById(R.id.profilebg);
    int nType = Util.GetScreenSizeAttribute(getActivity());
    int[] resBackgrounds = { R.drawable.profile_background, R.drawable.profile_background_l, R.drawable.profile_background_xl };
    int[] resGroddleBg = { R.drawable.profile_other_background, R.drawable.profile_other_background, R.drawable.profile_other_background_xl };
    vbg.setImageResource(m_bOtherProfile ? resGroddleBg[nType] : resBackgrounds[nType]);
    if (nType == 0) {
        int nPaddingTop = 180;
        int nWidth = Util.GetScreenSize(getActivity()).widthPixels;
        if (nWidth > 320)
            nPaddingTop = 170;
        if (m_bOtherProfile)
            nPaddingTop -= 36;
        vbg.setPadding(0, nPaddingTop, 0, 0);
    } else if (nType == 2) {
        int nPaddingTop = 120;
        if (m_bOtherProfile)
            nPaddingTop = 0;
        vbg.setPadding(0, nPaddingTop, 0, 0);
    }
    ScrollView sv = (ScrollView) root.findViewById(R.id.scr_profile);
    sv.setOnTouchListener(new OnTouchListener() {

        public boolean onTouch(View arg0, MotionEvent arg1) {
            return true;
        }
    });
    profileSelf.setVisibility(m_bOtherProfile ? View.GONE : View.VISIBLE);
    profileOther.setVisibility(m_bOtherProfile ? View.VISIBLE : View.GONE);
    ((ImageView) root.findViewById(R.id.rookfossil_image)).setVisibility(m_bOtherProfile ? View.GONE : View.VISIBLE);
    ((ImageView) root.findViewById(R.id.treasure_image)).setVisibility(m_bOtherProfile ? View.VISIBLE : View.GONE);
    m_vProfile = m_bOtherProfile ? profileOther : profileSelf;
    nameTextView = (TextView) m_vProfile.findViewById(R.id.playername);
    nameTextView.setTypeface(m_application.m_vagFont);
    m_listView = (LinearListView) root.findViewById(R.id.homeListView);
    m_learningListView = (LinearListView) root.findViewById(R.id.learning_list);
    m_unlearningListView = (LinearListView) root.findViewById(R.id.unlearning_list);
    m_onlineIcon = (ImageView) m_vProfile.findViewById(R.id.player_online_status);
    m_avatar = (ImageView) m_vProfile.findViewById(R.id.avatar);
    if (!m_bOtherProfile) {
        m_tv_currants = (TextView) m_vProfile.findViewById(R.id.profile_currant_amount);
        m_tv_currants.setTypeface(m_application.m_vagLightFont);
        m_tv_imagination = (TextView) m_vProfile.findViewById(R.id.profile_imagination_amount);
        m_tv_imagination.setTypeface(m_application.m_vagLightFont);
    }
    m_tv_level = (TextView) m_vProfile.findViewById(R.id.tv_level);
    m_tv_level.setTypeface(m_application.m_vagLightFont);
    m_tv_achievements = (TextView) m_vProfile.findViewById(R.id.tv_achievements);
    m_tv_achievements.setTypeface(m_application.m_vagLightFont);
    m_tv_skills = (TextView) m_vProfile.findViewById(R.id.tv_skills);
    m_tv_skills.setTypeface(m_application.m_vagLightFont);
    m_tv_upgrades = (TextView) m_vProfile.findViewById(R.id.tv_upgrades);
    m_tv_upgrades.setTypeface(m_application.m_vagLightFont);
    if (bUpdateData)
        m_actList = new Vector<glitchActivity>();
    m_adapter = new ActivityListViewAdapter(this, m_actList);
    m_listView.setAdapter(m_adapter);
    if (bUpdateData) {
        m_learningList = new Vector<skillAvailable>();
        m_unlearningList = new Vector<skillAvailable>();
    }
    m_learningAdapter = new LearningListViewAdapter(getActivity(), m_learningList);
    m_learningListView.setAdapter(m_learningAdapter);
    m_unlearningAdapter = new UnlearningListViewAdapter(getActivity(), m_unlearningList);
    m_unlearningListView.setAdapter(m_unlearningAdapter);
    View clouds = root.findViewById(R.id.clouds);
    Util.startTranslateAnimation(clouds, 300000);
    m_learningListView.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {
            skillAvailable skill = m_learningList.get(0);
            SkillDetailFragment fm = new SkillDetailFragment(m_this, skill);
            ((HomeScreen) getActivity()).setCurrentFragment(fm, true);
        }
    });
    m_unlearningListView.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {
            skillAvailable skill = m_unlearningList.get(0);
            SkillDetailFragment fm = new SkillDetailFragment(m_this, skill);
            ((HomeScreen) getActivity()).setCurrentFragment(fm, true);
        }
    });
    //     initPushToRefresh();
    setupSettings();
    if (m_bOtherProfile) {
        m_learningListView.setVisibility(View.GONE);
        m_unlearningListView.setVisibility(View.GONE);
        if (bUpdateData)
            getProfileInfo(false);
    } else {
        m_learningListView.setVisibility(View.VISIBLE);
        m_unlearningListView.setVisibility(View.VISIBLE);
        if (bUpdateData) {
            GlitchRequest request = m_application.glitch.getRequest("players.info");
            request.execute(this);
        }
    }
    if (!bUpdateData)
        showProfilePage();
}
Also used : OnTouchListener(android.view.View.OnTouchListener) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) MotionEvent(android.view.MotionEvent) GlitchRequest(com.tinyspeck.android.GlitchRequest) ScrollView(android.widget.ScrollView) BaseFragment.skillAvailable(com.tinyspeck.glitchhq.BaseFragment.skillAvailable) OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) Vector(java.util.Vector)

Example 2 with GlitchRequest

use of com.tinyspeck.android.GlitchRequest in project glitch-hq-android by tinyspeck.

the class EncyclopediaSkillsInCategoryFragment method getSkillsInCategory.

private void getSkillsInCategory() {
    if (m_application != null) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("category", m_category);
        GlitchRequest request = m_application.glitch.getRequest("skills.listAllInCategory", params);
        request.execute(this);
        m_requestCount = 1;
        ((HomeScreen) getActivity()).showSpinner(true);
    }
}
Also used : HashMap(java.util.HashMap) GlitchRequest(com.tinyspeck.android.GlitchRequest)

Example 3 with GlitchRequest

use of com.tinyspeck.android.GlitchRequest in project glitch-hq-android by tinyspeck.

the class EncyclopediaStreetDetailFragment method setAsDestination.

private void setAsDestination() {
    Map<String, String> params = new HashMap<String, String>();
    params.put("street_tsid", m_street.tsid);
    GlitchRequest request = m_application.glitch.getRequest("locations.setAsDestination", params);
    request.execute(this);
}
Also used : HashMap(java.util.HashMap) GlitchRequest(com.tinyspeck.android.GlitchRequest)

Example 4 with GlitchRequest

use of com.tinyspeck.android.GlitchRequest in project glitch-hq-android by tinyspeck.

the class MailChooseRecipientFragment method getRecipients.

private void getRecipients() {
    if (m_application != null) {
        GlitchRequest request1 = m_application.glitch.getRequest("friends.list");
        request1.execute(this);
        m_requestCount = 1;
        FrameLayout recipientFilterArea = (FrameLayout) m_root.findViewById(R.id.recipients_filter_area);
        recipientFilterArea.setVisibility(View.GONE);
        ((HomeScreen) getActivity()).showSpinner(true);
    }
}
Also used : FrameLayout(android.widget.FrameLayout) GlitchRequest(com.tinyspeck.android.GlitchRequest)

Example 5 with GlitchRequest

use of com.tinyspeck.android.GlitchRequest in project glitch-hq-android by tinyspeck.

the class MailboxDetailFragment method getMessage.

public void getMessage() {
    Map<String, String> params = new HashMap<String, String>();
    params.put("message_id", Integer.toString(m_msgId));
    GlitchRequest request = m_application.glitch.getRequest("mail.getMessage", params);
    request.execute(this);
    m_requestCount = 1;
    ((HomeScreen) getActivity()).showSpinner(true);
}
Also used : HashMap(java.util.HashMap) GlitchRequest(com.tinyspeck.android.GlitchRequest)

Aggregations

GlitchRequest (com.tinyspeck.android.GlitchRequest)46 HashMap (java.util.HashMap)33 Vector (java.util.Vector)3 MotionEvent (android.view.MotionEvent)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 OnTouchListener (android.view.View.OnTouchListener)1 Button (android.widget.Button)1 FrameLayout (android.widget.FrameLayout)1 ImageView (android.widget.ImageView)1 ScrollView (android.widget.ScrollView)1 TextView (android.widget.TextView)1 Glitch (com.tinyspeck.android.Glitch)1 BaseFragment.skillAvailable (com.tinyspeck.glitchhq.BaseFragment.skillAvailable)1 Map (java.util.Map)1 JSONArray (org.json.JSONArray)1 JSONObject (org.json.JSONObject)1