Search in sources :

Example 76 with TextView

use of android.widget.TextView in project Shuttle by timusus.

the class RobotoSpinnerAdapter method getDropDownView.

@Override
public TextView getDropDownView(int position, View convertView, ViewGroup parent) {
    TextView view = (TextView) super.getDropDownView(position, convertView, parent);
    view.setTypeface(mTypeface);
    return view;
}
Also used : TextView(android.widget.TextView)

Example 77 with TextView

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

the class MailboxListViewAdapter 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.mailbox_list_item, null);
        holder = new ViewHolder();
        holder.name = (TextView) convertView.findViewById(R.id.inbox_message_name);
        holder.name.setTypeface(m_application.m_vagFont);
        holder.text = (TextView) convertView.findViewById(R.id.inbox_message_text);
        holder.text.setTypeface(m_application.m_vagLightFont);
        holder.time = (TextView) convertView.findViewById(R.id.inbox_message_when);
        holder.time.setTypeface(m_application.m_vagLightFont);
        holder.icon = (ImageView) convertView.findViewById(R.id.icon_message_sender);
        holder.divider = (View) convertView.findViewById(R.id.inbox_message_divider);
        holder.whole = (View) convertView.findViewById(R.id.inbox_item);
        convertView.setTag(holder);
    }
    holder = (ViewHolder) convertView.getTag();
    if (position < getCount()) {
        glitchMail message = m_mailList.get(position);
        if (message.sender_label != null && !message.sender_label.equals("")) {
            holder.name.setText(message.sender_label);
            holder.text.setText(message.text);
        } else {
            holder.name.setText("Glitch");
            holder.text.setText(Html.fromHtml(message.text));
        }
        if (message.sender_avatar != null && !message.sender_avatar.equals("")) {
            DrawableURL.CropShow(holder.icon, message.sender_avatar + "_100.png");
        } else {
            BitmapUtil.CropShow(holder.icon, BitmapFactory.decodeResource(m_act.getResources(), R.drawable.wireframe));
            holder.icon.setVisibility(View.INVISIBLE);
        }
        if (message.is_read == false) {
            holder.text.setTypeface(m_application.m_vagLightFont, Typeface.BOLD);
        }
        holder.time.setText(Util.TimeToString((int) (System.currentTimeMillis() / 1000 - message.received)));
        if (position == getCount() - 1)
            holder.divider.setVisibility(View.GONE);
        else
            holder.divider.setVisibility(View.VISIBLE);
    }
    holder.whole.setTag(position);
    holder.whole.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            glitchMail currentMessage = m_mailList.get((Integer) v.getTag());
            if (currentMessage.is_read == false) {
                ((MailboxFragment) m_bf).markAsRead(currentMessage.id);
                ((TextView) v.findViewById(R.id.inbox_message_text)).setTypeface(m_application.m_vagLightFont, Typeface.NORMAL);
            }
            MailboxDetailFragment fm = new MailboxDetailFragment(currentMessage.id);
            ((HomeScreen) m_act).setCurrentFragment(fm, true);
        }
    });
    return convertView;
}
Also used : OnClickListener(android.view.View.OnClickListener) BaseFragment.glitchMail(com.tinyspeck.glitchhq.BaseFragment.glitchMail) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Example 78 with TextView

use of android.widget.TextView 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 79 with TextView

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

the class LoginScreen method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Util.getDevicePhysicalSize(this) < 6.0) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
    Bundle bundle = getIntent().getExtras();
    m_application = (MyApplication) getApplicationContext();
    m_application.init(this);
    setContentView(R.layout.login);
    setTitle(getResources().getString(R.string.str_main_title));
    m_loginSpinner = (View) findViewById(R.id.loginSpinner);
    TextView tvLogin = ((TextView) findViewById(R.id.tv_login));
    if (tvLogin != null) {
        tvLogin.setTypeface(m_application.m_vagFont);
    }
    m_btnLogin = (Button) findViewById(R.id.btnLogin);
    m_btnLogin.setTypeface(m_application.m_vagFont);
    setupTitlebar();
    m_email = (EditText) findViewById(R.id.email);
    m_password = (EditText) findViewById(R.id.password);
    m_email.setTypeface(m_application.m_vagLightFont);
    m_password.setTypeface(m_application.m_vagLightFont);
    m_errorMsg = (TextView) findViewById(R.id.tv_login_error);
    m_tv_forgot_password = (TextView) findViewById(R.id.tv_forgot_password);
    TextView tv = (TextView) findViewById(R.id.copyright);
    tv.setText(Html.fromHtml("Glitch is built by <a href='http://tinyspeck.com'>Tiny Speck</a> <br>Copyright @ 2012 Tiny Speck<br>All rights reserved"));
    tv.setMovementMethod(LinkMovementMethod.getInstance());
    tv.setTypeface(m_application.m_vagLightFont);
    m_background = findViewById(R.id.LayoutBack);
    if (m_background != null) {
        Util.startTranslateAnimation(m_background, 40000);
    }
    m_btnLogin.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {
            m_sUsername = m_email.getText().toString();
            m_sPassword = m_password.getText().toString();
            if (m_sUsername.length() <= 0) {
                m_errorMsg.setVisibility(View.VISIBLE);
                m_errorMsg.setText(LoginScreen.this.getResources().getString(R.string.error_login_username));
                FlurryAgent.logEvent("Login - Didn't provide email");
                return;
            }
            if (m_sPassword.length() <= 0) {
                m_errorMsg.setVisibility(View.VISIBLE);
                m_errorMsg.setText(LoginScreen.this.getResources().getString(R.string.error_login_password));
                FlurryAgent.logEvent("Login - Didn't provide password");
                return;
            }
            m_loginSpinner.setVisibility(View.VISIBLE);
            m_errorMsg.setVisibility(View.GONE);
            m_application.glitch.login(m_sUsername, m_sPassword, LoginScreen.this);
        }
    });
    m_tv_forgot_password.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.glitch.com/reset"));
            startActivity(browserIntent);
        }
    });
    String user = m_application.PreferenceGetString("username", "");
    String password = m_application.PreferenceGetString("password", "");
    if (!user.equalsIgnoreCase("") && !password.equalsIgnoreCase("")) {
        FrameLayout loginLayout = (FrameLayout) findViewById(R.id.login_layout);
        if (loginLayout != null)
            loginLayout.setVisibility(View.INVISIBLE);
        m_loginSpinner.setVisibility(View.VISIBLE);
        m_application.glitch.login(user, password, LoginScreen.this);
        return;
    }
}
Also used : Bundle(android.os.Bundle) FrameLayout(android.widget.FrameLayout) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) Intent(android.content.Intent) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Example 80 with TextView

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

the class EncyclopediaSkillCategoriesFragment method onRequestBack.

@Override
public void onRequestBack(String method, JSONObject response) {
    if (method == "skills.listAllCategories") {
        JSONObject categories = response.optJSONObject("categories");
        if (categories.length() > 0) {
            m_categoriesList.clear();
            Iterator<String> itr = categories.keys();
            while (itr.hasNext()) {
                String key = itr.next();
                String category = categories.optString(key);
                m_categoriesList.add(category);
            }
            Collections.sort(m_categoriesList);
        }
        if (m_categoriesList.size() == 0) {
            ((TextView) m_root.findViewById(R.id.encyclopedia_skill_categories_list_message)).setText("");
        }
        showEncyclopediaSkillCategoriesPage();
    }
    onRequestComplete();
}
Also used : JSONObject(org.json.JSONObject) TextView(android.widget.TextView)

Aggregations

TextView (android.widget.TextView)4994 View (android.view.View)2680 ImageView (android.widget.ImageView)1137 Button (android.widget.Button)442 LinearLayout (android.widget.LinearLayout)439 LayoutInflater (android.view.LayoutInflater)425 Intent (android.content.Intent)397 ListView (android.widget.ListView)389 AdapterView (android.widget.AdapterView)372 ViewGroup (android.view.ViewGroup)322 OnClickListener (android.view.View.OnClickListener)304 RecyclerView (android.support.v7.widget.RecyclerView)197 Test (org.junit.Test)197 ScrollView (android.widget.ScrollView)166 DialogInterface (android.content.DialogInterface)162 Context (android.content.Context)156 Drawable (android.graphics.drawable.Drawable)155 EditText (android.widget.EditText)149 AlertDialog (android.app.AlertDialog)144 Bundle (android.os.Bundle)144