All Projects → pzienowicz → Trialer

pzienowicz / Trialer

Licence: Apache-2.0 License
A small and simple library for managing trial period in your android app.

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to Trialer

Telegrambots
Java library to create bots using Telegram Bots API
Stars: ✭ 2,728 (+6100%)
Mutual labels:  jitpack
TrialMaker.Demo
A powerful yet straight-forward library suite that provides secure trial license generation and copy-protection features for .NET applications. It also supports premium license generation for expired free-trials.
Stars: ✭ 21 (-52.27%)
Mutual labels:  trial
Android-XML-to-PDF-Generator
This library is for convert XML to PDF very easily using Step Builders Pattern
Stars: ✭ 140 (+218.18%)
Mutual labels:  android-arsenal
NAGPythonExamples
Examples and demos showing how to call functions from the NAG Library for Python
Stars: ✭ 46 (+4.55%)
Mutual labels:  trial
awesome-hosting
List of awesome hosting
Stars: ✭ 134 (+204.55%)
Mutual labels:  trial
packetevents
PacketEvents is a powerful packet library. Our packet wrappers are efficient and easy to use. We support many protocol versions. (1.8+)
Stars: ✭ 235 (+434.09%)
Mutual labels:  jitpack
Jitpack.io
Documentation and issues of https://jitpack.io
Stars: ✭ 2,156 (+4800%)
Mutual labels:  jitpack
jcenter-config
Painlessly publish your library/project to jcenter() with these simple scripts.
Stars: ✭ 13 (-70.45%)
Mutual labels:  jitpack
kotlogram2
An convinient wrapper for kotlogram
Stars: ✭ 17 (-61.36%)
Mutual labels:  jitpack
PaymentCardView
Custom Credit/Debit card view
Stars: ✭ 62 (+40.91%)
Mutual labels:  jitpack
jitci
A CI with tests, coverage, dependency audit, license & vuln. checks
Stars: ✭ 17 (-61.36%)
Mutual labels:  jitpack
ctrdata
Aggregate and analyse information on clinical trials from public registers
Stars: ✭ 26 (-40.91%)
Mutual labels:  trial
wallhaven4j
Wallhaven API for Java
Stars: ✭ 17 (-61.36%)
Mutual labels:  jitpack
RedirectStorage
针对第三方 SDK 乱改存储卡和读取用户数据等行为,利用反射方式重定向 SD 卡目录。
Stars: ✭ 47 (+6.82%)
Mutual labels:  jitpack
Image-Slider-View
Slider is android library, which makes you bit more attractive for sliding images. It will be useful for displaying movie casting and crew pics, on-boarding pages etc.
Stars: ✭ 23 (-47.73%)
Mutual labels:  jitpack
Diffadapter
A high-performance , easy-to-use Adapter for RecyclerView ,using diffutil
Stars: ✭ 193 (+338.64%)
Mutual labels:  jitpack
responsive-html-email-templates
Collection of Free responsive HTML templates for Startups
Stars: ✭ 187 (+325%)
Mutual labels:  trial
kerastuneR
R interface to Keras Tuner
Stars: ✭ 28 (-36.36%)
Mutual labels:  trial
ProminentColor
Android Library to get average/prominent color of bitmap/drawable
Stars: ✭ 23 (-47.73%)
Mutual labels:  jitpack
SSJetpackComposeSwipeableView
SSJetpackComposeSwipeableView is a small library which provides support for the swipeable views. You can use this in your lazyColumns or can add a simple view which contains swipe to edit/delete functionality.
Stars: ✭ 57 (+29.55%)
Mutual labels:  jitpack

Trialer

API GitHub issues Build Status Android Arsenal GitHub license

A small and simple library for managing trial period in your android app.

Installation

Gradle

Add this to your root build.gradle file under repositories:

allprojects {
	repositories {
		maven { url "https://jitpack.io" }
	}
}

Add this to your app level build.gradle as dependency:

implementation 'com.github.pzienowicz:Trialer:{latest.version}'

Latest version:

Usage

Kotlin

val trialer = Trialer(this)
trialer.trialEndedListener = object : TrialEndedListener {
	override fun onTrialEnded(validatorClass: ValidatorInterface) {
        Toast.makeText(
            applicationContext, 
            "Trial ended by: " + validatorClass::class.java.simpleName, 
            Toast.LENGTH_LONG
        ).show()
    }
}
trialer.addValidator(InstallDateValidator(10))
trialer.addValidator(StaticDateValidator(someFutureDate))
trialer.addValidator(RunTimesValidator(5))
trialer.addValidator(YourCustomValidator())
trialer.addAction(DisplayToastAction(context, "Toast by DisplayToastAction"))
trialer.valid()

Java

Trialer trialer = new Trialer(this);
trialer.setTrialEndedListener(validatorClass ->
    Toast.makeText(
        getApplicationContext(),
        "Trial ended by: " + validatorClass.getClass().getSimpleName(),
        Toast.LENGTH_LONG
    ).show()
);
trialer.addValidator(new InstallDateValidator(10));
trialer.addValidator(new StaticDateValidator(someFutureDate.getTime()));
trialer.addValidator(new RunTimesValidator(5));
trialer.addValidator(new YourCustomValidator());
trialer.addAction(new DisplayToastAction(context, "Toast by DisplayToastAction"))
trialer.valid();

Validators

StaticDateValidator

Simple validator - it fails if given date is in the past.

val someFutureDate = Calendar.getInstance()
someFutureDate.add(Calendar.DATE, 30)
...
trialer.addValidator(StaticDateValidator(someFutureDate.time))
...

InstallDateValidator

It fails when X days have passed since installation.

val days = 10 //Int
...
trialer.addValidator(InstallDateValidator(days))
...

RunTimesValidator

It fails when X times your activity has been launched.

val runTimes = 5 //Int
...
trialer.addValidator(RunTimesValidator(runTimes))
...

CustomValidators

You are able to create your custom validators. Just implement ValidatorInterface interface. You can run Trialer with as many validators as you want.

More validators soon

Feel free to contribute and add your custom validators.

Actions

If you don't want to use TrialEndedListener, you can just use simple action, which will be run if trial ended. For now we have few actions specified below. If these actions don't meet your needs, please implement ActionInterface and create your own action.

FinishActivityAction

Closes activity if trial ended.

trialer.addAction(FinishActivityAction(activity))

DisplayToastAction

Displays toast message if trial ended.

trialer.addAction(DisplayToastAction(context, "Toast by DisplayToastAction"))
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].