Skip to content

Commit 847e041

Browse files
qiiduansishu
authored and
duansishu
committed
Init project with demo, implements the basic feature
0 parents  commit 847e041

File tree

346 files changed

+26292
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

346 files changed

+26292
-0
lines changed

.gitignore

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Built application files
2+
*.apk
3+
*.ap_
4+
*.aab
5+
6+
# Files for the ART/Dalvik VM
7+
*.dex
8+
9+
# Java class files
10+
*.class
11+
12+
# Generated files
13+
bin/
14+
gen/
15+
out/
16+
17+
# Gradle files
18+
.gradle/
19+
build/
20+
21+
# Local configuration file (sdk path, etc)
22+
local.properties
23+
24+
# Proguard folder generated by Eclipse
25+
proguard/
26+
27+
# Log Files
28+
*.log
29+
30+
# Android Studio Navigation editor temp files
31+
.navigation/
32+
33+
# Android Studio captures folder
34+
captures/
35+
36+
# IntelliJ
37+
*.iml
38+
.idea/workspace.xml
39+
.idea/tasks.xml
40+
.idea/gradle.xml
41+
.idea/assetWizardSettings.xml
42+
.idea/dictionaries
43+
.idea/libraries
44+
.idea/caches
45+
46+
# Keystore files
47+
# Uncomment the following lines if you do not want to check your keystore files in.
48+
#*.jks
49+
#*.keystore
50+
51+
# External native build folder generated in Android Studio 2.2 and later
52+
.externalNativeBuild
53+
54+
# Google Services (e.g. APIs or Firebase)
55+
google-services.json
56+
57+
# Freeline
58+
freeline.py
59+
freeline/
60+
freeline_project_description.json
61+
62+
# fastlane
63+
fastlane/report.xml
64+
fastlane/Preview.html
65+
fastlane/screenshots
66+
fastlane/test_output
67+
fastlane/readme.md

README.md

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
2+
# TouchTileImageView
3+
TouchTileImageView aims to help produce an easily usable implementation of a zooming Android ImageView.
4+
5+
## Dependency
6+
7+
Add this in your root `build.gradle` file (**not** your module `build.gradle` file):
8+
9+
```gradle
10+
allprojects {
11+
repositories {
12+
maven { url "https://jitpack.io" }
13+
}
14+
}
15+
```
16+
17+
Then, add the library to your module `build.gradle`
18+
```gradle
19+
dependencies {
20+
implementation 'com.ixigua.common:touchtileimageview:latest.release.here'
21+
}
22+
```
23+
24+
## Features
25+
- Smooth scroll/zoom/fling
26+
- Works perfectly when used in a scrolling parent (such as ViewPager).
27+
- Perfect PullDownToDismiss gesture like Google Photo, iOS Photos
28+
- Support MultiLevel thumbnail drawable
29+
- Support Subsampling with inBitmap
30+
- Support all Android image async library, Glide/Fresco
31+
32+
Compared with PhotoView and subsampling-scale-image-view:
33+
<table>
34+
<tr><th></th><th>TouchTileImageView</th><th>PhotoView</th><th>subsampling-scale-image-view</th></tr>
35+
<tr><td>Pan/Fling/Scale</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
36+
<tr><td>Subsampling</td><td>Yes</td><td>No</td><td>Yes</td></tr>
37+
<tr><td>Animation</td><td>Yes</td><td>No</td><td>No</td></tr>
38+
<tr><td>MultiLevel thumbnail</td><td>Yes</td><td>No</td><td>No</td></tr>
39+
<tr><td>Google Photo like gesture</td><td>Yes</td><td>No</td><td>No</td></tr>
40+
<tr><td>inBitmap</td><td>Yes</td><td>No</td><td>No</td></tr>
41+
</table>
42+
43+
## Usage
44+
Simple use cases:
45+
```xml
46+
<com.ixigua.touchtileimageview.TouchTileImageView
47+
android:id="@+id/image_view"
48+
android:layout_width="match_parent"
49+
android:layout_height="match_parent"/>
50+
```
51+
```java
52+
TouchTileImageView imageView = (TouchTileImageView) findViewById(R.id.image_view);
53+
Drawable drawable = ? ;
54+
imageView.setImageAspectRatio((float) drawable.getIntrinsicWidth() / (float) drawable.getIntrinsicHeight());
55+
imageView.addImageDrawable(drawable);
56+
```
57+
58+
59+
## Subsampling
60+
61+
after add Drawable
62+
63+
```java
64+
File file = ? ;
65+
imageView.setImageFile(file)
66+
```
67+
68+
## Glide/Fresco, PullDownToDismiss gesture, Animation
69+
70+
demo project
71+
72+
```shell
73+
./gradlew :demo:installDebug
74+
```
75+
76+
## Issues With ViewGroups
77+
There are some ViewGroups (ones that utilize onInterceptTouchEvent) that throw exceptions when a TouchTileImageView is placed within them, most notably [ViewPager](http://developer.android.com/reference/android/support/v4/view/ViewPager.html)
78+
```java
79+
public class CatchExceptionViewPager extends ViewPager {
80+
public CatchExceptionViewPager(Context context) {
81+
super(context);
82+
}
83+
84+
public CatchExceptionViewPager(Context context, AttributeSet attrs) {
85+
super(context, attrs);
86+
}
87+
88+
@Override
89+
public boolean onInterceptTouchEvent(MotionEvent ev) {
90+
try {
91+
return super.onInterceptTouchEvent(ev);
92+
} catch (IllegalArgumentException ignored) {
93+
ignored.printStackTrace();
94+
return false;
95+
}
96+
}
97+
}
98+
```

build.gradle

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
3+
buildscript {
4+
repositories {
5+
google()
6+
jcenter()
7+
mavenCentral()
8+
}
9+
dependencies {
10+
classpath 'com.android.tools.build:gradle:3.1.4'
11+
// NOTE: Do not place your application dependencies here; they belong
12+
// in the individual module build.gradle files
13+
}
14+
}
15+
16+
allprojects {
17+
repositories {
18+
google()
19+
jcenter()
20+
mavenCentral()
21+
}
22+
}
23+
24+
task clean(type: Delete) {
25+
delete rootProject.buildDir
26+
}

demo/build.gradle

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 27
5+
defaultConfig {
6+
applicationId "com.bytedance.scenedemo"
7+
minSdkVersion 14
8+
targetSdkVersion 27
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
implementation fileTree(dir: 'libs', include: ['*.jar'])
23+
implementation 'com.android.support:appcompat-v7:26.1.0'
24+
implementation 'com.android.support:design:26.1.0'
25+
testImplementation 'junit:junit:4.12'
26+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
27+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
28+
29+
30+
implementation "android.arch.navigation:navigation-fragment:1.0.0-alpha01"
31+
implementation "android.arch.navigation:navigation-ui:1.0.0-alpha01"
32+
compile project(path: ':library:scene')
33+
compile project(path: ':library:scene_ui')
34+
}

demo/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

demo/src/main/AndroidManifest.xml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.bytedance.scenedemo">
4+
5+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
6+
<application
7+
android:allowBackup="true"
8+
android:icon="@mipmap/ic_launcher"
9+
android:label="@string/app_name"
10+
android:roundIcon="@mipmap/ic_launcher_round"
11+
android:supportsRtl="true"
12+
android:theme="@style/AppTheme">
13+
<activity
14+
android:name=".MainListActivity"
15+
android:configChanges="orientation|screenSize|keyboardHidden">
16+
<intent-filter>
17+
<action android:name="android.intent.action.MAIN" />
18+
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
<activity android:name=".navigation.performance.EmptyActivity" />
23+
<activity android:name=".group.fragment.FragmentBindingDemoActivity" />
24+
<activity android:name=".group.fragment.TestSceneToViewActivity" />
25+
<activity android:name="com.bytedance.scenedemo.navigation.forresult.TestActivityResultActivity" />
26+
<activity android:name="com.bytedance.scenedemo.navigation.forresult.ActivityToSceneDemoActivity" />
27+
</application>
28+
29+
</manifest>

0 commit comments

Comments
 (0)