diff --git a/app/build.gradle b/app/build.gradle index 8c9d674825c9f60a831b1f8cda6df2037146e233..023a2e20feec7c96e3e7294047121683015c8880 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -30,6 +30,6 @@ android { } dependencies { - testImplementation 'junit:junit:4.12' - implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'androidx.appcompat:appcompat:1.1.0-alpha01' + implementation 'androidx.core:core:1.1.0-alpha03' } diff --git a/app/src/main/java/org/xphnx/ameixa/activities/BaseActivity.java b/app/src/main/java/org/xphnx/ameixa/activities/BaseActivity.java index 50dbad6e1d8f6b624ea284018acf1107ccab5eb5..9281d37af85663d216d61fa4807e0ee13d48e08c 100644 --- a/app/src/main/java/org/xphnx/ameixa/activities/BaseActivity.java +++ b/app/src/main/java/org/xphnx/ameixa/activities/BaseActivity.java @@ -2,11 +2,12 @@ package org.xphnx.ameixa.activities; import android.os.Build; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; import android.view.WindowManager; import org.xphnx.ameixa.R; +import androidx.appcompat.app.AppCompatActivity; + public abstract class BaseActivity extends AppCompatActivity { @Override diff --git a/app/src/main/java/org/xphnx/ameixa/activities/IconActivity.java b/app/src/main/java/org/xphnx/ameixa/activities/IconActivity.java index 27f5f28172e1b5bf68e8f55f11909b09d4973d21..850dd762b7268363ccefe86c0698792b006b8cf1 100644 --- a/app/src/main/java/org/xphnx/ameixa/activities/IconActivity.java +++ b/app/src/main/java/org/xphnx/ameixa/activities/IconActivity.java @@ -6,6 +6,7 @@ import android.view.Gravity; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.LinearLayout.LayoutParams; import android.widget.ScrollView; import org.xphnx.ameixa.R; @@ -32,14 +33,14 @@ public class IconActivity extends BaseActivity { float scale = ScreenUtils.densityScale(getApplicationContext()); int margin = 16 * Math.round(scale); - LinearLayout.LayoutParams baseParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.MATCH_PARENT); - LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.WRAP_CONTENT); - LinearLayout.LayoutParams containerParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT); - LinearLayout.LayoutParams imageParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT, 1f); + LayoutParams baseParams = new LayoutParams(LayoutParams.MATCH_PARENT, + LayoutParams.MATCH_PARENT); + LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, + LayoutParams.WRAP_CONTENT); + LayoutParams containerParams = new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.WRAP_CONTENT); + LayoutParams imageParams = new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.WRAP_CONTENT, 1f); ScrollView baseScroller = new ScrollView(this); baseScroller.setLayoutParams(baseParams); diff --git a/app/src/main/java/org/xphnx/ameixa/activities/LicenseActivity.java b/app/src/main/java/org/xphnx/ameixa/activities/LicenseActivity.java index 28ad98d7f73fe00d4d939ea38321459aa0ac27ae..4046f7cdec230ab319e838b674f4c86e81b654bf 100644 --- a/app/src/main/java/org/xphnx/ameixa/activities/LicenseActivity.java +++ b/app/src/main/java/org/xphnx/ameixa/activities/LicenseActivity.java @@ -6,6 +6,7 @@ import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.widget.LinearLayout; +import android.widget.LinearLayout.LayoutParams; import android.widget.TextView; import org.xphnx.ameixa.R; @@ -20,22 +21,22 @@ public class LicenseActivity extends BaseActivity { } private void createLayout() { - LinearLayout.LayoutParams smallLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.WRAP_CONTENT, 1f); + LayoutParams smallLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, + LayoutParams.WRAP_CONTENT, 1f); float scale = ScreenUtils.densityScale(getApplicationContext()); int padding = Math.round(64 * scale); LinearLayout frameLayout = new LinearLayout(this); - frameLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.MATCH_PARENT)); + frameLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, + LayoutParams.MATCH_PARENT)); frameLayout.setBackgroundColor(0xffffffff); frameLayout.setGravity(Gravity.CENTER); setContentView(frameLayout); LinearLayout baseLayout = new LinearLayout(this); baseLayout.setOrientation(LinearLayout.VERTICAL); - baseLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.MATCH_PARENT)); + baseLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.MATCH_PARENT)); baseLayout.setGravity(Gravity.START); frameLayout.addView(baseLayout); @@ -48,8 +49,8 @@ public class LicenseActivity extends BaseActivity { LinearLayout sourceClickLayout = new LinearLayout(this); sourceClickLayout.setOrientation(LinearLayout.HORIZONTAL); - sourceClickLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT)); + sourceClickLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.WRAP_CONTENT)); sourceClickLayout.setGravity(Gravity.CENTER); sourceLayout.addView(sourceClickLayout); sourceClickLayout.setOnClickListener(this::gplLink); @@ -71,7 +72,7 @@ public class LicenseActivity extends BaseActivity { LinearLayout imgClickLayout = new LinearLayout(this); imgClickLayout.setOrientation(LinearLayout.HORIZONTAL); - imgClickLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); + imgClickLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); imgClickLayout.setGravity(Gravity.CENTER); imgLayout.addView(imgClickLayout); imgClickLayout.setOnClickListener(this::ccLink); diff --git a/app/src/main/java/org/xphnx/ameixa/activities/MainActivity.java b/app/src/main/java/org/xphnx/ameixa/activities/MainActivity.java index e31eb3aead65268b395ac547329bdd292991e038..142d6f7df191b9f1980f361cd41ae090a50f4332 100644 --- a/app/src/main/java/org/xphnx/ameixa/activities/MainActivity.java +++ b/app/src/main/java/org/xphnx/ameixa/activities/MainActivity.java @@ -4,18 +4,20 @@ import android.content.Intent; import android.graphics.drawable.BitmapDrawable; import android.net.Uri; import android.os.Bundle; -import android.support.v4.content.ContextCompat; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.LinearLayout; +import android.widget.LinearLayout.LayoutParams; import android.widget.TextView; import org.xphnx.ameixa.R; import org.xphnx.ameixa.utils.ImageUtils; import org.xphnx.ameixa.utils.ScreenUtils; +import androidx.core.content.ContextCompat; + public class MainActivity extends BaseActivity { @Override @@ -25,22 +27,22 @@ public class MainActivity extends BaseActivity { } private void createLayout() { - LinearLayout.LayoutParams smallLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.WRAP_CONTENT, 1f); + LayoutParams smallLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, + LayoutParams.WRAP_CONTENT, 1f); float scale = ScreenUtils.densityScale(getApplicationContext()); ViewGroup.LayoutParams buttonParams = new ViewGroup.LayoutParams(Math.round(48 * scale), Math.round(48 * scale)); LinearLayout frameLayout = new LinearLayout(this); - frameLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.MATCH_PARENT)); + frameLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, + LayoutParams.MATCH_PARENT)); frameLayout.setBackgroundColor(getResources().getColor(R.color.colorLight)); frameLayout.setGravity(Gravity.CENTER); setContentView(frameLayout); LinearLayout baseLayout = new LinearLayout(this); baseLayout.setOrientation(LinearLayout.VERTICAL); - baseLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.MATCH_PARENT)); + baseLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.MATCH_PARENT)); baseLayout.setGravity(Gravity.START); frameLayout.addView(baseLayout); @@ -53,8 +55,8 @@ public class MainActivity extends BaseActivity { LinearLayout iconClickLayout = new LinearLayout(this); iconClickLayout.setOrientation(LinearLayout.HORIZONTAL); - iconClickLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT)); + iconClickLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.WRAP_CONTENT)); iconClickLayout.setGravity(Gravity.CENTER); iconLayout.addView(iconClickLayout); iconClickLayout.setOnClickListener(this::iconActivity); @@ -83,8 +85,8 @@ public class MainActivity extends BaseActivity { LinearLayout sourceClickLayout = new LinearLayout(this); sourceClickLayout.setOrientation(LinearLayout.HORIZONTAL); - sourceClickLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT)); + sourceClickLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.WRAP_CONTENT)); sourceClickLayout.setGravity(Gravity.CENTER); sourceLayout.addView(sourceClickLayout); sourceClickLayout.setOnClickListener(this::gitLink); @@ -113,8 +115,8 @@ public class MainActivity extends BaseActivity { LinearLayout aboutClickLayout = new LinearLayout(this); aboutClickLayout.setOrientation(LinearLayout.HORIZONTAL); - aboutClickLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT)); + aboutClickLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.WRAP_CONTENT)); aboutClickLayout.setGravity(Gravity.CENTER); aboutLayout.addView(aboutClickLayout); aboutClickLayout.setOnClickListener(this::licenseActivity); diff --git a/app/src/main/java/org/xphnx/ameixa/utils/ImageUtils.java b/app/src/main/java/org/xphnx/ameixa/utils/ImageUtils.java index 81bd341d4d264ffe04d2718a3029db26b7d45072..70f2973ca70541c5dfe11424828336de63aaa9c2 100644 --- a/app/src/main/java/org/xphnx/ameixa/utils/ImageUtils.java +++ b/app/src/main/java/org/xphnx/ameixa/utils/ImageUtils.java @@ -3,13 +3,15 @@ package org.xphnx.ameixa.utils; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.BitmapFactory.Options; import android.graphics.drawable.Drawable; -import android.support.v4.graphics.drawable.DrawableCompat; import android.view.View; import android.widget.ImageView; import org.xphnx.ameixa.async.BitmapLoadTask; +import androidx.core.graphics.drawable.DrawableCompat; + public class ImageUtils { public static void bitmapLoadAsync(final ImageView imageView, final Resources resources, @@ -27,7 +29,7 @@ public class ImageUtils { } public static Bitmap bitmapLoad(Resources resources, int resId, int width, int height) { - BitmapFactory.Options resOptions = new BitmapFactory.Options(); + Options resOptions = new Options(); resOptions.inJustDecodeBounds = true; // load appropriately sampled bitmap from given resource diff --git a/app/src/main/java/org/xphnx/ameixa/utils/ScreenUtils.java b/app/src/main/java/org/xphnx/ameixa/utils/ScreenUtils.java index 4e3b279e51b42c40b2512f679b2821253e2949b4..729ab46f57533a6e56a41a594f8b4d6f2431a80c 100644 --- a/app/src/main/java/org/xphnx/ameixa/utils/ScreenUtils.java +++ b/app/src/main/java/org/xphnx/ameixa/utils/ScreenUtils.java @@ -17,6 +17,6 @@ public class ScreenUtils { } public static float densityScale(Context context) { - return (context.getResources().getDisplayMetrics().density); + return context.getResources().getDisplayMetrics().density; } } diff --git a/build.gradle b/build.gradle index 8e5e76e8c6a2f82d8a230200a18c2aa1696aac63..9d19e984640e6c901ac3a1b5e850da7cc7b791ee 100644 --- a/build.gradle +++ b/build.gradle @@ -2,8 +2,8 @@ buildscript { repositories { - jcenter() google() + jcenter() } dependencies { @@ -16,8 +16,8 @@ buildscript { allprojects { repositories { - jcenter() google() + jcenter() } } diff --git a/gradle.properties b/gradle.properties index 1d3591c8a4c9c29578c36c87f80c05a6aea3ee3f..915f0e66f948533c06b756c4ef9e586bb9132793 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,6 @@ # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true +android.enableJetifier=true +android.useAndroidX=true \ No newline at end of file