Android Open Source - android-usable-location-privacy L P Preset Config Adapter






From Project

Back to project page android-usable-location-privacy.

License

The source code is released under:

Apache License

If you think the Android project android-usable-location-privacy 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) 2014 B. Henne, C. Kater,
 *   Distributed Computing & Security Group,
 *   Leibniz Universitaet Hannover, Germany
 */*from  w  w  w  .j  ava 2s.  com*/
 * 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 com.android.settings.locationprivacy;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RatingBar;
import android.widget.TextView;

import com.android.settings.R;

public class LPPresetConfigAdapter extends BaseAdapter {

  private List<Integer> images;
  private String[] labels;
  private OnClickListener listener;
  private int[] stars;

  private int checked;
  private LayoutInflater inflater;

  public LPPresetConfigAdapter(List<Integer> images, String[] labels,
      Context context, OnClickListener listener) {
    super();
    this.images = images;
    this.labels = labels;
    checked = -1;
    inflater = LayoutInflater.from(context);
    this.listener = listener;
    stars = new int[labels.length];

  }

  @Override
  public int getCount() {
    return images.size();
  }

  @Override
  public String getItem(int position) {
    return labels[position];
  }

  public Integer getImage(int position) {
    return images.get(position);
  }

  @Override
  public long getItemId(int position) {
    return position;
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    Holder holder = new Holder();
    
    convertView = inflater.inflate(R.layout.lp_dialog_listview_element, null);
    holder.title = (TextView) convertView.findViewById(R.id.lp_dialog_listview_title);
    holder.check = (RadioButton) convertView.findViewById(R.id.lp_dialog_listview_check);
    holder.icon =  (ImageView) convertView.findViewById(R.id.lp_dialog_listview_icon);
    holder.stars = (RatingBar) convertView.findViewById(R.id.ratingBar1); 
    convertView.setTag(holder);
    
    holder.title.setText(getItem(position));
    holder.check.setChecked(position == checked);
    holder.check.setClickable(false);
    holder.icon.setImageResource(getImage(position));
    
    if(stars[position] > 0){
      holder.stars.setVisibility(View.VISIBLE);
      holder.stars.setNumStars(stars[position]);
    } else {
      holder.stars.setVisibility(View.GONE);
    }
    
    convertView.setOnClickListener(listener);
    convertView.setId(position);
    
    return convertView;
  }

  public int getChecked() {
    return checked;
  }

  public void setChecked(int checked) {
    this.checked = checked;
  }

  public void setStars(int[] stars) {
    this.stars = stars;
  }

  /**
   * Platzhalterklasse fuer die Elemente der einzelnen Zeilen.
   */
  
   static class Holder {

    TextView title;
    ImageView icon;
    RadioButton check;
    RatingBar stars;

  }
  
}




Java Source Code List

android.locationprivacy.algorithm.GeoReverseGeo.java
android.locationprivacy.algorithm.RadiusDistance.java
android.locationprivacy.control.CryptoDatabase.java
android.locationprivacy.control.LocationPrivacyManager.java
android.locationprivacy.model.AbstractLocationPrivacyAlgorithm.java
android.locationprivacy.model.Coordinate.java
android.locationprivacy.model.LocationPrivacyAlgorithmValues.java
android.locationprivacy.model.LocationPrivacyApplication.java
com.android.server.LocationManagerService.java
com.android.settings.Settings.java
com.android.settings.locationprivacy.LPPresetConfigAdapter.java
com.android.settings.locationprivacy.LocationPrivacyAdvancedSettings.java
com.android.settings.locationprivacy.LocationPrivacyAppPreference.java
com.android.settings.locationprivacy.LocationPrivacyDialog.java
com.android.settings.locationprivacy.LocationPrivacyMap.java
com.android.settings.locationprivacy.LocationPrivacyOfflineObfuscation.java
com.android.settings.locationprivacy.LocationPrivacyOnlineInfoActivity.java
com.android.settings.locationprivacy.LocationPrivacySettings.java
com.android.settings.locationprivacy.LocationPrivacyStatisticOverview.java
com.android.settings.locationprivacy.LocationPrivacyStatistic.java
com.android.settings.locationprivacy.SendDataService.java
com.android.settings.locationprivacy.StatisticDiagram24HPreference.java
com.android.settings.locationprivacy.StatisticDiagramPreference.java
com.android.settings.locationprivacy.UserRecoverableAuth.java
com.cyanogenmod.trebuchet.Launcher.java
com.jjoe64.graphview.BarGraphView.java
com.jjoe64.graphview.CustomLabelFormatter.java
com.jjoe64.graphview.GraphViewDataInterface.java
com.jjoe64.graphview.GraphViewSeries.java
com.jjoe64.graphview.GraphViewStyle.java
com.jjoe64.graphview.GraphView.java
com.jjoe64.graphview.LineGraphView.java
com.jjoe64.graphview.StatisticGraphView.java
com.jjoe64.graphview.ValueDependentColor.java
com.jjoe64.graphview.compatible.RealScaleGestureDetector.java
com.jjoe64.graphview.compatible.ScaleGestureDetector.java