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();
}
}
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;
}
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();
}
}
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;
}
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;
}
Aggregations