Skip to content

Commit

Permalink
2.1.0开始支持AndroidX,Target SDK=33
Browse files Browse the repository at this point in the history
  • Loading branch information
AnyLifeZLB committed Dec 17, 2022
1 parent 86069cb commit 586a2f0
Show file tree
Hide file tree
Showing 32 changed files with 435 additions and 176 deletions.
229 changes: 228 additions & 1 deletion .idea/assetWizardSettings.xml

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions .idea/runConfigurations.xml

This file was deleted.

64 changes: 26 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
# About ScrollTextView

## 由于Jcenter 已经停止使用,现在repo 托管更改到 mavenCentral
Class ScrollTextView extends SurfaceView implements SurfaceHolder.Callback

# 关于提Issues
本库一直在持续维护中,但是能投入的时间不多,有issues 的同学说明一下以下内容
- 1.使用场景: 比如ViewPager+fragment 滑动切换
- 2.Android系统信息: 手机品牌,Android版本号
Android 滚动字幕,如新闻联播下面的,可以使用在广告机,滚动新闻信息,机场地铁等信息发布系统。
以前是在信息发布系统上使用过,作为动态布局的一部分,题外话,如果有想做像分众传媒或者类似的
电梯广告的可以参考一下.

动态布局专利:http://www.google.com/patents/CN103336691A?cl=zh (科学上网打开)

继承SurfaceView 实现,CPU 占用低,无内存抖动,以Nexus5X,Android 7.0 上测试流畅度很好,
大部分品牌手机测试兼容性良好。(下面gif图看起来卡是为了图像质量和大小的平衡减低帧率)

Any questions,please contact me at: [email protected]

![image](https://github.com/AnyLifeZLB/ScrollTextView/raw/master/GIF.gif)

# How to use

## Gradle 集成使用 (2.1.0 以后所有support库变为了AndroidX,并且Target SDK=33)

```
implementation 'io.github.anylifezlb:ScrollTextviewLib:2.1.0'
```

## 基础设置代码概要

```
<anylife.scrolltextview.ScrollTextView
android:id="@+id/textView2"
Expand Down Expand Up @@ -36,40 +53,11 @@
```

# 关于提Issues

# Gradle 集成使用
```
implementation 'io.github.anylifezlb:ScrollTextviewLib:2.0.0'
```

# Maven 集成使用
```
<dependency>
<groupId>io.github.anylifezlb</groupId>
<artifactId>ScrollTextView</artifactId>
<version>2.0.0</version>
<type>aar</type>
</dependency>
```

# About ScrollTextView
Class ScrollTextView extends SurfaceView implements SurfaceHolder.Callback


Android 滚动字幕,如新闻联播下面的,可以使用在广告机,机顶盒,电视App等信息发布系统。
以前是在信息发布系统上使用过,作为动态布局的一部分,题外话,如果有想做像分众传媒或者
类似的电梯门口广告的可以参考一下.

动态布局专利:http://www.google.com/patents/CN103336691A?cl=zh (科学上网)


继承SurfaceView 实现,CPU 占用低,无内存抖动,在Nexus5X,Android 7.0 上测试流畅
Gif 图看起来卡是为了图像质量和大小的平衡减低帧率。

Any questions,please contact me at:anylife.[email protected]


![image](https://github.com/AnyLifeZLB/ScrollTextView/raw/master/GIF.gif)
本库一直在持续维护中,但是能投入的时间不多,有issues 的同学说明一下以下内容

- 1.使用场景: 比如ViewPager+fragment 滑动切换出现XX和YY 问题
- 2.Android系统信息: 手机品牌或特殊设备描述,Android系统版本号等信息


17 changes: 8 additions & 9 deletions ScrollTextviewLib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ apply plugin: "com.vanniktech.maven.publish"


android {
compileSdkVersion 28
compileSdkVersion 33

defaultConfig {
minSdkVersion 15
targetSdkVersion 28
versionCode 6
versionName "1.4.8"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
targetSdkVersion 33
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}

buildTypes {
Expand All @@ -20,15 +18,16 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

lintOptions {
checkReleaseBuilds false
lint {
abortOnError false
checkReleaseBuilds false
}
namespace 'anylife.scrolltextview'


}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
}
3 changes: 1 addition & 2 deletions ScrollTextviewLib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="anylife.scrolltextview">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
package anylife.scrolltextview;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.FontMetrics;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff.Mode;
import android.support.annotation.ColorInt;
import androidx.annotation.ColorInt;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
Expand All @@ -31,7 +26,7 @@
* Android auto Scroll Text,like TV News,AD devices
*
*
* Basic knowledge:https://www.jianshu.com/p/918fec73a24d
* Basic knowledge:https://www.jianshu.com/p/918fec73a24d------- unable
*
* @author [email protected] 2013/09/02
*/
Expand Down Expand Up @@ -100,6 +95,10 @@ public ScrollTextView(Context context, AttributeSet attrs) {
paint.setColor(textColor);
paint.setTextSize(textSize);

paint.setFlags(Paint.ANTI_ALIAS_FLAG);
paint.setAntiAlias(true);
paint.setFilterBitmap(true);

setZOrderOnTop(true); //Control whether the surface view's surface is placed on top of its window.
getHolder().setFormat(PixelFormat.TRANSLUCENT);

Expand Down Expand Up @@ -278,7 +277,7 @@ public void setTextSize(float textSizeTem) {
this.textSize=sp2px(getContext(), textSizeTem);
//重新设置Size
paint.setTextSize(textSize);
//试图区域也要改变
//视图区域也要改变
measureVarious();

//实际的视图高,thanks to WG
Expand Down
20 changes: 10 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
compileSdkVersion 33

defaultConfig {
applicationId "com.anylife.fragment.scrolltextview"
minSdkVersion 16
targetSdkVersion 28
targetSdkVersion 33
versionCode 1
versionName "1.0"
}
Expand All @@ -17,23 +17,23 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

lintOptions {
lint {
abortOnError false
}
namespace 'com.anylife.fragment.scrolltextview'


}


dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

implementation 'com.larswerkman:HoloColorPicker:1.5' //颜色选择
implementation project(':ScrollTextviewLib') //依赖 library ScrollTextViewLib

// implementation 'anylife.scrolltextview:ScrollTextviewLib:1.5.0'

implementation project(':ScrollTextviewLib')
implementation 'com.google.android.material:material:1.7.0' //依赖 library ScrollTextViewLib

// implementation 'io.github.anylifezlb:ScrollTextView:2.1.0'
}
22 changes: 11 additions & 11 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.anylife.fragment.scrolltextview">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".TestActivity"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".SettingActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/FullscreenTheme">

</activity>

android:theme="@style/FullscreenTheme"></activity>
<activity
android:name=".LauncherActivity"
android:exported="true"
android:theme="@style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -25,11 +30,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name=".MainActivity"
android:theme="@style/FullscreenTheme"/>

</application>

</manifest>
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 586a2f0

Please sign in to comment.