-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44de67b
commit 8b20093
Showing
58 changed files
with
1,553 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,9 @@ proguard/ | |
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# Directory-based project format | ||
.idea/ | ||
|
||
# IntelliJ | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,76 @@ | ||
# AppUpdater | ||
Library that checks for new app updates using Google Play, GitHub and Amazon. API 8+ required. | ||
<h1 align="center">AppUpdater</h1> | ||
<h4 align="center">Android Library</h4> | ||
|
||
<p align="center"> | ||
<a target="_blank" href="https://android-arsenal.com/api?level=8"><img src="https://img.shields.io/badge/API-8%2B-orange.svg"></a> | ||
<a target="_blank" href="https://www.paypal.me/javiersantos" title="Donate using PayPal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" /></a> | ||
<a target="_blank" href="http://patreon.com/javiersantos" title="Donate using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" /></a> | ||
</p> | ||
|
||
<p align="center">Android Library that checks for new app updates using Google Play, GitHub and Amazon.</p> | ||
|
||
## How to include | ||
Add the repository to your project **build.gradle**: | ||
```Java | ||
repositories { | ||
maven { | ||
url "https://jitpack.io" | ||
} | ||
} | ||
``` | ||
|
||
And add the library to your module **build.gradle**: | ||
```Java | ||
dependencies { | ||
compile 'com.github.javiersantos:AppUpdater:1.0' | ||
} | ||
``` | ||
|
||
## Usage | ||
Add **INTERNET** and **ACCESS_NETWORK_STATE** permissions to your app's Manifest: | ||
```Java | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | ||
``` | ||
|
||
### Activity | ||
```Java | ||
AppUpdater appUpdater = new AppUpdater(this); | ||
appUpdater.init(); | ||
``` | ||
|
||
## Customization | ||
|
||
### Display dialog only once | ||
Use the builder and add following: | ||
```Java | ||
// (Optional) Provide a Display mode (DIALOG, SNACKBAR, NOTIFICATION) | ||
.setDisplay(Display.DIALOG) | ||
// (Optional) Provide a duration for the Snackbars (NORMAL, INDEFINITE) | ||
.setDuration(Duration.NORMAL) | ||
// (Optional) Provide a source for the updates (GOOGLE_PLAY, GITHUB, AMAZON) | ||
.setUpdateFrom(UpdateFrom.GOOGLE_PLAY) | ||
// (Required for GITHUB, optional otherwise) Provide the GitHub user and repo where releases are available | ||
.setGitHubUserAndRepo("javiersantos", "AppUpdater") | ||
// (Optional) Updates will be displayed only every X times the app ascertains that a new update is availabl | ||
.showEvery(5) | ||
// (Optional) Show dialog, snackbar or notification although there aren't updates | ||
.showAppUpdated(false); | ||
``` | ||
|
||
![ML Manager](https://raw.githubusercontent.com/javiersantos/AppUpdater/master/Screenshots/banner.png) | ||
|
||
## License | ||
Copyright 2016 Javier Santos | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.2" | ||
|
||
defaultConfig { | ||
applicationId "com.github.javiersantos.appupdater.demo" | ||
minSdkVersion 11 | ||
targetSdkVersion 23 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
|
||
applicationVariants.all { variant -> | ||
variant.outputs.each { output -> | ||
output.outputFile = new File(output.outputFile.parent, output.outputFile.name.replace("app-release.apk", applicationId + "_" + versionName + "_" + versionCode + ".apk")) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
testCompile 'junit:junit:4.12' | ||
compile 'com.android.support:appcompat-v7:23.1.1' | ||
compile 'com.android.support:design:23.1.1' | ||
compile 'com.android.support:cardview-v7:23.1.1' | ||
compile 'com.mikepenz:iconics-core:2.5.5@aar' | ||
compile 'com.mikepenz:material-design-iconic-typeface:2.2.0.1@aar' | ||
compile project(':library') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /Users/javiersantos/Library/Android/sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# 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 *; | ||
#} |
13 changes: 13 additions & 0 deletions
13
app/src/androidTest/java/com/github/javiersantos/demo/ApplicationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.github.javiersantos.demo; | ||
|
||
import android.app.Application; | ||
import android.test.ApplicationTestCase; | ||
|
||
/** | ||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> | ||
*/ | ||
public class ApplicationTest extends ApplicationTestCase<Application> { | ||
public ApplicationTest() { | ||
super(Application.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.github.javiersantos.appupdater.demo"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name="com.github.javiersantos.demo.MainActivity" | ||
android:theme="@style/AppTheme.NoActionBar"> | ||
|
||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
88 changes: 88 additions & 0 deletions
88
app/src/main/java/com/github/javiersantos/demo/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package com.github.javiersantos.demo; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.graphics.Color; | ||
import android.net.Uri; | ||
import android.os.Bundle; | ||
import android.support.design.widget.FloatingActionButton; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.CardView; | ||
import android.support.v7.widget.Toolbar; | ||
import android.view.View; | ||
|
||
import com.github.javiersantos.appupdater.AppUpdater; | ||
import com.github.javiersantos.appupdater.demo.R; | ||
import com.github.javiersantos.appupdater.enums.Display; | ||
import com.github.javiersantos.appupdater.enums.UpdateFrom; | ||
import com.mikepenz.iconics.IconicsDrawable; | ||
import com.mikepenz.material_design_iconic_typeface_library.MaterialDesignIconic; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
private Context context; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
this.context = this; | ||
|
||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
setSupportActionBar(toolbar); | ||
|
||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | ||
CardView dialog = (CardView) findViewById(R.id.dialog); | ||
CardView snackbar = (CardView) findViewById(R.id.snackbar); | ||
CardView notification = (CardView) findViewById(R.id.notification); | ||
|
||
fab.setImageDrawable(new IconicsDrawable(this).icon(MaterialDesignIconic.Icon.gmi_github).color(Color.WHITE).sizeDp(24)); | ||
fab.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/javiersantos/AppUpdater"))); | ||
} | ||
}); | ||
|
||
dialog.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
AppUpdater appUpdater = new AppUpdater(context); | ||
appUpdater.setUpdateFrom(UpdateFrom.GOOGLE_PLAY); | ||
// appUpdater.setUpdateFrom(UpdateFrom.AMAZON); | ||
// appUpdater.setUpdateFrom(UpdateFrom.GITHUB); | ||
// appUpdater.setGitHubUserAndRepo("javiersantos", "AppUpdater"); | ||
appUpdater.setDisplay(Display.DIALOG); | ||
appUpdater.showAppUpdated(true); | ||
appUpdater.init(); | ||
} | ||
}); | ||
|
||
snackbar.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
AppUpdater appUpdater = new AppUpdater(context); | ||
appUpdater.setUpdateFrom(UpdateFrom.GOOGLE_PLAY); | ||
// appUpdater.setUpdateFrom(UpdateFrom.AMAZON); | ||
// appUpdater.setUpdateFrom(UpdateFrom.GITHUB); | ||
// appUpdater.setGitHubUserAndRepo("javiersantos", "AppUpdater"); | ||
appUpdater.setDisplay(Display.SNACKBAR); | ||
appUpdater.showAppUpdated(true); | ||
appUpdater.init(); | ||
} | ||
}); | ||
|
||
notification.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
AppUpdater appUpdater = new AppUpdater(context); | ||
appUpdater.setUpdateFrom(UpdateFrom.GOOGLE_PLAY); | ||
// appUpdater.setUpdateFrom(UpdateFrom.AMAZON); | ||
// appUpdater.setUpdateFrom(UpdateFrom.GITHUB); | ||
// appUpdater.setGitHubUserAndRepo("javiersantos", "AppUpdater"); | ||
appUpdater.setDisplay(Display.NOTIFICATION); | ||
appUpdater.showAppUpdated(true); | ||
appUpdater.init(); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:fitsSystemWindows="true" | ||
tools:context="com.github.javiersantos.demo.MainActivity" | ||
tools:ignore="PrivateResource"> | ||
|
||
<android.support.design.widget.AppBarLayout | ||
android:id="@+id/app_bar" | ||
android:layout_width="match_parent" | ||
android:layout_height="@dimen/app_bar_height" | ||
android:fitsSystemWindows="true" | ||
android:theme="@style/AppTheme.AppBarOverlay"> | ||
|
||
<android.support.design.widget.CollapsingToolbarLayout | ||
android:id="@+id/toolbar_layout" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:fitsSystemWindows="true" | ||
app:expandedTitleTextAppearance="@style/AppTheme.TransparentText" | ||
app:contentScrim="?attr/colorPrimary" | ||
app:layout_scrollFlags="exitUntilCollapsed"> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="@string/app_name" | ||
android:textColor="@android:color/white" | ||
android:layout_marginRight="48dp" | ||
android:layout_marginLeft="48dp" | ||
android:textSize="@dimen/abc_text_size_display_1_material" | ||
android:layout_gravity="bottom" | ||
android:layout_marginBottom="64dp" | ||
app:layout_collapseMode="parallax" /> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="@string/app_description" | ||
android:textColor="@android:color/white" | ||
android:layout_marginRight="48dp" | ||
android:layout_marginLeft="48dp" | ||
android:textSize="@dimen/abc_text_size_subhead_material" | ||
android:singleLine="true" | ||
android:layout_gravity="bottom" | ||
android:layout_marginBottom="32dp" | ||
app:layout_collapseMode="parallax" /> | ||
|
||
<android.support.v7.widget.Toolbar | ||
android:id="@+id/toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="?attr/actionBarSize" | ||
app:layout_collapseMode="pin" | ||
app:popupTheme="@style/AppTheme.PopupOverlay" /> | ||
|
||
</android.support.design.widget.CollapsingToolbarLayout> | ||
</android.support.design.widget.AppBarLayout> | ||
|
||
<include layout="@layout/content_main" /> | ||
|
||
<android.support.design.widget.FloatingActionButton | ||
android:id="@+id/fab" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="@dimen/fab_margin" | ||
app:layout_anchor="@id/app_bar" | ||
app:layout_anchorGravity="bottom|end" /> | ||
|
||
</android.support.design.widget.CoordinatorLayout> |
Oops, something went wrong.