Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added remove listener #59

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: https://paypal.me/janrabe/5
54 changes: 40 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,53 @@
language: android
jdk: oraclejdk8
- yes | sdkmanager "platforms;android-27"
dist: trusty
jdk: openjdk8

env:
global:
- ANDROID_API_LEVEL=27
- ANDROID_BUILD_TOOLS_VERSION=27.0.3
- TRAVIS_SECURE_ENV_VARS=true

- SLAVE_AAPT_TIMEOUT=31
- TERM=dumb
- GRADLE_OPTS="-XX:MaxPermSize=1024m -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx2048m -Dfile.encoding=UTF-8"

matrix:
fast_finish: true

android:
components:
# The BuildTools version used by your project
- tools

- platform-tools
- build-tools-$ANDROID_BUILD_TOOLS_VERSION
- tools
- build-tools-31.0.0
- android-31
- extra-google-m2repository
- extra-android-m2repository
- extra-google-android-support

# The SDK version used to compile your project
- android-$ANDROID_API_LEVEL
# https://docs.travis-ci.com/user/languages/android/
licenses:
- '.+'
- 'android-sdk-preview-license-.+'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'

before_install:
- git submodule update --init --recursive
- chmod u+x gradlew
- android list sdk --no-ui --all --extended
- android list targets
- yes | sdkmanager "platforms;android-31"



install: true

script:
- ./gradlew clean
- ./gradlew assembleDebug
- wget https://github.com/sormuras/bach/raw/master/install-jdk.sh
- chmod +x $TRAVIS_BUILD_DIR/install-jdk.sh
- export JAVA_HOME=$HOME/openjdk11
- $TRAVIS_BUILD_DIR/install-jdk.sh -F 11 --target $JAVA_HOME
- ./gradlew -v
- ./gradlew clean build --stacktrace

after_failure: true

notifications:
email: false
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# ProgressManager
[ ![Jcenter](https://img.shields.io/badge/Jcenter-v1.5.0-brightgreen.svg?style=flat-square) ](https://bintray.com/jessyancoding/maven/progressmanager/1.5.0/link)
[ ![Build Status](https://travis-ci.org/JessYanCoding/ProgressManager.svg?branch=master) ](https://travis-ci.org/JessYanCoding/ProgressManager)
[![](https://jitpack.io/v/kibotu/ProgressManager.svg)](https://jitpack.io/#kibotu/ProgressManager)
[![Build Status](https://app.travis-ci.com/kibotu/ProgressManager.svg?branch=master)](https://app.travis-ci.com/kibotu/ProgressManager)
[ ![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-ProgressManager-brightgreen.svg?style=flat-square)](https://android-arsenal.com/details/1/5865)
[ ![API](https://img.shields.io/badge/API-14%2B-blue.svg?style=flat-square) ](https://developer.android.com/about/versions/android-4.0.html)
[ ![License](http://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square) ](http://www.apache.org/licenses/LICENSE-2.0)
[ ![Author](https://img.shields.io/badge/Author-JessYan-orange.svg?style=flat-square) ](https://www.jianshu.com/u/1d0c0bc634db)
[ ![QQ-Group](https://img.shields.io/badge/QQ%E7%BE%A4-455850365%20%7C%20301733278-orange.svg?style=flat-square) ](https://shang.qq.com/wpa/qunwpa?idkey=7e59e59145e6c7c68932ace10f52790636451f01d1ecadb6a652b1df234df753)
[ ![Author](https://img.shields.io/badge/Author-Jan%20Rabe-orange.svg?style=flat-square) ](https://kibotu.net)


## Listen the progress of downloading and uploading in Okhttp (compatible Retrofit and Glide).
Expand Down Expand Up @@ -33,7 +33,15 @@

## Download
``` gradle
implementation 'me.jessyan:progressmanager:1.5.0'
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.kibotu:ProgressManager:Tag'
}
```

## Usage
Expand All @@ -58,22 +66,16 @@
ProgressManager.getInstance().addRequestListener(UPLOAD_URL, getUploadListener());
```

## About Me

## ProGuard
```
-keep class me.jessyan.progressmanager.** { *; }
-keep interface me.jessyan.progressmanager.** { *; }
```
Follow me on Twitter: [@wolkenschauer](https://twitter.com/wolkenschauer)
Let me know what you think: [jan.rabe@kibotu.net](mailto:jan.rabe@kibotu.net)

## About Me
* **Email**: <jess.yan.effort@gmail.com>
* **Home**: <http://jessyan.me>
* **掘金**: <https://juejin.im/user/57a9dbd9165abd0061714613>
* **简书**: <https://www.jianshu.com/u/1d0c0bc634db>
Contributions welcome!

## License
```
Copyright 2017, jessyan
Copyright 2021, Jan Rabe

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
20 changes: 14 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion rootProject.compileSdkVersion
Expand All @@ -25,12 +26,19 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
implementation 'com.github.bumptech.glide:okhttp3-integration:4.6.1'
testImplementation 'junit:junit:4.13.2'

implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.appcompat:appcompat-resources:1.3.1'
implementation "androidx.annotation:annotation:1.2.0"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'com.google.android.material:material:1.4.0'

implementation 'com.squareup.okhttp3:okhttp:4.9.2'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:4.12.0'
implementation project(':progress')
// implementation 'me.jessyan:progressmanager:1.5.0'
}
24 changes: 12 additions & 12 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="me.jessyan.progressmanager.demo">
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="me.jessyan.progressmanager.demo">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:name=".BaseApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="ProgressManager Base"
>
android:exported="true"
android:label="ProgressManager Base">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".AdvanceActivity"
android:label="ProgressManager Advance"
/>
android:exported="false"
android:label="ProgressManager Advance" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@

import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import com.bumptech.glide.load.engine.DiskCacheStrategy;

import java.io.BufferedInputStream;
Expand Down Expand Up @@ -79,8 +80,8 @@ protected void onCreate(Bundle savedInstanceState) {
initView();
initListener();
//在 Activity 中显示进度条的同时,也在 Fragment 中显示对应 url 的进度条,为了展示此框架的多端同步更新某一个进度信息
getSupportFragmentManager().beginTransaction().add(R.id.fragment_container,
AdvanceFragment.newInstance(mNewImageUrl, mNewDownloadUrl, mNewUploadUrl)).commit();
// getSupportFragmentManager().beginTransaction().add(R.id.fragment_container,
// AdvanceFragment.newInstance(mNewImageUrl, mNewDownloadUrl, mNewUploadUrl)).commit();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@

import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import java.util.ArrayList;
import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.bumptech.glide.load.engine.DiskCacheStrategy;

import org.jetbrains.annotations.NotNull;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
Expand Down Expand Up @@ -101,8 +103,8 @@ protected void onCreate(Bundle savedInstanceState) {
initView();
initListener();
//在 Activity 中显示进度条的同时,也在 Fragment 中显示对应 url 的进度条,为了展示此框架的多端同步更新某一个进度信息
getSupportFragmentManager().beginTransaction().add(R.id.fragment_container,
MainFragment.newInstance(mImageUrl, mDownloadUrl, mUploadUrl)).commit();
// getSupportFragmentManager().beginTransaction().add(R.id.fragment_container,
// MainFragment.newInstance(mImageUrl, mDownloadUrl, mUploadUrl)).commit();
}


Expand Down Expand Up @@ -135,7 +137,7 @@ private void initListener() {
}


@NonNull
@NotNull
private ProgressListener getGlideListener() {
return new ProgressListener() {
@Override
Expand Down Expand Up @@ -163,7 +165,7 @@ public void run() {
};
}

@NonNull
@NotNull
private ProgressListener getUploadListener() {
return new ProgressListener() {
@Override
Expand Down Expand Up @@ -206,7 +208,7 @@ public void run() {
};
}

@NonNull
@NotNull
private ProgressListener getDownloadListener() {
return new ProgressListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@

import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import java.util.ArrayList;
import java.util.Arrays;

Expand Down