This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spinner spinner = (Spinner) findViewById(R.id.main_spinner); | |
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getSupportActionBar().getThemedContext(), | |
R.layout.spinner_list_style, | |
getResources().getStringArray(R.array.countries)); | |
spinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item); | |
spinner.setAdapter(spinnerAdapter); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Bitmap DownloadImageBitmap(String url) { | |
Bitmap bm = null; | |
try { | |
URL aURL = new URL(url); | |
URLConnection conn = aURL.openConnection(); | |
conn.connect(); | |
InputStream is = conn.getInputStream(); | |
BufferedInputStream bis = new BufferedInputStream(is); | |
bm = BitmapFactory.decodeStream(bis); | |
bis.close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.design.widget.CoordinatorLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:fitsSystemWindows="true"> | |
<android.support.design.widget.AppBarLayout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Header extends AbstractItem<Header, Header.ViewHolder> { | |
String title; | |
public Header(String title) { | |
this.title = title; | |
} | |
public String getTitle() { | |
return title; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomRecyclerClickListener implements RecyclerView.OnItemTouchListener { | |
private OnItemClickListener mListener; | |
public interface OnItemClickListener { | |
public void onItemClick(View view, int position); | |
} | |
GestureDetector mGestureDetector; | |
public CustomRecyclerClickListener(Context context, OnItemClickListener listener) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class PaginationScrollListener extends RecyclerView.OnScrollListener { | |
LinearLayoutManager layoutManager; | |
public PaginationScrollListener(LinearLayoutManager layoutManager) { | |
this.layoutManager = layoutManager; | |
} | |
@Override | |
public void onScrolled(RecyclerView recyclerView, int dx, int dy) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.design.widget.CoordinatorLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/htab_maincontent" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:fitsSystemWindows="true"> | |
<android.support.design.widget.AppBarLayout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static class ViewPagerAdapter extends FragmentPagerAdapter { | |
private final List<Fragment> mmFragmentTitleList FragmentList = new ArrayList<>(); | |
private final List<String> = new ArrayList<>(); | |
public ViewPagerAdapter(FragmentManager manager) { | |
super(manager); | |
} | |
@Override | |
public Fragment getItem(int position) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.header); | |
Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() { | |
@SuppressWarnings("ResourceType") | |
@Override | |
public void onGenerated(Palette palette) { | |
int vibrantColor = palette.getVibrantColor(R.color.primary_500); | |
int vibrantDarkColor = palette.getDarkVibrantColor(R.color.primary_700); | |
collapsingToolbarLayout.setContentScrimColor(vibrantColor); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DummyFragment extends Fragment { | |
int color; | |
public DummyFragment() { | |
} | |
@SuppressLint("ValidFragment") | |
public DummyFragment(int color) { | |
this.color = color; | |
} |
NewerOlder