package com.example.svc.activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

import com.example.svc.R;
import com.example.svc.services.DownloadService2;

public class ServicesActivity extends Activity {
    private static String TAG = "ServicesActivity";

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

        Button download1 = (Button) findViewById(R.id.downloadIS);
        download1.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                Log.v(TAG, "Thread: " + Thread.currentThread()
                        .getName());
                EditText url = (EditText) findViewById(R.id.url);
                Intent intent = new Intent();
                intent.setAction("com.example.svc.DOWNLOAD");
                intent.putExtra("Url", url.getText().toString());
                startService(intent);
            }
        });

        Button download2 = (Button) findViewById(R.id.downloadRS);
        download2.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                Log.v(TAG, "Thread: " + Thread.currentThread()
                        .getName());
                EditText url = (EditText) findViewById(R.id.url);

                Intent intent = new Intent(ServicesActivity.this,
                        DownloadService2.class);
                intent.putExtra("Url", url.getText().toString());
                startService(intent);
            }
        });
    }
}