Search in sources :

Example 26 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project Applozic-Android-SDK by AppLozic.

the class ChannelNameActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.update_channel_name_layout);
    Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(toolbar);
    mActionBar = getSupportActionBar();
    layout = (LinearLayout) findViewById(R.id.footerAd);
    applozicPermissions = new ApplozicPermissions(this, layout);
    mActionBar.setTitle(getString(R.string.update_channel_title_name));
    selectImageProfileIcon = (CircleImageView) findViewById(R.id.applozic_group_profile_camera);
    applozicGroupProfileIcon = (ImageView) findViewById(R.id.applozic_group_profile);
    String jsonString = FileUtils.loadSettingsJsonFile(getApplicationContext());
    fileClientService = new FileClientService(this);
    if (!TextUtils.isEmpty(jsonString)) {
        alCustomizationSettings = (AlCustomizationSettings) GsonUtils.getObjectFromJson(jsonString, AlCustomizationSettings.class);
    } else {
        alCustomizationSettings = new AlCustomizationSettings();
    }
    if (!TextUtils.isEmpty(alCustomizationSettings.getThemeColorPrimary()) && !TextUtils.isEmpty(alCustomizationSettings.getThemeColorPrimaryDark())) {
        mActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(alCustomizationSettings.getThemeColorPrimary())));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().setStatusBarColor(Color.parseColor(alCustomizationSettings.getThemeColorPrimaryDark()));
        }
    }
    int drawableResourceId = getResources().getIdentifier(alCustomizationSettings.getAttachCameraIconName(), "drawable", getPackageName());
    selectImageProfileIcon.setImageResource(drawableResourceId);
    if (getIntent().getExtras() != null) {
        String groupInfoJson = getIntent().getExtras().getString(ChannelInfoActivity.GROUP_UPDTAE_INFO);
        groupInfoUpdate = (GroupInfoUpdate) GsonUtils.getObjectFromJson(groupInfoJson, GroupInfoUpdate.class);
    }
    if (groupInfoUpdate != null && !TextUtils.isEmpty(groupInfoUpdate.getLocalImagePath())) {
        File file = new File(groupInfoUpdate.getLocalImagePath());
        Uri uri = Uri.parse(file.getAbsolutePath());
        if (uri != null) {
            Utils.printLog(this, "ChannelNameActivity::", uri.toString());
            applozicGroupProfileIcon.setImageURI(uri);
        }
    } else {
        applozicGroupProfileIcon.setImageResource(R.drawable.applozic_group_icon);
    }
    channelName = (EditText) findViewById(R.id.newChannelName);
    channelName.setText(groupInfoUpdate.getNewName());
    ok = (Button) findViewById(R.id.channelNameOk);
    cancel = (Button) findViewById(R.id.channelNameCancel);
    selectImageProfileIcon.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            processImagePicker();
        }
    });
    ok.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (channelName.getText().toString().equals(groupInfoUpdate.getNewName()) && imageChangeUri == null || groupInfoUpdate.getNewName() == null) {
                ChannelNameActivity.this.finish();
            }
            if (TextUtils.isEmpty(channelName.getText().toString()) || channelName.getText().toString().trim().length() == 0) {
                Toast.makeText(ChannelNameActivity.this, getString(R.string.channel_name_empty), Toast.LENGTH_SHORT).show();
                ChannelNameActivity.this.finish();
            } else {
                Intent intent = new Intent();
                groupInfoUpdate.setNewName(channelName.getText().toString());
                if (imageChangeUri != null && profilePhotoFile != null) {
                    groupInfoUpdate.setNewlocalPath(profilePhotoFile.getAbsolutePath());
                    groupInfoUpdate.setContentUri(imageChangeUri.toString());
                }
                intent.putExtra(ChannelInfoActivity.GROUP_UPDTAE_INFO, GsonUtils.getJsonFromObject(groupInfoUpdate, GroupInfoUpdate.class));
                setResult(RESULT_OK, intent);
                finish();
            }
        }
    });
    cancel.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ChannelNameActivity.this.finish();
        }
    });
    connectivityReceiver = new ConnectivityReceiver();
    registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}
Also used : IntentFilter(android.content.IntentFilter) AlCustomizationSettings(com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings) ApplozicPermissions(com.applozic.mobicomkit.uiwidgets.instruction.ApplozicPermissions) ConnectivityReceiver(com.applozic.mobicomkit.broadcast.ConnectivityReceiver) FileClientService(com.applozic.mobicomkit.api.attachment.FileClientService) Intent(android.content.Intent) Uri(android.net.Uri) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) CropImageView(com.theartofdev.edmodo.cropper.CropImageView) ColorDrawable(android.graphics.drawable.ColorDrawable) File(java.io.File) Toolbar(android.support.v7.widget.Toolbar)

Example 27 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project vialer-android by VoIPGRID.

the class CallRecordAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder;
    // Get the call record.
    CallRecord callRecord = getItem(position);
    String name = null;
    String number = "";
    // Default resource for direction.
    int resource = 0;
    if (callRecord != null) {
        // Get the direction from the call record.
        String direction = callRecord.getDirection();
        // Set the drawable resource.
        if (direction.equals(CallRecord.DIRECTION_OUTBOUND)) {
            number = callRecord.getDialedNumber();
            resource = R.drawable.ic_outgoing;
        } else if (direction.equals(CallRecord.DIRECTION_INBOUND)) {
            number = callRecord.getCaller();
            if (callRecord.getDuration() == 0) {
                resource = R.drawable.ic_incoming_missed;
            } else {
                resource = R.drawable.ic_incoming;
            }
        }
        // Get possible name or null.
        if (ContactsPermission.hasPermission(mActivity)) {
            name = getContactNameForNumber(number);
        }
    }
    if (convertView == null) {
        // Inflate the layout.
        LayoutInflater inflater = mActivity.getLayoutInflater();
        convertView = inflater.inflate(R.layout.list_item_call_record, parent, false);
    }
    String firstLetterOfName = name != null ? name.substring(0, 1) : "";
    Bitmap bitmapImage = IconHelper.getCallerIconBitmap(firstLetterOfName, Color.BLUE);
    View photoView = convertView.findViewById(R.id.text_view_contact_icon);
    ((CircleImageView) photoView).setImageBitmap(bitmapImage);
    // Set up the ViewHolder.
    viewHolder = new ViewHolder();
    viewHolder.title = (TextView) convertView.findViewById(R.id.text_view_contact_name);
    viewHolder.information = (TextView) convertView.findViewById(R.id.text_view_contact_information);
    ImageButton callButton = (ImageButton) convertView.findViewById(R.id.call_record_call_button);
    // Store the holder with the view.
    convertView.setTag(viewHolder);
    if (callRecord != null) {
        // Set name or number as text.
        if (number != null && PhoneNumberUtils.isAnonymousNumber(callRecord.getCaller())) {
            viewHolder.title.setText(convertView.getContext().getString(R.string.supressed_number));
            // Make call button invisible.
            callButton.setVisibility(View.GONE);
        } else if (name != null) {
            viewHolder.title.setText(name);
            callButton.setOnClickListener(this);
            callButton.setVisibility(View.VISIBLE);
        } else {
            viewHolder.title.setText(number);
            callButton.setOnClickListener(this);
            callButton.setVisibility(View.VISIBLE);
        }
        // Set the compound drawable to the view.
        viewHolder.information.setCompoundDrawablesWithIntrinsicBounds(resource, 0, 0, 0);
        // Format the date.
        SimpleDateFormat dateFormat = new SimpleDateFormat(CallRecord.DATE_FORMAT);
        Date date = null;
        try {
            date = dateFormat.parse(callRecord.getCallDate());
        } catch (ParseException e) {
            e.printStackTrace();
        }
        // Set the call record date information to the view.
        viewHolder.information.setText(DateUtils.getRelativeDateTimeString(mActivity, date.getTime(), DateUtils.SECOND_IN_MILLIS, DateUtils.YEAR_IN_MILLIS, DateUtils.FORMAT_ABBREV_TIME));
    }
    return convertView;
}
Also used : CircleImageView(de.hdodenhof.circleimageview.CircleImageView) Bitmap(android.graphics.Bitmap) ImageButton(android.widget.ImageButton) LayoutInflater(android.view.LayoutInflater) ParseException(java.text.ParseException) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView) SimpleDateFormat(java.text.SimpleDateFormat) CallRecord(com.voipgrid.vialer.api.models.CallRecord) Date(java.util.Date)

Example 28 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project vialer-android by VoIPGRID.

the class DialerActivity method setupContactsListView.

/**
 * Function to setup the listview and cursor adapter.
 */
private void setupContactsListView() {
    mContactsAdapter = new SimpleCursorAdapter(getBaseContext(), R.layout.list_item_contact, null, new String[] { "name", "photo", "number", "type" }, new int[] { R.id.text_view_contact_name, R.id.text_view_contact_icon, R.id.text_view_contact_information, R.id.text_view_contact_type }, 0);
    mContactsAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {

        /**
         * Binds the Cursor column defined by the specified index to the specified view.
         */
        public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
            if (view.getId() == R.id.text_view_contact_icon) {
                // The class stores a contact uri for which
                // we can retrieve a photo.
                boolean hasThumbnail = false;
                String thumbnailUriString = cursor.getString(columnIndex);
                if (thumbnailUriString != null) {
                    Bitmap thumbNail = loadContactThumbnail(thumbnailUriString);
                    if (thumbNail != null) {
                        hasThumbnail = true;
                        ((CircleImageView) view).setImageBitmap(thumbNail);
                    }
                }
                if (!hasThumbnail) {
                    String firstLetter = cursor.getString(1).replaceAll("\\<.*?>", "").substring(0, 1);
                    Bitmap bitmapImage = IconHelper.getCallerIconBitmap(firstLetter, Color.BLUE);
                    ((CircleImageView) view).setImageBitmap(bitmapImage);
                }
                return true;
            } else if (view instanceof TextView) {
                String result = cursor.getString(columnIndex);
                ((TextView) view).setText(Html.fromHtml(result != null ? result : ""));
                return true;
            }
            return false;
        }
    });
    // Getting reference to listview.
    mContactsListView.setOnScrollListener(this);
    mContactsListView.setOnItemClickListener(this);
    mContactsListView.setAdapter(mContactsAdapter);
    mContactsListView.setEmptyView(mEmptyView);
}
Also used : Bitmap(android.graphics.Bitmap) SimpleCursorAdapter(android.widget.SimpleCursorAdapter) TextView(android.widget.TextView) Cursor(android.database.Cursor) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 29 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project ride-read-android by Ride-Read.

the class MapFragment method convertBitmapFromXML.

public static Bitmap convertBitmapFromXML(Context context, int count, Bitmap bitmap) {
    View view = LayoutInflater.from(context).inflate(R.layout.item_picture_location, null);
    View bitmapView = view.findViewById(R.id.layout);
    TextView text = (TextView) view.findViewById(R.id.textView);
    CircleImageView image = (CircleImageView) view.findViewById(R.id.circleImageView);
    image.setImageBitmap(bitmap);
    text.setText(count + "");
    bitmapView.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
    bitmapView.layout(0, 0, bitmapView.getMeasuredWidth(), bitmapView.getMeasuredHeight());
    final Bitmap clusterBitmap = Bitmap.createBitmap(bitmapView.getMeasuredWidth(), bitmapView.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(clusterBitmap);
    bitmapView.draw(canvas);
    return clusterBitmap;
}
Also used : CircleImageView(de.hdodenhof.circleimageview.CircleImageView) Bitmap(android.graphics.Bitmap) Canvas(android.graphics.Canvas) TextView(android.widget.TextView) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView) TextureMapView(com.amap.api.maps.TextureMapView)

Example 30 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project ride-read-android by Ride-Read.

the class PersonalityMapActivity method convertBitmapFromXML.

public static Bitmap convertBitmapFromXML(Context context, Bitmap bitmap) {
    View view = LayoutInflater.from(context).inflate(R.layout.item_picture_location3, null);
    View bitmapView = view.findViewById(R.id.layout);
    CircleImageView image = (CircleImageView) view.findViewById(R.id.circleImageView);
    image.setImageBitmap(bitmap);
    bitmapView.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
    bitmapView.layout(0, 0, bitmapView.getMeasuredWidth(), bitmapView.getMeasuredHeight());
    final Bitmap clusterBitmap = Bitmap.createBitmap(bitmapView.getMeasuredWidth(), bitmapView.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(clusterBitmap);
    bitmapView.draw(canvas);
    return clusterBitmap;
}
Also used : CircleImageView(de.hdodenhof.circleimageview.CircleImageView) Bitmap(android.graphics.Bitmap) Canvas(android.graphics.Canvas) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView) TextureMapView(com.amap.api.maps.TextureMapView)

Aggregations

CircleImageView (de.hdodenhof.circleimageview.CircleImageView)30 View (android.view.View)27 TextView (android.widget.TextView)23 ImageView (android.widget.ImageView)13 ActionBar (android.support.v7.app.ActionBar)6 AdapterView (android.widget.AdapterView)6 ListView (android.widget.ListView)6 Intent (android.content.Intent)5 Bitmap (android.graphics.Bitmap)5 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)5 RecyclerView (android.support.v7.widget.RecyclerView)5 BmobUser (cn.bmob.v3.BmobUser)4 DescriptionAnimation (com.daimajia.slider.library.Animations.DescriptionAnimation)4 BaseSliderView (com.daimajia.slider.library.SliderTypes.BaseSliderView)4 User (com.nightonke.saver.model.User)4 CustomSliderView (com.nightonke.saver.ui.CustomSliderView)4 IntentFilter (android.content.IntentFilter)3 ColorDrawable (android.graphics.drawable.ColorDrawable)3 Handler (android.os.Handler)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3