From 62c55d9b6b06b55fb940753d65d1f32c328344be Mon Sep 17 00:00:00 2001 From: omkar01 Date: Fri, 30 Apr 2021 17:50:08 +0530 Subject: [PATCH 1/4] upgrade gradle files --- app/build.gradle | 11 +++++++---- build.gradle | 2 +- gradle.properties | 2 ++ gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8fe725f6fd7..edb4240b3db 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 25 + compileSdkVersion 30 defaultConfig { applicationId "com.android.example.favoritetoys" - minSdkVersion 10 - targetSdkVersion 25 + minSdkVersion 19 + targetSdkVersion 30 versionCode 1 versionName "1.0" } @@ -19,5 +19,8 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.support:appcompat-v7:25.1.0' + implementation 'androidx.appcompat:appcompat:1.2.0' + + + } \ No newline at end of file diff --git a/build.gradle b/build.gradle index c148ec8d3f4..382785ece4f 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:4.1.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle.properties b/gradle.properties index 1d3591c8a4c..5c01bdbc2a7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,6 +12,8 @@ # Default value: -Xmx10248m -XX:MaxPermSize=256m # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +android.enableJetifier=true +android.useAndroidX=true # 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 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 98960897404..868d3e99ec4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip From 7492b16ac57d6772475d41d845d02c133a8cbe11 Mon Sep 17 00:00:00 2001 From: omkar01 Date: Fri, 30 Apr 2021 17:56:17 +0530 Subject: [PATCH 2/4] lines deleted --- app/build.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index edb4240b3db..2adf334c21b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,6 +21,4 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.2.0' - - } \ No newline at end of file From a7bb40be2ba471b44211a3a6b3c923298df6b8ba Mon Sep 17 00:00:00 2001 From: omkar01 Date: Fri, 30 Apr 2021 18:14:30 +0530 Subject: [PATCH 3/4] completed exercise 2 --- .../example/android/favoritetoys/MainActivity.java | 12 +++++++++++- app/src/main/res/layout/activity_main.xml | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/example/android/favoritetoys/MainActivity.java b/app/src/main/java/com/example/android/favoritetoys/MainActivity.java index 37a08159f35..56d864e6d5c 100644 --- a/app/src/main/java/com/example/android/favoritetoys/MainActivity.java +++ b/app/src/main/java/com/example/android/favoritetoys/MainActivity.java @@ -16,11 +16,15 @@ package com.example.android.favoritetoys; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; +//import android.support.v7.app.AppCompatActivity; public class MainActivity extends AppCompatActivity { // TODO (1) Declare a TextView variable called mToysListTextView + TextView mToysListTextView; @Override protected void onCreate(Bundle savedInstanceState) { @@ -28,9 +32,15 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); // TODO (3) Use findViewById to get a reference to the TextView from the layout + mToysListTextView = findViewById(R.id.tv_toy_names); // TODO (4) Use the static ToyBox.getToyNames method and store the names in a String array + String[] toyNames = ToyBox.getToyNames(); // TODO (5) Loop through each toy and append the name to the TextView (add \n for spacing) + for (String toyName : toyNames + ) { + mToysListTextView.append(toyName + "\n\n\n"); + } } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 7eacda3bc33..46d514db5ac 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -21,6 +21,7 @@ Date: Fri, 30 Apr 2021 18:15:25 +0530 Subject: [PATCH 4/4] completed exercise 2 --- .../main/java/com/example/android/favoritetoys/MainActivity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/example/android/favoritetoys/MainActivity.java b/app/src/main/java/com/example/android/favoritetoys/MainActivity.java index 56d864e6d5c..de3e0f7fcaa 100644 --- a/app/src/main/java/com/example/android/favoritetoys/MainActivity.java +++ b/app/src/main/java/com/example/android/favoritetoys/MainActivity.java @@ -42,5 +42,6 @@ protected void onCreate(Bundle savedInstanceState) { ) { mToysListTextView.append(toyName + "\n\n\n"); } + } } \ No newline at end of file