diff --git a/app/src/main/java/com/blankie/unshortify/ShareActivity.java b/app/src/main/java/com/blankie/unshortify/ShareActivity.java index 181241b..d9a1da4 100644 --- a/app/src/main/java/com/blankie/unshortify/ShareActivity.java +++ b/app/src/main/java/com/blankie/unshortify/ShareActivity.java @@ -6,12 +6,23 @@ import android.widget.Toast; import android.content.Intent; import android.content.ActivityNotFoundException; import android.net.Uri; +import android.util.Log; import com.blankie.unshortify.R; public class ShareActivity extends Activity { public static final String TAG = "unshortify"; + private void logVariable(final String name, final String value) { + String msg = name + " = "; + if (value != null) { + msg += "[" + value + "]"; + } else { + msg += "null"; + } + Log.d(TAG, msg); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -19,6 +30,7 @@ public class ShareActivity extends Activity { try { final Intent intent = getIntent(); final String urlString = intent.getStringExtra(Intent.EXTRA_TEXT); + logVariable("urlString", urlString); if (urlString == null || urlString == "") { Toast.makeText(getApplicationContext(), R.string.empty_url, Toast.LENGTH_SHORT).show(); @@ -26,6 +38,7 @@ public class ShareActivity extends Activity { } final Uri urlParsed = Uri.parse(urlString); + logVariable("scheme", urlParsed.getScheme()); if (urlParsed.getScheme() != "http" && urlParsed.getScheme() != "https" && urlParsed.getScheme() != "") { Toast.makeText(getApplicationContext(), R.string.unknown_scheme, @@ -33,6 +46,7 @@ public class ShareActivity extends Activity { return; } + logVariable("host", urlParsed.getHost()); if (urlParsed.getHost() == null || (urlParsed.getHost() != "youtube.com" && urlParsed.getHost().endsWith(".youtube.com"))) { Toast.makeText(getApplicationContext(), R.string.non_youtube_url, @@ -40,6 +54,7 @@ public class ShareActivity extends Activity { return; } + logVariable("path", urlParsed.getPath()); if (urlParsed.getPath() == null) { Toast.makeText(getApplicationContext(), R.string.null_path, Toast.LENGTH_SHORT).show();