ImageSliderWithSwipes


Source link: https://github.com/myinnos/ImageSliderWithSwipes

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!

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 {
  compile 'com.github.myinnos:ImageSliderWithSwipes:1.0.2' 
}

Example

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 {

  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.android.support:appcompat-v7:25.1.0'
  compile 'com.github.myinnos:ImageSliderWithSwipes:1.0.1'
  compile '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

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. 

Resources

ChromeLikeTabSwitcher is an Android-library, which provides a tab switcher similar to the one, which is used in the Android version of Google's Chrome browser. It provides layouts optimized for smartphone and tablet devices.

Wrapper of StrictMode API that can be safely called on any version of Android.

Android project to experiment the VIPER approach.

Motivations

  • Tend toward the VIPER approach
  • Make it easier to test the application
  • Simplify the set up of asynchronous job with RxJava

A demo project for showing how to use WebViews in Android.

Things covered in this project

  • Load a local html file into a WebView with the basic WebView settings.
  • Handle Javascript callbacks from the Javascript to the client.
  • Make Javascript callbacks from the client to Javascript.
  • Set WebViewClient to the WebView
  • Debugging of WebView

This is an Android Library for showing Material Dialog with little customization with icons, colors, divider line.

With Oblique explore new styles of displaying images.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes