All Projects → myinnos → ImageSliderWithSwipes

myinnos / ImageSliderWithSwipes

Licence: Apache-2.0 license
This is an Image slider with swipes, Here we used Volley to Image load URL from JSON! Here we make it a very easy way to load images from the Internet and We customized the description font style(OpenSans).

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to ImageSliderWithSwipes

Android-Code-Demos
📦 Android learning code demos.
Stars: ✭ 41 (-6.82%)
Mutual labels:  volley
OLA Play Music App
Music Streaming App
Stars: ✭ 27 (-38.64%)
Mutual labels:  volley
My Android Garage
A quick reference guide for Android development.
Stars: ✭ 66 (+50%)
Mutual labels:  volley
Quotes
Quotes Status Creator lets you share quotations as status images on social media
Stars: ✭ 31 (-29.55%)
Mutual labels:  volley
SaveVolley
Save volley from anything, By Agera to save. Thus, derived the AgeraVolley . (。>﹏<。)
Stars: ✭ 29 (-34.09%)
Mutual labels:  volley
ipapi-retrofit
Android Library for Calling IP-API using Retrofit
Stars: ✭ 47 (+6.82%)
Mutual labels:  volley
AndroidGo
Android、Flutter 开发者帮助 APP。包含事件分发、性能分析、Google Jetpack组件、OkHttp、RxJava、Retrofit、Volley、Canvas绘制以及优秀博文代码案例等内容,帮助开发者快速上手!
Stars: ✭ 30 (-31.82%)
Mutual labels:  volley
AndroidProjects
个人总结归纳Android知识点。1.Data Binding框架MVVM;2. BaseView;3.CollapseView;4.Notification;5.MultiChannelBuild;6.SwipeBack;7.CustomTabs;8.HandlerCourse;9.VolleyStudy;10.OkHttpStudy;11.PermissionManage;12.InterView;13.KotlinLearning
Stars: ✭ 32 (-27.27%)
Mutual labels:  volley
travelapp
旅游自助系统。分为Android APP和Web管理系统JAVA旅游自助系统, 是一套开源的项目,系统具有完整的源代码和数据库,以及配套的文档。因为是一个课程设计,功能很简单,所以只能参考学习
Stars: ✭ 90 (+104.55%)
Mutual labels:  volley
Reader
📚 MVP + Volley + Gson, 内容包含了糗事百科,煎蛋,和内涵段子
Stars: ✭ 60 (+36.36%)
Mutual labels:  volley

ImageSliderWithSwipes

This is an Image slider with swipes, Here we used Volley to load URL's from JSON! Here we make it very easy way to load images from Internet and We customized the description font(OpenSans).

First of all thanks to AndroidImageSlider, Here You can easily load images from an internet URL, drawable, or file. And there are many kinds of amazing animations you can choose. Happy Coding!

Get it on Google Play

Kindly use the following links to use this library:

In build.gradle (Project)

allprojects {
  repositories {
			...
		maven { url "https://jitpack.io" }
	}
}

And then in the other gradle file(may be your app gradle or your own module library gradle, but never add in both of them to avoid conflict.)

dependencies {
	implementation 'com.github.myinnos:ImageSliderWithSwipes:1.0.2'
}

Example

ImageSliderWithSwipes

Create Android Project (set name ImageSliderWithSwipes)
Add permissions to AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Add dependencies for Loading Images from URL's(Here we used Volley)
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:25.1.0'
    implementation 'com.github.myinnos:ImageSliderWithSwipes:1.0.1'
    implementation 'com.mcxiaoke.volley:library:1.0.+'
}
Copy this code in to activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <in.myinnos.imagesliderwithswipeslibrary.SliderLayout
        android:id="@+id/slider"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        custom:auto_cycle="true"
        custom:indicator_visibility="visible"
        custom:pager_animation="Stack"
        custom:pager_animation_span="1100" />

</RelativeLayout>
Copy this code in to MainActivity.java
public class MainActivity extends AppCompatActivity implements BaseSliderView.OnSliderClickListener {

    private SliderLayout mDemoSlider;

    // Billionaires json url
    private static final String getURL = "http://api.androidhive.info/json/movies.json";
    HashMap<String, String> url_maps;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mDemoSlider = (SliderLayout) findViewById(R.id.slider);

        // Creating volley request obj
        JsonArrayRequest billionaireReq = new JsonArrayRequest(getURL,
                new Response.Listener<JSONArray>() {
                    @Override
                    public void onResponse(JSONArray response) {
                        url_maps = new HashMap<String, String>();
                        // Parsing json
                        for (int i = 0; i < response.length(); i++) {
                            try {

                                JSONObject obj = response.getJSONObject(i);
                                url_maps.put(obj.getString("title") + " - " + obj.getString("releaseYear"), obj.getString("image"));

                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                        }

                        for (String name : url_maps.keySet()) {
                            TextSliderView textSliderView = new TextSliderView(MainActivity.this);
                            // initialize a SliderLayout
                            textSliderView
                                    .description(name)
				    .descriptionSize(20)
                                    .image(url_maps.get(name))
                                    .setScaleType(BaseSliderView.ScaleType.CenterCrop)
                                    .setOnSliderClickListener(MainActivity.this);

                            //add your extra information
                            textSliderView.bundle(new Bundle());
                            textSliderView.getBundle().putString("extra", name);

                            mDemoSlider.addSlider(textSliderView);
                        }
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                Toast.makeText(getApplicationContext(), "network issue: please enable wifi/mobile data", Toast.LENGTH_SHORT).show();
            }
        });

        // Adding request to request queue
        AppController.getInstance().addToRequestQueue(billionaireReq);

        mDemoSlider.setPresetTransformer(SliderLayout.Transformer.Stack);
        mDemoSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Top);
        mDemoSlider.setCustomAnimation(new DescriptionAnimation());
        mDemoSlider.setDuration(4000);

        mDemoSlider.setPresetTransformer("Stack");

    }

    @Override
    protected void onStop() {
        // To prevent a memory leak on rotation, make sure to call stopAutoCycle() on the slider before activity or fragment is destroyed
        mDemoSlider.stopAutoCycle();
        super.onStop();
    }

    @Override
    public void onSliderClick(BaseSliderView slider) {
        Toast.makeText(this, slider.getBundle().get("extra") + "", Toast.LENGTH_SHORT).show();
    }

}

Apps using ImageSliderWithSwipes

If you are using ImageSliderWithSwipes in your app and would like to be listed here, please let us know by opening a new issue!

Thanks

Contact

Prabhakar Thota

Flattr this git repo

License

Copyright 2017 MyInnos

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].