Skip to content

Commit

Permalink
Merge branch 'release/v1.0'
Browse files Browse the repository at this point in the history
* release/v1.0: (31 commits)
  Updated readme and added binary
  Changed download folder and fixed issue with installer not launching
  If the app isn't installed, offer download
  Fixed checker
  Re-wrote comparison methods
  Fixed addon spec
  Finish download activity
  Added latest stable support
  Added experimental option
  Removed remind action and added auto cancel
  Added 1 day check limit and force update respond toast
  Updated style
  Added download functionality and UI population
  Fixed issue with API failing and notifications not updating
  Added toString override for version
  Added provider info
  Added permission helper class
  Added basic download activity
  Added update notification
  Added version unit test
  ...
  • Loading branch information
7LPdWcaW authored and 7LPdWcaW committed Feb 25, 2017
2 parents a6a02b4 + 7671d1f commit cc83851
Show file tree
Hide file tree
Showing 34 changed files with 1,357 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Read me

Welcome to grow updater. This is an application addon for the [Grow Tracker](https://github.com/7LPdWcaW/GrowTracker-Android).

This addon periodically (1 day, only checks when using GrowTracker) checks for updates for the Grow Tracker application.

Downloaded updates are saved in `/sdcard/Download/`

[Latest APK: (MD5) 4daf947e4009a8975d7a5fd7c4b8607c v1.0](https://github.com/7LPdWcaW/GrowUpdater-Android/raw/master/app/app-release.apk)

# Installation

Install the APK. You must have Grow Tracker version 2.2 or above, inside the Grow Tracker app, go to Settings from the sidebar, and you should see listed under `Addons` the addon. You can tap to configure the addon.

## How to install

1. Follow [this guide](https://gameolith.uservoice.com/knowledgebase/articles/76902-android-4-0-tablets-allowing-app-installs-from) to enable unknown sources
2. Download the APK from [here](https://github.com/7LPdWcaW/GrowUpdater-Android/raw/master/app/app-release.apk)
3. Click on downloaded app and install

#License

Copyright 2014-2016 7LPdWcaW

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.
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Binary file added app/app-release.apk
Binary file not shown.
32 changes: 32 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"

defaultConfig {
applicationId "me.anon.grow.updater"

minSdkVersion 17
targetSdkVersion 25

versionCode 1
versionName "v1.0"

manifestPlaceholders = [versionName: versionName]
}

buildTypes {
release {
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.loopj.android:android-async-http:1.4.9'
testCompile 'junit:junit:4.12'
}
42 changes: 42 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="me.anon.grow.updater"
>
<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:allowBackup="true"
android:supportsRtl="true"
android:icon="@mipmap/ic_launcher"
android:label="Grow Updater"
>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true"
>
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
</provider>

<receiver android:name=".CheckUpdateReceiver" android:exported="true" android:enabled="true">
<intent-filter>
<action android:name="me.anon.grow.ACTION_UPDATER" />
</intent-filter>
</receiver>

<activity android:name="me.anon.grow.updater.ConfigureActivity" android:theme="@style/AppTheme">
<intent-filter>
<category android:name="me.anon.grow.ADDON_CONFIGURATION" />
<action android:name="me.anon.grow.ACTION_UPDATER" />
</intent-filter>
</activity>

<activity android:name=".DownloadActivity" android:theme="@style/AppTheme" />

<meta-data android:name="me.anon.grow.ADDON_NAME" android:value="Updater" />
<meta-data android:name="me.anon.grow.ADDON_VERSION" android:value="${versionName}" />
</application>
</manifest>
8 changes: 8 additions & 0 deletions app/src/main/assets/readme.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<body>
<h1>Read me</h1>
<div>
Welcome to grow updater. This is a simple addon for Grow Tracker that periodically checks the Releases page on github for updates and automatically downloads ans prompts for install. This app does not do any other website requests.
</div>
</body>
</html>
Binary file added app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 77 additions & 0 deletions app/src/main/java/me/anon/grow/helper/PermissionHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package me.anon.grow.helper;

import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.v4.content.PermissionChecker;

public class PermissionHelper
{
@TargetApi(Build.VERSION_CODES.M)
public static boolean doPermissionCheck(final Fragment fragment, final String permission, final int requestCode, String dialogMessage)
{
if (PermissionChecker.checkSelfPermission(fragment.getActivity(), permission) != PackageManager.PERMISSION_GRANTED)
{
if (fragment.shouldShowRequestPermissionRationale(permission) && dialogMessage != null)
{
new AlertDialog.Builder(fragment.getActivity())
.setMessage(dialogMessage)
.setPositiveButton("OK", new DialogInterface.OnClickListener()
{
@Override public void onClick(DialogInterface dialog, int which)
{
fragment.requestPermissions(new String[]{permission}, requestCode);
}
})
.setNegativeButton("Cancel", null)
.show();

return false;
}

fragment.requestPermissions(new String[]{permission}, requestCode);
return false;
}

return true;
}

@TargetApi(Build.VERSION_CODES.M)
public static boolean doPermissionCheck(final Activity activity, final String permission, final int requestCode, String dialogMessage)
{
if (PermissionChecker.checkSelfPermission(activity, permission) != PackageManager.PERMISSION_GRANTED)
{
if (activity.shouldShowRequestPermissionRationale(permission) && dialogMessage != null)
{
new AlertDialog.Builder(activity)
.setMessage(dialogMessage)
.setPositiveButton("OK", new DialogInterface.OnClickListener()
{
@Override public void onClick(DialogInterface dialog, int which)
{
activity.requestPermissions(new String[]{permission}, requestCode);
}
})
.setNegativeButton("Cancel", null)
.show();

return false;
}

activity.requestPermissions(new String[]{permission}, requestCode);
return false;
}

return true;
}

public static boolean hasPermission(Context context, String permission)
{
return Build.VERSION.SDK_INT < 23 || PermissionChecker.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED;
}
}
Loading

0 comments on commit cc83851

Please sign in to comment.