Android Open Source - openmidaas-android-app Consented Details Dialog






From Project

Back to project page openmidaas-android-app.

License

The source code is released under:

Apache License

If you think the Android project openmidaas-android-app 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 2013 SecureKey Technologies Inc.
 * /*from ww w  .j av a  2  s .  c  o m*/
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package org.openmidaas.app.activities.ui;

import java.util.List;
import org.openmidaas.app.R;
import org.openmidaas.app.common.DialogUtils;
import org.openmidaas.app.common.Intents;
import org.openmidaas.app.common.Logger;
import org.openmidaas.app.session.ConsentManager;
import org.openmidaas.library.model.core.AbstractAttribute;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;

public class ConsentedDetailsDialog extends DialogFragment implements DialogInterface.OnClickListener {
  
  private ListView lvConsentedItems;
  
  private TextView tvInfo;
  
  private List<AbstractAttribute<?>> mAttributeList;
  
  private String mClientId;
  
  @Override
  public void onCreate(Bundle bundle) {
    super.onCreate(bundle);  
  }
  
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater =getActivity().getLayoutInflater();
      final View view = inflater.inflate(R.layout.consent_details, null);
      lvConsentedItems = (ListView) view.findViewById(R.id.lvConsentedItems);
      tvInfo = (TextView)view.findViewById(R.id.tvDialogInfoText);
      AlertDialog.Builder alert = new AlertDialog.Builder(getActivity())
              .setNeutralButton(getActivity().getString(R.string.btnRevokeConsent), this);
      alert.setView(view);
      Logger.debug(getClass(), "Consent details dialog created");
      return alert.create();
  }
  
  public void setData(String clientId, List<AbstractAttribute<?>> dataSource) {
    this.mClientId = clientId;
    this.mAttributeList = dataSource;
  }
  
   @Override
   public void onStart() {
     super.onStart();
     getDialog().setTitle(getActivity().getString(R.string.consentDetailsDialogTitle));
     ConsentedDetailsDialogListAdapter adapter = new ConsentedDetailsDialogListAdapter();
     adapter.setActivity(getActivity());
     adapter.setDataSource(this.mAttributeList);
     lvConsentedItems.setAdapter(adapter);
     tvInfo.setText(getActivity().getString(R.string.consentDetailsDialogInfoText) + " "+ this.mClientId);
   }

  @Override
  public void onClick(DialogInterface dialogInterface, int which) {
    if(!ConsentManager.revokeConsentForClient(getActivity(), mClientId)) {
      Logger.error(getClass(), "Error revoking consent");
      this.dismiss();
      DialogUtils.showNeutralButtonDialog(getActivity(), "Error", "Error revoking consent to: " + this.mClientId);
    } else {
      Logger.debug(getClass(), "Revoked successfully");
      Logger.debug(getClass(), "Refreshing consent summary list");
      getActivity().sendBroadcast(new Intent().setAction(Intents.REFRESH_CONSENT_LIST));
    }
  }
}




Java Source Code List

org.openmidaas.app.App.java
org.openmidaas.app.Settings.java
org.openmidaas.app.activities.AboutUsActivity.java
org.openmidaas.app.activities.AbstractActivity.java
org.openmidaas.app.activities.AbstractAttributeRegistrationActivity.java
org.openmidaas.app.activities.AddressActivity.java
org.openmidaas.app.activities.AttributeListFragment.java
org.openmidaas.app.activities.AuthorizationActivity.java
org.openmidaas.app.activities.CreditCardActivity.java
org.openmidaas.app.activities.EmailRegistrationActivity.java
org.openmidaas.app.activities.EnterURLDialogFragment.java
org.openmidaas.app.activities.MainTabActivity.java
org.openmidaas.app.activities.ManageConsentActivity.java
org.openmidaas.app.activities.PhoneRegistrationActivity.java
org.openmidaas.app.activities.ProfileFragment.java
org.openmidaas.app.activities.PushNotificationActivity.java
org.openmidaas.app.activities.ScanFragment.java
org.openmidaas.app.activities.SplashActivity.java
org.openmidaas.app.activities.ui.ConsentedDetailsDialogListAdapter.java
org.openmidaas.app.activities.ui.ConsentedDetailsDialog.java
org.openmidaas.app.activities.ui.list.AbstractAttributeListElement.java
org.openmidaas.app.activities.ui.list.AbstractListCategory.java
org.openmidaas.app.activities.ui.list.AddressCategory.java
org.openmidaas.app.activities.ui.list.AddressListElement.java
org.openmidaas.app.activities.ui.list.AttributeExpandableListAdapter.java
org.openmidaas.app.activities.ui.list.AuthorizationListAdapter.java
org.openmidaas.app.activities.ui.list.BirthdayListElement.java
org.openmidaas.app.activities.ui.list.ConsentListAdapter.java
org.openmidaas.app.activities.ui.list.CreditCardCategory.java
org.openmidaas.app.activities.ui.list.CreditCardListElement.java
org.openmidaas.app.activities.ui.list.EmailAttributeListElement.java
org.openmidaas.app.activities.ui.list.EmailCategory.java
org.openmidaas.app.activities.ui.list.GenderListElement.java
org.openmidaas.app.activities.ui.list.GeneralCategory.java
org.openmidaas.app.activities.ui.list.GenericAttributeListElement.java
org.openmidaas.app.activities.ui.list.OnListElementLongTouch.java
org.openmidaas.app.activities.ui.list.OnListElementTouch.java
org.openmidaas.app.activities.ui.list.PersonalListCategory.java
org.openmidaas.app.activities.ui.list.PhoneAttributeListElement.java
org.openmidaas.app.activities.ui.list.PhoneCategory.java
org.openmidaas.app.activities.ui.spinner.AttributeSpinnerAdapter.java
org.openmidaas.app.common.AttributeRegistrationHelper.java
org.openmidaas.app.common.CategoryManager.java
org.openmidaas.app.common.CategoryMap.java
org.openmidaas.app.common.Constants.java
org.openmidaas.app.common.DialogUtils.java
org.openmidaas.app.common.Intents.java
org.openmidaas.app.common.Logger.java
org.openmidaas.app.common.Utils.java
org.openmidaas.app.services.GCMIntentService.java
org.openmidaas.app.services.GCMReceiver.java
org.openmidaas.app.session.AttributeFetchException.java
org.openmidaas.app.session.AttributeRequestObjectException.java
org.openmidaas.app.session.ConsentManager.java
org.openmidaas.app.session.EssentialAttributeMissingException.java
org.openmidaas.app.session.PostbackReturnStrategy.java
org.openmidaas.app.session.ReturnStrategyFactory.java
org.openmidaas.app.session.ReturnStrategy.java
org.openmidaas.app.session.SessionCreationException.java
org.openmidaas.app.session.SessionManager.java
org.openmidaas.app.session.Session.java
org.openmidaas.app.session.attributeset.AbstractAttributeSet.java
org.openmidaas.app.session.attributeset.AddressAttributeSet.java
org.openmidaas.app.session.attributeset.AttributeSetFactory.java
org.openmidaas.app.session.attributeset.CreditCardAttributeSet.java
org.openmidaas.app.session.attributeset.EmailAttributeSet.java
org.openmidaas.app.session.attributeset.GenericAttributeSet.java
org.openmidaas.app.session.attributeset.PhoneAttributeSet.java