-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Word Object And Custom ArrayAdapter
- Loading branch information
1 parent
e1578cc
commit 6f9e945
Showing
21 changed files
with
443 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
app/src/main/java/com/example/android/miwok/ColorsActivity.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
app/src/main/java/com/example/android/miwok/FamilyActivity.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
app/src/main/java/com/example/android/miwok/NumbersActivity.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
app/src/main/java/com/example/android/miwok/PhrasesActivity.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
app/src/main/java/com/example/android/miwok/activity/ColorsActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* 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. | ||
*/ | ||
package com.example.android.miwok.activity; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.widget.ListView; | ||
|
||
import com.example.android.miwok.R; | ||
import com.example.android.miwok.adapter.WordAdapter; | ||
import com.example.android.miwok.model.Word; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class ColorsActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_content); | ||
|
||
// Create a list of words | ||
ArrayList<Word> words = new ArrayList<>(); | ||
words.add(new Word("red", "weṭeṭṭi", R.drawable.color_red)); | ||
words.add(new Word("mustard yellow", "chiwiiṭә", R.drawable.color_mustard_yellow)); | ||
words.add(new Word("dusty yellow", "ṭopiisә", R.drawable.color_dusty_yellow)); | ||
words.add(new Word("green", "chokokki", R.drawable.color_green)); | ||
words.add(new Word("brown", "ṭakaakki", R.drawable.color_brown)); | ||
words.add(new Word("gray", "ṭopoppi", R.drawable.color_gray)); | ||
words.add(new Word("black", "kululli", R.drawable.color_black)); | ||
words.add(new Word("white", "kelelli", R.drawable.color_white)); | ||
|
||
// Create an {@link WordAdapter}, whose data source is a list of {@link Word}s. The | ||
// adapter knows how to create list items for each item in the list. | ||
WordAdapter adapter = new WordAdapter(this, words,R.color.category_colors); | ||
|
||
// Find the {@link ListView} object in the view hierarchy of the {@link Activity}. | ||
// There should be a {@link ListView} with the view ID called list, which is declared in the | ||
// word_list.xml layout file. | ||
// Find The View That Shows The Item List For The Phrases | ||
ListView itemList = findViewById(R.id.item_list_view); | ||
itemList.setAdapter(adapter); | ||
} | ||
} |
Oops, something went wrong.