-
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.
- Loading branch information
Matthew
committed
Nov 21, 2024
1 parent
e38df72
commit 27e925f
Showing
12 changed files
with
161 additions
and
25 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
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
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
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
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
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
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
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/example/komodohub/models/StableArrayAdapter.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,32 @@ | ||
package com.example.komodohub.models; | ||
|
||
import android.content.Context; | ||
import android.widget.ArrayAdapter; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
public class StableArrayAdapter extends ArrayAdapter<String> { | ||
|
||
HashMap<String, Integer> mIdMap = new HashMap<String, Integer>(); | ||
|
||
public StableArrayAdapter(Context context, int textViewResourceId, | ||
List<String> objects) { | ||
super(context, textViewResourceId, objects); | ||
for (int i = 0; i < objects.size(); ++i) { | ||
mIdMap.put(objects.get(i), i); | ||
} | ||
} | ||
|
||
@Override | ||
public long getItemId(int position) { | ||
String item = getItem(position); | ||
return mIdMap.get(item); | ||
} | ||
|
||
@Override | ||
public boolean hasStableIds() { | ||
return true; | ||
} | ||
|
||
} |
72 changes: 72 additions & 0 deletions
72
app/src/main/java/com/example/komodohub/placeholder/PlaceholderContent.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,72 @@ | ||
package com.example.komodohub.placeholder; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* Helper class for providing sample content for user interfaces created by | ||
* Android template wizards. | ||
* <p> | ||
* TODO: Replace all uses of this class before publishing your app. | ||
*/ | ||
public class PlaceholderContent { | ||
|
||
/** | ||
* An array of sample (placeholder) items. | ||
*/ | ||
public static final List<PlaceholderItem> ITEMS = new ArrayList<PlaceholderItem>(); | ||
|
||
/** | ||
* A map of sample (placeholder) items, by ID. | ||
*/ | ||
public static final Map<String, PlaceholderItem> ITEM_MAP = new HashMap<String, PlaceholderItem>(); | ||
|
||
private static final int COUNT = 25; | ||
|
||
static { | ||
// Add some sample items. | ||
for (int i = 1; i <= COUNT; i++) { | ||
addItem(createPlaceholderItem(i)); | ||
} | ||
} | ||
|
||
private static void addItem(PlaceholderItem item) { | ||
ITEMS.add(item); | ||
ITEM_MAP.put(item.id, item); | ||
} | ||
|
||
private static PlaceholderItem createPlaceholderItem(int position) { | ||
return new PlaceholderItem(String.valueOf(position), "Item " + position, makeDetails(position)); | ||
} | ||
|
||
private static String makeDetails(int position) { | ||
StringBuilder builder = new StringBuilder(); | ||
builder.append("Details about Item: ").append(position); | ||
for (int i = 0; i < position; i++) { | ||
builder.append("\nMore details information here."); | ||
} | ||
return builder.toString(); | ||
} | ||
|
||
/** | ||
* A placeholder item representing a piece of content. | ||
*/ | ||
public static class PlaceholderItem { | ||
public final String id; | ||
public final String content; | ||
public final String details; | ||
|
||
public PlaceholderItem(String id, String content, String details) { | ||
this.id = id; | ||
this.content = content; | ||
this.details = details; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return content; | ||
} | ||
} | ||
} |
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
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
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