diff --git a/.gitignore b/.gitignore
index 796b96d..603b140 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,14 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
/build
+/captures
+.externalNativeBuild
+.cxx
diff --git a/.gradle/6.1.1/fileChanges/last-build.bin b/.gradle/6.1.1/fileChanges/last-build.bin
new file mode 100644
index 0000000..f76dd23
Binary files /dev/null and b/.gradle/6.1.1/fileChanges/last-build.bin differ
diff --git a/.gradle/6.1.1/fileHashes/fileHashes.lock b/.gradle/6.1.1/fileHashes/fileHashes.lock
new file mode 100644
index 0000000..738d430
Binary files /dev/null and b/.gradle/6.1.1/fileHashes/fileHashes.lock differ
diff --git a/.gradle/6.1.1/gc.properties b/.gradle/6.1.1/gc.properties
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/.gitignore b/.idea/.gitignore
index 0e40fe8..5c98b42 100644
--- a/.idea/.gitignore
+++ b/.idea/.gitignore
@@ -1,3 +1,2 @@
-
# Default ignored files
/workspace.xml
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..ac6b0ae
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..a5f05cd
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..37a7509
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..0232076
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,34 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 30
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.paulbsd.myip"
+ minSdkVersion 19
+ targetSdkVersion 30
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: "libs", include: ["*.jar"])
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
+ implementation 'com.google.android.material:material:1.0.0'
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..2c2d434
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+ >>>>>> 64e9f08dbcd4adcd0791cbe73337bd2b3822ecce:app/src/main/AndroidManifest.xml
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme.NoActionBar">
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/paulbsd/myip/MainActivity.java b/app/src/main/java/com/paulbsd/myip/MainActivity.java
new file mode 100644
index 0000000..d94879a
--- /dev/null
+++ b/app/src/main/java/com/paulbsd/myip/MainActivity.java
@@ -0,0 +1,98 @@
+package com.paulbsd;
+
+import android.os.Build;
+import android.os.Bundle;
+import android.os.StrictMode;
+<<<<<<< HEAD:paulbsdmyip/src/com/paulbsd/main.java
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+=======
+import android.widget.Toolbar;
+>>>>>>> 64e9f08dbcd4adcd0791cbe73337bd2b3822ecce:app/src/main/java/com/paulbsd/myip/MainActivity.java
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+
+import androidx.annotation.RequiresApi;
+import androidx.appcompat.app.AppCompatActivity;
+
+public class MainActivity extends AppCompatActivity {
+
+ String url = "https://ipinfo.io/json";
+
+ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
+ StrictMode.setThreadPolicy(policy);
+
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+
+ final TextView public_ip = (TextView) findViewById(R.id.PublicIP);
+ final TextView hostname = (TextView) findViewById(R.id.Hostname);
+ final TextView city = (TextView) findViewById(R.id.City);
+ final TextView org = (TextView) findViewById(R.id.Org);
+
+ Button but = (Button) findViewById(R.id.but);
+
+<<<<<<< HEAD:paulbsdmyip/src/com/paulbsd/main.java
+ this.updateIpInfo(publicip, hostname, city, org);
+=======
+ this.updateIpInfo(public_ip,hostname,city,org);
+>>>>>>> 64e9f08dbcd4adcd0791cbe73337bd2b3822ecce:app/src/main/java/com/paulbsd/myip/MainActivity.java
+
+ but.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+<<<<<<< HEAD:paulbsdmyip/src/com/paulbsd/main.java
+ updateIpInfo(publicip, hostname, city, org);
+=======
+ updateIpInfo(public_ip,hostname,city,org);
+>>>>>>> 64e9f08dbcd4adcd0791cbe73337bd2b3822ecce:app/src/main/java/com/paulbsd/myip/MainActivity.java
+ }
+ });
+ }
+
+ private void setSupportActionBar(Toolbar toolbar) {
+ }
+
+ public void updateIpInfo(TextView public_ip, TextView hostname, TextView city, TextView org) {
+ try {
+ getIpInfo ipinfo = new getIpInfo(this.url);
+ public_ip.setText(ipinfo.getIp());
+ hostname.setText(ipinfo.getHostname());
+ city.setText(ipinfo.getCity());
+ org.setText(ipinfo.getOrg());
+ } catch (Exception e) {
+
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.menu_main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Handle action bar item clicks here. The action bar will
+ // automatically handle clicks on the Home/Up button, so long
+ // as you specify a parent activity in AndroidManifest.xml.
+ int id = item.getItemId();
+
+ //noinspection SimplifiableIfStatement
+ if (id == R.id.action_settings) {
+ return true;
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/paulbsd/myip/getIpInfo.java b/app/src/main/java/com/paulbsd/myip/getIpInfo.java
new file mode 100644
index 0000000..b2d92fa
--- /dev/null
+++ b/app/src/main/java/com/paulbsd/myip/getIpInfo.java
@@ -0,0 +1,94 @@
+package com.paulbsd;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class getIpInfo {
+
+ // Main URL
+ String url;
+
+ // IP attributes
+ private String ip = "undef";
+ private String hostname = "undef";
+ private String city = "undef";
+ private String org = "undef";
+
+ // Response
+ String resp;
+
+<<<<<<< HEAD:paulbsdmyip/src/com/paulbsd/getIpInfo.java
+ getIpInfo(String url) throws Exception {
+=======
+ public getIpInfo(String url) throws Exception
+ {
+>>>>>>> 64e9f08dbcd4adcd0791cbe73337bd2b3822ecce:app/src/main/java/com/paulbsd/myip/getIpInfo.java
+ this.url = url;
+
+ System.out.println("Initiating connection to " + this.url);
+
+ this.resp = getHTML(this.url);
+ JSONObject reader = new JSONObject(resp);
+
+ System.out.println("Terminating connection to " + this.url);
+
+ try {
+ this.ip = reader.getString("ip");
+ this.hostname = reader.getString("hostname");
+ this.city = reader.getString("city");
+ this.org = reader.getString("org");
+ } catch (JSONException jse) {
+ System.out.println(jse);
+ }
+ }
+
+ public static String getHTML(String urlToRead) throws IOException {
+ StringBuilder result = new StringBuilder();
+ URL url = new URL(urlToRead);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setRequestMethod("GET");
+ BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+ String line;
+ while ((line = rd.readLine()) != null) {
+ result.append(line);
+ }
+ rd.close();
+ return result.toString();
+ }
+
+<<<<<<< HEAD:paulbsdmyip/src/com/paulbsd/getIpInfo.java
+ String getIp() {
+ return this.ip;
+ }
+
+ String getHostname() {
+ return this.hostname;
+ }
+
+ String getCity() {
+ return this.city;
+ }
+
+ String getOrg() {
+=======
+ public String getIp()
+ {
+ return this.ip;
+ }
+
+ public String getHostname()
+ {
+ return this.hostname;
+ }
+
+ public String getCity()
+ {
+ return this.city;
+ }
+
+ public String getOrg()
+ {
+>>>>>>> 64e9f08dbcd4adcd0791cbe73337bd2b3822ecce:app/src/main/java/com/paulbsd/myip/getIpInfo.java
+ return this.org;
+ }
+}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..0d17026
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml
new file mode 100644
index 0000000..2146ea5
--- /dev/null
+++ b/app/src/main/res/layout/content_main.xml
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..d82e992
--- /dev/null
+++ b/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,10 @@
+
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml
new file mode 100644
index 0000000..2ea3a22
--- /dev/null
+++ b/app/src/main/res/values-v21/styles.xml
@@ -0,0 +1,8 @@
+
+
+
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..812cb7b
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 16dp
+ 16dp
+ 16dp
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..0d013c0
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,11 @@
+
+ PaulBSD ShowMyIP
+ Settings
+ Refresh
+ Public IP
+ https://ipinfo.io/json
+ IP
+ Host
+ City
+ Provider
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..44f664f
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..da807a2
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,24 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath "com.android.tools.build:gradle:4.0.0"
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
\ No newline at end of file
diff --git a/gradlew b/gradlew
index 9c0d6c6..b2f65b6 100644
--- a/gradlew
+++ b/gradlew
@@ -161,7 +161,10 @@ save () {
}
APP_ARGS=$(save "$@")
+<<<<<<< HEAD
+=======
+>>>>>>> 64e9f08dbcd4adcd0791cbe73337bd2b3822ecce
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
diff --git a/paulbsdmyip/src/com/paulbsd/getIpInfo.java b/paulbsdmyip/src/com/paulbsd/getIpInfo.java
index 0129ebe..e96e97a 100644
--- a/paulbsdmyip/src/com/paulbsd/getIpInfo.java
+++ b/paulbsdmyip/src/com/paulbsd/getIpInfo.java
@@ -6,7 +6,7 @@ import org.json.JSONObject;
public class getIpInfo {
// Main URL
- private String url;
+ String url;
// IP attributes
private String ip = "undef";
@@ -15,7 +15,7 @@ public class getIpInfo {
private String org = "undef";
// Response
- private String resp;
+ String resp;
getIpInfo(String url) throws Exception {
this.url = url;
@@ -37,7 +37,7 @@ public class getIpInfo {
}
}
- static String getHTML(String urlToRead) throws IOException {
+ public static String getHTML(String urlToRead) throws IOException {
StringBuilder result = new StringBuilder();
URL url = new URL(urlToRead);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
diff --git a/paulbsdmyip/src/com/paulbsd/main.java b/paulbsdmyip/src/com/paulbsd/main.java
index 66aa74a..bee659c 100644
--- a/paulbsdmyip/src/com/paulbsd/main.java
+++ b/paulbsdmyip/src/com/paulbsd/main.java
@@ -1,5 +1,6 @@
package com.paulbsd;
+import android.os.Build;
import android.os.Bundle;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
@@ -10,8 +11,14 @@ import android.view.View;
import android.widget.Button;
import android.widget.TextView;
+import androidx.annotation.RequiresApi;
+import androidx.appcompat.app.AppCompatActivity;
+
public class MainActivity extends AppCompatActivity {
+ String url = "https://ipinfo.io/json";
+
+ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -23,7 +30,7 @@ public class MainActivity extends AppCompatActivity {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
- final TextView publicip = (TextView) findViewById(R.id.PublicIP);
+ final TextView public_ip = (TextView) findViewById(R.id.PublicIP);
final TextView hostname = (TextView) findViewById(R.id.Hostname);
final TextView city = (TextView) findViewById(R.id.City);
final TextView org = (TextView) findViewById(R.id.Org);
@@ -40,10 +47,13 @@ public class MainActivity extends AppCompatActivity {
});
}
- public void updateIpInfo(TextView publicip, TextView hostname, TextView city, TextView org) {
+ private void setSupportActionBar(Toolbar toolbar) {
+ }
+
+ public void updateIpInfo(TextView public_ip, TextView hostname, TextView city, TextView org) {
try {
- getIpInfo ipinfo = new getIpInfo("https://ipinfo.io/json");
- publicip.setText(ipinfo.getIp());
+ getIpInfo ipinfo = new getIpInfo(this.url);
+ public_ip.setText(ipinfo.getIp());
hostname.setText(ipinfo.getHostname());
city.setText(ipinfo.getCity());
org.setText(ipinfo.getOrg());
@@ -73,4 +83,4 @@ public class MainActivity extends AppCompatActivity {
return super.onOptionsItemSelected(item);
}
-}
+}
\ No newline at end of file
diff --git a/paulbsdmyip/src/com/paulbsd/res/layout/content_main.xml b/paulbsdmyip/src/com/paulbsd/res/layout/content_main.xml
index 561c734..2146ea5 100644
--- a/paulbsdmyip/src/com/paulbsd/res/layout/content_main.xml
+++ b/paulbsdmyip/src/com/paulbsd/res/layout/content_main.xml
@@ -4,19 +4,20 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingBottom="@dimen/activity_vertical_margin"
+ android:background="#FFFFFF"
android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
- app:layout_behavior="@string/appbar_scrolling_view_behavior"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.paulbsd.myip.MainActivity"
tools:showIn="@layout/activity_main">
+ tools:ignore="PrivateResource">