Android Open Source - nl.fhict.intellicloud.answers.android Review Overview Activity






From Project

Back to project page nl.fhict.intellicloud.answers.android.

License

The source code is released under:

Apache License

If you think the Android project nl.fhict.intellicloud.answers.android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package nl.fhict.intellicloud.answers;
// w  w  w. j ava2 s  . com

import nl.fhict.intellicloud.answers.backendcommunication.DummyBackend;
import nl.fhict.intellicloud.answers.backendcommunication.IAnswerService;

import java.util.List;

import nl.fhict.intellicloud.answers.backendcommunication.AnswerDataSource;
import nl.fhict.intellicloud.answers.backendcommunication.IQuestionService;
import nl.fhict.intellicloud.answers.backendcommunication.IReviewService;
import nl.fhict.intellicloud.answers.backendcommunication.QuestionDataSource;
import nl.fhict.intellicloud.answers.backendcommunication.ReviewDataSource;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;

public class ReviewOverviewActivity extends Activity {

  int reviewInt;
  Context context;
  
  Answer answer;
  Question question;
  User user1, user2;
  
  EditText etReviewField;
  IReviewService iReviewService;
  IAnswerService iAnswerService;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_review_overview);
    reviewInt = getIntent().getExtras().getInt("reviewInt");
    this.context = this;

    IQuestionService iQuestionService = new QuestionDataSource(getApplicationContext());
    final IReviewService iReviewService = new ReviewDataSource(getApplicationContext());
    iAnswerService = new AnswerDataSource(getApplicationContext());
    question = iQuestionService.GetQuestion(reviewInt);
    answer = iAnswerService.GetAnswerUsingQuestion(reviewInt);
    
    TextView tvQuestion = (TextView) findViewById(R.id.tvQuestion);
    tvQuestion.setText(question.getQuestion());
    TextView tvQuestionDetail = (TextView) findViewById(R.id.tvQuestionDetail);
    tvQuestionDetail.setText(question.getQuestion());
    
    TextView tvAnswer = (TextView) findViewById(R.id.tvAnswer);
    if (answer != null)
    {
      tvAnswer.setText(answer.getAnswer());
    }
    
    Button btnDeclineAnswer = (Button) findViewById(R.id.btnDeclineAnswer);
    btnDeclineAnswer.setOnClickListener(new OnClickListener(){
      @Override
      public void onClick(View v){
        Intent intent = new Intent(context, AddReviewActivity.class);
        
        ListView lvReviews = (ListView) findViewById(R.id.lvReviews);
        List<Review> reviews = iReviewService.GetReviews(answer.getId());
        if(reviews != null && reviews.size() > 0){
          //TODO: ADD Reviews in list
          //lvReviews.setAdapter();          
        }
        
        intent.putExtra("reviewInt", reviewInt);
        startActivity(intent);
        finish();
      }
    });
    
    Button btnAcceptAnswer = (Button) findViewById(R.id.btnAcceptAnswer);
    btnAcceptAnswer.setOnClickListener(new OnClickListener(){
      @Override
      public void onClick(View v){
        answer.setAnswerState(AnswerState.Ready);
        iAnswerService.UpdateAnswer(answer);
        finish();
      }
    });
    
    
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.answer_reviews, menu);
    return true;
  }
}




Java Source Code List

nl.fhict.intellicloud.answers.AddReviewActivity.java
nl.fhict.intellicloud.answers.AnswerState.java
nl.fhict.intellicloud.answers.Answer.java
nl.fhict.intellicloud.answers.AuthorizationActivity.java
nl.fhict.intellicloud.answers.FeedbackState.java
nl.fhict.intellicloud.answers.FeedbackType.java
nl.fhict.intellicloud.answers.Feedback.java
nl.fhict.intellicloud.answers.FilterList.java
nl.fhict.intellicloud.answers.GetUserIdTask.java
nl.fhict.intellicloud.answers.IUserFoundObserver.java
nl.fhict.intellicloud.answers.IncomingQuestionsListAdapter.java
nl.fhict.intellicloud.answers.ListFragment.java
nl.fhict.intellicloud.answers.MainActivity.java
nl.fhict.intellicloud.answers.OriginalAnswerActivity.java
nl.fhict.intellicloud.answers.QuestionListOnClickListener.java
nl.fhict.intellicloud.answers.QuestionState.java
nl.fhict.intellicloud.answers.Question.java
nl.fhict.intellicloud.answers.RejectedAnswerActivity.java
nl.fhict.intellicloud.answers.ReviewListAdapter.java
nl.fhict.intellicloud.answers.ReviewOverviewActivity.java
nl.fhict.intellicloud.answers.ReviewState.java
nl.fhict.intellicloud.answers.Review.java
nl.fhict.intellicloud.answers.SendAnswerActivity.java
nl.fhict.intellicloud.answers.SlidingMenuListAdapter.java
nl.fhict.intellicloud.answers.UserType.java
nl.fhict.intellicloud.answers.User.java
nl.fhict.intellicloud.answers.backendcommunication.AnswerDataSource.java
nl.fhict.intellicloud.answers.backendcommunication.AnswerSync.java
nl.fhict.intellicloud.answers.backendcommunication.AuthenticatorService.java
nl.fhict.intellicloud.answers.backendcommunication.Authenticator.java
nl.fhict.intellicloud.answers.backendcommunication.BackendContentProvider.java
nl.fhict.intellicloud.answers.backendcommunication.BackendSyncAdapter.java
nl.fhict.intellicloud.answers.backendcommunication.BackendSyncService.java
nl.fhict.intellicloud.answers.backendcommunication.DummyBackend.java
nl.fhict.intellicloud.answers.backendcommunication.IAnswerService.java
nl.fhict.intellicloud.answers.backendcommunication.IClaimService.java
nl.fhict.intellicloud.answers.backendcommunication.IQuestionService.java
nl.fhict.intellicloud.answers.backendcommunication.IReviewService.java
nl.fhict.intellicloud.answers.backendcommunication.IUserService.java
nl.fhict.intellicloud.answers.backendcommunication.IntellicloudDbContract.java
nl.fhict.intellicloud.answers.backendcommunication.LocalStorageSQLiteHelper.java
nl.fhict.intellicloud.answers.backendcommunication.QuestionDataSource.java
nl.fhict.intellicloud.answers.backendcommunication.QuestionsSync.java
nl.fhict.intellicloud.answers.backendcommunication.ReviewDataSource.java
nl.fhict.intellicloud.answers.backendcommunication.ReviewSync.java
nl.fhict.intellicloud.answers.backendcommunication.ServerAccessor.java
nl.fhict.intellicloud.answers.backendcommunication.SyncHelper.java
nl.fhict.intellicloud.answers.backendcommunication.UserDataSource.java
nl.fhict.intellicloud.answers.backendcommunication.UserSync.java
nl.fhict.intellicloud.answers.backendcommunication.oauth.AuthenticationManager.java