-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from jjhesk/dev
update slider to support zoom and zoom out mode
- Loading branch information
Showing
27 changed files
with
1,480 additions
and
393 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.hkm.sliderdemo; | ||
|
||
import com.hkm.slider.SliderLayout; | ||
import com.hypebeast.sdk.api.model.hbeditorial.ArticleData; | ||
import com.hypebeast.sdk.api.model.hbeditorial.ResponsePostW; | ||
import com.hypebeast.sdk.clients.HBEditorialClient; | ||
|
||
import java.util.List; | ||
|
||
import retrofit.Callback; | ||
import retrofit.RetrofitError; | ||
import retrofit.client.Response; | ||
|
||
/** | ||
* Created by hesk on 15/12/15. | ||
* Test of API on the news feed | ||
*/ | ||
public class NewsArticle extends BigScreenDemo { | ||
protected HBEditorialClient clientApi; | ||
|
||
protected void defaultCompleteSlider(SliderLayout slide, List<ArticleData> list) { | ||
|
||
} | ||
|
||
protected Callback<ResponsePostW> res = new Callback<ResponsePostW>() { | ||
@Override | ||
public void success(ResponsePostW responsePostW, Response response) { | ||
try { | ||
defaultCompleteSlider(mDemoSlider, responsePostW.postList.getArticles()); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Override | ||
public void failure(RetrofitError error) { | ||
error.printStackTrace(); | ||
} | ||
}; | ||
|
||
@Override | ||
protected boolean shouldRequestAPIBeforeLayoutRender() { | ||
clientApi = HBEditorialClient.getInstance(this); | ||
try { | ||
clientApi.createFeedInterface().the_recent_page(1, res); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
return true; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
AppDemo/src/main/java/com/hkm/sliderdemo/ZoomScreenSlider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.hkm.sliderdemo; | ||
|
||
import android.annotation.TargetApi; | ||
import android.os.Build; | ||
|
||
import com.hkm.slider.SliderLayout; | ||
import com.hkm.slider.SliderTypes.BaseSliderView; | ||
import com.hkm.slider.SliderTypes.TextSliderView; | ||
import com.hkm.slider.SliderTypes.ZoomableView; | ||
|
||
import java.util.HashMap; | ||
|
||
/** | ||
* Created by hesk on 15/12/15. | ||
*/ | ||
public class ZoomScreenSlider extends BigScreenDemo { | ||
|
||
@TargetApi(Build.VERSION_CODES.HONEYCOMB) | ||
protected void defaultCompleteSlider(final SliderLayout slide, final HashMap<String, String> maps) { | ||
for (String name : maps.keySet()) { | ||
ZoomableView zoomer = new ZoomableView(true, this); | ||
// initialize a SliderLayout | ||
zoomer | ||
|
||
//ZoomableView configurations | ||
.setInitalZoomFactor(1.3f) | ||
|
||
//BaseSlider configurations | ||
.description(name) | ||
.image(maps.get(name)) | ||
.enableImageLocalStorage() | ||
.setScaleType(BaseSliderView.ScaleType.CenterInside) | ||
.setOnSliderClickListener(this); | ||
//add your extra information | ||
zoomer.getBundle().putString("extra", name); | ||
slide.addSlider(zoomer); | ||
} | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
AppDemo/src/main/java/com/hkm/sliderdemo/modules/Feed.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package com.hkm.sliderdemo.modules; | ||
|
||
import android.content.Context; | ||
import android.view.View; | ||
import android.widget.ProgressBar; | ||
import android.widget.RelativeLayout; | ||
|
||
import com.hkm.ezwebview.Util.Fx9C; | ||
import com.hkm.ezwebview.webviewleakfix.NonLeakingWebView; | ||
import com.hkm.slider.SliderTypes.NewsFeedArticleView; | ||
import com.hkm.sliderdemo.R; | ||
import com.hypebeast.sdk.api.model.hbeditorial.ResponsePostW; | ||
import com.hypebeast.sdk.api.model.hbeditorial.ResponseSingle; | ||
import com.hypebeast.sdk.clients.HBEditorialClient; | ||
|
||
import retrofit.Callback; | ||
import retrofit.RetrofitError; | ||
import retrofit.client.Response; | ||
|
||
/** | ||
* Created by hesk on 15/12/15. | ||
*/ | ||
public class Feed extends NewsFeedArticleView { | ||
protected NonLeakingWebView block; | ||
protected HBEditorialClient clientApi; | ||
protected RelativeLayout rlout; | ||
|
||
protected Feed(Context context) { | ||
super(context); | ||
clientApi = HBEditorialClient.getInstance(context); | ||
} | ||
|
||
@Override | ||
protected int getLayoutHolder() { | ||
return R.layout.news_feed_item; | ||
} | ||
|
||
@Override | ||
protected void filter_apply_event_to_view(View root_view) { | ||
rlout = (RelativeLayout) root_view.findViewById(R.id.ns_display_number_container); | ||
block = (NonLeakingWebView) root_view.findViewById(R.id.wv_content_block); | ||
progressBar_circle = (ProgressBar) root_view.findViewById(R.id.ns_loading_progress); | ||
triggerLoading(); | ||
} | ||
|
||
protected void triggerLoading() { | ||
try { | ||
clientApi.createAPIUniversal(getUrl()).getSingleArticle(res); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
protected void removeLoader() { | ||
if (progressBar_circle != null) { | ||
progressBar_circle.animate().alpha(0.0f); | ||
} | ||
} | ||
|
||
protected Callback<ResponseSingle> res = new Callback<ResponseSingle>() { | ||
@Override | ||
public void success(ResponseSingle responsePostW, Response response) { | ||
try { | ||
Fx9C.setup_content_block_wb(mContext, | ||
rlout, | ||
block, | ||
responsePostW.post.single_article_content, | ||
new Runnable() { | ||
@Override | ||
public void run() { | ||
removeLoader(); | ||
} | ||
} | ||
); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Override | ||
public void failure(RetrofitError error) { | ||
error.printStackTrace(); | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:custom="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context="com.daimajia.slider.demo.MainActivity"> | ||
|
||
<RelativeLayout | ||
android:id="@+id/sliderframe" | ||
android:layout_width="match_parent" | ||
android:layout_height="500dp"> | ||
|
||
<com.hkm.slider.SliderLayout | ||
android:id="@+id/slider" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
custom:auto_cycle="true" | ||
custom:image_button_l="@drawable/myarrowl" | ||
custom:indicator_visibility="visible" | ||
custom:lns_use_presentation="Numbers" | ||
custom:page_type="ZOOMABLE" | ||
custom:pager_animation="Default" | ||
custom:pager_animation_span="1100" | ||
custom:slider_side_buttons="true" | ||
custom:slider_side_buttons_function_flip="true" /> | ||
|
||
<com.hkm.slider.Indicators.PagerIndicator | ||
android:id="@+id/custom_indicator" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentBottom="true" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginBottom="20dp" | ||
android:gravity="center" | ||
custom:selected_color="#0095BF" | ||
custom:selected_drawable="@drawable/bird" | ||
custom:selected_height="6dp" | ||
custom:selected_padding_left="5dp" | ||
custom:selected_padding_right="5dp" | ||
custom:selected_width="6dp" | ||
custom:shape="oval" | ||
custom:unselected_color="#55333333" | ||
custom:unselected_height="6dp" | ||
custom:unselected_padding_left="5dp" | ||
custom:unselected_padding_right="5dp" | ||
custom:unselected_width="6dp" /> | ||
|
||
<com.hkm.slider.Indicators.PagerIndicator | ||
android:id="@+id/custom_indicator2" | ||
style="@style/AndroidImageSlider_Corner_Oval_Orange" | ||
android:layout_alignParentBottom="true" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginBottom="20dp" /> | ||
</RelativeLayout> | ||
|
||
|
||
<View | ||
android:id="@+id/slient" | ||
android:layout_width="match_parent" | ||
android:layout_height="1dp" | ||
android:layout_below="@id/sliderframe" | ||
android:background="@color/red_23" /> | ||
|
||
<ListView | ||
android:id="@+id/transformers" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/slient" /> | ||
|
||
|
||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<RelativeLayout | ||
android:id="@id/ns_display_number_container" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<com.hkm.ezwebview.webviewleakfix.NonLeakingWebView | ||
android:id="@id/wv_content_block" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
</RelativeLayout> | ||
|
||
<ProgressBar | ||
android:id="@id/ns_loading_progress" | ||
android:layout_width="60dp" | ||
android:layout_height="60dp" | ||
android:layout_centerInParent="true" /> | ||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.