Skip to content

Instantly share code, notes, and snippets.

Suleiman Ali Shakir Suleiman19

Block or report user

Report or block Suleiman19

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Suleiman19
Suleiman19 / TabsHeaderActivity.java
Created Apr 1, 2017
Palette API that fetches a dynamic color from a Bitmap and also includes fallback colors on failure.
View TabsHeaderActivity.java
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);
@Suleiman19
Suleiman19 / TabsHeaderActivity.java
Created Apr 1, 2017
A simple ViewPager adapter that populates Fragments to create the parallax scrolling effect for Tabs.
View TabsHeaderActivity.java
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) {
@Suleiman19
Suleiman19 / TabsHeaderActivity.java
Last active Apr 1, 2017
Dummy Fragment that contains a scrollable list to demonstrate parallax scroll effect.
View TabsHeaderActivity.java
public static class DummyFragment extends Fragment {
int color;
public DummyFragment() {
}
@SuppressLint("ValidFragment")
public DummyFragment(int color) {
this.color = color;
}
@Suleiman19
Suleiman19 / activity_parallax_tabs.xml
Last active Aug 19, 2018
Android XML Layout for Parallax scrolling with header Tabs. Uses Design Support Library.
View activity_parallax_tabs.xml
<?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
@Suleiman19
Suleiman19 / AnimateToolbar.java
Last active Mar 12, 2017
Flexible Space with Image pattern UI setup and menu scroll listener
View AnimateToolbar.java
public class AnimateToolbar extends AppCompatActivity {
private CollapsingToolbarLayout collapsingToolbar;
private AppBarLayout appBarLayout;
private RecyclerView recyclerView;
private DessertAdapter dessertAdapter;
private Menu collapsedMenu;
private boolean appBarExpanded = true;
@Suleiman19
Suleiman19 / activity_animate_toolbar.xml
Last active Mar 12, 2017
Flexible Space with Image pattern XML layout. Using Design Support library widgets.
View activity_animate_toolbar.xml
<?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
@Suleiman19
Suleiman19 / wifi_buddy_privacy_policy.html
Last active Mar 12, 2017
Wifi Buddy Privacy Policy
View wifi_buddy_privacy_policy.html
<!DOCTYPE html><html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Privacy Policy</title> <style>body{font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; padding:1em;}</style></head> <body><h2>Privacy Policy</h2> <p> Suleiman Ali Shakir built the Wifi Buddy: Live Monitor app as an Ad Supported app. This SERVICE is provided by Suleiman Ali Shakir at no cost and is intended for use as is. </p> <p>This page is used to inform website visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service. </p> <p>If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy. </p> <p>The terms used in this Privacy Policy have the same meanings as in our Terms and Cond
@Suleiman19
Suleiman19 / PaginationScrollListener.java
Last active Oct 23, 2018
RecyclerView OnScrollListener for Pagination support
View PaginationScrollListener.java
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) {
@Suleiman19
Suleiman19 / Header.java
Last active Jun 27, 2019
Sample code snippets for using mikepenz/FastAdapter library and its various features
View Header.java
public class Header extends AbstractItem<Header, Header.ViewHolder> {
String title;
public Header(String title) {
this.title = title;
}
public String getTitle() {
return title;
View download image as bitmap from URL
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();
You can’t perform that action at this time.