{
8 | private Location mFromLocation;
9 |
10 | public LocalizableComparator(Location fromLocation) {
11 | this.mFromLocation = fromLocation;
12 | }
13 |
14 | @Override
15 | public int compare(Localizable loc1, Localizable loc2) {
16 | float diff = mFromLocation.distanceTo(loc1.getLocation()) - mFromLocation.distanceTo(loc2.getLocation());
17 | return diff > 0 ? 1 : diff < 0 ? -1 : 0;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/gms/GmsUtils.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.gms;
2 |
3 | import android.content.Context;
4 |
5 | import com.google.android.gms.common.ConnectionResult;
6 | import com.google.android.gms.common.GooglePlayServicesUtil;
7 |
8 | public class GmsUtils {
9 | public static boolean supportsGooglePlayServices(Context context) {
10 | return GooglePlayServicesUtil.isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/gms/auth/GoogleAuthFragment.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.gms.auth;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import com.google.android.gms.common.SignInButton;
11 |
12 | import org.michenux.drodrolib.MCXApplication;
13 | import org.michenux.drodrolib.R;
14 | import org.michenux.drodrolib.security.UserHelper;
15 | import org.michenux.drodrolib.security.UserSessionCallback;
16 |
17 | import javax.inject.Inject;
18 |
19 | public class GoogleAuthFragment extends Fragment implements UserSessionCallback, View.OnClickListener {
20 | @Inject
21 | UserHelper mUserHelper;
22 |
23 | private GoogleAuthDelegate mGoogleAuthDelegate;
24 |
25 | private SignInButton mSignInButton;
26 |
27 | @Override
28 | public void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | ((MCXApplication) getActivity().getApplication()).inject(this);
31 |
32 | mGoogleAuthDelegate = new GoogleAuthDelegate(this.getActivity(), mUserHelper);
33 | mGoogleAuthDelegate.setUserSessionCallback(this);
34 |
35 | }
36 |
37 | @Override
38 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
39 | View view = inflater.inflate(R.layout.login_googleplus, container, false);
40 | mSignInButton = (SignInButton) view.findViewById(R.id.sign_in_button);
41 | mSignInButton.setOnClickListener(this);
42 | return view;
43 | }
44 |
45 | @Override
46 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
47 | super.onActivityResult(requestCode, resultCode, data);
48 | mGoogleAuthDelegate.onActivityResult(requestCode, resultCode, data);
49 | }
50 |
51 | @Override
52 | public void onStart() {
53 | super.onStart();
54 | mGoogleAuthDelegate.onStart();
55 | }
56 |
57 | @Override
58 | public void onLogin() {
59 | updateButtons(true);
60 | this.getActivity().finish();
61 | }
62 |
63 | @Override
64 | public void onLogout() {
65 | updateButtons(false);
66 | }
67 |
68 | private void updateButtons(boolean isSignedIn) {
69 | if (isSignedIn) {
70 | mSignInButton.setVisibility(View.INVISIBLE);
71 | } else {
72 | mSignInButton.setVisibility(View.VISIBLE);
73 | }
74 | }
75 |
76 | @Override
77 | public void onClick(View view) {
78 | if (view.getId() == R.id.sign_in_button) {
79 | mGoogleAuthDelegate.signIn(this.getActivity());
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/info/AppUsageUtils.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.info;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.preference.PreferenceManager;
6 |
7 | public class AppUsageUtils {
8 | private static final String LASTUSED_PARAM = "lastUsed";
9 | private static final String LASTSYNC_PARAM = "lastSync";
10 |
11 | public static void updateLastUsedTimestamp(Context context) {
12 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
13 | SharedPreferences.Editor edit = prefs.edit();
14 | edit.putLong(LASTUSED_PARAM, System.currentTimeMillis());
15 | edit.commit();
16 | }
17 |
18 | public static long getLastUsedTimestamp(Context context) {
19 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
20 | return prefs.getLong(LASTUSED_PARAM, 0);
21 | }
22 |
23 | public static long getLastSync(Context context) {
24 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
25 | return prefs.getLong(LASTSYNC_PARAM, 0);
26 | }
27 |
28 | public static void updateLastSync(Context context) {
29 | long lastSync = getLastSync(context);
30 | long now = System.currentTimeMillis();
31 | if (lastSync < now) {
32 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
33 | SharedPreferences.Editor editor = prefs.edit();
34 | editor.putLong(LASTSYNC_PARAM, now);
35 | editor.commit();
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/info/VersionUtils.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.info;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageInfo;
5 | import android.content.pm.PackageManager.NameNotFoundException;
6 |
7 | public class VersionUtils {
8 | public static int getVersionCode(Context context) {
9 | PackageInfo manager = null;
10 | try {
11 | manager = context.getPackageManager().getPackageInfo(
12 | context.getPackageName(), 0);
13 | } catch (NameNotFoundException e) {
14 | throw new RuntimeException(e);
15 | }
16 | return manager.versionCode;
17 | }
18 |
19 | public static String getVersionName(Context context) {
20 | PackageInfo manager = null;
21 | try {
22 | manager = context.getPackageManager().getPackageInfo(
23 | context.getPackageName(), 0);
24 | } catch (NameNotFoundException e) {
25 | throw new RuntimeException(e);
26 | }
27 | return manager.versionName;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/lang/DateUtils.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.lang;
2 |
3 | import java.util.Calendar;
4 | import java.util.Date;
5 |
6 | public class DateUtils {
7 | /**
8 | * Checks if two dates are on the same day ignoring time.
9 | *
10 | * @param date1 the first date, not altered, not null
11 | * @param date2 the second date, not altered, not null
12 | * @return true if they represent the same day
13 | * @throws IllegalArgumentException if either date is null
14 | */
15 | public static boolean isSameDay(Date date1, Date date2) {
16 | if (date1 == null || date2 == null) {
17 | throw new IllegalArgumentException("The dates must not be null");
18 | }
19 | Calendar cal1 = Calendar.getInstance();
20 | cal1.setTime(date1);
21 | Calendar cal2 = Calendar.getInstance();
22 | cal2.setTime(date2);
23 | return isSameDay(cal1, cal2);
24 | }
25 |
26 | /**
27 | * Checks if two calendars represent the same day ignoring time.
28 | *
29 | * @param cal1 the first calendar, not altered, not null
30 | * @param cal2 the second calendar, not altered, not null
31 | * @return true if they represent the same day
32 | * @throws IllegalArgumentException if either calendar is null
33 | */
34 | public static boolean isSameDay(Calendar cal1, Calendar cal2) {
35 | if (cal1 == null || cal2 == null) {
36 | throw new IllegalArgumentException("The dates must not be null");
37 | }
38 | return (cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) &&
39 | cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) &&
40 | cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR));
41 | }
42 |
43 | /**
44 | * Checks if a date is today.
45 | *
46 | * @param date the date, not altered, not null.
47 | * @return true if the date is today.
48 | * @throws IllegalArgumentException if the date is null
49 | */
50 | public static boolean isToday(Date date) {
51 | return isSameDay(date, Calendar.getInstance().getTime());
52 | }
53 |
54 | /**
55 | * Checks if a calendar date is today.
56 | *
57 | * @param cal the calendar, not altered, not null
58 | * @return true if cal date is today
59 | * @throws IllegalArgumentException if the calendar is null
60 | */
61 | public static boolean isToday(Calendar cal) {
62 | return isSameDay(cal, Calendar.getInstance());
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/network/connectivity/ConnectivityUtils.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.network.connectivity;
2 |
3 | import android.content.Context;
4 | import android.net.ConnectivityManager;
5 | import android.net.NetworkInfo;
6 |
7 | public class ConnectivityUtils {
8 | public static boolean isConnected(Context context) {
9 | ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
10 | NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo();
11 | return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
12 | }
13 |
14 | public static boolean isConnectedWifi(Context context) {
15 | ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
16 | NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo();
17 | return activeNetwork != null && activeNetwork.getType() == ConnectivityManager.TYPE_WIFI;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/network/gson/LocationDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.network.gson;
2 |
3 | import android.location.Location;
4 |
5 | import com.google.gson.JsonArray;
6 | import com.google.gson.JsonDeserializationContext;
7 | import com.google.gson.JsonDeserializer;
8 | import com.google.gson.JsonElement;
9 | import com.google.gson.JsonObject;
10 | import com.google.gson.JsonParseException;
11 |
12 | import java.lang.reflect.Type;
13 |
14 | public class LocationDeserializer implements JsonDeserializer {
15 | @Override
16 | public Location deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
17 | JsonObject jsonObject = jsonElement.getAsJsonObject();
18 | Location location = new Location("mongodb");
19 | JsonArray coord = jsonObject.getAsJsonArray("coordinates");
20 | location.setLongitude(coord.get(0).getAsDouble());
21 | location.setLatitude(coord.get(1).getAsDouble());
22 | return location;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/network/gson/TimestampDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.network.gson;
2 |
3 | import com.google.gson.JsonDeserializationContext;
4 | import com.google.gson.JsonDeserializer;
5 | import com.google.gson.JsonElement;
6 | import com.google.gson.JsonParseException;
7 |
8 | import java.lang.reflect.Type;
9 | import java.sql.Timestamp;
10 |
11 | public class TimestampDeserializer implements JsonDeserializer {
12 | public Timestamp deserialize(JsonElement json, Type typeOfT,
13 | JsonDeserializationContext context) throws JsonParseException {
14 | Timestamp result = null;
15 | long time = Long.parseLong(json.getAsString());
16 | if (time > 0) {
17 | result = new Timestamp(time * 1000);
18 | }
19 | return result;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/network/okhttp/LoggingInterceptor.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.network.okhttp;
2 |
3 | import android.util.Log;
4 |
5 | import org.michenux.drodrolib.BuildConfig;
6 | import org.michenux.drodrolib.MCXApplication;
7 |
8 | import java.io.IOException;
9 |
10 | import okhttp3.Interceptor;
11 | import okhttp3.Request;
12 | import okhttp3.Response;
13 |
14 | public class LoggingInterceptor implements Interceptor {
15 | @Override
16 | public Response intercept(Chain chain) throws IOException {
17 | Request request = chain.request();
18 | long t1 = System.nanoTime();
19 |
20 | String url = request.url().toString();
21 |
22 | if (BuildConfig.DEBUG) {
23 | Log.d(MCXApplication.LOG_TAG, String.format("Sending request %s on %s%n%s",
24 | url, chain.connection(), request.headers()));
25 | }
26 |
27 | Response response = chain.proceed(request);
28 |
29 | long t2 = System.nanoTime();
30 |
31 | if (BuildConfig.DEBUG) {
32 | Log.d(MCXApplication.LOG_TAG, String.format("Received response for %s in %.1fms%n%s",
33 | url, (t2 - t1) / 1e6d, response.headers()));
34 | }
35 |
36 | return response;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/network/ssl/TrustAllManager.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.network.ssl;
2 |
3 | import java.security.cert.CertificateException;
4 | import java.security.cert.X509Certificate;
5 |
6 | import javax.net.ssl.X509TrustManager;
7 |
8 | public class TrustAllManager implements X509TrustManager {
9 | public void checkClientTrusted(X509Certificate[] cert, String authType) throws CertificateException {
10 | }
11 |
12 | public void checkServerTrusted(X509Certificate[] cert, String authType) throws CertificateException {
13 | }
14 |
15 | public X509Certificate[] getAcceptedIssuers() {
16 | return null;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/network/ssl/TrustAllSSLSocketFactory.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.network.ssl;
2 |
3 | import org.apache.http.conn.scheme.SocketFactory;
4 | import org.apache.http.conn.ssl.AllowAllHostnameVerifier;
5 | import org.apache.http.conn.ssl.SSLSocketFactory;
6 |
7 | import java.io.IOException;
8 | import java.net.InetAddress;
9 | import java.net.Socket;
10 | import java.security.KeyManagementException;
11 | import java.security.KeyStoreException;
12 | import java.security.NoSuchAlgorithmException;
13 | import java.security.UnrecoverableKeyException;
14 |
15 | import javax.net.ssl.SSLContext;
16 | import javax.net.ssl.TrustManager;
17 |
18 | public class TrustAllSSLSocketFactory extends SSLSocketFactory {
19 | private javax.net.ssl.SSLSocketFactory factory;
20 |
21 | public TrustAllSSLSocketFactory() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException {
22 | super(null);
23 | try {
24 | SSLContext sslcontext = SSLContext.getInstance("TLS");
25 | sslcontext.init(null, new TrustManager[]{new TrustAllManager()}, null);
26 | factory = sslcontext.getSocketFactory();
27 | setHostnameVerifier(new AllowAllHostnameVerifier());
28 | } catch (Exception ex) {
29 | }
30 | }
31 |
32 | public static SocketFactory getDefault() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException {
33 | return new TrustAllSSLSocketFactory();
34 | }
35 |
36 | public Socket createSocket() throws IOException {
37 | return factory.createSocket();
38 | }
39 |
40 | public Socket createSocket(Socket socket, String s, int i, boolean flag) throws IOException {
41 | return factory.createSocket(socket, s, i, flag);
42 | }
43 |
44 | public Socket createSocket(InetAddress inaddr, int i, InetAddress inaddr1, int j) throws IOException {
45 | return factory.createSocket(inaddr, i, inaddr1, j);
46 | }
47 |
48 | public Socket createSocket(InetAddress inaddr, int i) throws IOException {
49 | return factory.createSocket(inaddr, i);
50 | }
51 |
52 | public Socket createSocket(String s, int i, InetAddress inaddr, int j) throws IOException {
53 | return factory.createSocket(s, i, inaddr, j);
54 | }
55 |
56 | public Socket createSocket(String s, int i) throws IOException {
57 | return factory.createSocket(s, i);
58 | }
59 |
60 | public String[] getDefaultCipherSuites() {
61 | return factory.getDefaultCipherSuites();
62 | }
63 |
64 | public String[] getSupportedCipherSuites() {
65 | return factory.getSupportedCipherSuites();
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/resources/AssetUtils.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.resources;
2 |
3 | import android.content.res.AssetManager;
4 |
5 | import java.io.IOException;
6 | import java.util.Arrays;
7 |
8 | public class AssetUtils {
9 | /**
10 | * @param fileName searched file name
11 | * @param path subpath from the asset directory
12 | * @param assetManager assetManager
13 | * @return
14 | * @throws IOException
15 | */
16 | public static boolean exists(String fileName, String path, AssetManager assetManager) throws IOException {
17 | for (String currentFileName : assetManager.list(path)) {
18 | if (currentFileName.equals(fileName)) {
19 | return true;
20 | }
21 | }
22 | return false;
23 | }
24 |
25 | /**
26 | * @param path
27 | * @param assetManager
28 | * @return
29 | * @throws IOException
30 | */
31 | public static String[] list(String path, AssetManager assetManager) throws IOException {
32 | String[] files = assetManager.list(path);
33 | Arrays.sort(files);
34 | return files;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/resources/ResourceUtils.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.resources;
2 |
3 | import android.content.Context;
4 | import android.graphics.drawable.Drawable;
5 | import android.support.v4.content.ContextCompat;
6 |
7 | public class ResourceUtils {
8 | public static Drawable getDrawableByName(String name, Context context) {
9 | int drawableResource = context.getResources().getIdentifier(
10 | name,
11 | "drawable",
12 | context.getPackageName());
13 | if (drawableResource == 0) {
14 | throw new RuntimeException("Can't find drawable with name: " + name);
15 | }
16 | return ContextCompat.getDrawable(context, drawableResource);
17 | }
18 |
19 | public static int getDrawableIdByName(String name, Context context) {
20 | int drawableResource = context.getResources().getIdentifier(
21 | name,
22 | "drawable",
23 | context.getPackageName());
24 | if (drawableResource == 0) {
25 | throw new RuntimeException("Can't find drawable with name: " + name);
26 | }
27 | return drawableResource;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/security/SecurityUtils.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.security;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageInfo;
5 | import android.content.pm.PackageManager;
6 | import android.content.pm.Signature;
7 | import android.util.Base64;
8 | import android.util.Log;
9 |
10 | import org.michenux.drodrolib.MCXApplication;
11 |
12 | import java.security.MessageDigest;
13 | import java.security.NoSuchAlgorithmException;
14 |
15 | public class SecurityUtils {
16 | public static String logHashKey(Context context) {
17 | try {
18 | PackageInfo info = context.getPackageManager().getPackageInfo(
19 | context.getPackageName(),
20 | PackageManager.GET_SIGNATURES);
21 | for (Signature signature : info.signatures) {
22 | MessageDigest md = MessageDigest.getInstance("SHA");
23 | md.update(signature.toByteArray());
24 | return Base64.encodeToString(md.digest(), Base64.DEFAULT);
25 | }
26 | } catch (PackageManager.NameNotFoundException e) {
27 | Log.e(MCXApplication.LOG_TAG, "logHashKey error", e);
28 | } catch (NoSuchAlgorithmException e) {
29 | Log.e(MCXApplication.LOG_TAG, "logHashKey error", e);
30 | }
31 | return null;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/security/User.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.security;
2 |
3 | public class User {
4 | private String userId;
5 |
6 | private String provider;
7 |
8 | private String providerDisplayName;
9 |
10 | private String userName;
11 |
12 | private String displayName;
13 |
14 | private String firstName;
15 |
16 | private String lastName;
17 |
18 | private String mail;
19 |
20 | public String getUserName() {
21 | return userName;
22 | }
23 |
24 | public void setUserName(String userName) {
25 | this.userName = userName;
26 | }
27 |
28 | public String getUserId() {
29 | return userId;
30 | }
31 |
32 | public void setUserId(String userId) {
33 | this.userId = userId;
34 | }
35 |
36 | public String getFirstName() {
37 | return firstName;
38 | }
39 |
40 | public void setFirstName(String firstName) {
41 | this.firstName = firstName;
42 | }
43 |
44 | public String getLastName() {
45 | return lastName;
46 | }
47 |
48 | public void setLastName(String lastName) {
49 | this.lastName = lastName;
50 | }
51 |
52 | public String getProvider() {
53 | return provider;
54 | }
55 |
56 | public void setProvider(String provider) {
57 | this.provider = provider;
58 | }
59 |
60 | public String getDisplayName() {
61 | return displayName;
62 | }
63 |
64 | public void setDisplayName(String displayName) {
65 | this.displayName = displayName;
66 | }
67 |
68 | public String getProviderDisplayName() {
69 | return providerDisplayName;
70 | }
71 |
72 | public void setProviderDisplayName(String providerDisplayName) {
73 | this.providerDisplayName = providerDisplayName;
74 | }
75 |
76 | public String getMail() {
77 | return mail;
78 | }
79 |
80 | public void setMail(String mail) {
81 | this.mail = mail;
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/security/UserHelper.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.security;
2 |
3 | import javax.inject.Inject;
4 | import javax.inject.Singleton;
5 |
6 | @Singleton
7 | public class UserHelper {
8 | private User mCurrentUser;
9 |
10 | @Inject
11 | public UserHelper() {
12 | }
13 |
14 | public User getCurrentUser() {
15 | return mCurrentUser;
16 | }
17 |
18 | public void setCurrentUser(User currentUser) {
19 | this.mCurrentUser = currentUser;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/security/UserSessionCallback.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.security;
2 |
3 | public interface UserSessionCallback {
4 | public void onLogin();
5 |
6 | public void onLogout();
7 | }
8 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/ui/animation/LiveButton.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.ui.animation;
2 |
3 | import android.annotation.TargetApi;
4 | import android.view.MotionEvent;
5 | import android.view.View;
6 | import android.view.animation.DecelerateInterpolator;
7 | import android.view.animation.OvershootInterpolator;
8 | import android.widget.Button;
9 |
10 | import javax.inject.Inject;
11 | import javax.inject.Singleton;
12 |
13 | @Singleton
14 | public class LiveButton {
15 | private DecelerateInterpolator decelerator = new DecelerateInterpolator();
16 | private OvershootInterpolator overshooter = new OvershootInterpolator(10f);
17 |
18 | @Inject
19 | LiveButton() {
20 | }
21 |
22 | public void setupLiveAnimOnButton(Button button, final Runnable onEndRunnable) {
23 | if (android.os.Build.VERSION.SDK_INT >= 16) {
24 | this.setupLiveAnimOnButtonL16(button, onEndRunnable);
25 | } else {
26 | button.setOnClickListener(new View.OnClickListener() {
27 | @Override
28 | public void onClick(View v) {
29 | onEndRunnable.run();
30 | ;
31 | }
32 | });
33 | }
34 | }
35 |
36 | @TargetApi(16)
37 | public void setupLiveAnimOnButtonL16(final Button button, final Runnable onEndRunnable) {
38 | button.animate().setDuration(400);
39 | button.setOnTouchListener(new View.OnTouchListener() {
40 | @Override
41 | public boolean onTouch(View arg0, MotionEvent arg1) {
42 | if (arg1.getAction() == MotionEvent.ACTION_DOWN) {
43 | button.animate().setInterpolator(decelerator).
44 | scaleX(.7f).scaleY(.7f);
45 | } else if (arg1.getAction() == MotionEvent.ACTION_UP) {
46 | button.animate().setInterpolator(overshooter).
47 | scaleX(1.6f).scaleY(1.6f).withEndAction(onEndRunnable);
48 | }
49 | return false;
50 | }
51 | });
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/ui/changelog/ChangeLogDialogFragment.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.ui.changelog;
2 |
3 | import android.app.AlertDialog;
4 | import android.app.Dialog;
5 | import android.content.DialogInterface;
6 | import android.os.Bundle;
7 | import android.support.v4.app.DialogFragment;
8 | import android.webkit.WebView;
9 |
10 | import org.michenux.drodrolib.info.VersionUtils;
11 |
12 | public class ChangeLogDialogFragment extends DialogFragment {
13 | public static ChangeLogDialogFragment newInstance(int title, int closeLabel, String changeLog) {
14 | ChangeLogDialogFragment changelogDialog = new ChangeLogDialogFragment();
15 | Bundle args = new Bundle();
16 | args.putInt("title", title);
17 | args.putInt("closeLabel", closeLabel);
18 | args.putString("changeLog", changeLog);
19 | changelogDialog.setArguments(args);
20 | return changelogDialog;
21 | }
22 |
23 | @Override
24 | public Dialog onCreateDialog(Bundle savedInstanceState) {
25 | int resTitle = getArguments().getInt("title");
26 | int closeLabel = getArguments().getInt("closeLabel");
27 | String changeLog = getArguments().getString("changeLog");
28 |
29 | String title = getString(resTitle, VersionUtils.getVersionName(this.getActivity()));
30 |
31 | final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
32 | builder.setTitle(title);
33 | this.setCancelable(true);
34 |
35 | final WebView webView = new WebView(this.getActivity());
36 | webView.loadDataWithBaseURL(null, changeLog, "text/html", "utf-8", null);
37 | builder.setView(webView);
38 | builder.setNeutralButton(closeLabel,
39 | new DialogInterface.OnClickListener() {
40 | public void onClick(DialogInterface dialog, int which) {
41 | dialog.cancel();
42 | }
43 | });
44 | return builder.create();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/ui/changelog/EulaChangeLogChainHelper.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.ui.changelog;
2 |
3 | import android.support.annotation.StringRes;
4 | import android.support.annotation.XmlRes;
5 | import android.support.v4.app.FragmentActivity;
6 |
7 | import org.michenux.drodrolib.ui.eula.EulaHelper;
8 |
9 | public class EulaChangeLogChainHelper {
10 | public static void show(FragmentActivity fragmentActivity,
11 | @StringRes int resEulaTitle,
12 | @StringRes int resEulaAcceptLabel,
13 | @StringRes int resEulaRefuseLabel,
14 | @StringRes int resChangeLogTitle,
15 | @StringRes int resChangeLogClose,
16 | @XmlRes int resChangeLog) {
17 | //not shown = already accepted
18 | boolean shown = EulaHelper.showAcceptRefuse(fragmentActivity, resEulaTitle, resEulaAcceptLabel, resEulaRefuseLabel);
19 |
20 | ChangeLogHelper changeLogHelper = new ChangeLogHelper();
21 | if (!shown) {
22 | changeLogHelper.showWhatsNew(resChangeLogTitle, resChangeLogClose, resChangeLog, fragmentActivity);
23 | } else {
24 | //We don't show the changelog at first run of the first install, but we have to save the current version
25 | //for the future upgrades
26 | changeLogHelper.saveCurrentVersion(fragmentActivity);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/ui/fragment/FragmentHelper.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.ui.fragment;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentManager;
5 | import android.support.v4.app.FragmentTransaction;
6 |
7 | public class FragmentHelper {
8 | /**
9 | * @param frag
10 | * @param container
11 | * @param fm
12 | */
13 | public static void initFragment(Fragment frag, int container, FragmentManager fm) {
14 | FragmentTransaction ft = fm.beginTransaction();
15 | ft.add(container, frag);
16 | ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
17 | ft.commit();
18 | }
19 |
20 | /**
21 | * @param frag
22 | * @param container
23 | * @param fm
24 | */
25 | public static void initFragmentWithBackstack(Fragment frag, int container, FragmentManager fm) {
26 | FragmentTransaction ft = fm.beginTransaction();
27 | ft.add(container, frag);
28 | ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
29 | ft.addToBackStack(null);
30 | ft.commit();
31 | }
32 |
33 | /**
34 | * @param container1
35 | * @param container2
36 | * @param fm
37 | */
38 | public static void swapFragment(int container1, int container2, FragmentManager fm) {
39 | Fragment f1 = fm.findFragmentById(container1);
40 | Fragment f2 = fm.findFragmentById(container2);
41 |
42 | FragmentTransaction ft = fm.beginTransaction();
43 | ft.remove(f1);
44 | ft.remove(f2);
45 | ft.commit();
46 | fm.executePendingTransactions();
47 |
48 | ft = fm.beginTransaction();
49 | ft.add(container1, f2);
50 | ft.add(container2, f1);
51 | ft.setTransition(FragmentTransaction.TRANSIT_NONE);
52 |
53 | ft.commit();
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/ui/fragment/MasterDetailFragments.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.ui.fragment;
2 |
3 | import android.support.v4.app.Fragment;
4 |
5 | public class MasterDetailFragments {
6 | public Fragment master;
7 |
8 | public Fragment detail;
9 | }
10 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/ui/navdrawer/NavdrawerHeaderArrowView.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.ui.navdrawer;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.ImageView;
6 |
7 | public class NavdrawerHeaderArrowView extends ImageView {
8 | private boolean mExpanded = false;
9 | private static final int[] EXPANDED_STATE = new int[]{android.R.attr.state_expanded};
10 |
11 | public NavdrawerHeaderArrowView(Context context) {
12 | super(context);
13 | }
14 |
15 | public NavdrawerHeaderArrowView(Context context, AttributeSet attrs) {
16 | super(context, attrs);
17 | }
18 |
19 | @Override
20 | public int[] onCreateDrawableState(int extraSpace) {
21 | int[] state = super.onCreateDrawableState(extraSpace + 1);
22 | if (mExpanded) {
23 | mergeDrawableStates(state, EXPANDED_STATE);
24 | }
25 | return state;
26 | }
27 |
28 | public boolean switchExpandedState() {
29 | this.mExpanded = !mExpanded;
30 | refreshDrawableState();
31 | return this.mExpanded;
32 | }
33 |
34 | public boolean isExpanded() {
35 | return mExpanded;
36 | }
37 |
38 | public void setExpanded(boolean expanded) {
39 | if (mExpanded != expanded) {
40 | switchExpandedState();
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/ui/snackbar/SnackbarHelper.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.ui.snackbar;
2 |
3 | import android.graphics.Color;
4 | import android.support.annotation.StringRes;
5 | import android.support.design.widget.Snackbar;
6 | import android.view.View;
7 | import android.widget.TextView;
8 |
9 | public class SnackbarHelper {
10 | public static void showInfoLongMessage(View view, @StringRes int message) {
11 | Snackbar snackbar = Snackbar
12 | .make(view, message, Snackbar.LENGTH_LONG);
13 | View sbView = snackbar.getView();
14 | TextView textView = (TextView) sbView.findViewById(org.michenux.drodrolib.R.id.snackbar_text);
15 | textView.setTextColor(Color.YELLOW);
16 | snackbar.show();
17 | }
18 |
19 | public static void showErrorLongMessageWithAction(View view, @StringRes int message, @StringRes int actionMessage,
20 | View.OnClickListener actionOnClickListener) {
21 | Snackbar snackbar = Snackbar
22 | .make(view, message, Snackbar.LENGTH_LONG)
23 | .setAction(actionMessage, actionOnClickListener);
24 | snackbar.setActionTextColor(Color.RED);
25 | View sbView = snackbar.getView();
26 | TextView textView = (TextView) sbView.findViewById(org.michenux.drodrolib.R.id.snackbar_text);
27 | textView.setTextColor(Color.YELLOW);
28 | snackbar.show();
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/wordpress/json/WPAttachment.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.wordpress.json;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | public class WPAttachment {
6 | private int id;
7 | private String url;
8 | private String slug;
9 | private String title;
10 | private String description;
11 | private String caption;
12 | @SerializedName("mime_type")
13 | private String mimeType;
14 |
15 | public int getId() {
16 | return id;
17 | }
18 |
19 | public void setId(int id) {
20 | this.id = id;
21 | }
22 |
23 | public String getUrl() {
24 | return url;
25 | }
26 |
27 | public void setUrl(String url) {
28 | this.url = url;
29 | }
30 |
31 | public String getSlug() {
32 | return slug;
33 | }
34 |
35 | public void setSlug(String slug) {
36 | this.slug = slug;
37 | }
38 |
39 | public String getTitle() {
40 | return title;
41 | }
42 |
43 | public void setTitle(String title) {
44 | this.title = title;
45 | }
46 |
47 | public String getDescription() {
48 | return description;
49 | }
50 |
51 | public void setDescription(String description) {
52 | this.description = description;
53 | }
54 |
55 | public String getCaption() {
56 | return caption;
57 | }
58 |
59 | public void setCaption(String caption) {
60 | this.caption = caption;
61 | }
62 |
63 | public String getMimeType() {
64 | return mimeType;
65 | }
66 |
67 | public void setMimeType(String mimeType) {
68 | this.mimeType = mimeType;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/wordpress/json/WPAuthor.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.wordpress.json;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | public class WPAuthor {
6 | private long id;
7 | private String slug;
8 | private String name;
9 |
10 | @SerializedName("first_name")
11 | private String firstName;
12 | @SerializedName("last_name")
13 | private String lastName;
14 | @SerializedName("nickname")
15 | private String nickName;
16 | private String url;
17 | private String description;
18 |
19 | public long getId() {
20 | return id;
21 | }
22 |
23 | public void setId(long id) {
24 | this.id = id;
25 | }
26 |
27 | public String getSlug() {
28 | return slug;
29 | }
30 |
31 | public void setSlug(String slug) {
32 | this.slug = slug;
33 | }
34 |
35 | public String getName() {
36 | return name;
37 | }
38 |
39 | public void setName(String name) {
40 | this.name = name;
41 | }
42 |
43 | public String getFirstName() {
44 | return firstName;
45 | }
46 |
47 | public void setFirstName(String firstName) {
48 | this.firstName = firstName;
49 | }
50 |
51 | public String getLastName() {
52 | return lastName;
53 | }
54 |
55 | public void setLastName(String lastName) {
56 | this.lastName = lastName;
57 | }
58 |
59 | public String getNickName() {
60 | return nickName;
61 | }
62 |
63 | public void setNickName(String nickName) {
64 | this.nickName = nickName;
65 | }
66 |
67 | public String getUrl() {
68 | return url;
69 | }
70 |
71 | public void setUrl(String url) {
72 | this.url = url;
73 | }
74 |
75 | public String getDescription() {
76 | return description;
77 | }
78 |
79 | public void setDescription(String description) {
80 | this.description = description;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/wordpress/json/WPCustomFields.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.wordpress.json;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | import java.util.List;
6 |
7 | public class WPCustomFields {
8 | @SerializedName("android_desc")
9 | List description;
10 |
11 | public List getDescription() {
12 | return description;
13 | }
14 |
15 | public void setDescription(List description) {
16 | this.description = description;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/wordpress/json/WPJsonResponse.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.wordpress.json;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | import java.util.List;
6 |
7 | public class WPJsonResponse {
8 | public static final String STATUS_OK = "ok";
9 |
10 | private String status;
11 | private int count;
12 | @SerializedName("count_total")
13 | private int countTotal;
14 | private int pages;
15 | private List posts;
16 |
17 | public String getStatus() {
18 | return status;
19 | }
20 |
21 | public void setStatus(String status) {
22 | this.status = status;
23 | }
24 |
25 | public int getCount() {
26 | return count;
27 | }
28 |
29 | public void setCount(int count) {
30 | this.count = count;
31 | }
32 |
33 | public int getCountTotal() {
34 | return countTotal;
35 | }
36 |
37 | public void setCountTotal(int countTotal) {
38 | this.countTotal = countTotal;
39 | }
40 |
41 | public int getPages() {
42 | return pages;
43 | }
44 |
45 | public void setPages(int pages) {
46 | this.pages = pages;
47 | }
48 |
49 | public List getPosts() {
50 | return posts;
51 | }
52 |
53 | public void setPosts(List posts) {
54 | this.posts = posts;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/wordpress/json/WPThumbnailImage.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.wordpress.json;
2 |
3 | public class WPThumbnailImage {
4 | private String url;
5 | private String width;
6 | private String height;
7 |
8 | public String getUrl() {
9 | return url;
10 | }
11 |
12 | public void setUrl(String url) {
13 | this.url = url;
14 | }
15 |
16 | public String getWidth() {
17 | return width;
18 | }
19 |
20 | public void setWidth(String width) {
21 | this.width = width;
22 | }
23 |
24 | public String getHeight() {
25 | return height;
26 | }
27 |
28 | public void setHeight(String height) {
29 | this.height = height;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/drodrolib/src/main/java/org/michenux/drodrolib/wordpress/json/WPThumbnailImages.java:
--------------------------------------------------------------------------------
1 | package org.michenux.drodrolib.wordpress.json;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | public class WPThumbnailImages {
6 | private WPThumbnailImage full;
7 | private WPThumbnailImage thumbnail;
8 | private WPThumbnailImage medium;
9 | private WPThumbnailImage large;
10 |
11 | @SerializedName("foundation-featured-image")
12 | private WPThumbnailImage foundationFeaturedImage;
13 |
14 | public WPThumbnailImage getFull() {
15 | return full;
16 | }
17 |
18 | public void setFull(WPThumbnailImage full) {
19 | this.full = full;
20 | }
21 |
22 | public WPThumbnailImage getThumbnail() {
23 | return thumbnail;
24 | }
25 |
26 | public void setThumbnail(WPThumbnailImage thumbnail) {
27 | this.thumbnail = thumbnail;
28 | }
29 |
30 | public WPThumbnailImage getMedium() {
31 | return medium;
32 | }
33 |
34 | public void setMedium(WPThumbnailImage medium) {
35 | this.medium = medium;
36 | }
37 |
38 | public WPThumbnailImage getLarge() {
39 | return large;
40 | }
41 |
42 | public void setLarge(WPThumbnailImage large) {
43 | this.large = large;
44 | }
45 |
46 | public WPThumbnailImage getFoundationFeaturedImage() {
47 | return foundationFeaturedImage;
48 | }
49 |
50 | public void setFoundationFeaturedImage(WPThumbnailImage foundationFeaturedImage) {
51 | this.foundationFeaturedImage = foundationFeaturedImage;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/drodrolib/src/main/res/drawable-v21/expander_group.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
6 |
7 | -
8 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/drodrolib/src/main/res/drawable-xhdpi-v21/expander_close_mtrl_alpha.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Michenux/YourAppIdea/7db2a73608c3237bcdaef37db5678fa9fbcd5d7e/drodrolib/src/main/res/drawable-xhdpi-v21/expander_close_mtrl_alpha.9.png
--------------------------------------------------------------------------------
/drodrolib/src/main/res/drawable-xhdpi-v21/expander_open_mtrl_alpha.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Michenux/YourAppIdea/7db2a73608c3237bcdaef37db5678fa9fbcd5d7e/drodrolib/src/main/res/drawable-xhdpi-v21/expander_open_mtrl_alpha.9.png
--------------------------------------------------------------------------------
/drodrolib/src/main/res/drawable-xhdpi/expander_close_holo_dark.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Michenux/YourAppIdea/7db2a73608c3237bcdaef37db5678fa9fbcd5d7e/drodrolib/src/main/res/drawable-xhdpi/expander_close_holo_dark.9.png
--------------------------------------------------------------------------------
/drodrolib/src/main/res/drawable-xhdpi/expander_open_holo_dark.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Michenux/YourAppIdea/7db2a73608c3237bcdaef37db5678fa9fbcd5d7e/drodrolib/src/main/res/drawable-xhdpi/expander_open_holo_dark.9.png
--------------------------------------------------------------------------------
/drodrolib/src/main/res/drawable-xhdpi/navdrawer_profile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Michenux/YourAppIdea/7db2a73608c3237bcdaef37db5678fa9fbcd5d7e/drodrolib/src/main/res/drawable-xhdpi/navdrawer_profile.png
--------------------------------------------------------------------------------
/drodrolib/src/main/res/drawable/expander_group.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
8 |
9 |
--------------------------------------------------------------------------------
/drodrolib/src/main/res/drawable/preferences_listselector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/drodrolib/src/main/res/layout/login_googleplus.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
--------------------------------------------------------------------------------
/drodrolib/src/main/res/layout/preference_list_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/drodrolib/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/drodrolib/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Yes
4 | No
5 |
6 | Open navigation drawer
7 | Close navigation drawer
8 |
9 | Close
10 |
11 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Settings specified in this file will override any Gradle settings
5 | # configured through the IDE.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 | org.gradle.jvmargs=-Xmx1536m
15 |
16 | # When configured, Gradle will run in incubating parallel mode.
17 | # This option should only be used with decoupled projects. More details, visit
18 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
19 | # org.gradle.parallel=true
20 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Michenux/YourAppIdea/7db2a73608c3237bcdaef37db5678fa9fbcd5d7e/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jan 06 15:55:44 PST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':drodrolib', ':YourAppIdea'
2 |
--------------------------------------------------------------------------------