master
panxw 11 years ago
parent 5146b6f0e9
commit 0e5be05bac

@ -7,26 +7,6 @@
<uses-sdk <uses-sdk
android:minSdkVersion="8" android:minSdkVersion="8"
android:targetSdkVersion="17" /> android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="com.allthelucky.common.view.sample.SampleApp" >
<activity
android:name="com.allthelucky.common.view.sample.SampleActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.allthelucky.common.view.sample.AutoImageIndicatorActivity" />
<activity android:name="com.allthelucky.common.view.sample.GuideImageIndicatorActivity" />
<activity android:name="com.allthelucky.common.view.sample.ImageIndicatorActivity" />
</application>
</manifest> </manifest>

@ -12,4 +12,4 @@
# Project target. # Project target.
target=android-17 target=android-17
android.library.reference.1=../../android-app-http/android-app-http android.library=true

@ -81,7 +81,7 @@ public class AutoPlayManager {
* *
* *
* @param startMils * @param startMils
* ms(>5, 8s) * ms(>2, 8s)
* @param intevelMils * @param intevelMils
* ms(3s) * ms(3s)
*/ */
@ -122,7 +122,7 @@ public class AutoPlayManager {
protected void handleMessage(android.os.Message msg) { protected void handleMessage(android.os.Message msg) {
if (broadcastEnable) { if (broadcastEnable) {
if (System.currentTimeMillis() if (System.currentTimeMillis()
- mImageIndicatorView.getRefreshTime() < 5 * 1000) {// 最近一次划动间隔小于2s - mImageIndicatorView.getRefreshTime() < 2 * 1000) {// 最近一次划动间隔小于2s
return; return;
} }
if ((broadcastTimes != DEFAULT_TIMES) if ((broadcastTimes != DEFAULT_TIMES)

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

@ -0,0 +1,3 @@
.settings
bin/
gen/

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>AndroidImageIndicatorSample</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.allthelucky.common.view.sample"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="com.allthelucky.common.view.sample.SampleApp" >
<activity
android:name="com.allthelucky.common.view.sample.SampleActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.allthelucky.common.view.sample.AutoImageIndicatorActivity" />
<activity android:name="com.allthelucky.common.view.sample.GuideImageIndicatorActivity" />
<activity android:name="com.allthelucky.common.view.sample.ImageIndicatorActivity" />
<activity android:name="com.allthelucky.common.view.sample.NetworkImageIndicatorActivity" />
</application>
</manifest>

@ -0,0 +1,20 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

@ -0,0 +1,15 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-17
android.library.reference.1=../AndroidImageIndicator

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

@ -1,12 +1,12 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
> >
<com.allthelucky.common.view.ImageIndicatorView <com.allthelucky.common.view.ImageIndicatorView
android:id="@+id/indicate_view" android:id="@+id/indicate_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="120dp" /> android:layout_height="120dp" />
</RelativeLayout> </RelativeLayout>

@ -1,11 +1,11 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent" >
<com.allthelucky.common.view.ImageIndicatorView <com.allthelucky.common.view.ImageIndicatorView
android:id="@+id/auto_indicate_view" android:id="@+id/auto_indicate_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="120dp" /> android:layout_height="120dp" />
</RelativeLayout> </RelativeLayout>

@ -1,21 +1,21 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent" >
<com.allthelucky.common.view.ImageIndicatorView <com.allthelucky.common.view.ImageIndicatorView
android:id="@+id/guide_indicate_view" android:id="@+id/guide_indicate_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<Button <Button
android:id="@+id/button1" android:id="@+id/button1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:layout_marginBottom="25dp" android:layout_marginBottom="25dp"
android:text="Go ahead!" /> android:text="Go ahead!" />
</RelativeLayout> </RelativeLayout>

@ -0,0 +1,12 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.allthelucky.common.view.network.NetworkImageIndicatorView
android:id="@+id/indicate_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>

@ -1,28 +1,34 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<Button <Button
android:id="@+id/button1" android:id="@+id/button1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="22dp" android:layout_marginTop="22dp"
android:text="IMAGE_INDICATOR" /> android:text="IMAGE_INDICATOR" />
<Button <Button
android:id="@+id/button2" android:id="@+id/button2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="22dp" android:layout_marginTop="22dp"
android:text="AUTO_IMAGE_INDICATOR" /> android:text="AUTO_IMAGE_INDICATOR" />
<Button <Button
android:id="@+id/button3" android:id="@+id/button3"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="22dp" android:layout_marginTop="22dp"
android:text="USERGUIDE_INDICATOR" /> android:text="USERGUIDE_INDICATOR" />
<Button
android:id="@+id/button4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="22dp"
android:text="NETWORK_IMAGE_INDICATOR" />
</LinearLayout> </LinearLayout>

@ -0,0 +1,7 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">AndroidImageIndicatorSample</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
</resources>

@ -0,0 +1,20 @@
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

@ -5,7 +5,6 @@ import android.os.Bundle;
import com.allthelucky.common.view.AutoPlayManager; import com.allthelucky.common.view.AutoPlayManager;
import com.allthelucky.common.view.ImageIndicatorView; import com.allthelucky.common.view.ImageIndicatorView;
import com.app.library.common.view.R;
public class AutoImageIndicatorActivity extends Activity { public class AutoImageIndicatorActivity extends Activity {
private ImageIndicatorView autoImageIndicatorView; private ImageIndicatorView autoImageIndicatorView;
@ -41,7 +40,7 @@ public class AutoImageIndicatorActivity extends Activity {
AutoPlayManager autoBrocastManager = new AutoPlayManager(this.autoImageIndicatorView); AutoPlayManager autoBrocastManager = new AutoPlayManager(this.autoImageIndicatorView);
autoBrocastManager.setBroadcastEnable(true); autoBrocastManager.setBroadcastEnable(true);
autoBrocastManager.setBroadCastTimes(5);//循环播放5次 autoBrocastManager.setBroadCastTimes(5);//循环播放5次
autoBrocastManager.setBroadcastTimeIntevel(5 * 1000, 3 * 1000);//播放启动时间及间隔 autoBrocastManager.setBroadcastTimeIntevel(3 * 1000, 3 * 1000);//播放启动时间及间隔
autoBrocastManager.loop(); autoBrocastManager.loop();
} }

@ -1,54 +1,53 @@
package com.allthelucky.common.view.sample; package com.allthelucky.common.view.sample;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.Toast; import android.widget.Toast;
import com.allthelucky.common.view.ImageIndicatorView; import com.allthelucky.common.view.ImageIndicatorView;
import com.app.library.common.view.R;
public class GuideImageIndicatorActivity extends Activity implements View.OnClickListener,
public class GuideImageIndicatorActivity extends Activity implements View.OnClickListener, ImageIndicatorView.OnItemChangeListener {
ImageIndicatorView.OnItemChangeListener { private ImageIndicatorView imageIndicatorView;
private ImageIndicatorView imageIndicatorView; private Button goButton;
private Button goButton;
@Override
@Override protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
super.onCreate(savedInstanceState); setContentView(R.layout.activity_indicator_guide);
setContentView(R.layout.activity_indicator_guide);
this.imageIndicatorView = (ImageIndicatorView) findViewById(R.id.guide_indicate_view);
this.imageIndicatorView = (ImageIndicatorView) findViewById(R.id.guide_indicate_view); this.goButton = (Button) findViewById(R.id.button1);
this.goButton = (Button) findViewById(R.id.button1); this.goButton.setVisibility(View.GONE);
this.goButton.setVisibility(View.GONE);
this.imageIndicatorView.setOnItemChangeListener(this);
this.imageIndicatorView.setOnItemChangeListener(this); this.goButton.setOnClickListener(this);
this.goButton.setOnClickListener(this);
this.initView();
this.initView(); }
}
@Override
@Override public void onPosition(int position, int totalCount) {
public void onPosition(int position, int totalCount) { if (position == totalCount - 1) {
if (position == totalCount - 1) { goButton.setVisibility(View.VISIBLE);
goButton.setVisibility(View.VISIBLE); } else {
} else { goButton.setVisibility(View.GONE);
goButton.setVisibility(View.GONE); }
} }
}
@Override
@Override public void onClick(View view) {
public void onClick(View view) { Toast.makeText(GuideImageIndicatorActivity.this, "let's roll...", Toast.LENGTH_SHORT).show();
Toast.makeText(GuideImageIndicatorActivity.this, "let's roll...", Toast.LENGTH_SHORT).show(); GuideImageIndicatorActivity.this.finish();
GuideImageIndicatorActivity.this.finish(); }
}
private void initView() {
private void initView() { final Integer[] resArray = new Integer[] { R.drawable.guide_00, R.drawable.guide_01 };
final Integer[] resArray = new Integer[] { R.drawable.guide_00, R.drawable.guide_01 }; this.imageIndicatorView.setupLayoutByDrawable(resArray);
this.imageIndicatorView.setupLayoutByDrawable(resArray); this.imageIndicatorView.setIndicateStyle(ImageIndicatorView.INDICATE_USERGUIDE_STYLE);
this.imageIndicatorView.setIndicateStyle(ImageIndicatorView.INDICATE_USERGUIDE_STYLE); this.imageIndicatorView.show();
this.imageIndicatorView.show(); }
}
}
}

@ -1,39 +1,38 @@
package com.allthelucky.common.view.sample; package com.allthelucky.common.view.sample;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import com.allthelucky.common.view.ImageIndicatorView; import com.allthelucky.common.view.ImageIndicatorView;
import com.app.library.common.view.R;
public class ImageIndicatorActivity extends Activity {
public class ImageIndicatorActivity extends Activity { private ImageIndicatorView imageIndicatorView;
private ImageIndicatorView imageIndicatorView;
@Override
@Override protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
super.onCreate(savedInstanceState); setContentView(R.layout.activity_indicator);
setContentView(R.layout.activity_indicator);
this.imageIndicatorView = (ImageIndicatorView) findViewById(R.id.indicate_view);
this.imageIndicatorView = (ImageIndicatorView) findViewById(R.id.indicate_view); this.imageIndicatorView.setOnItemChangeListener(new ImageIndicatorView.OnItemChangeListener() {
this.imageIndicatorView.setOnItemChangeListener(new ImageIndicatorView.OnItemChangeListener() { @Override
@Override public void onPosition(int position, int totalCount) {
public void onPosition(int position, int totalCount) {
}
} });
}); this.imageIndicatorView.setOnItemChangeListener(new ImageIndicatorView.OnItemChangeListener() {
this.imageIndicatorView.setOnItemChangeListener(new ImageIndicatorView.OnItemChangeListener() { @Override
@Override public void onPosition(int position, int totalCount) {
public void onPosition(int position, int totalCount) {
}
} });
});
this.initView();
this.initView(); }
}
private void initView() {
private void initView() { final Integer[] resArray = new Integer[] { R.drawable.poster1, R.drawable.poster2, R.drawable.poster3 };
final Integer[] resArray = new Integer[] { R.drawable.poster1, R.drawable.poster2, R.drawable.poster3 }; this.imageIndicatorView.setupLayoutByDrawable(resArray);
this.imageIndicatorView.setupLayoutByDrawable(resArray); this.imageIndicatorView.show();
this.imageIndicatorView.show(); }
} }
}

@ -0,0 +1,45 @@
package com.allthelucky.common.view.sample;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.os.Bundle;
import com.allthelucky.common.view.ImageIndicatorView;
import com.allthelucky.common.view.network.NetworkImageIndicatorView;
public class NetworkImageIndicatorActivity extends Activity {
private NetworkImageIndicatorView imageIndicatorView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_indicator_network);
this.imageIndicatorView = (NetworkImageIndicatorView) findViewById(R.id.indicate_view);
this.imageIndicatorView.setOnItemChangeListener(new ImageIndicatorView.OnItemChangeListener() {
@Override
public void onPosition(int position, int totalCount) {
}
});
this.imageIndicatorView.setOnItemChangeListener(new ImageIndicatorView.OnItemChangeListener() {
@Override
public void onPosition(int position, int totalCount) {
}
});
this.initView();
}
private void initView() {
List<String> urlList= new ArrayList<String>();
urlList.add("https://camo.githubusercontent.com/89e5d1cbd313c8611aaac6040fc4be873818ac12/68747470733a2f2f7261772e6769746875622e636f6d2f77696e6669726d2f616e64726f69642d696d6167652d696e64696361746f722f6d61737465722f416e64726f6964496d616765496e64696361746f722f73637265656e73686f742f6775696465725f30302e6a7067");
urlList.add("https://camo.githubusercontent.com/929483245f2f66ad7a6fd3bb7396049780446199/68747470733a2f2f7261772e6769746875622e636f6d2f77696e6669726d2f616e64726f69642d696d6167652d696e64696361746f722f6d61737465722f416e64726f6964496d616765496e64696361746f722f73637265656e73686f742f6775696465725f30312e6a7067");
this.imageIndicatorView.setupLayoutByImageUrl(urlList);
this.imageIndicatorView.show();
}
}

@ -1,34 +1,35 @@
package com.allthelucky.common.view.sample; package com.allthelucky.common.view.sample;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import com.app.library.common.view.R; public class SampleActivity extends Activity implements OnClickListener {
public class SampleActivity extends Activity implements OnClickListener { @Override
protected void onCreate(Bundle savedInstanceState) {
@Override super.onCreate(savedInstanceState);
protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); findViewById(R.id.button1).setOnClickListener(this);
findViewById(R.id.button2).setOnClickListener(this);
findViewById(R.id.button1).setOnClickListener(this); findViewById(R.id.button3).setOnClickListener(this);
findViewById(R.id.button2).setOnClickListener(this); findViewById(R.id.button4).setOnClickListener(this);
findViewById(R.id.button3).setOnClickListener(this); }
}
@Override
@Override public void onClick(View v) {
public void onClick(View v) { final int resId = v.getId();
final int resId = v.getId(); if (resId == R.id.button1) {
if (resId == R.id.button1) { startActivity(new Intent(this, ImageIndicatorActivity.class));
startActivity(new Intent(this, ImageIndicatorActivity.class)); } else if (resId == R.id.button2) {
} else if (resId == R.id.button2) { startActivity(new Intent(this, AutoImageIndicatorActivity.class));
startActivity(new Intent(this, AutoImageIndicatorActivity.class)); } else if (resId == R.id.button3) {
} else if (resId == R.id.button3) { startActivity(new Intent(this, GuideImageIndicatorActivity.class));
startActivity(new Intent(this, GuideImageIndicatorActivity.class)); }else {
} startActivity(new Intent(this, NetworkImageIndicatorActivity.class));
} }
} }
}
Loading…
Cancel
Save