mirror of
https://github.com/afollestad/nock-nock.git
synced 2025-08-03 14:48:39 +00:00
Initial commit
This commit is contained in:
commit
fca080bb7f
47 changed files with 1643 additions and 0 deletions
183
.gitignore
vendored
Normal file
183
.gitignore
vendored
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
|
||||||
|
# Created by https://www.gitignore.io/api/android,intellij,osx,windows,gradle,java
|
||||||
|
|
||||||
|
### Android ###
|
||||||
|
# Built application files
|
||||||
|
*.ap_
|
||||||
|
|
||||||
|
# Files for the ART/Dalvik VM
|
||||||
|
*.dex
|
||||||
|
|
||||||
|
# Java class files
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
bin/
|
||||||
|
gen/
|
||||||
|
out/
|
||||||
|
|
||||||
|
# Gradle files
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Local configuration file (sdk path, etc)
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
# Proguard folder generated by Eclipse
|
||||||
|
proguard/
|
||||||
|
|
||||||
|
# Log Files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Android Studio Navigation editor temp files
|
||||||
|
.navigation/
|
||||||
|
|
||||||
|
# Android Studio captures folder
|
||||||
|
captures/
|
||||||
|
|
||||||
|
# Intellij
|
||||||
|
*.iml
|
||||||
|
.idea/workspace.xml
|
||||||
|
.idea/libraries
|
||||||
|
|
||||||
|
# Keystore files
|
||||||
|
*.jks
|
||||||
|
|
||||||
|
### Android Patch ###
|
||||||
|
gen-external-apklibs
|
||||||
|
|
||||||
|
|
||||||
|
### Intellij ###
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff:
|
||||||
|
.idea/workspace.xml
|
||||||
|
.idea/tasks.xml
|
||||||
|
.idea/dictionaries
|
||||||
|
.idea/vcs.xml
|
||||||
|
.idea/jsLibraryMappings.xml
|
||||||
|
|
||||||
|
# Sensitive or high-churn files:
|
||||||
|
.idea/dataSources.ids
|
||||||
|
.idea/dataSources.xml
|
||||||
|
.idea/dataSources.local.xml
|
||||||
|
.idea/sqlDataSources.xml
|
||||||
|
.idea/dynamic.xml
|
||||||
|
.idea/uiDesigner.xml
|
||||||
|
|
||||||
|
# Gradle:
|
||||||
|
.idea/gradle.xml
|
||||||
|
.idea/libraries
|
||||||
|
|
||||||
|
# Mongo Explorer plugin:
|
||||||
|
.idea/mongoSettings.xml
|
||||||
|
|
||||||
|
## File-based project format:
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
## Plugin-specific files:
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
/out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
### Intellij Patch ###
|
||||||
|
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||||
|
|
||||||
|
# *.iml
|
||||||
|
# modules.xml
|
||||||
|
# .idea/misc.xml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
|
||||||
|
### OSX ###
|
||||||
|
*.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
|
||||||
|
### Windows ###
|
||||||
|
# Windows image file caches
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
|
||||||
|
### Java ###
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
|
||||||
|
### Gradle ###
|
||||||
|
.gradle
|
||||||
|
/build/
|
||||||
|
|
||||||
|
# Ignore Gradle GUI config
|
||||||
|
gradle-app.setting
|
||||||
|
|
||||||
|
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||||
|
!gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Cache of project
|
||||||
|
.gradletasknamecache
|
||||||
|
|
||||||
|
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
|
||||||
|
# gradle/wrapper/gradle-wrapper.properties
|
1
.idea/.name
generated
Normal file
1
.idea/.name
generated
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Nock Nock
|
22
.idea/compiler.xml
generated
Normal file
22
.idea/compiler.xml
generated
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<resourceExtensions />
|
||||||
|
<wildcardResourcePatterns>
|
||||||
|
<entry name="!?*.java" />
|
||||||
|
<entry name="!?*.form" />
|
||||||
|
<entry name="!?*.class" />
|
||||||
|
<entry name="!?*.groovy" />
|
||||||
|
<entry name="!?*.scala" />
|
||||||
|
<entry name="!?*.flex" />
|
||||||
|
<entry name="!?*.kt" />
|
||||||
|
<entry name="!?*.clj" />
|
||||||
|
<entry name="!?*.aj" />
|
||||||
|
</wildcardResourcePatterns>
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile default="true" name="Default" enabled="false">
|
||||||
|
<processorPath useClasspath="true" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
3
.idea/copyright/profiles_settings.xml
generated
Normal file
3
.idea/copyright/profiles_settings.xml
generated
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<component name="CopyrightManager">
|
||||||
|
<settings default="" />
|
||||||
|
</component>
|
6
.idea/encodings.xml
generated
Normal file
6
.idea/encodings.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="PROJECT" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
46
.idea/misc.xml
generated
Normal file
46
.idea/misc.xml
generated
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="EntryPointsManager">
|
||||||
|
<entry_points version="2.0" />
|
||||||
|
</component>
|
||||||
|
<component name="NullableNotNullManager">
|
||||||
|
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||||
|
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||||
|
<option name="myNullables">
|
||||||
|
<value>
|
||||||
|
<list size="4">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myNotNulls">
|
||||||
|
<value>
|
||||||
|
<list size="4">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||||
|
<OptionsSetting value="true" id="Add" />
|
||||||
|
<OptionsSetting value="true" id="Remove" />
|
||||||
|
<OptionsSetting value="true" id="Checkout" />
|
||||||
|
<OptionsSetting value="true" id="Update" />
|
||||||
|
<OptionsSetting value="true" id="Status" />
|
||||||
|
<OptionsSetting value="true" id="Edit" />
|
||||||
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="Android" />
|
||||||
|
</component>
|
||||||
|
</project>
|
9
.idea/modules.xml
generated
Normal file
9
.idea/modules.xml
generated
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/NockNock.iml" filepath="$PROJECT_DIR$/NockNock.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
12
.idea/runConfigurations.xml
generated
Normal file
12
.idea/runConfigurations.xml
generated
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RunConfigurationProducerService">
|
||||||
|
<option name="ignoredProducers">
|
||||||
|
<set>
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
1
app/.gitignore
vendored
Normal file
1
app/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/build
|
39
app/build.gradle
Normal file
39
app/build.gradle
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 24
|
||||||
|
buildToolsVersion "24.0.0"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.afollestad.nocknock"
|
||||||
|
minSdkVersion 21
|
||||||
|
targetSdkVersion 24
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
jackOptions {
|
||||||
|
enabled true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile 'com.android.support:appcompat-v7:24.1.1'
|
||||||
|
compile 'com.afollestad.material-dialogs:core:0.8.6.2'
|
||||||
|
compile 'com.afollestad.material-dialogs:commons:0.8.6.2'
|
||||||
|
compile 'com.afollestad:bridge:3.2.5'
|
||||||
|
compile 'com.afollestad:inquiry:2.0.2'
|
||||||
|
compile 'com.android.support:design:24.1.1'
|
||||||
|
}
|
17
app/proguard-rules.pro
vendored
Normal file
17
app/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# By default, the flags in this file are appended to flags specified
|
||||||
|
# in C:\Users\drumm\AppData\Local\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 *;
|
||||||
|
#}
|
27
app/src/main/AndroidManifest.xml
Normal file
27
app/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.afollestad.nocknock">
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme">
|
||||||
|
|
||||||
|
<activity android:name=".ui.MainActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".ui.AddSiteActivity"
|
||||||
|
android:label="@string/add_site"
|
||||||
|
android:theme="@style/AppTheme.Transparent" />
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
|
@ -0,0 +1,133 @@
|
||||||
|
package com.afollestad.nocknock.adapter;
|
||||||
|
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.afollestad.nocknock.R;
|
||||||
|
import com.afollestad.nocknock.api.ServerModel;
|
||||||
|
import com.afollestad.nocknock.api.ServerStatus;
|
||||||
|
import com.afollestad.nocknock.util.TimeUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Aidan Follestad (afollestad)
|
||||||
|
*/
|
||||||
|
public class ServerAdapter extends RecyclerView.Adapter<ServerAdapter.ServerVH> {
|
||||||
|
|
||||||
|
private final Object LOCK = new Object();
|
||||||
|
private ArrayList<ServerModel> mServers;
|
||||||
|
|
||||||
|
public ServerAdapter() {
|
||||||
|
mServers = new ArrayList<>(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(ServerModel model) {
|
||||||
|
mServers.add(model);
|
||||||
|
notifyItemInserted(mServers.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(int index, ServerModel model) {
|
||||||
|
mServers.set(index, model);
|
||||||
|
notifyItemChanged(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(ServerModel model) {
|
||||||
|
synchronized (LOCK) {
|
||||||
|
for (int i = 0; i < mServers.size(); i++) {
|
||||||
|
if (mServers.get(i).id == model.id) {
|
||||||
|
update(i, model);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void remove(int index) {
|
||||||
|
mServers.remove(index);
|
||||||
|
notifyItemRemoved(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void remove(ServerModel model) {
|
||||||
|
synchronized (LOCK) {
|
||||||
|
for (int i = 0; i < mServers.size(); i++) {
|
||||||
|
if (mServers.get(i).id == model.id) {
|
||||||
|
remove(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(ServerModel[] models) {
|
||||||
|
mServers = new ArrayList<>(models.length);
|
||||||
|
Collections.addAll(mServers, models);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServerAdapter.ServerVH onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
final View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_server, parent, false);
|
||||||
|
return new ServerVH(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(ServerAdapter.ServerVH holder, int position) {
|
||||||
|
final ServerModel model = mServers.get(position);
|
||||||
|
|
||||||
|
holder.textName.setText(model.name);
|
||||||
|
holder.textUrl.setText(model.url);
|
||||||
|
|
||||||
|
switch (model.status) {
|
||||||
|
case ServerStatus.OK:
|
||||||
|
holder.textStatus.setText(R.string.everything_checks_out);
|
||||||
|
holder.iconStatus.setImageResource(R.drawable.green_circle);
|
||||||
|
break;
|
||||||
|
case ServerStatus.WAITING:
|
||||||
|
holder.textStatus.setText(R.string.waiting);
|
||||||
|
holder.iconStatus.setImageResource(R.drawable.yellow_circle);
|
||||||
|
break;
|
||||||
|
case ServerStatus.CHECKING:
|
||||||
|
holder.textStatus.setText(R.string.checking_status);
|
||||||
|
holder.iconStatus.setImageResource(R.drawable.yellow_circle);
|
||||||
|
break;
|
||||||
|
case ServerStatus.ERROR:
|
||||||
|
holder.textStatus.setText(R.string.something_wrong);
|
||||||
|
holder.iconStatus.setImageResource(R.drawable.red_circle);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
final long now = System.currentTimeMillis();
|
||||||
|
final long nextCheck = model.lastCheck + model.checkInterval;
|
||||||
|
final long difference = nextCheck - now;
|
||||||
|
holder.textInterval.setText(TimeUtil.str(difference));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mServers.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ServerVH extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
final ImageView iconStatus;
|
||||||
|
final TextView textName;
|
||||||
|
final TextView textInterval;
|
||||||
|
final TextView textUrl;
|
||||||
|
final TextView textStatus;
|
||||||
|
|
||||||
|
public ServerVH(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
iconStatus = (ImageView) itemView.findViewById(R.id.iconStatus);
|
||||||
|
textName = (TextView) itemView.findViewById(R.id.textName);
|
||||||
|
textInterval = (TextView) itemView.findViewById(R.id.textInterval);
|
||||||
|
textUrl = (TextView) itemView.findViewById(R.id.textUrl);
|
||||||
|
textStatus = (TextView) itemView.findViewById(R.id.textStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.afollestad.nocknock.api;
|
||||||
|
|
||||||
|
import com.afollestad.inquiry.annotations.Column;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Aidan Follestad (afollestad)
|
||||||
|
*/
|
||||||
|
public class ServerModel implements Serializable {
|
||||||
|
|
||||||
|
public ServerModel() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Column(name = "_id", primaryKey = true, notNull = true, autoIncrement = true)
|
||||||
|
public long id;
|
||||||
|
@Column
|
||||||
|
public String name;
|
||||||
|
@Column
|
||||||
|
public String url;
|
||||||
|
@Column
|
||||||
|
public int status;
|
||||||
|
@Column
|
||||||
|
public long checkInterval;
|
||||||
|
@Column
|
||||||
|
public long lastCheck;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.afollestad.nocknock.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Aidan Follestad (afollestad)
|
||||||
|
*/
|
||||||
|
public final class ServerStatus {
|
||||||
|
|
||||||
|
public final static int OK = 1;
|
||||||
|
public final static int WAITING = 2;
|
||||||
|
public final static int CHECKING = 3;
|
||||||
|
public final static int ERROR = 4;
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.afollestad.nocknock.dialogs;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.text.Html;
|
||||||
|
|
||||||
|
import com.afollestad.materialdialogs.MaterialDialog;
|
||||||
|
import com.afollestad.nocknock.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Aidan Follestad (afollestad)
|
||||||
|
*/
|
||||||
|
public class AboutDialog extends DialogFragment {
|
||||||
|
|
||||||
|
public static void show(AppCompatActivity context) {
|
||||||
|
AboutDialog dialog = new AboutDialog();
|
||||||
|
dialog.show(context.getSupportFragmentManager(), "[ABOUT_DIALOG]");
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
return new MaterialDialog.Builder(getActivity())
|
||||||
|
.title(R.string.about)
|
||||||
|
.positiveText(R.string.dismiss)
|
||||||
|
.content(Html.fromHtml(getString(R.string.about_body)))
|
||||||
|
.contentLineSpacing(1.6f)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,144 @@
|
||||||
|
package com.afollestad.nocknock.ui;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewAnimationUtils;
|
||||||
|
import android.view.ViewTreeObserver;
|
||||||
|
import android.view.animation.AccelerateInterpolator;
|
||||||
|
import android.view.animation.DecelerateInterpolator;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
|
||||||
|
import com.afollestad.nocknock.R;
|
||||||
|
import com.afollestad.nocknock.api.ServerModel;
|
||||||
|
import com.afollestad.nocknock.api.ServerStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Aidan Follestad (afollestad)
|
||||||
|
*/
|
||||||
|
public class AddSiteActivity extends AppCompatActivity implements View.OnClickListener {
|
||||||
|
|
||||||
|
private View rootLayout;
|
||||||
|
private Toolbar toolbar;
|
||||||
|
|
||||||
|
private EditText inputName;
|
||||||
|
private EditText inputUrl;
|
||||||
|
private EditText inputInterval;
|
||||||
|
private Spinner spinnerInterval;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_addsite);
|
||||||
|
|
||||||
|
rootLayout = findViewById(R.id.rootView);
|
||||||
|
inputName = (EditText) findViewById(R.id.inputName);
|
||||||
|
inputUrl = (EditText) findViewById(R.id.inputUrl);
|
||||||
|
inputInterval = (EditText) findViewById(R.id.checkIntervalInput);
|
||||||
|
spinnerInterval = (Spinner) findViewById(R.id.checkIntervalSpinner);
|
||||||
|
|
||||||
|
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
|
toolbar.setNavigationOnClickListener(view -> {
|
||||||
|
closeFromNavWithReveal();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (savedInstanceState == null) {
|
||||||
|
rootLayout.setVisibility(View.INVISIBLE);
|
||||||
|
ViewTreeObserver viewTreeObserver = rootLayout.getViewTreeObserver();
|
||||||
|
if (viewTreeObserver.isAlive()) {
|
||||||
|
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
@Override
|
||||||
|
public void onGlobalLayout() {
|
||||||
|
circularRevealActivity();
|
||||||
|
rootLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayAdapter<String> intervalOptionsAdapter = new ArrayAdapter<>(this, R.layout.list_item_spinner,
|
||||||
|
getResources().getStringArray(R.array.interval_options));
|
||||||
|
spinnerInterval.setAdapter(intervalOptionsAdapter);
|
||||||
|
|
||||||
|
findViewById(R.id.doneBtn).setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closeFromNavWithReveal() {
|
||||||
|
final int offset = (int) getResources().getDimension(R.dimen.content_inset);
|
||||||
|
final int cx = rootLayout.getMeasuredWidth();
|
||||||
|
final int cy = rootLayout.getMeasuredHeight();
|
||||||
|
float initialRadius = Math.max(cx, cy);
|
||||||
|
|
||||||
|
final Animator circularReveal = ViewAnimationUtils.createCircularReveal(rootLayout, offset, offset, initialRadius, 0);
|
||||||
|
circularReveal.setDuration(300);
|
||||||
|
circularReveal.setInterpolator(new AccelerateInterpolator());
|
||||||
|
circularReveal.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
super.onAnimationEnd(animation);
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(0, 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
circularReveal.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void circularRevealActivity() {
|
||||||
|
final int cx = rootLayout.getMeasuredWidth() / 2;
|
||||||
|
final int cy = rootLayout.getMeasuredHeight() / 2;
|
||||||
|
final int animDuration = 300;
|
||||||
|
final float finalRadius = Math.max(cx, cy);
|
||||||
|
final Animator circularReveal = ViewAnimationUtils.createCircularReveal(rootLayout, cx, cy, 0, finalRadius);
|
||||||
|
|
||||||
|
circularReveal.setDuration(animDuration);
|
||||||
|
circularReveal.setInterpolator(new DecelerateInterpolator());
|
||||||
|
|
||||||
|
toolbar.setAlpha(0f);
|
||||||
|
rootLayout.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
toolbar.animate().alpha(1f).setDuration(animDuration).start();
|
||||||
|
circularReveal.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Done button
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
ServerModel model = new ServerModel();
|
||||||
|
model.name = inputName.getText().toString().trim();
|
||||||
|
model.url = inputUrl.getText().toString().trim();
|
||||||
|
model.lastCheck = -1;
|
||||||
|
model.status = ServerStatus.WAITING;
|
||||||
|
|
||||||
|
String intervalStr = inputInterval.getText().toString().trim();
|
||||||
|
if (intervalStr.isEmpty()) intervalStr = "0";
|
||||||
|
model.checkInterval = Integer.parseInt(intervalStr);
|
||||||
|
|
||||||
|
switch (spinnerInterval.getSelectedItemPosition()) {
|
||||||
|
case 0: // minutes
|
||||||
|
model.checkInterval *= (60 * 1000);
|
||||||
|
break;
|
||||||
|
case 1: // hours
|
||||||
|
model.checkInterval *= (60 * 60 * 1000);
|
||||||
|
break;
|
||||||
|
case 2: // days
|
||||||
|
model.checkInterval *= (60 * 60 * 24 * 1000);
|
||||||
|
break;
|
||||||
|
default: // weeks
|
||||||
|
model.checkInterval *= (60 * 60 * 24 * 7 * 1000);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
setResult(RESULT_OK, new Intent()
|
||||||
|
.putExtra("model", model));
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.fade_out, R.anim.fade_out);
|
||||||
|
}
|
||||||
|
}
|
126
app/src/main/java/com/afollestad/nocknock/ui/MainActivity.java
Normal file
126
app/src/main/java/com/afollestad/nocknock/ui/MainActivity.java
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
package com.afollestad.nocknock.ui;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Path;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.animation.PathInterpolator;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.afollestad.nocknock.R;
|
||||||
|
import com.afollestad.nocknock.adapter.ServerAdapter;
|
||||||
|
import com.afollestad.nocknock.api.ServerModel;
|
||||||
|
import com.afollestad.nocknock.api.ServerStatus;
|
||||||
|
import com.afollestad.nocknock.dialogs.AboutDialog;
|
||||||
|
import com.afollestad.nocknock.util.MathUtil;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener, View.OnClickListener {
|
||||||
|
|
||||||
|
private FloatingActionButton mFab;
|
||||||
|
private RecyclerView mList;
|
||||||
|
private ServerAdapter mAdapter;
|
||||||
|
private TextView mEmptyText;
|
||||||
|
|
||||||
|
private ObjectAnimator mFabAnimator;
|
||||||
|
private float mOrigFabX;
|
||||||
|
private float mOrigFabY;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
mAdapter = new ServerAdapter();
|
||||||
|
mEmptyText = (TextView) findViewById(R.id.emptyText);
|
||||||
|
|
||||||
|
mList = (RecyclerView) findViewById(R.id.list);
|
||||||
|
mList.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
mList.setAdapter(mAdapter);
|
||||||
|
|
||||||
|
SwipeRefreshLayout sr = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
|
||||||
|
sr.setOnRefreshListener(this);
|
||||||
|
sr.setColorSchemeColors(ContextCompat.getColor(this, R.color.md_green),
|
||||||
|
ContextCompat.getColor(this, R.color.md_yellow),
|
||||||
|
ContextCompat.getColor(this, R.color.md_red));
|
||||||
|
|
||||||
|
mFab = (FloatingActionButton) findViewById(R.id.fab);
|
||||||
|
mFab.setOnClickListener(this);
|
||||||
|
|
||||||
|
ServerModel model = new ServerModel();
|
||||||
|
model.name = "Personal Site";
|
||||||
|
model.url = "https://aidanfollestad.com";
|
||||||
|
model.id = 1;
|
||||||
|
model.status = ServerStatus.OK;
|
||||||
|
model.checkInterval = 1000 * 60;
|
||||||
|
model.lastCheck = System.currentTimeMillis();
|
||||||
|
mAdapter.add(model);
|
||||||
|
|
||||||
|
model = new ServerModel();
|
||||||
|
model.name = "Polar Request Manager";
|
||||||
|
model.url = "https://polar.aidanfollestad.com";
|
||||||
|
model.id = 2;
|
||||||
|
model.status = ServerStatus.CHECKING;
|
||||||
|
model.checkInterval = 1000 * 60 * 2;
|
||||||
|
model.lastCheck = System.currentTimeMillis();
|
||||||
|
mAdapter.add(model);
|
||||||
|
|
||||||
|
mEmptyText.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||||
|
return super.onCreateOptionsMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == R.id.about) {
|
||||||
|
AboutDialog.show(this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRefresh() {
|
||||||
|
// TODO check all servers in order
|
||||||
|
}
|
||||||
|
|
||||||
|
// FAB clicked
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
mOrigFabX = mFab.getX();
|
||||||
|
mOrigFabY = mFab.getY();
|
||||||
|
final Path curve = MathUtil.bezierCurve(mFab, mList);
|
||||||
|
if (mFabAnimator != null)
|
||||||
|
mFabAnimator.cancel();
|
||||||
|
mFabAnimator = ObjectAnimator.ofFloat(view, View.X, View.Y, curve);
|
||||||
|
mFabAnimator.setInterpolator(new PathInterpolator(0.4f, 0.4f, 1, 1));
|
||||||
|
mFabAnimator.setDuration(300);
|
||||||
|
mFabAnimator.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
super.onAnimationEnd(animation);
|
||||||
|
startActivity(new Intent(MainActivity.this, AddSiteActivity.class)
|
||||||
|
.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION));
|
||||||
|
mFab.postDelayed(() -> {
|
||||||
|
mFab.setX(mOrigFabX);
|
||||||
|
mFab.setY(mOrigFabY);
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mFabAnimator.start();
|
||||||
|
}
|
||||||
|
}
|
32
app/src/main/java/com/afollestad/nocknock/util/MathUtil.java
Normal file
32
app/src/main/java/com/afollestad/nocknock/util/MathUtil.java
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
package com.afollestad.nocknock.util;
|
||||||
|
|
||||||
|
import android.graphics.Path;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Aidan Follestad (afollestad)
|
||||||
|
*/
|
||||||
|
public final class MathUtil {
|
||||||
|
|
||||||
|
public static Path bezierCurve(FloatingActionButton fab, View rootView) {
|
||||||
|
final int fabCenterX = (int) (fab.getX() + fab.getMeasuredWidth() / 2);
|
||||||
|
final int fabCenterY = (int) (fab.getY() + fab.getMeasuredHeight() / 2);
|
||||||
|
|
||||||
|
final int endCenterX = (rootView.getMeasuredWidth() / 2) - (fab.getMeasuredWidth() / 2);
|
||||||
|
final int endCenterY = (rootView.getMeasuredHeight() / 2) - (fab.getMeasuredHeight() / 2);
|
||||||
|
|
||||||
|
final int halfX = (fabCenterX - endCenterX) / 2;
|
||||||
|
final int halfY = (fabCenterY - endCenterY) / 2;
|
||||||
|
int mControlX = endCenterX + halfX;
|
||||||
|
int mControlY = endCenterY + halfY;
|
||||||
|
mControlY -= halfY;
|
||||||
|
mControlX += halfX;
|
||||||
|
|
||||||
|
Path path = new Path();
|
||||||
|
path.moveTo(fab.getX(), fab.getY());
|
||||||
|
path.quadTo(mControlX, mControlY, endCenterX, endCenterY);
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
30
app/src/main/java/com/afollestad/nocknock/util/TimeUtil.java
Normal file
30
app/src/main/java/com/afollestad/nocknock/util/TimeUtil.java
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
package com.afollestad.nocknock.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Aidan Follestad (afollestad)
|
||||||
|
*/
|
||||||
|
public class TimeUtil {
|
||||||
|
|
||||||
|
private static long SECOND = 1000;
|
||||||
|
private static long MINUTE = SECOND * 60;
|
||||||
|
private static long HOUR = MINUTE * 60;
|
||||||
|
private static long DAY = HOUR * 24;
|
||||||
|
private static long WEEK = DAY * 7;
|
||||||
|
private static long MONTH = WEEK * 4;
|
||||||
|
|
||||||
|
public static String str(long duration) {
|
||||||
|
if (duration >= MONTH) {
|
||||||
|
return (duration / MONTH) + "mo";
|
||||||
|
} else if (duration >= WEEK) {
|
||||||
|
return (duration / WEEK) + "w";
|
||||||
|
} else if (duration >= DAY) {
|
||||||
|
return (duration / DAY) + "d";
|
||||||
|
} else if (duration >= HOUR) {
|
||||||
|
return (duration / HOUR) + "h";
|
||||||
|
} else if (duration >= MINUTE) {
|
||||||
|
return (duration / MINUTE) + "m";
|
||||||
|
} else {
|
||||||
|
return "<1m";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
app/src/main/res/anim/fade_out.xml
Normal file
11
app/src/main/res/anim/fade_out.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:fillAfter="true">
|
||||||
|
|
||||||
|
<alpha
|
||||||
|
android:duration="1000"
|
||||||
|
android:fromAlpha="1.0"
|
||||||
|
android:interpolator="@android:anim/accelerate_interpolator"
|
||||||
|
android:toAlpha="0.0" />
|
||||||
|
|
||||||
|
</set>
|
12
app/src/main/res/drawable/green_circle.xml
Normal file
12
app/src/main/res/drawable/green_circle.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
|
||||||
|
<solid android:color="@color/md_green" />
|
||||||
|
|
||||||
|
<stroke android:color="#424242" />
|
||||||
|
|
||||||
|
<size
|
||||||
|
android:width="@dimen/list_circle_size"
|
||||||
|
android:height="@dimen/list_circle_size" />
|
||||||
|
</shape>
|
9
app/src/main/res/drawable/ic_action_close.xml
Normal file
9
app/src/main/res/drawable/ic_action_close.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#fff"
|
||||||
|
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z" />
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_add.xml
Normal file
9
app/src/main/res/drawable/ic_add.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#fff"
|
||||||
|
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
|
||||||
|
</vector>
|
12
app/src/main/res/drawable/red_circle.xml
Normal file
12
app/src/main/res/drawable/red_circle.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
|
||||||
|
<solid android:color="@color/md_red" />
|
||||||
|
|
||||||
|
<stroke android:color="#424242"/>
|
||||||
|
|
||||||
|
<size
|
||||||
|
android:width="@dimen/list_circle_size"
|
||||||
|
android:height="@dimen/list_circle_size" />
|
||||||
|
</shape>
|
12
app/src/main/res/drawable/yellow_circle.xml
Normal file
12
app/src/main/res/drawable/yellow_circle.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
|
||||||
|
<solid android:color="@color/md_yellow" />
|
||||||
|
|
||||||
|
<stroke android:color="#424242" />
|
||||||
|
|
||||||
|
<size
|
||||||
|
android:width="@dimen/list_circle_size"
|
||||||
|
android:height="@dimen/list_circle_size" />
|
||||||
|
</shape>
|
129
app/src/main/res/layout/activity_addsite.xml
Normal file
129
app/src/main/res/layout/activity_addsite.xml
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout 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:id="@+id/rootView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?colorPrimary"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<android.support.v7.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?colorPrimary"
|
||||||
|
android:elevation="@dimen/fab_elevation"
|
||||||
|
app:navigationIcon="@drawable/ic_action_close"
|
||||||
|
app:title="@string/add_site"
|
||||||
|
app:titleTextColor="?android:textColorPrimary" />
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="@dimen/content_inset"
|
||||||
|
android:paddingLeft="@dimen/content_inset"
|
||||||
|
android:paddingRight="@dimen/content_inset"
|
||||||
|
android:paddingTop="@dimen/content_inset_less">
|
||||||
|
|
||||||
|
<android.support.design.widget.TextInputLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="-4dp"
|
||||||
|
android:layout_marginRight="-4dp"
|
||||||
|
android:layout_marginTop="@dimen/content_inset">
|
||||||
|
|
||||||
|
<android.support.design.widget.TextInputEditText
|
||||||
|
android:id="@+id/inputName"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/site_name"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textColorHint="?android:textColorSecondary" />
|
||||||
|
|
||||||
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
<android.support.design.widget.TextInputLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="-4dp"
|
||||||
|
android:layout_marginRight="-4dp"
|
||||||
|
android:layout_marginTop="@dimen/content_inset_half">
|
||||||
|
|
||||||
|
<android.support.design.widget.TextInputEditText
|
||||||
|
android:id="@+id/inputUrl"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/site_url"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textColorHint="?android:textColorSecondary" />
|
||||||
|
|
||||||
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/content_inset_double"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/checkIntervalLabel"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/list_text_spacing"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:text="@string/check_interval"
|
||||||
|
android:textColor="?colorAccent"
|
||||||
|
android:textSize="@dimen/caption_font_size" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="5">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/checkIntervalInput"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="start|center_vertical"
|
||||||
|
android:layout_marginEnd="@dimen/content_inset_half"
|
||||||
|
android:layout_marginStart="-4dp"
|
||||||
|
android:layout_weight="3"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
|
android:hint="@string/never_refresh"
|
||||||
|
android:inputType="number"
|
||||||
|
tools:ignore="LabelFor" />
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/checkIntervalSpinner"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end|center_vertical"
|
||||||
|
android:layout_marginEnd="-4dp"
|
||||||
|
android:layout_weight="2" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/doneBtn"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="-4dp"
|
||||||
|
android:layout_marginRight="-4dp"
|
||||||
|
android:layout_marginTop="@dimen/content_inset"
|
||||||
|
android:text="@string/done"
|
||||||
|
android:textColor="#fff" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
46
app/src/main/res/layout/activity_main.xml
Normal file
46
app/src/main/res/layout/activity_main.xml
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout 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"
|
||||||
|
tools:context=".ui.MainActivity">
|
||||||
|
|
||||||
|
<android.support.v4.widget.SwipeRefreshLayout
|
||||||
|
android:id="@+id/swipeRefreshLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scrollbars="vertical" />
|
||||||
|
|
||||||
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/emptyText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/no_sites_added"
|
||||||
|
android:textSize="@dimen/title_font_size"
|
||||||
|
android:textStyle="italic" />
|
||||||
|
|
||||||
|
<android.support.design.widget.FloatingActionButton
|
||||||
|
android:id="@+id/fab"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end|bottom"
|
||||||
|
android:src="@drawable/ic_add"
|
||||||
|
app:backgroundTint="?colorAccent"
|
||||||
|
app:elevation="@dimen/fab_elevation"
|
||||||
|
app:fabSize="normal"
|
||||||
|
app:pressedTranslationZ="@dimen/fab_elevation_pressed"
|
||||||
|
app:rippleColor="#40ffffff"
|
||||||
|
app:useCompatPadding="true" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
90
app/src/main/res/layout/list_item_server.xml
Normal file
90
app/src/main/res/layout/list_item_server.xml
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingLeft="@dimen/content_inset"
|
||||||
|
android:paddingRight="@dimen/content_inset">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iconStatus"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginBottom="@dimen/content_inset"
|
||||||
|
android:layout_marginEnd="@dimen/content_inset"
|
||||||
|
android:layout_marginTop="@dimen/content_inset_half"
|
||||||
|
android:src="@drawable/green_circle"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/content_inset_half"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="@dimen/content_inset_half"
|
||||||
|
android:layout_toStartOf="@+id/textInterval"
|
||||||
|
android:fontFamily="sans-serif-medium"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textSize="@dimen/title_font_size"
|
||||||
|
tools:text="Website Name" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textInterval"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/caption_font_size"
|
||||||
|
tools:text="1h" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textUrl"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/list_text_spacing"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/body_font_size"
|
||||||
|
tools:text="https://yourwebsitehere.com" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textStatus"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/list_text_spacing"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/body_font_size"
|
||||||
|
tools:text="Everything checks out!" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1px"
|
||||||
|
android:layout_marginTop="@dimen/content_inset_less"
|
||||||
|
android:background="@color/dividerColor" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
10
app/src/main/res/layout/list_item_spinner.xml
Normal file
10
app/src/main/res/layout/list_item_spinner.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/button_height"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
|
android:gravity="center_vertical|start"
|
||||||
|
android:paddingLeft="@dimen/content_inset"
|
||||||
|
android:paddingRight="@dimen/content_inset"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textSize="@dimen/body_font_size" />
|
8
app/src/main/res/menu/menu_main.xml
Normal file
8
app/src/main/res/menu/menu_main.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/about"
|
||||||
|
android:title="@string/about" />
|
||||||
|
|
||||||
|
</menu>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
14
app/src/main/res/values/colors.xml
Normal file
14
app/src/main/res/values/colors.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<color name="colorPrimary">#455A64</color>
|
||||||
|
<color name="colorPrimaryDark">#37474F</color>
|
||||||
|
<color name="colorAccent">#FF6E40</color>
|
||||||
|
|
||||||
|
<color name="dividerColor">#B6B6B6</color>
|
||||||
|
|
||||||
|
<color name="md_red">#E53935</color>
|
||||||
|
<color name="md_yellow">#FDD835</color>
|
||||||
|
<color name="md_green">#43A047</color>
|
||||||
|
|
||||||
|
</resources>
|
20
app/src/main/res/values/dimens.xml
Normal file
20
app/src/main/res/values/dimens.xml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<dimen name="headline_font_size">24sp</dimen>
|
||||||
|
<dimen name="title_font_size">20sp</dimen>
|
||||||
|
<dimen name="body_font_size">14sp</dimen>
|
||||||
|
<dimen name="caption_font_size">12sp</dimen>
|
||||||
|
|
||||||
|
<dimen name="content_inset_half">8dp</dimen>
|
||||||
|
<dimen name="content_inset_less">12dp</dimen>
|
||||||
|
<dimen name="content_inset">16dp</dimen>
|
||||||
|
<dimen name="content_inset_more">24dp</dimen>
|
||||||
|
<dimen name="content_inset_double">32dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="list_circle_size">42dp</dimen>
|
||||||
|
<dimen name="list_text_spacing">2dp</dimen>
|
||||||
|
<dimen name="fab_elevation">4dp</dimen>
|
||||||
|
<dimen name="fab_elevation_pressed">8dp</dimen>
|
||||||
|
<dimen name="button_height">52dp</dimen>
|
||||||
|
|
||||||
|
</resources>
|
36
app/src/main/res/values/strings.xml
Normal file
36
app/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<string name="app_name" tools:ignore="Typos">Nock Nock</string>
|
||||||
|
|
||||||
|
<string name="everything_checks_out">Everything checks out!</string>
|
||||||
|
<string name="something_wrong">Something\'s wrong!</string>
|
||||||
|
<string name="checking_status">Checking status…</string>
|
||||||
|
<string name="waiting">Waiting</string>
|
||||||
|
|
||||||
|
<string name="no_sites_added">No sites added!</string>
|
||||||
|
|
||||||
|
<string name="about">About</string>
|
||||||
|
<string name="about_body"><![CDATA[
|
||||||
|
<b>Nock Nock</b>, a simple app designed by <b>Aidan Follestad</b>.<br/>
|
||||||
|
<a href=\'http://aidanfollestad.com\'>Website</a>
|
||||||
|
<a href=\'https://twitter.com/afollestad\'>Twitter</a>
|
||||||
|
<a href=\'https://google.com/+AidanFollestad\'>Google+</a>
|
||||||
|
<a href=\'https://github.com/afollestad\'>GitHub</a>
|
||||||
|
<a href=\'https://www.linkedin.com/in/afollestad\'>LinkedIn</a>
|
||||||
|
]]></string>
|
||||||
|
<string name="dismiss">Dismiss</string>
|
||||||
|
<string name="add_site">Add Site</string>
|
||||||
|
<string name="site_name">Site Name</string>
|
||||||
|
<string name="site_url">Site URL</string>
|
||||||
|
<string name="check_interval">Check Interval</string>
|
||||||
|
<string name="done">Done</string>
|
||||||
|
<string name="never_refresh">Never Refresh</string>
|
||||||
|
|
||||||
|
<string-array name="interval_options">
|
||||||
|
<item>Minute(s)</item>
|
||||||
|
<item>Hour(s)</item>
|
||||||
|
<item>Day(s)</item>
|
||||||
|
<item>Weeks(s)</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
</resources>
|
24
app/src/main/res/values/styles.xml
Normal file
24
app/src/main/res/values/styles.xml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
<item name="colorButtonNormal">@color/colorPrimaryDark</item>
|
||||||
|
|
||||||
|
<item name="android:textColorPrimary">#212121</item>
|
||||||
|
<item name="android:textColorSecondary">#727272</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme.Transparent" parent="Theme.AppCompat.NoActionBar">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
<item name="colorButtonNormal">@color/colorPrimaryDark</item>
|
||||||
|
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
23
build.gradle
Normal file
23
build.gradle
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:2.1.2'
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
18
gradle.properties
Normal file
18
gradle.properties
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Project-wide Gradle settings.
|
||||||
|
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||||
|
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
|
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
# org.gradle.parallel=true
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#Mon Dec 28 10:00:20 PST 2015
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
|
160
gradlew
vendored
Normal file
160
gradlew
vendored
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
gradlew.bat
vendored
Normal file
90
gradlew.bat
vendored
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
1
settings.gradle
Normal file
1
settings.gradle
Normal file
|
@ -0,0 +1 @@
|
||||||
|
include ':app'
|
Loading…
Add table
Add a link
Reference in a new issue