-
Notifications
You must be signed in to change notification settings - Fork 7
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
Showing
17 changed files
with
696 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# MaterialDesignColors | ||
An Android library which provides Google Material Design Colors | ||
Android library which provides [Google Material Design Colors](https://material.io/guidelines/style/color.html) | ||
|
||
|
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
36 changes: 36 additions & 0 deletions
36
app/src/main/java/com/github/bassaer/materialdesigncolors/ColorEntry.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 |
---|---|---|
@@ -1,7 +1,43 @@ | ||
package com.github.bassaer.materialdesigncolors; | ||
|
||
/** | ||
* Color label data | ||
* Created by nakayama on 2017/02/19. | ||
*/ | ||
public class ColorEntry { | ||
/** | ||
* Name of color | ||
*/ | ||
private String mLabel; | ||
|
||
/** | ||
* Color value | ||
*/ | ||
private int color; | ||
|
||
/** | ||
* Constructor | ||
* @param label Name of color | ||
* @param color Color value | ||
*/ | ||
public ColorEntry(String label, int color) { | ||
mLabel = label; | ||
this.color = color; | ||
} | ||
|
||
public String getLabel() { | ||
return mLabel; | ||
} | ||
|
||
public void setLabel(String label) { | ||
mLabel = label; | ||
} | ||
|
||
public int getColor() { | ||
return color; | ||
} | ||
|
||
public void setColor(int color) { | ||
this.color = color; | ||
} | ||
} |
42 changes: 41 additions & 1 deletion
42
app/src/main/java/com/github/bassaer/materialdesigncolors/ColorListAdapter.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 |
---|---|---|
@@ -1,7 +1,47 @@ | ||
package com.github.bassaer.materialdesigncolors; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ArrayAdapter; | ||
import android.widget.TextView; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* List adapter for color list view | ||
* Created by nakayama on 2017/02/19. | ||
*/ | ||
public class ColorListAdapter { | ||
public class ColorListAdapter extends ArrayAdapter<ColorEntry> { | ||
private LayoutInflater mLayoutInflater; | ||
|
||
public ColorListAdapter(Context context, int resource, List<ColorEntry> objects) { | ||
super(context, resource, objects); | ||
mLayoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); | ||
} | ||
|
||
@Override | ||
public View getView(int position, View convertView, ViewGroup parent) { | ||
ViewHolder holder; | ||
if (convertView == null) { | ||
convertView = mLayoutInflater.inflate(R.layout.color_row, null); | ||
holder = new ViewHolder(); | ||
holder.colorLabel = (TextView)convertView.findViewById(R.id.color_row_label); | ||
convertView.setTag(holder); | ||
} else { | ||
holder = (ViewHolder) convertView.getTag(); | ||
} | ||
ColorEntry colorEntry = getItem(position); | ||
holder.colorLabel.setText(colorEntry.getLabel()); | ||
holder.colorLabel.setBackgroundColor(colorEntry.getColor()); | ||
|
||
return convertView; | ||
} | ||
|
||
class ViewHolder { | ||
TextView colorLabel; | ||
} | ||
|
||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,66 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
<TableRow xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
</LinearLayout> | ||
<View | ||
android:id="@+id/table_row_10_50" | ||
android:layout_height="@dimen/cell_height" | ||
android:layout_width="0dp" | ||
android:layout_weight="1"/> | ||
|
||
<View | ||
android:id="@+id/table_row_10_100" | ||
android:layout_height="@dimen/cell_height" | ||
android:layout_width="0dp" | ||
android:layout_weight="1"/> | ||
|
||
<View | ||
android:id="@+id/table_row_10_200" | ||
android:layout_height="@dimen/cell_height" | ||
android:layout_width="0dp" | ||
android:layout_weight="1"/> | ||
|
||
<View | ||
android:id="@+id/table_row_10_300" | ||
android:layout_height="@dimen/cell_height" | ||
android:layout_width="0dp" | ||
android:layout_weight="1"/> | ||
|
||
<View | ||
android:id="@+id/table_row_10_400" | ||
android:layout_height="@dimen/cell_height" | ||
android:layout_width="0dp" | ||
android:layout_weight="1"/> | ||
|
||
<View | ||
android:id="@+id/table_row_10_500" | ||
android:layout_height="@dimen/cell_height" | ||
android:layout_width="0dp" | ||
android:layout_weight="1"/> | ||
|
||
<View | ||
android:id="@+id/table_row_10_600" | ||
android:layout_height="@dimen/cell_height" | ||
android:layout_width="0dp" | ||
android:layout_weight="1"/> | ||
|
||
<View | ||
android:id="@+id/table_row_10_700" | ||
android:layout_height="@dimen/cell_height" | ||
android:layout_width="0dp" | ||
android:layout_weight="1"/> | ||
|
||
<View | ||
android:id="@+id/table_row_10_800" | ||
android:layout_height="@dimen/cell_height" | ||
android:layout_width="0dp" | ||
android:layout_weight="1"/> | ||
|
||
<View | ||
android:id="@+id/table_row_10_900" | ||
android:layout_height="@dimen/cell_height" | ||
android:layout_width="0dp" | ||
android:layout_weight="1"/> | ||
|
||
</TableRow> |
Oops, something went wrong.