Search in sources :

Example 31 with OnClickListener

use of android.view.View.OnClickListener in project PreLollipopTransition by takahirom.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    findViewById(R.id.imageView).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final Intent intent = new Intent(MainActivity.this, SubActivity.class);
            ActivityTransitionLauncher.with(MainActivity.this).from(v).launch(intent);
        }
    });
    findViewById(R.id.imageView2).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final Intent intent = new Intent(MainActivity.this, SubActivity2.class);
            // set bitmap for animation
            // use startActivityForResult
            Bundle transitionBundle = ActivityTransitionLauncher.with(MainActivity.this).image(BitmapFactory.decodeResource(getResources(), R.drawable.photo)).from(v).createBundle();
            intent.putExtras(transitionBundle);
            startActivityForResult(intent, REQUEST_CODE);
            // you should prevent default activity tansition animation
            overridePendingTransition(0, 0);
        }
    });
    findViewById(R.id.imageView3).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final Fragment toFragment = new SubFragment();
            //init your bundle first!!
            Bundle bundle = new Bundle();
            bundle.putString("Test", "Test");
            toFragment.setArguments(bundle);
            //You should call this method after init your argumentsBundle.
            FragmentTransitionLauncher.with(v.getContext()).from(v).prepare(toFragment);
            getSupportFragmentManager().beginTransaction().replace(R.id.parent_container, toFragment).addToBackStack(null).commit();
        }
    });
    findViewById(R.id.listViewExampleButton).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            final Intent intent = new Intent(MainActivity.this, ListViewActivity.class);
            Bundle transitionBundle = ActivityTransitionLauncher.with(MainActivity.this).from(v).createBundle();
            intent.putExtras(transitionBundle);
            startActivity(intent);
            // you should prevent default activity tansition animation
            overridePendingTransition(0, 0);
        }
    });
    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction().add(R.id.support_content, new SupportStartFragment()).commit();
        getFragmentManager().beginTransaction().add(R.id.content, new com.kogitune.prelollipoptransition.fragment.StartFragment()).commit();
    }
}
Also used : Bundle(android.os.Bundle) SupportStartFragment(com.kogitune.prelollipoptransition.support_fragment.SupportStartFragment) SupportStartFragment(com.kogitune.prelollipoptransition.support_fragment.SupportStartFragment) OnClickListener(android.view.View.OnClickListener) Intent(android.content.Intent) View(android.view.View) SupportStartFragment(com.kogitune.prelollipoptransition.support_fragment.SupportStartFragment) Fragment(android.support.v4.app.Fragment) SubFragment(com.kogitune.prelollipoptransition.fragment.SubFragment) EndFragment(com.kogitune.prelollipoptransition.fragment.EndFragment) SubFragment(com.kogitune.prelollipoptransition.fragment.SubFragment) OnClickListener(android.view.View.OnClickListener)

Example 32 with OnClickListener

use of android.view.View.OnClickListener in project glitch-hq-android by tinyspeck.

the class EncyclopediaItemsInCategoryListViewAdapter 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_items_in_category_list_item, null);
        holder = new ViewHolder();
        holder.name = (TextView) convertView.findViewById(R.id.encyclopedia_items_in_category_name);
        holder.name.setTypeface(m_application.m_vagFont);
        holder.icon = (ImageView) convertView.findViewById(R.id.encyclopedia_items_in_category_icon);
        holder.whole = (View) convertView.findViewById(R.id.encyclopedia_items_in_category_item);
        convertView.setTag(holder);
    }
    holder = (ViewHolder) convertView.getTag();
    if (position < getCount()) {
        glitchItem item = m_itemList.get(position);
        holder.name.setText(item.name);
        DrawableURL.Show(holder.icon, item.icon, false);
        holder.whole.setTag(position);
        holder.whole.setOnClickListener(new OnClickListener() {

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

Example 33 with OnClickListener

use of android.view.View.OnClickListener in project glitch-hq-android by tinyspeck.

the class EncyclopediaLocationHubsFragment method init.

private void init(View root) {
    boolean bUpdateData = (m_hubsList == null);
    m_btnBack = (Button) m_root.findViewById(R.id.btnBack);
    m_btnBack.setText("Encyclopedia");
    m_btnBack.setSingleLine();
    m_btnBack.setEllipsize(TruncateAt.END);
    m_btnBack.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            FragmentManager fm = getFragmentManager();
            fm.popBackStack();
        }
    });
    m_btnBack.setVisibility(View.VISIBLE);
    m_btnSidebar = (Button) m_root.findViewById(R.id.btnSidebar);
    m_btnSidebar.setVisibility(View.GONE);
    if (bUpdateData) {
        m_hubsList = new Vector<glitchLocationHub>();
    }
    TextView title = (TextView) root.findViewById(R.id.encyclopedia_location_hubs_title);
    title.setTypeface(m_application.m_vagFont);
    m_adapter = new EncyclopediaLocationHubsListViewAdapter(this, m_hubsList);
    m_listView = (LinearListView) root.findViewById(R.id.encyclopedia_location_hubs_list);
    m_listView.setAdapter(m_adapter);
    if (bUpdateData) {
        getEncyclopediaLocationHubs();
    } else {
        showEncyclopediaLocationHubsPage();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) View(android.view.View)

Example 34 with OnClickListener

use of android.view.View.OnClickListener in project glitch-hq-android by tinyspeck.

the class EncyclopediaLocationHubsListViewAdapter 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_location_hubs_list_item, null);
        holder = new ViewHolder();
        holder.name = (TextView) convertView.findViewById(R.id.encyclopedia_location_hub_name);
        holder.name.setTypeface(m_application.m_vagFont);
        holder.whole = (View) convertView.findViewById(R.id.encyclopedia_location_hub_item);
        convertView.setTag(holder);
    }
    holder = (ViewHolder) convertView.getTag();
    if (position < getCount()) {
        glitchLocationHub hub = m_hubsList.get(position);
        holder.name.setText(hub.name);
        holder.whole.setTag(position);
        holder.whole.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                glitchLocationHub hub = m_hubsList.get((Integer) v.getTag());
                EncyclopediaLocationStreetFragment f = new EncyclopediaLocationStreetFragment(hub);
                ((HomeScreen) m_act).setCurrentFragment(f, true);
            }
        });
    }
    return convertView;
}
Also used : BaseFragment.glitchLocationHub(com.tinyspeck.glitchhq.BaseFragment.glitchLocationHub) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) View(android.view.View)

Example 35 with OnClickListener

use of android.view.View.OnClickListener in project glitch-hq-android by tinyspeck.

the class EncyclopediaLocationStreetsListViewAdapter 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_location_streets_list_item, null);
        holder = new ViewHolder();
        holder.name = (TextView) convertView.findViewById(R.id.encyclopedia_location_street_name);
        holder.name.setTypeface(m_application.m_vagFont);
        holder.whole = (View) convertView.findViewById(R.id.encyclopedia_location_street_item);
        convertView.setTag(holder);
    }
    holder = (ViewHolder) convertView.getTag();
    if (position < getCount()) {
        glitchLocationStreet street = m_streetsList.get(position);
        holder.name.setText(street.name);
        holder.whole.setTag(position);
        holder.whole.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                glitchLocationStreet street = m_streetsList.get((Integer) v.getTag());
                EncyclopediaStreetDetailFragment f = new EncyclopediaStreetDetailFragment(((EncyclopediaLocationStreetFragment) m_bf).getHub(), street);
                ((HomeScreen) m_act).setCurrentFragment(f, true);
            }
        });
    }
    return convertView;
}
Also used : BaseFragment.glitchLocationStreet(com.tinyspeck.glitchhq.BaseFragment.glitchLocationStreet) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) View(android.view.View)

Aggregations

OnClickListener (android.view.View.OnClickListener)794 View (android.view.View)792 TextView (android.widget.TextView)492 Button (android.widget.Button)265 ImageView (android.widget.ImageView)256 Intent (android.content.Intent)183 ListView (android.widget.ListView)112 AdapterView (android.widget.AdapterView)91 ScrollView (android.widget.ScrollView)52 LinearLayout (android.widget.LinearLayout)49 Bundle (android.os.Bundle)43 LayoutInflater (android.view.LayoutInflater)35 ViewGroup (android.view.ViewGroup)30 ArrayList (java.util.ArrayList)30 BindView (butterknife.BindView)29 KeyEvent (android.view.KeyEvent)28 EditText (android.widget.EditText)28 DialogInterface (android.content.DialogInterface)27 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)25 FragmentManager (android.support.v4.app.FragmentManager)23