This repository has been archived by the owner on Jun 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
cezannec
authored and
Asser
committed
Apr 14, 2017
1 parent
4f4bcaa
commit b32773d
Showing
43 changed files
with
252 additions
and
31 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
13 changes: 0 additions & 13 deletions
13
app/src/main/java/com/example/android/android_me/MainActivity.java
This file was deleted.
Oops, something went wrong.
100 changes: 100 additions & 0 deletions
100
app/src/main/java/com/example/android/android_me/data/AndroidImageAssets.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,100 @@ | ||
/* | ||
* Copyright (C) 2017 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.android_me.data; | ||
|
||
import com.example.android.android_me.R; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
// Class for storing all the image drawable resources in ArrayLists | ||
public class AndroidImageAssets { | ||
|
||
// Lists for all AndroidMe images | ||
// Broken down into heads, bodies, legs, and all images | ||
|
||
private static final List<Integer> heads = new ArrayList<Integer>() {{ | ||
add(R.drawable.head1); | ||
add(R.drawable.head2); | ||
add(R.drawable.head3); | ||
add(R.drawable.head4); | ||
add(R.drawable.head5); | ||
add(R.drawable.head6); | ||
add(R.drawable.head7); | ||
add(R.drawable.head8); | ||
add(R.drawable.head9); | ||
add(R.drawable.head10); | ||
add(R.drawable.head11); | ||
add(R.drawable.head12); | ||
}}; | ||
|
||
private static final List<Integer> bodies = new ArrayList<Integer>() {{ | ||
add(R.drawable.body1); | ||
add(R.drawable.body2); | ||
add(R.drawable.body3); | ||
add(R.drawable.body4); | ||
add(R.drawable.body5); | ||
add(R.drawable.body6); | ||
add(R.drawable.body7); | ||
add(R.drawable.body8); | ||
add(R.drawable.body9); | ||
add(R.drawable.body10); | ||
add(R.drawable.body11); | ||
add(R.drawable.body12); | ||
}}; | ||
|
||
private static final List<Integer> legs = new ArrayList<Integer>() {{ | ||
add(R.drawable.legs1); | ||
add(R.drawable.legs2); | ||
add(R.drawable.legs3); | ||
add(R.drawable.legs4); | ||
add(R.drawable.legs5); | ||
add(R.drawable.legs6); | ||
add(R.drawable.legs7); | ||
add(R.drawable.legs8); | ||
add(R.drawable.legs9); | ||
add(R.drawable.legs10); | ||
add(R.drawable.legs11); | ||
add(R.drawable.legs12); | ||
}}; | ||
|
||
private static final List<Integer> all = new ArrayList<Integer>() {{ | ||
addAll(heads); | ||
addAll(bodies); | ||
addAll(legs); | ||
}}; | ||
|
||
|
||
// Getter methods that return lists of all head images, body images, and leg images | ||
|
||
public static List<Integer> getHeads() { | ||
return heads; | ||
} | ||
|
||
public static List<Integer> getBodies() { | ||
return bodies; | ||
} | ||
|
||
public static List<Integer> getLegs() { | ||
return legs; | ||
} | ||
|
||
// Returns a list of all the images combined: heads, bodies, and legs in that order | ||
public static List<Integer> getAll() { | ||
return all; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/example/android/android_me/ui/AndroidMeActivity.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 @@ | ||
/* | ||
* Copyright (C) 2017 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.android_me.ui; | ||
|
||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
|
||
import com.example.android.android_me.R; | ||
|
||
// This activity will display a custom Android image composed of three body parts: head, body, and legs | ||
public class AndroidMeActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_android_me); | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
app/src/main/java/com/example/android/android_me/ui/MasterListAdapter.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,84 @@ | ||
/* | ||
* Copyright (C) 2017 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.android_me.ui; | ||
|
||
import android.content.Context; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.BaseAdapter; | ||
import android.widget.GridView; | ||
import android.widget.ImageView; | ||
|
||
import java.util.List; | ||
|
||
|
||
// Custom adapter class that displays a list of Android-Me images in a GridView | ||
public class MasterListAdapter extends BaseAdapter { | ||
|
||
// Keeps track of the context and list of images to display | ||
private Context mContext; | ||
private List<Integer> mImageIds; | ||
|
||
/** | ||
* Constructor method | ||
* @param imageIds The list of images to display | ||
*/ | ||
public MasterListAdapter(Context context, List<Integer> imageIds) { | ||
mContext = context; | ||
mImageIds = imageIds; | ||
} | ||
|
||
/** | ||
* Returns the number of items the adapter will display | ||
*/ | ||
@Override | ||
public int getCount() { | ||
return mImageIds.size(); | ||
} | ||
|
||
@Override | ||
public Object getItem(int i) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public long getItemId(int i) { | ||
return 0; | ||
} | ||
|
||
/** | ||
* Creates a new ImageView for each item referenced by the adapter | ||
*/ | ||
public View getView(final int position, View convertView, ViewGroup parent) { | ||
ImageView imageView; | ||
if (convertView == null) { | ||
// If the view is not recycled, this creates a new ImageView to hold an image | ||
This comment has been minimized.
Sorry, something went wrong. |
||
imageView = new ImageView(mContext); | ||
// Define the layout parameters | ||
imageView.setAdjustViewBounds(true); | ||
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); | ||
imageView.setPadding(8, 8, 8, 8); | ||
} else { | ||
imageView = (ImageView) convertView; | ||
} | ||
|
||
// Set the image resource and return the newly created ImageView | ||
imageView.setImageResource(mImageIds.get(position)); | ||
return imageView; | ||
} | ||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!--Copyright (C) 2017 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.--> | ||
|
||
<ScrollView | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context="com.example.android.android_me.ui.AndroidMeActivity"> | ||
|
||
<!-- LinearLayout for holding three Android-Me images --> | ||
<LinearLayout | ||
android:id="@+id/android_me_linear_layout" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@android:color/white" | ||
android:orientation="vertical" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
android:paddingLeft="@dimen/activity_horizontal_margin" | ||
android:paddingRight="@dimen/activity_horizontal_margin" | ||
android:paddingTop="@dimen/activity_vertical_margin"> | ||
|
||
|
||
</LinearLayout> | ||
|
||
</ScrollView> |
This file was deleted.
Oops, something went wrong.
// If the view is recycled, this creates a new ImageView to hold an image