Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Check #257

Open
wants to merge 2 commits into
base: Starter-code
Choose a base branch
from
Open

Check #257

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
Expand Down
52 changes: 36 additions & 16 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.miwok">

Expand All @@ -22,7 +8,41 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity" android:exported="true">
<activity
android:name=".PhrasesActivity"
android:exported="false"
android:label="Phrases">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".ColorsActivity"
android:exported="false"
android:label="Colors">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".FamilyActivity"
android:exported="false"
android:label="Family">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:label="Numbers"
android:name=".NumbersActivity"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -31,4 +51,4 @@
</activity>
</application>

</manifest>
</manifest>
14 changes: 14 additions & 0 deletions app/src/main/java/com/example/android/miwok/ColorsActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.android.miwok;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class ColorsActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_colors);
}
}
14 changes: 14 additions & 0 deletions app/src/main/java/com/example/android/miwok/FamilyActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.android.miwok;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class FamilyActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_family);
}
}
34 changes: 34 additions & 0 deletions app/src/main/java/com/example/android/miwok/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
*/
package com.example.android.miwok;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
// import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;

Expand All @@ -27,5 +30,36 @@ protected void onCreate(Bundle savedInstanceState) {

// Set the content of the activity to use the activity_main.xml layout file
setContentView(R.layout.activity_main);
// Find the View that shows the numbers category
TextView numbers = (TextView) findViewById(R.id.numbers);

// Set a click listener on that View
numbers.setOnClickListener(new View.OnClickListener() {
// The code in this method will be executed when the numbers View is clicked on.
@Override
public void onClick(View view) {
Intent numbersIntent = new Intent(MainActivity.this, NumbersActivity.class);
startActivity(numbersIntent);
}
});
}
;

public void openNumbersList(View view){
Intent i = new Intent(this,NumbersActivity.class);
startActivity(i);
}

public void openColorsList(View view){
Intent i = new Intent(this,ColorsActivity.class);
startActivity(i);
}
public void openFamilyList(View view){
Intent i = new Intent(this,FamilyActivity.class);
startActivity(i);
}
public void openPhrasesList(View view){
Intent i = new Intent(this,PhrasesActivity.class);
startActivity(i);
}
}
40 changes: 40 additions & 0 deletions app/src/main/java/com/example/android/miwok/NumbersActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.example.android.miwok;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;

public class NumbersActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_numbers);
ArrayList<Word> words = new ArrayList<Word>();

//words.add one
words.add(new Word());


ArrayAdapter<Word> itemsAdapter = new ArrayAdapter<Word>(this,R.layout.list_item, words);

ListView listView = (ListView) findViewById(R.id.list);

listView.setAdapter(itemsAdapter);





}


}

14 changes: 14 additions & 0 deletions app/src/main/java/com/example/android/miwok/PhrasesActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.android.miwok;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class PhrasesActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_phrases);
}
}
65 changes: 65 additions & 0 deletions app/src/main/java/com/example/android/miwok/TextView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package com.example.android.miwok;

import android.content.Context;
import android.view.View;

/**
* Displays text to the user.
*/
public class TextView extends View {

// String value
private String mText;

// Text color of the text
private int mTextColor;

// Context of the app
private Context mContext;

/**
* Constructs a new TextView with initial values for text and text color.
*/
public TextView(Context context) {
super(context);
mText = "";
mTextColor = 0;
mContext = context;
}

/**
* Sets the string value in the TextView.
*
* @param text is the updated string to be displayed.
*/
public void setText(String text) {
mText = text;
}

/**
* Sets the text color of the TextView.
*
* @param color of text to be displayed.
*/
public void setTextColor(int color) {
mTextColor = color;
}

/**
* Gets the string value in the TextView.
*
* @return current text in the TextView.
*/
public String getText() {
return mText;
}

/**
* Gets the text color of the TextView.
*
* @return current text color.
*/
public int getTextColor() {
return mTextColor;
}
}
4 changes: 4 additions & 0 deletions app/src/main/java/com/example/android/miwok/Word.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.example.android.miwok;

public class Word {
}
9 changes: 9 additions & 0 deletions app/src/main/res/layout/activity_colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ColorsActivity">

</androidx.constraintlayout.widget.ConstraintLayout>
9 changes: 9 additions & 0 deletions app/src/main/res/layout/activity_family.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FamilyActivity">

</androidx.constraintlayout.widget.ConstraintLayout>
14 changes: 10 additions & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,30 @@
android:id="@+id/numbers"
style="@style/CategoryStyle"
android:background="@color/category_numbers"
android:text="@string/category_numbers" />
android:text="@string/category_numbers"
android:onClick="openNumbersList"/>

<TextView
android:id="@+id/family"
style="@style/CategoryStyle"
android:background="@color/category_family"
android:text="@string/category_family" />
android:text="@string/category_family"
android:onClick="openFamilyList"
/>

<TextView
android:id="@+id/colors"
style="@style/CategoryStyle"
android:background="@color/category_colors"
android:text="@string/category_colors" />
android:text="@string/category_colors"
android:onClick="openColorsList"/>

<TextView
android:id="@+id/phrases"
style="@style/CategoryStyle"
android:background="@color/category_phrases"
android:text="@string/category_phrases" />
android:text="@string/category_phrases"
android:onClick="openPhrasesList"
/>

</LinearLayout>
12 changes: 12 additions & 0 deletions app/src/main/res/layout/activity_numbers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/list"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.android.miwok.NumbersActivity"/>
9 changes: 9 additions & 0 deletions app/src/main/res/layout/activity_phrases.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".PhrasesActivity">

</androidx.constraintlayout.widget.ConstraintLayout>
6 changes: 6 additions & 0 deletions app/src/main/res/layout/list_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

</LinearLayout>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.0'
classpath 'com.android.tools.build:gradle:7.3.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip