// Path: WhatAndroid/src/main/java/what/whatandroid/WhatApplication.java
// public class WhatApplication extends Application {
// 
// 	//TODO: Developers put your local Gazelle install IP here instead of testing on the live site
// 	//I recommend setting up with Vagrant: https://github.com/dr4g0nnn/VagrantGazelle
// 	public static final String DEFAULT_SITE = "";
// 
// 	@Override
// 	public void onCreate() {
// 		super.onCreate();
// 
// 		initSoup(DEFAULT_SITE);
// 		if (SettingsActivity.lightThemeEnabled(getApplicationContext())) {
// 			AppCompatDelegate.setDefaultNightMode(
// 					AppCompatDelegate.MODE_NIGHT_NO);
// 		} else {
// 			AppCompatDelegate.setDefaultNightMode(
// 					AppCompatDelegate.MODE_NIGHT_YES);
// 		}
// 	}
// 
// 	/**
// 	 * Initialize MySoup so that we can start making API requests
// 	 */
// 	public void initSoup(String site) {
// 		MySoup.setSite(site, true);
// 		MySoup.setUserAgent("WhatAndroid Android");
// 	}
// 
// 	/**
// 	 * Main method for all image displaying operations
// 	 * Fail tracking is done here instead of wherever this method is called from.
// 	 */
// 
// 	public static void loadImage(Context context, final String url, final ImageView imageView, final ProgressBar spinner, final ImageLoadFailTracker failTracker, final Integer failImage) {
// 
// 		if (failTracker != null && failTracker.failed(url)) {
// 			if (spinner != null) spinner.setVisibility(View.GONE);
// 			if (failImage != null) {
// 				imageView.setImageResource(failImage);
// 			} else {
// 				imageView.setImageResource(R.drawable.no_artwork);
// 			}
// 		} else {
// 			if (spinner != null) spinner.setVisibility(View.VISIBLE);
// 			Glide.with(context)
// 					.load(url)
// 					.listener(new RequestListener<String, GlideDrawable>() {
// 						@Override
// 						public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
// 							if (spinner != null) {
// 								spinner.setVisibility(View.GONE);
// 							}
// 							if (failTracker != null) {
// 								failTracker.addFailed(url);
// 							}
// 							if (failImage != null) {
// 								imageView.setImageResource(failImage);
// 							} else {
// 								imageView.setImageResource(R.drawable.no_artwork);
// 							}
// 							return true;
// 						}
// 
// 						@Override
// 						public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
// 							if (spinner != null) {
// 								spinner.setVisibility(View.GONE);
// 							}
// //                            imageView.setImageDrawable(resource);
// 							return false;
// 						}
// 					})
// 					.into(imageView);
// 		}
// 
// 	}
// 
// }
// 
// Path: WhatAndroid/src/main/java/what/whatandroid/callbacks/OnLoggedInCallback.java
// public interface OnLoggedInCallback {
// 	/**
// 	 * Function called when the user has logged in or has been confirmed to be logged in
// 	 */
// 	public void onLoggedIn();
// }


import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v4.view.ViewPager;
import android.text.format.DateUtils;
import android.view.*;
import android.widget.*;
import api.cli.Utils;
import api.index.Index;
import api.soup.MySoup;
import api.user.Profile;
import api.user.User;
import api.user.UserProfile;
import api.user.recent.UserRecents;
import what.whatandroid.R;
import what.whatandroid.WhatApplication;
import what.whatandroid.callbacks.LoadingListener;
import what.whatandroid.callbacks.OnLoggedInCallback;
import what.whatandroid.callbacks.SetTitleCallback;
import what.whatandroid.forums.thread.ReplyDialogFragment;
import what.whatandroid.settings.SettingsActivity;
import java.util.Date;
            ft.remove(prev);
        }
        ft.addToBackStack(null);
        ReplyDialogFragment reply = ReplyDialogFragment.newInstance(messageDraft, messageSubject);
        reply.setTargetFragment(this, 0);
        reply.show(ft, "dialog");
    }

    /**
     * Update the profile fields with the information we loaded. We need to do a ton of checks here to
     * properly handle user's various paranoia configurations, which could cause us to get a null for any of the
     * fields that can be hidden. We also hide the recent snatches/uploads if the user's paranoia is high (6+).
     * When viewing our own profile we'll get all the data back but will still see our paranoia value so we need to
     * ignore the paranoia if it's our own profile
     */
    private void populateViews() {
        Profile profile = userProfile.getUser().getProfile();
        setTitle.setTitle(profile.getUsername());
        username.setText(profile.getUsername());
        userClass.setText(profile.getPersonal().getUserClass());
        Date joinDate = MySoup.parseDate(profile.getStats().getJoinedDate());
        joined.setText("Joined " + DateUtils.getRelativeTimeSpanString(joinDate.getTime(),
                new Date().getTime(), DateUtils.WEEK_IN_MILLIS));

        //We need to check all the paranoia cases that may cause a field to be missing and hide the views for it
        String avatarUrl = profile.getAvatar();
        if (!SettingsActivity.imagesEnabled(getActivity())) {
            artContainer.setVisibility(View.GONE);
        } else {
            artContainer.setVisibility(View.VISIBLE);
// Path: WhatAndroid/src/main/java/what/whatandroid/WhatApplication.java
// public class WhatApplication extends Application {
// 
// 	//TODO: Developers put your local Gazelle install IP here instead of testing on the live site
// 	//I recommend setting up with Vagrant: https://github.com/dr4g0nnn/VagrantGazelle
// 	public static final String DEFAULT_SITE = "";
// 
// 	@Override
// 	public void onCreate() {
// 		super.onCreate();
// 
// 		initSoup(DEFAULT_SITE);
// 		if (SettingsActivity.lightThemeEnabled(getApplicationContext())) {
// 			AppCompatDelegate.setDefaultNightMode(
// 					AppCompatDelegate.MODE_NIGHT_NO);
// 		} else {
// 			AppCompatDelegate.setDefaultNightMode(
// 					AppCompatDelegate.MODE_NIGHT_YES);
// 		}
// 	}
// 
// 	/**
// 	 * Initialize MySoup so that we can start making API requests
// 	 */
// 	public void initSoup(String site) {
// 		MySoup.setSite(site, true);
// 		MySoup.setUserAgent("WhatAndroid Android");
// 	}
// 
// 	/**
// 	 * Main method for all image displaying operations
// 	 * Fail tracking is done here instead of wherever this method is called from.
// 	 */
// 
// 	public static void loadImage(Context context, final String url, final ImageView imageView, final ProgressBar spinner, final ImageLoadFailTracker failTracker, final Integer failImage) {
// 
// 		if (failTracker != null && failTracker.failed(url)) {
// 			if (spinner != null) spinner.setVisibility(View.GONE);
// 			if (failImage != null) {
// 				imageView.setImageResource(failImage);
// 			} else {
// 				imageView.setImageResource(R.drawable.no_artwork);
// 			}
// 		} else {
// 			if (spinner != null) spinner.setVisibility(View.VISIBLE);
// 			Glide.with(context)
// 					.load(url)
// 					.listener(new RequestListener<String, GlideDrawable>() {
// 						@Override
// 						public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
// 							if (spinner != null) {
// 								spinner.setVisibility(View.GONE);
// 							}
// 							if (failTracker != null) {
// 								failTracker.addFailed(url);
// 							}
// 							if (failImage != null) {
// 								imageView.setImageResource(failImage);
// 							} else {
// 								imageView.setImageResource(R.drawable.no_artwork);
// 							}
// 							return true;
// 						}
// 
// 						@Override
// 						public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
// 							if (spinner != null) {
// 								spinner.setVisibility(View.GONE);
// 							}
// //                            imageView.setImageDrawable(resource);
// 							return false;
// 						}
// 					})
// 					.into(imageView);
// 		}
// 
// 	}
// 
// }
// 
// Path: WhatAndroid/src/main/java/what/whatandroid/callbacks/OnLoggedInCallback.java
// public interface OnLoggedInCallback {
// 	/**
// 	 * Function called when the user has logged in or has been confirmed to be logged in
// 	 */
// 	public void onLoggedIn();
// }


// Path: WhatAndroid/src/main/java/what/whatandroid/profile/ProfileFragment.java
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v4.view.ViewPager;
import android.text.format.DateUtils;
import android.view.*;
import android.widget.*;
import api.cli.Utils;
import api.index.Index;
import api.soup.MySoup;
import api.user.Profile;
import api.user.User;
import api.user.UserProfile;
import api.user.recent.UserRecents;
import what.whatandroid.R;
import what.whatandroid.WhatApplication;
import what.whatandroid.callbacks.LoadingListener;
import what.whatandroid.callbacks.OnLoggedInCallback;
import what.whatandroid.callbacks.SetTitleCallback;
import what.whatandroid.forums.thread.ReplyDialogFragment;
import what.whatandroid.settings.SettingsActivity;
import java.util.Date;

            ft.remove(prev);
        }
        ft.addToBackStack(null);
        ReplyDialogFragment reply = ReplyDialogFragment.newInstance(messageDraft, messageSubject);
        reply.setTargetFragment(this, 0);
        reply.show(ft, "dialog");
    }

    /**
     * Update the profile fields with the information we loaded. We need to do a ton of checks here to
     * properly handle user's various paranoia configurations, which could cause us to get a null for any of the
     * fields that can be hidden. We also hide the recent snatches/uploads if the user's paranoia is high (6+).
     * When viewing our own profile we'll get all the data back but will still see our paranoia value so we need to
     * ignore the paranoia if it's our own profile
     */
    private void populateViews() {
        Profile profile = userProfile.getUser().getProfile();
        setTitle.setTitle(profile.getUsername());
        username.setText(profile.getUsername());
        userClass.setText(profile.getPersonal().getUserClass());
        Date joinDate = MySoup.parseDate(profile.getStats().getJoinedDate());
        joined.setText("Joined " + DateUtils.getRelativeTimeSpanString(joinDate.getTime(),
                new Date().getTime(), DateUtils.WEEK_IN_MILLIS));

        //We need to check all the paranoia cases that may cause a field to be missing and hide the views for it
        String avatarUrl = profile.getAvatar();
        if (!SettingsActivity.imagesEnabled(getActivity())) {
            artContainer.setVisibility(View.GONE);
        } else {
            artContainer.setVisibility(View.VISIBLE);
            WhatApplication.loadImage(getActivity(), avatarUrl, avatar, spinner, null, null);