<commit_before>package com.microsoft.office365.demo;

import android.app.Activity;
import android.app.Application;
import android.util.Log;

import com.microsoft.adal.AuthenticationCallback;
import com.microsoft.adal.AuthenticationContext;
import com.microsoft.adal.AuthenticationResult;
import com.microsoft.office365.OfficeClient;
import com.microsoft.office365.OfficeFuture;
import com.microsoft.office365.files.FileClient;
import com.microsoft.office365.http.OAuthCredentials;

public class DemoApplication extends Application {
	public AuthenticationContext getAuthenticationContext() {
	    AuthenticationContext context = null;
	    try {
            context = new AuthenticationContext(this, Constants.AUTHORITY_URL, false);
        } catch (Exception e) {
        }
	    
	    return context;
	}

	@Override
	public void onCreate() {
		Log.d("Asset Management", "onCreate");
		super.onCreate();
	}

	public OfficeFuture<OfficeClient> getOfficeClient(final Activity activity, String resourceId) {
        final OfficeFuture<OfficeClient> future = new OfficeFuture<OfficeClient>();

        try {
            getAuthenticationContext().acquireToken(activity, resourceId,
                    Constants.CLIENT_ID, Constants.REDIRECT_URL, "",
                    new AuthenticationCallback<AuthenticationResult>() {

                        @Override
                        public void onError(Exception exc) {
                            future.triggerError(exc);
                        }

                        @Override
                        public void onSuccess(AuthenticationResult result) {
                            OAuthCredentials credentials = new OAuthCredentials(result
                                    .getAccessToken());
                            
                            OfficeClient client = new OfficeClient(credentials);
                            future.setResult(client);
                        }
                    });

        } catch (Throwable t) {
            future.triggerError(t);
        }
        return future;
    }
	
	public OfficeFuture<FileClient> getFileClient(final Activity activity, String resourceId, final String sharepointUrl) {
        final OfficeFuture<FileClient> future = new OfficeFuture<FileClient>();

        try {
            getAuthenticationContext().acquireToken(activity, resourceId,
                    Constants.CLIENT_ID, Constants.REDIRECT_URL, "",
                    new AuthenticationCallback<AuthenticationResult>() {

                        @Override
                        public void onError(Exception exc) {
                            future.triggerError(exc);
                        }

                        @Override
                        public void onSuccess(AuthenticationResult result) {
                            OAuthCredentials credentials = new OAuthCredentials(result
                                    .getAccessToken());
                            
                            FileClient client = new FileClient(sharepointUrl, "", credentials);
                            future.setResult(client);
                        }
                    });

        } catch (Throwable t) {
            future.triggerError(t);
        }
        return future;
    }
}
<commit_msg>adding comments for the discovery app<commit_after>package com.microsoft.office365.demo;

import android.app.Activity;
import android.app.Application;
import android.util.Log;

import com.microsoft.adal.AuthenticationCallback;
import com.microsoft.adal.AuthenticationContext;
import com.microsoft.adal.AuthenticationResult;
import com.microsoft.office365.OfficeClient;
import com.microsoft.office365.OfficeFuture;
import com.microsoft.office365.files.FileClient;
import com.microsoft.office365.http.OAuthCredentials;

public class DemoApplication extends Application {
	public AuthenticationContext getAuthenticationContext() {
	    AuthenticationContext context = null;
	    try {
            context = new AuthenticationContext(this, Constants.AUTHORITY_URL, false);
        } catch (Exception e) {
        }
	    
	    return context;
	}

	@Override
	public void onCreate() {
		Log.d("Asset Management", "onCreate");
		super.onCreate();
	}

	public OfficeFuture<OfficeClient> getOfficeClient(final Activity activity, String resourceId) {
        final OfficeFuture<OfficeClient> future = new OfficeFuture<OfficeClient>();

        try {
        	//here we get the token using ADAL Library
            getAuthenticationContext().acquireToken(activity, resourceId,
                    Constants.CLIENT_ID, Constants.REDIRECT_URL, "",
                    new AuthenticationCallback<AuthenticationResult>() {

                        @Override
                        public void onError(Exception exc) {
                            future.triggerError(exc);
                        }

                        @Override
                        public void onSuccess(AuthenticationResult result) {
                        	//once succedded we create a credentials instance using the token from ADAL
                            OAuthCredentials credentials = new OAuthCredentials(result
                                    .getAccessToken());
                            
                            //retrieve the OfficeClient with the credentials
                            OfficeClient client = new OfficeClient(credentials);
                            future.setResult(client);
                        }
                    });

        } catch (Throwable t) {
            future.triggerError(t);
        }
        return future;
    }
	
	public OfficeFuture<FileClient> getFileClient(final Activity activity, String resourceId, final String sharepointUrl) {
        final OfficeFuture<FileClient> future = new OfficeFuture<FileClient>();

        try {
            getAuthenticationContext().acquireToken(activity, resourceId,
                    Constants.CLIENT_ID, Constants.REDIRECT_URL, "",
                    new AuthenticationCallback<AuthenticationResult>() {

                        @Override
                        public void onError(Exception exc) {
                            future.triggerError(exc);
                        }

                        @Override
                        public void onSuccess(AuthenticationResult result) {
                            OAuthCredentials credentials = new OAuthCredentials(result
                                    .getAccessToken());
                            
                            FileClient client = new FileClient(sharepointUrl, "", credentials);
                            future.setResult(client);
                        }
                    });

        } catch (Throwable t) {
            future.triggerError(t);
        }
        return future;
    }
}

{'fraction_non_alphanumeric': 0.07015542563810068, 'fraction_numerical': 0.004277769855981748, 'mean_word_length': 1.5872371818517153, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5015467', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1460, 'n_words': 327}