Android Open Source - android_sdk Result Activity






From Project

Back to project page android_sdk.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project android_sdk 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

/*
 * Copyright (C) 2013  Spunk Media Pvt Ltd (www.qubecell.com)
 */// ww w  . j ava2  s  .  c o  m

package com.qubecell.ui;

import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.qubecell.constants.ApplicationActivities;
import com.qubecell.constants.IntentConstant;
import com.qubecell.constants.PaymentResult;
import com.qubecell.constants.WidgetsTagName;
import com.qubecell.elogger.ELogger;
import com.qubecell.utility.CommonUtility;

/**
 * The ResultActivity class is used to display the success or failure message received from server. 
 * @author Eninov
 *
 */
public class ResultActivity extends BaseActivity 
{
  private Button backButton = null;
  private ELogger log = null;
  private String message = null;
  private String logTag = "ResultDisplayActivity::";
  private View resultLayoutView = null;
  private String result = null;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    resultLayoutView = CommonUtility.getResultLayoutView(appContext);
    this.setContentView(resultLayoutView);  
    initLogger();
    log.debug("Inside ResultActivity");
    getIntentData(getIntent());
    initializeWidget();
    handleItemClickListener();
    ((TextView)resultLayoutView.findViewWithTag(WidgetsTagName.RESULT_RESULT_TEXTVIEW)).setText(message);
    setCurrentActivity(ApplicationActivities.RESULT_ACTIVITY);
  }

  private void handleItemClickListener() 
  {
    // Back Button Click listener
    backButton.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View arg0) 
      {
        if(result == null)
        {
          setQubecell(PaymentResult.PAYMENT_FALIURE);
        }
        else
        {
          if(result.equalsIgnoreCase(PaymentResult.SUCCESS))
          {
            setQubecell(PaymentResult.PAYMENT_SUCCESS);
          }
          else
          {
            setQubecell(PaymentResult.PAYMENT_FALIURE);
          }
        }
        setCurrentActivity(ApplicationActivities.CLOSE_QUBECELL);
        finish();
      }
    });
  }

  /**
   * This method is used to initialize the widgets
   */
  private void initializeWidget() 
  {

    backButton = ((Button)resultLayoutView.findViewWithTag(WidgetsTagName.RESULT_BUTTON_VIEW));
    backButton.setBackgroundColor(getBackGroundColor());
    if(getBillingPartner() != null)
    {
      TextView poweredBy = ((TextView)resultLayoutView.findViewWithTag(WidgetsTagName.RESULT_BOTTOM_TEXTVIEW));
      poweredBy.setText(getBillingPartner());
    }
    if(getLogoImage() != null)
    {
      ImageView logoImageView = ((ImageView)resultLayoutView.findViewWithTag(WidgetsTagName.RESULT_TOPHEADER_IMAGEVIEW));
      Drawable logoDrawable = new BitmapDrawable(getLogoImage());
      logoImageView.setBackgroundDrawable(logoDrawable);
    }
    LinearLayout mainFrame = ((LinearLayout)resultLayoutView.findViewWithTag(WidgetsTagName.RESULT_MAIN_FRAME));
    mainFrame.setBackgroundColor(getThemeColor());
  }

  /**
   * This method is used to get intent data and set it in class variable.
   */
  private void getIntentData(Intent intent) 
  {
    log.debug("Inside getIntentData.");
    if(intent == null)
    {
      log.error("getIntentData() : Intent is found null");
      return;
    }
    message = intent.getStringExtra(IntentConstant.MESSAGE); 
    result = intent.getStringExtra(IntentConstant.PAYMENT_RESULT);
    String progressBarClose = intent.getStringExtra(IntentConstant.CLOSE_PROGRESSBAR);
    if(progressBarClose != null &&  progressBarClose.equalsIgnoreCase("true"))
    {
      log.debug("Close progressbar");
      dismissProgressDialogOnEvent();
    }
    else
    {
      log.debug("Dont close progressbar");
    }
  }

  /**
   * This method is used to initialize the Elogger. 
   */
  private void initLogger() 
  {
    if(log == null)
      log = new ELogger();
    log.setTag(logTag);
  }
}




Java Source Code List

com.qubecell.beans.BaseBean.java
com.qubecell.beans.CheckStatusRespBean.java
com.qubecell.beans.EventChargeRespBean.java
com.qubecell.beans.MsisdnRespBean.java
com.qubecell.beans.OperatorDetails.java
com.qubecell.beans.OperatorsRespBean.java
com.qubecell.beans.ResponseBaseBean.java
com.qubecell.beans.SendOTPRespBean.java
com.qubecell.beans.ValidateOTPRespBean.java
com.qubecell.constants.ApplicationActivities.java
com.qubecell.constants.CheckstatusServerRespCode.java
com.qubecell.constants.ConstantStrings.java
com.qubecell.constants.EventChargeServerRespCode.java
com.qubecell.constants.HttpConstant.java
com.qubecell.constants.IntentConstant.java
com.qubecell.constants.MerchantData.java
com.qubecell.constants.MessageResponseCode.java
com.qubecell.constants.MobileOperators.java
com.qubecell.constants.MsisdnServerRespCode.java
com.qubecell.constants.NetworkResponseCode.java
com.qubecell.constants.NetworkResponse.java
com.qubecell.constants.NetworkURL.java
com.qubecell.constants.PaymentResult.java
com.qubecell.constants.ProductIds.java
com.qubecell.constants.QubecellResult.java
com.qubecell.constants.SendOTPServerRespCode.java
com.qubecell.constants.ServerCommand.java
com.qubecell.constants.ThemeConfigurationVariables.java
com.qubecell.constants.ValidateOTPServerRespCode.java
com.qubecell.constants.WidgetsTagName.java
com.qubecell.elogger.ELogger.java
com.qubecell.network.AsyncClient.java
com.qubecell.network.NetworkController.java
com.qubecell.receivers.SMSReceiver.java
com.qubecell.smsmgr.QubecellSMSManager.java
com.qubecell.ui.BaseActivity.java
com.qubecell.ui.QubecellActivity.java
com.qubecell.ui.ResultActivity.java
com.qubecell.ui.SelectOperatorActivity.java
com.qubecell.ui.ValidateOTPActivity.java
com.qubecell.utility.CommonUtility.java
com.qubecell.utility.ImageBase64.java
com.qubecell.xmlparser.XMLParser.java
com.qubecell.xmlparser.XMLfunctions.java
com.qubecelltestapp.ui.MerchantActivity.java