Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified UI, updated library versions and build tool versions #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions Language/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
compileSdkVersion 26
buildToolsVersion '26.0.2'

defaultConfig {
applicationId 'com.google.cloud.android.language'
minSdkVersion 9
targetSdkVersion 25
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName '1.0'
vectorDrawables.useSupportLibrary = true
Expand All @@ -43,29 +43,27 @@ ext {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.github.Susmit-A:AndroidAceEditor:0.5.8'
// Support libraries
compile "com.android.support:design:$supportLibraryVersion"
compile "com.android.support:recyclerview-v7:$supportLibraryVersion"

compile "com.android.support:support-v4:$supportLibraryVersion"
// FlexboxLayout
compile 'com.google.android:flexbox:0.2.6'

// Dependencies for Google API Client Libraries
compile("com.google.http-client:google-http-client:$googleApiClientVersion") {
exclude module: 'httpclient'
exclude module: 'jsr305'
}
compile("com.google.api-client:google-api-client-android:$googleApiClientVersion"){
compile("com.google.api-client:google-api-client-android:$googleApiClientVersion") {
exclude module: 'httpclient'
exclude module: 'jsr305'
}
compile("com.google.apis:google-api-services-language:v1-rev386-$googleApiClientVersion") {
exclude module: 'httpclient'
exclude module: 'jsr305'
}

// Tests
testCompile 'junit:junit:4.12'
androidTestCompile('com.android.support.test:runner:0.5') {
Expand Down
10 changes: 3 additions & 7 deletions Language/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,13 @@
android:supportsRtl="true"
android:theme="@style/Theme.Language"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".MainActivity">
<activity android:name=".MainActivity" android:theme="@style/ResultsActivityTheme"/>

<activity android:name=".EditorActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
</intent-filter>
</activity>
</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.services.language.v1.CloudNaturalLanguageScopes;

import android.support.v4.content.AsyncTaskLoader;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.v4.content.AsyncTaskLoader;
import android.util.Log;

import java.io.IOException;
Expand Down Expand Up @@ -67,7 +67,7 @@ public String loadInBackground() {
// of this client app. You should never do this in your app. Instead, store the file in your
// server and obtain an access token from there.
// *******************
final InputStream stream = getContext().getResources().openRawResource(R.raw.credential);
final InputStream stream = getContext().getResources().openRawResource(R.raw.credentials);
try {
final GoogleCredential credential = GoogleCredential.fromStream(stream)
.createScoped(CloudNaturalLanguageScopes.all());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.google.cloud.android.language;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.susmit.aceeditor.AceEditor;
import com.susmit.aceeditor.OnLoadedEditorListener;
import com.susmit.aceeditor.ResultReceivedListener;

public class EditorActivity extends Activity {

FloatingActionButton analyze;
AceEditor editor;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.actuvity_main_new);

editor = findViewById(R.id.editor);

editor.setOnLoadedEditorListener(new OnLoadedEditorListener() {
@Override
public void onCreate() {
editor.setText(getResources().getString(R.string.sample_text));
}
});
editor.setResultReceivedListener(new ResultReceivedListener() {
@Override
public void onReceived(int FLAG_VALUE, String... results) {
if(FLAG_VALUE==AceEditor.Request.TEXT_REQUEST){
Intent i = new Intent(EditorActivity.this, MainActivity.class);
i.putExtra("text",results[0]);
startActivity(i);
}
}
});

analyze = findViewById(R.id.analyze);

analyze.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editor.requestText();
}
});
}

@Override
protected void onPause() {
super.onPause();
analyze.setVisibility(View.GONE);
}

@Override
protected void onResume() {
super.onResume();
analyze.setVisibility(View.VISIBLE);
}
}
Loading