Skip to content

Commit

Permalink
started ExpandableListViewのじっそう
Browse files Browse the repository at this point in the history
  • Loading branch information
mi-24v committed Oct 21, 2015
1 parent f3f64aa commit 2dfeb48
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 1 deletion.
21 changes: 21 additions & 0 deletions res/layout/questitem.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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"
android:orientation="vertical" >

<TextView
android:id="@+id/questText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/black" />

<RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:rating="0.0"
android:stepSize="1.0" />

</LinearLayout>
7 changes: 6 additions & 1 deletion res/values/arrays.xml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
<item>両方!</item>
</string-array>

<string-array name="quest_day1"></string-array>
<string-array name="quest_day1">
<item>おっちょこちょい</item>
<item>巫女は1位じゃなくても世界1位だと思う</item>
<item>ここには夢がちゃんとあると思う</item>
<item>やっぱりアリスのつくるブラウニーはうまいな</item>
</string-array>

<string-array name="quest_day2"></string-array>

Expand Down
Empty file modified src/com/joken/survey2015/Human.java
100755 → 100644
Empty file.
Empty file modified src/com/joken/survey2015/MainActivity.java
100755 → 100644
Empty file.
94 changes: 94 additions & 0 deletions src/com/joken/survey2015/QuestExpandableAdapter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package com.joken.survey2015;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.TextView;

public class QuestExpandableAdapter extends BaseExpandableListAdapter {
private ArrayList<ArrayList<QuestItem>> children;
private ArrayList<String> groups;
private Context context;

public QuestExpandableAdapter(Context ct) {
// TODO Auto-generated constructor stub
this.context = ct;
this.children = new ArrayList<ArrayList<QuestItem>>();
this.groups = new ArrayList<String>();
}

private View getBasicView(){
return LayoutInflater.from(context).inflate(R.layout.questitem, null);
}

@Override
public Object getChild(int arg0, int arg1) {
// TODO Auto-generated method stub
return null;
}

@Override
public long getChildId(int arg0, int arg1) {
// TODO Auto-generated method stub
return 0;
}

@Override
public View getChildView(int arg0, int arg1, boolean arg2, View arg3,
ViewGroup arg4) {
// TODO Auto-generated method stub
if(arg3 != null && arg4 != null){
return arg3;
}
View v = this.getBasicView();
TextView tv = (TextView)v.findViewById(R.id.questText);
return v;
}

@Override
public int getChildrenCount(int arg0) {
// TODO Auto-generated method stub
return 0;
}

@Override
public Object getGroup(int arg0) {
// TODO Auto-generated method stub
return null;
}

@Override
public int getGroupCount() {
// TODO Auto-generated method stub
return 0;
}

@Override
public long getGroupId(int arg0) {
// TODO Auto-generated method stub
return 0;
}

@Override
public View getGroupView(int arg0, boolean arg1, View arg2, ViewGroup arg3) {
// TODO Auto-generated method stub
return null;
}

@Override
public boolean hasStableIds() {
// TODO Auto-generated method stub
return false;
}

@Override
public boolean isChildSelectable(int arg0, int arg1) {
// TODO Auto-generated method stub
return false;
}

}
23 changes: 23 additions & 0 deletions src/com/joken/survey2015/QuestItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.joken.survey2015;

public class QuestItem {
private int questRaw;
private short questAns;

public QuestItem() {
questRaw = R.array.quest_day1;
}

public int getName(){
return this.questRaw;
}

public void setQuestAns(short ans){
this.questAns = ans;
}

public short getQuestAns(){
return this.questAns;
}

}

0 comments on commit 2dfeb48

Please sign in to comment.