// Path: app/src/ee/ioc/phon/android/arvutaja/command/Command.java
// public interface Command {
// 
// 	Intent getIntent() throws CommandParseException;
// 
// 	/**
// 	 * <p>Returns a message that helps the user to resolve the situation
// 	 * where the command (intent) cannot be executed because the corresponding
// 	 * activity is not installed.</p>
// 	 *
// 	 * @return suggestion for an activity
// 	 */
// 	Uri getSuggestion();
// 
// 	String getCommand();
// 
// 	/**
// 	 * <p>Evaluates the expression and returns the result.
// 	 * This method can throw various exceptions.</p>
// 	 *
// 	 * @return evaluation of the expression that was given to the constructor
// 	 */
// 	Object getOut();
// 
// 
// 	/**
// 	 * @return resource ID of the message to show in the UI for this command.
// 	 */
// 	int getMessage();
// }
// 
// Path: app/src/ee/ioc/phon/android/arvutaja/command/CommandParseException.java
// public class CommandParseException extends Exception {
// 
// }
// 
// Path: app/src/ee/ioc/phon/android/arvutaja/command/CommandParser.java
// public class CommandParser {
// 
// 	public static Command getCommand(Context context, String command) throws CommandParseException {
// 		if (command == null) {
// 			throw new CommandParseException();
// 		}
// 
// 		// We check expressions first because some can be mistaken for URIs.
// 		if (Expr.isCommand(command))
// 			return new Expr(command);
// 
// 		// In case the command is a URI then we launch ACTION_VIEW.
// 		if (View.isCommand(command))
// 			return new View(command);
// 
// 		if (Alarm.isCommand(command))
// 			return new Alarm(command, context.getString(R.string.alarmExtraMessage));
// 
// 		if (WebSearch.isCommand(command))
// 			return new WebSearch(command);
// 
// 		if (Dial.isCommand(command))
// 			return new Dial(command);
// 
// 		if (Search.isCommand(command))
// 			return new Search(command);
// 
// 		if (Unitconv.isCommand(command))
// 			return new Unitconv(command);
// 
// 		if (Direction.isCommand(command))
// 			return new Direction(command);
// 
// 		return new DefaultCommand(command);
// 	}
// 
// }
// 
// Path: app/src/ee/ioc/phon/android/arvutaja/provider/Query.java
// public class Query {
// 
//     public static final class Columns implements BaseColumns {
// 
//         public static final Uri CONTENT_URI = Uri.parse("content://" +
//                 QueriesContentProvider.AUTHORITY +
//                 "/" +
//                 QueriesContentProvider.QUERIES_TABLE_NAME);
// 
//         public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.ee.ioc.phon.android.arvutaja";
// 
//         public static final String TIMESTAMP = "TIMESTAMP";
//         public static final String UTTERANCE = "UTTERANCE";
//         public static final String TRANSLATION = "TRANSLATION";
//         public static final String EVALUATION = "EVALUATION";
//         public static final String LANG = "LANG";
//         public static final String TARGET_LANG = "TARGET_LANG";
//         public static final String MESSAGE = "MESSAGE";
// 
//         private Columns() {
//         }
//     }
// }


import android.widget.LinearLayout;
import android.widget.TextView;
import ee.ioc.phon.android.arvutaja.command.Command;
import ee.ioc.phon.android.arvutaja.command.CommandParseException;
import ee.ioc.phon.android.arvutaja.command.CommandParser;
import ee.ioc.phon.android.arvutaja.provider.Query;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.text.format.Time;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.ImageButton;
/*
 * Copyright 2013, Institute of Cybernetics at Tallinn University of Technology
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ee.ioc.phon.android.arvutaja;


/**
 * Shows the full DB record:
 *
 * TIMESTAMP
 * UTTERANCE
 * LANG
 * TRANSLATION (linearization), possibly missing
 * EVALUATION, possibly missing
 * TARGET_LANG
 * VIEW (show which external evaluator would be used, support clicking on it)
 * MESSAGE (show error message if present)
 */
public class ShowActivity extends AbstractRecognizerActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.show);

		final Uri contentUri = getIntent().getData();

		ImageButton bDelete = (ImageButton) findViewById(R.id.bDelete);
		bDelete.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				getContentResolver().delete(contentUri, null, null);
				finish();
			}});

		TextView tvMessage = (TextView) findViewById(R.id.tvMessage);
		try {
			Cursor c = getContentResolver().query(contentUri, null, null, null, null);

			if (c.moveToFirst()) {
				// Column names are the same for Query and Qeval

				// Timestamp
// Path: app/src/ee/ioc/phon/android/arvutaja/command/Command.java
// public interface Command {
// 
// 	Intent getIntent() throws CommandParseException;
// 
// 	/**
// 	 * <p>Returns a message that helps the user to resolve the situation
// 	 * where the command (intent) cannot be executed because the corresponding
// 	 * activity is not installed.</p>
// 	 *
// 	 * @return suggestion for an activity
// 	 */
// 	Uri getSuggestion();
// 
// 	String getCommand();
// 
// 	/**
// 	 * <p>Evaluates the expression and returns the result.
// 	 * This method can throw various exceptions.</p>
// 	 *
// 	 * @return evaluation of the expression that was given to the constructor
// 	 */
// 	Object getOut();
// 
// 
// 	/**
// 	 * @return resource ID of the message to show in the UI for this command.
// 	 */
// 	int getMessage();
// }
// 
// Path: app/src/ee/ioc/phon/android/arvutaja/command/CommandParseException.java
// public class CommandParseException extends Exception {
// 
// }
// 
// Path: app/src/ee/ioc/phon/android/arvutaja/command/CommandParser.java
// public class CommandParser {
// 
// 	public static Command getCommand(Context context, String command) throws CommandParseException {
// 		if (command == null) {
// 			throw new CommandParseException();
// 		}
// 
// 		// We check expressions first because some can be mistaken for URIs.
// 		if (Expr.isCommand(command))
// 			return new Expr(command);
// 
// 		// In case the command is a URI then we launch ACTION_VIEW.
// 		if (View.isCommand(command))
// 			return new View(command);
// 
// 		if (Alarm.isCommand(command))
// 			return new Alarm(command, context.getString(R.string.alarmExtraMessage));
// 
// 		if (WebSearch.isCommand(command))
// 			return new WebSearch(command);
// 
// 		if (Dial.isCommand(command))
// 			return new Dial(command);
// 
// 		if (Search.isCommand(command))
// 			return new Search(command);
// 
// 		if (Unitconv.isCommand(command))
// 			return new Unitconv(command);
// 
// 		if (Direction.isCommand(command))
// 			return new Direction(command);
// 
// 		return new DefaultCommand(command);
// 	}
// 
// }
// 
// Path: app/src/ee/ioc/phon/android/arvutaja/provider/Query.java
// public class Query {
// 
//     public static final class Columns implements BaseColumns {
// 
//         public static final Uri CONTENT_URI = Uri.parse("content://" +
//                 QueriesContentProvider.AUTHORITY +
//                 "/" +
//                 QueriesContentProvider.QUERIES_TABLE_NAME);
// 
//         public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.ee.ioc.phon.android.arvutaja";
// 
//         public static final String TIMESTAMP = "TIMESTAMP";
//         public static final String UTTERANCE = "UTTERANCE";
//         public static final String TRANSLATION = "TRANSLATION";
//         public static final String EVALUATION = "EVALUATION";
//         public static final String LANG = "LANG";
//         public static final String TARGET_LANG = "TARGET_LANG";
//         public static final String MESSAGE = "MESSAGE";
// 
//         private Columns() {
//         }
//     }
// }


// Path: app/src/ee/ioc/phon/android/arvutaja/ShowActivity.java
import android.widget.LinearLayout;
import android.widget.TextView;
import ee.ioc.phon.android.arvutaja.command.Command;
import ee.ioc.phon.android.arvutaja.command.CommandParseException;
import ee.ioc.phon.android.arvutaja.command.CommandParser;
import ee.ioc.phon.android.arvutaja.provider.Query;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.text.format.Time;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.ImageButton;

/*
 * Copyright 2013, Institute of Cybernetics at Tallinn University of Technology
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ee.ioc.phon.android.arvutaja;


/**
 * Shows the full DB record:
 *
 * TIMESTAMP
 * UTTERANCE
 * LANG
 * TRANSLATION (linearization), possibly missing
 * EVALUATION, possibly missing
 * TARGET_LANG
 * VIEW (show which external evaluator would be used, support clicking on it)
 * MESSAGE (show error message if present)
 */
public class ShowActivity extends AbstractRecognizerActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.show);

		final Uri contentUri = getIntent().getData();

		ImageButton bDelete = (ImageButton) findViewById(R.id.bDelete);
		bDelete.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				getContentResolver().delete(contentUri, null, null);
				finish();
			}});

		TextView tvMessage = (TextView) findViewById(R.id.tvMessage);
		try {
			Cursor c = getContentResolver().query(contentUri, null, null, null, null);

			if (c.moveToFirst()) {
				// Column names are the same for Query and Qeval

				// Timestamp
				long timestamp = c.getLong(c.getColumnIndex(Query.Columns.TIMESTAMP));