TimelinePostContainer

Additional

Language
Java
Version
2.4.1 (Jun 21, 2016)
Created
Mar 1, 2016
Updated
Aug 14, 2016 (Retired)
Owner
Alireza Eskandarpour (meness)
Contributors
Alireza (alirezaaa)
Alireza Eskandarpour (meness)
2
Activity
Badge
Generate
Download
Source code
APK file

Advertisement

TimelinePostContainer

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.