Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
BIDL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Christof Wolke
BIDL
Commits
8ccf1040
Commit
8ccf1040
authored
Sep 07, 2016
by
Christof Wolke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feedback view
parent
cc9f90b9
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
206 additions
and
33 deletions
+206
-33
BIDL/BIDL/app/src/main/AndroidManifest.xml
BIDL/BIDL/app/src/main/AndroidManifest.xml
+1
-1
BIDL/BIDL/app/src/main/java/classes/apps/Feedback/Answer.java
.../BIDL/app/src/main/java/classes/apps/Feedback/Answer.java
+8
-18
BIDL/BIDL/app/src/main/java/classes/apps/Feedback/Question.java
...IDL/app/src/main/java/classes/apps/Feedback/Question.java
+4
-3
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/member_view/FeedbackActivity.java
...a/de/uni_oldenburg/bidl/member_view/FeedbackActivity.java
+99
-3
BIDL/BIDL/app/src/main/java/services/db/DBHelper.java
BIDL/BIDL/app/src/main/java/services/db/DBHelper.java
+13
-0
BIDL/BIDL/app/src/main/java/services/servercommunication/NetworkService.java
...ain/java/services/servercommunication/NetworkService.java
+47
-2
BIDL/BIDL/app/src/main/java/services/servercommunication/REST.java
.../app/src/main/java/services/servercommunication/REST.java
+3
-0
BIDL/BIDL/app/src/main/res/layout/activity_feedback.xml
BIDL/BIDL/app/src/main/res/layout/activity_feedback.xml
+28
-6
BIDL/BIDL/app/src/main/res/values/strings.xml
BIDL/BIDL/app/src/main/res/values/strings.xml
+3
-0
No files found.
BIDL/BIDL/app/src/main/AndroidManifest.xml
View file @
8ccf1040
...
...
@@ -24,7 +24,7 @@
android:value=
"de.uni_oldenburg.bidl.classes"
/>
<meta-data
android:name=
"Rush_db_version"
android:value=
"
2
"
/>
android:value=
"
3
"
/>
<meta-data
android:name=
"Rush_db_name"
android:value=
"bidl.db"
/>
...
...
BIDL/BIDL/app/src/main/java/classes/apps/Feedback/Answer.java
View file @
8ccf1040
...
...
@@ -15,37 +15,28 @@ import co.uk.rushorm.core.RushObject;
public
class
Answer
extends
RushObject
implements
Serializable
{
@JsonField
(
name
=
"id"
)
private
int
A
nswerid
;
private
int
a
nswerid
;
@JsonField
(
name
=
"finalAnswer"
)
private
String
finalAnswer
;
@JsonField
(
name
=
"possibleAnswers"
)
private
List
<
String
>
possibleAnswers
;
public
Answer
()
{
}
public
Answer
(
int
answerid
,
String
finalAnswer
,
List
<
String
>
possibleAnswers
)
{
Answerid
=
answerid
;
this
.
finalAnswer
=
finalAnswer
;
public
Answer
(
int
answerid
,
List
<
String
>
possibleAnswers
)
{
this
.
answerid
=
answerid
;
this
.
possibleAnswers
=
possibleAnswers
;
}
public
int
getAnswerid
()
{
return
A
nswerid
;
return
a
nswerid
;
}
public
void
setAnswerid
(
int
answerid
)
{
Answerid
=
answerid
;
}
public
String
getFinalAnswer
()
{
return
finalAnswer
;
}
public
void
setFinalAnswer
(
String
finalAnswer
)
{
this
.
finalAnswer
=
finalAnswer
;
this
.
answerid
=
answerid
;
}
public
List
<
String
>
getPossibleAnswers
()
{
...
...
@@ -59,8 +50,7 @@ public class Answer extends RushObject implements Serializable {
@Override
public
String
toString
()
{
return
"Answer{"
+
"Answerid="
+
Answerid
+
", finalAnswer='"
+
finalAnswer
+
'\''
+
"answerid="
+
answerid
+
", possibleAnswers="
+
possibleAnswers
+
'}'
;
}
...
...
BIDL/BIDL/app/src/main/java/classes/apps/Feedback/Question.java
View file @
8ccf1040
...
...
@@ -15,15 +15,16 @@ import co.uk.rushorm.core.annotations.RushList;
@JsonObject
public
class
Question
extends
RushObject
implements
Serializable
{
@RushList
(
classType
=
Answer
.
class
)
@JsonField
(
name
=
"answers"
)
private
ArrayList
<
Answer
>
answers
;
@JsonField
(
name
=
"id"
)
private
int
questionId
;
@JsonField
(
name
=
"text"
)
private
String
text
;
@RushList
(
classType
=
Answer
.
class
)
@JsonField
(
name
=
"answers"
)
private
ArrayList
<
Answer
>
answers
;
public
Question
()
{
}
...
...
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/member_view/FeedbackActivity.java
View file @
8ccf1040
...
...
@@ -2,29 +2,125 @@ package de.uni_oldenburg.bidl.member_view;
import
android.support.v7.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.support.v7.widget.LinearLayoutCompat
;
import
android.util.Log
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.Button
;
import
android.widget.FrameLayout
;
import
android.widget.LinearLayout
;
import
android.widget.RadioButton
;
import
android.widget.RadioGroup
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
java.util.ArrayList
;
import
java.util.List
;
import
classes.Event
;
import
classes.apps.feedback.Answer
;
import
classes.apps.feedback.Question
;
import
de.uni_oldenburg.bidl.BaseActivity
;
import
de.uni_oldenburg.bidl.R
;
import
services.db.DBHelper
;
import
services.servercommunication.NetworkService
;
public
class
FeedbackActivity
extends
AppCompatActivity
{
private
Event
event
;
private
List
<
Question
>
questions
;
private
LinearLayout
mLinearLayout
;
private
Button
btSendFeedback
;
private
RadioGroup
radioGroup
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_feedback
);
mLinearLayout
=
(
LinearLayout
)
findViewById
(
R
.
id
.
feedback_ll
);
btSendFeedback
=
(
Button
)
findViewById
(
R
.
id
.
sendFeedbackBt
);
setTitle
(
getIntent
().
getStringExtra
(
"appName"
));
btSendFeedback
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
radioGroup
.
getCheckedRadioButtonId
();
}
});
}
NetworkService
.
getQuestions
(
1
,
new
NetworkService
.
RequestGetQuestionsHandler
()
{
@Override
protected
void
onStart
()
{
super
.
onStart
();
event
=
DBHelper
.
getEvent
();
NetworkService
.
getQuestions
(
event
.
getEventId
(),
new
NetworkService
.
RequestGetQuestionsHandler
()
{
@Override
public
void
done
(
List
<
Question
>
questions
)
{
Question
question
=
questions
.
get
(
0
);
Log
.
d
(
"TEST"
,
"DIE ERSTE FRAGE LAUTET: "
+
question
.
getText
()
);
setQuestions
(
questions
);
getAnswers
(
);
}
});
}
@Override
protected
void
onPause
()
{
super
.
onPause
();
mLinearLayout
.
removeAllViews
();
}
private
void
getAnswers
()
{
for
(
final
Question
question
:
questions
){
NetworkService
.
getPossibleAnswers
(
question
.
getQuestionId
(),
new
NetworkService
.
RequestGetPossibleAnswersHandler
()
{
@Override
public
void
done
(
final
Answer
answer
)
{
if
(
answer
!=
null
){
FeedbackActivity
.
this
.
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
initGui
(
question
,
answer
);
}
});
}
}
});
}
}
private
void
initGui
(
Question
question
,
Answer
answer
)
{
for
(
int
row
=
0
;
row
<
1
;
row
++){
TextView
tv
=
new
TextView
(
this
);
tv
.
setText
(
question
.
getText
());
tv
.
setGravity
(
Gravity
.
CENTER
);
tv
.
setPadding
(
0
,
40
,
0
,
0
);
radioGroup
=
new
RadioGroup
(
this
);
radioGroup
.
setOrientation
(
LinearLayout
.
HORIZONTAL
);
radioGroup
.
setGravity
(
Gravity
.
CENTER
);
for
(
int
i
=
0
;
i
<
answer
.
getPossibleAnswers
().
size
();
i
++){
RadioButton
radioButton
=
new
RadioButton
(
this
);
radioButton
.
setId
((
row
*
2
)+
i
);
radioButton
.
setText
(
answer
.
getPossibleAnswers
().
get
(
i
));
radioGroup
.
addView
(
radioButton
);
}
mLinearLayout
.
addView
(
tv
);
mLinearLayout
.
addView
(
radioGroup
);
}
}
public
void
setQuestions
(
List
<
Question
>
questions
)
{
this
.
questions
=
questions
;
}
}
BIDL/BIDL/app/src/main/java/services/db/DBHelper.java
View file @
8ccf1040
...
...
@@ -8,6 +8,7 @@ import java.util.List;
import
classes.Event
;
import
classes.LocalStorage
;
import
classes.apps.AppContainer
;
import
classes.apps.feedback.Answer
;
import
co.uk.rushorm.core.RushCore
;
import
co.uk.rushorm.core.RushSearch
;
...
...
@@ -54,6 +55,7 @@ public class DBHelper {
*/
public
static
void
clearAll
()
{
clearEvents
();
clearAnswers
();
}
...
...
@@ -61,5 +63,16 @@ public class DBHelper {
RushCore
.
getInstance
().
deleteAll
(
Event
.
class
);
}
//Answer
public
static
List
<
Answer
>
getAllAnswer
(){
List
<
Answer
>
answers
=
new
RushSearch
().
find
(
Answer
.
class
);
return
answers
;
}
public
static
void
clearAnswers
(){
RushCore
.
getInstance
().
deleteAll
(
Answer
.
class
);}
}
BIDL/BIDL/app/src/main/java/services/servercommunication/NetworkService.java
View file @
8ccf1040
package
services.servercommunication
;
import
android.util.Log
;
import
com.bluelinelabs.logansquare.LoganSquare
;
import
com.squareup.okhttp.Call
;
import
com.squareup.okhttp.Callback
;
...
...
@@ -16,6 +18,7 @@ import java.util.concurrent.TimeUnit;
import
classes.Event
;
import
classes.StatusResponse
;
import
classes.User
;
import
classes.apps.feedback.Answer
;
import
classes.apps.feedback.Question
;
import
classes.apps.forum.Forum
;
...
...
@@ -265,11 +268,11 @@ public abstract class NetworkService {
void
done
(
String
status
);
}
public
static
void
getQuestions
(
int
feedback
Id
,
final
RequestGetQuestionsHandler
handler
){
public
static
void
getQuestions
(
int
event
Id
,
final
RequestGetQuestionsHandler
handler
){
okHttpClient
.
setReadTimeout
(
15
,
TimeUnit
.
SECONDS
);
RequestBody
requestBody
=
new
FormEncodingBuilder
()
.
add
(
"
feedbackId"
,
String
.
valueOf
(
feedback
Id
))
.
add
(
"
eventId"
,
String
.
valueOf
(
event
Id
))
.
build
();
Request
req
=
new
Request
.
Builder
()
...
...
@@ -305,4 +308,46 @@ public abstract class NetworkService {
public
interface
RequestGetQuestionsHandler
{
void
done
(
List
<
Question
>
questions
);
}
public
static
void
getPossibleAnswers
(
int
questionId
,
final
RequestGetPossibleAnswersHandler
handler
){
okHttpClient
.
setReadTimeout
(
15
,
TimeUnit
.
SECONDS
);
RequestBody
requestBody
=
new
FormEncodingBuilder
()
.
add
(
"questionId"
,
String
.
valueOf
(
questionId
))
.
build
();
Request
req
=
new
Request
.
Builder
()
.
url
(
REST
.
SPRING_GETPOSSIBLEANSWERS
)
.
post
(
requestBody
)
.
build
();
Call
call
=
okHttpClient
.
newCall
(
req
);
call
.
enqueue
(
new
Callback
()
{
@Override
public
void
onFailure
(
Request
request
,
IOException
e
)
{
handler
.
done
(
null
);
e
.
printStackTrace
();
}
@Override
public
void
onResponse
(
Response
response
)
throws
IOException
{
try
{
if
(
response
.
isSuccessful
()){
Answer
answer
=
LoganSquare
.
parse
(
response
.
body
().
byteStream
(),
Answer
.
class
);
handler
.
done
(
answer
);
}
}
catch
(
IOException
e
){
handler
.
done
(
null
);
e
.
printStackTrace
();
}
}
});
}
public
interface
RequestGetPossibleAnswersHandler
{
void
done
(
Answer
answer
);
}
}
BIDL/BIDL/app/src/main/java/services/servercommunication/REST.java
View file @
8ccf1040
...
...
@@ -49,4 +49,7 @@ public abstract class REST {
private
static
final
String
GETQUESTIONS
=
"/getQuestions"
;
public
static
String
SPRING_GETQUESTIONS
=
FULL_URL
+
FEEDBACK
+
GETQUESTIONS
;
private
static
final
String
GETPOSSIBLEANSWERS
=
"/getPossibleAnswers"
;
public
static
String
SPRING_GETPOSSIBLEANSWERS
=
FULL_URL
+
FEEDBACK
+
GETPOSSIBLEANSWERS
;
}
BIDL/BIDL/app/src/main/res/layout/activity_feedback.xml
View file @
8ccf1040
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:paddingBottom=
"@dimen/activity_vertical_margin"
android:paddingLeft=
"@dimen/activity_horizontal_margin"
android:paddingRight=
"@dimen/activity_horizontal_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
tools:context=
"de.uni_oldenburg.bidl.member_view.FeedbackActivity"
>
<LinearLayout
android:id=
"@+id/feedback_ll"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<RadioGroup
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/radiogroup"
android:orientation=
"vertical"
android:layout_margin=
"10dp"
></RadioGroup>
</LinearLayout>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/sendFeedbackBt"
android:text=
"@string/sendFeedbackBtn"
android:gravity=
"center"
android:layout_marginTop=
"50dp"
android:layout_below=
"@+id/feedback_ll"
android:layout_centerHorizontal=
"true"
/>
</RelativeLayout>
BIDL/BIDL/app/src/main/res/values/strings.xml
View file @
8ccf1040
...
...
@@ -19,6 +19,9 @@
<string
name=
"menuLogoutTitle"
>
Ausloggen
</string>
<string
name=
"menuShareTitle"
>
Teilen
</string>
<!-- FeedbackActivity !-->
<string
name=
"sendFeedbackBtn"
>
Abstimmen!
</string>
<!-- ForumActivity !-->
<string
name=
"sendMessageHint"
>
Ihre Nachricht
</string>
<string
name=
"noText"
>
Geben Sie eine Nachricht ein!
</string>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment