Code Monkey home page Code Monkey logo

timelinepostcontainer's Introduction

TimelinePostContainer

Platform Compatibility Release Codacy License

Timeline is a famous and user-friendly feature these days; If you need to implement one of them in your projects, consider using this library. Tried to have simple methods, currently you just need to write three lines of codes!

A Quick Overview What's In

  • Compatible down to API Level 16
  • Try loading images again if there's a problem with internet connection
  • Native VideoView
  • Listeners
  • Two kinds of posts supported (only images and videos with a thumbnail)
  • Determinate progress view while loading images
  • Caching images
  • Plays only one video at a time
  • Compatible with using inside RecyclerView
  • Appropriate animations
  • Good performance
  • Customizable

Include to Project

Provide the Gradle Dependency

Add the dependency:

dependencies {
	compile 'io.github.meness:timelinepostcontainer:x.y.z'
}

Note: Replace x.y.z with the latest version which can be found at releases page.

Clone or Download .zip file

Clone this repository or download the compressed file, then extract to your computer. Simply import the library module to your project.

Usage

You only need to provide your desired image and/or video paths as I did below or simply compile and try the sample app provided:

public class SampleActivity extends AppCompatActivity {
    @BindView(R.id.timelinePostContainer)
    TimelinePostContainer timelinePostContainer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sample);
		ButterKnife.bind(this);

        timelinePostContainer.setImagePath("image path");
        timelinePostContainer.setVideoPath("video path if you need the video implementation");
        timelinePostContainer.build(Type.VIDEO); // or Type.IMAGE if you need the image implementation
    }
}

Useful Tips

To avoid scrolling lags you can use PauseOnScrollListener or RecyclerPauseOnScrollListener:

recyclerView.addOnScrollListener(new RecyclerPauseOnScrollListener(ImageLoader, boolean, boolean));

Note: InitClass.imageLoader(this) gives you the default ImageLoader.

Customization

Options class gives you all options you can configure. For an example, I configure the ImageLoader:

Options options = new Options(getApplicationContext());
options.imageLoader = ImageLoader.getInstance(); // My desired configuration
timelinePostContainer.setOptions(options);

Note: The default ImageLoader configuration is good enough, modify this one only if you want different configuration.

Listeners

Check out listeners package for more details.

public class SampleActivity extends AppCompatActivity {
    @BindView(R.id.timelinePostContainer)
    public TimelinePostContainer timelinePostContainer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sample);
        ButterKnife.bind(this);

        Listeners listeners = new Listeners();
        listeners.imageLoading = new SampleActivity.MyImageLoadingListener();
        timelinePostContainer.setListeners(listeners);

        timelinePostContainer.setImagePath("image path");
        timelinePostContainer.setVideoPath("video path if you need the video implementation");
        timelinePostContainer.build(Type.VIDEO); // or Type.IMAGE if you need the image implementation
    }

    private static class MyImageLoadingListener implements IImageLoadingListener {
        @Override
        public void onProgressUpdate(String imageUri, ProgressWheel progressView, View view, int current, int total) {
            // ...
        }
    }
}

Attributes

Check out attrs.xml for a complete list of supported attributes.

Libraries Used

Apps Using the TimelinePostContainer

feel free to send me new projects.

Developed By

License

Copyright 2016 Alireza Eskandarpour Shoferi

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

timelinepostcontainer's People

Contributors

alirezaaa avatar meness avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.