// Path: app/src/main/java/com/teocci/ytinbg/utils/LogHelper.java
// public class LogHelper
// {
//     private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length();
//     private static final int MAX_LOG_TAG_LENGTH = 23;
//     private static final int RESERVED_LENGTH = MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 2;
// 
//     public static String makeLogTag(String str)
//     {
//         return LOG_PREFIX
//                 + '['
//                 + (str.length() > RESERVED_LENGTH ? str.substring(0, RESERVED_LENGTH - 1) : str)
//                 + ']';
//     }
// 
//     /**
//      * Don't use this when obfuscating class names!
//      */
//     public static String makeLogTag(Class cls)
//     {
//         return makeLogTag(cls.getSimpleName());
//     }
// 
// 
//     public static void v(String tag, Object... messages)
//     {
//         // Only log VERBOSE if build type is DEBUG
//         if (BuildConfig.DEBUG) {
//             log(tag, Log.VERBOSE, null, messages);
//         }
//     }
// 
//     public static void d(String tag, Object... messages)
//     {
//         // Only log DEBUG if build type is DEBUG
//         if (BuildConfig.DEBUG) {
//             log(tag, Log.DEBUG, null, messages);
//         }
//     }
// 
//     public static void i(String tag, Object... messages)
//     {
//         log(tag, Log.INFO, null, messages);
//     }
// 
//     public static void w(String tag, Object... messages)
//     {
//         log(tag, Log.WARN, null, messages);
//     }
// 
//     public static void w(String tag, Throwable t, Object... messages)
//     {
//         log(tag, Log.WARN, t, messages);
//     }
// 
//     public static void e(String tag, Object... messages)
//     {
//         log(tag, Log.ERROR, null, messages);
//     }
// 
//     public static void e(String tag, Throwable t, Object... messages)
//     {
//         log(tag, Log.ERROR, t, messages);
//     }
// 
//     public static void log(String tag, int level, Throwable t, Object... messages)
//     {
//         if (Log.isLoggable(tag, level)) {
//             String message;
//             if (t == null && messages != null && messages.length == 1) {
//                 // Handle this common case without the extra cost of creating a StringBuffer:
//                 message = messages[0].toString();
//             } else {
//                 StringBuilder sb = new StringBuilder();
//                 if (messages != null) for (Object m : messages) {
//                     sb.append(m);
//                 }
//                 if (t != null) {
//                     sb.append("\n").append(Log.getStackTraceString(t));
//                 }
//                 message = sb.toString();
//             }
// 
//             Log.println(level, tag, message);
//         }
//     }
// }
// 
// Path: app/src/main/java/com/teocci/ytinbg/utils/Auth.java
// public static final String[] SCOPES = {YouTubeScopes.YOUTUBE};


import android.content.Context;
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.ExponentialBackOff;
import com.google.api.services.youtube.YouTube;
import com.teocci.ytinbg.R;
import com.teocci.ytinbg.utils.LogHelper;
import java.util.Arrays;
import static com.teocci.ytinbg.utils.Auth.SCOPES;
package com.teocci.ytinbg.youtube;





/**
 * Created by teocci.
 *
 * @author teocci@yandex.com on 2017-Jun-09
 */

public class YouTubeSingleton
{
    private static String TAG = LogHelper.makeLogTag(YouTubeSingleton.class);

    private static YouTube youTube;
    private static YouTube youTubeWithCredentials;
    private static GoogleAccountCredential credential;


    // Create the instance
    private static YouTubeSingleton instance = null;
    private static final Object mutex = new Object();

    public static YouTubeSingleton getInstance(Context context)
    {
        if (instance == null) {
            synchronized (mutex) {
                if (instance == null)
                    instance = new YouTubeSingleton(context);
            }
        }
        // Return the instance
        return instance;
    }

    private YouTubeSingleton(Context context)
    {
        String appName = context.getString(R.string.app_name);
        credential = GoogleAccountCredential
// Path: app/src/main/java/com/teocci/ytinbg/utils/LogHelper.java
// public class LogHelper
// {
//     private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length();
//     private static final int MAX_LOG_TAG_LENGTH = 23;
//     private static final int RESERVED_LENGTH = MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 2;
// 
//     public static String makeLogTag(String str)
//     {
//         return LOG_PREFIX
//                 + '['
//                 + (str.length() > RESERVED_LENGTH ? str.substring(0, RESERVED_LENGTH - 1) : str)
//                 + ']';
//     }
// 
//     /**
//      * Don't use this when obfuscating class names!
//      */
//     public static String makeLogTag(Class cls)
//     {
//         return makeLogTag(cls.getSimpleName());
//     }
// 
// 
//     public static void v(String tag, Object... messages)
//     {
//         // Only log VERBOSE if build type is DEBUG
//         if (BuildConfig.DEBUG) {
//             log(tag, Log.VERBOSE, null, messages);
//         }
//     }
// 
//     public static void d(String tag, Object... messages)
//     {
//         // Only log DEBUG if build type is DEBUG
//         if (BuildConfig.DEBUG) {
//             log(tag, Log.DEBUG, null, messages);
//         }
//     }
// 
//     public static void i(String tag, Object... messages)
//     {
//         log(tag, Log.INFO, null, messages);
//     }
// 
//     public static void w(String tag, Object... messages)
//     {
//         log(tag, Log.WARN, null, messages);
//     }
// 
//     public static void w(String tag, Throwable t, Object... messages)
//     {
//         log(tag, Log.WARN, t, messages);
//     }
// 
//     public static void e(String tag, Object... messages)
//     {
//         log(tag, Log.ERROR, null, messages);
//     }
// 
//     public static void e(String tag, Throwable t, Object... messages)
//     {
//         log(tag, Log.ERROR, t, messages);
//     }
// 
//     public static void log(String tag, int level, Throwable t, Object... messages)
//     {
//         if (Log.isLoggable(tag, level)) {
//             String message;
//             if (t == null && messages != null && messages.length == 1) {
//                 // Handle this common case without the extra cost of creating a StringBuffer:
//                 message = messages[0].toString();
//             } else {
//                 StringBuilder sb = new StringBuilder();
//                 if (messages != null) for (Object m : messages) {
//                     sb.append(m);
//                 }
//                 if (t != null) {
//                     sb.append("\n").append(Log.getStackTraceString(t));
//                 }
//                 message = sb.toString();
//             }
// 
//             Log.println(level, tag, message);
//         }
//     }
// }
// 
// Path: app/src/main/java/com/teocci/ytinbg/utils/Auth.java
// public static final String[] SCOPES = {YouTubeScopes.YOUTUBE};


// Path: app/src/main/java/com/teocci/ytinbg/youtube/YouTubeSingleton.java
import android.content.Context;
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.ExponentialBackOff;
import com.google.api.services.youtube.YouTube;
import com.teocci.ytinbg.R;
import com.teocci.ytinbg.utils.LogHelper;
import java.util.Arrays;
import static com.teocci.ytinbg.utils.Auth.SCOPES;

package com.teocci.ytinbg.youtube;





/**
 * Created by teocci.
 *
 * @author teocci@yandex.com on 2017-Jun-09
 */

public class YouTubeSingleton
{
    private static String TAG = LogHelper.makeLogTag(YouTubeSingleton.class);

    private static YouTube youTube;
    private static YouTube youTubeWithCredentials;
    private static GoogleAccountCredential credential;


    // Create the instance
    private static YouTubeSingleton instance = null;
    private static final Object mutex = new Object();

    public static YouTubeSingleton getInstance(Context context)
    {
        if (instance == null) {
            synchronized (mutex) {
                if (instance == null)
                    instance = new YouTubeSingleton(context);
            }
        }
        // Return the instance
        return instance;
    }

    private YouTubeSingleton(Context context)
    {
        String appName = context.getString(R.string.app_name);
        credential = GoogleAccountCredential
                .usingOAuth2(context, Arrays.asList(SCOPES))