From bac914986578620752f33a3018f36e8450b70e96 Mon Sep 17 00:00:00 2001 From: Sadique Ali Date: Sat, 20 Jul 2013 15:03:33 -0700 Subject: [PATCH] Renamed the callback handler. --- .../main/java/in/sdqali/sharewithtitle/MainActivity.java | 2 +- .../{TitleViewUpdater.java => TitleGrabCallback.java} | 2 +- .../java/in/sdqali/sharewithtitle/TitleRetriever.java | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) rename ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/{TitleViewUpdater.java => TitleGrabCallback.java} (85%) diff --git a/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/MainActivity.java b/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/MainActivity.java index 2b2e436..46f680b 100644 --- a/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/MainActivity.java +++ b/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/MainActivity.java @@ -30,7 +30,7 @@ public class MainActivity extends Activity { String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT); Log.d("Share With Title", "Received shared text: " + sharedText); - new TitleRetriever(sharedText).retrieve(new TitleViewUpdater() { + new TitleRetriever(sharedText).retrieve(new TitleGrabCallback() { @Override public void update(String title) { textView.setText(title); diff --git a/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/TitleViewUpdater.java b/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/TitleGrabCallback.java similarity index 85% rename from ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/TitleViewUpdater.java rename to ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/TitleGrabCallback.java index bb94dc3..ab33e08 100644 --- a/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/TitleViewUpdater.java +++ b/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/TitleGrabCallback.java @@ -3,7 +3,7 @@ package in.sdqali.sharewithtitle; /** * Created by sdqali on 7/20/13. */ -public interface TitleViewUpdater { +public interface TitleGrabCallback { public void update(String title); public void showProgress(); public void finish(); diff --git a/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/TitleRetriever.java b/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/TitleRetriever.java index 282d237..0a1b708 100644 --- a/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/TitleRetriever.java +++ b/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/TitleRetriever.java @@ -1,11 +1,8 @@ package in.sdqali.sharewithtitle; -import android.content.Context; import android.os.AsyncTask; import android.util.Log; import android.webkit.URLUtil; -import android.widget.TextView; -import android.widget.Toast; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -20,7 +17,7 @@ public class TitleRetriever { this.urlText = url; } - public void retrieve(TitleViewUpdater viewUpdater) { + public void retrieve(TitleGrabCallback viewUpdater) { if(isValidUrl(urlText)) { new DownloadTaskNew(viewUpdater).execute(urlText); } else { @@ -33,10 +30,10 @@ public class TitleRetriever { } private class DownloadTaskNew extends AsyncTask { - private TitleViewUpdater viewUpdater; + private TitleGrabCallback viewUpdater; private final PageDownloader pageDownloader = new PageDownloader(); - public DownloadTaskNew(TitleViewUpdater viewUpdater) { + public DownloadTaskNew(TitleGrabCallback viewUpdater) { this.viewUpdater = viewUpdater; }