Skip to content

Commit

Permalink
Merge branch 'new_icon'
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-athome committed Dec 11, 2016
2 parents 39c420c + 091706a commit 0860f57
Show file tree
Hide file tree
Showing 18 changed files with 140 additions and 442 deletions.
Binary file modified app/src/debug/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/debug/res/mipmap-ldpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/debug/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/debug/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/debug/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
422 changes: 0 additions & 422 deletions app/src/main/java/cn/refactor/library/SmoothCheckBox.java

This file was deleted.

108 changes: 108 additions & 0 deletions app/src/main/java/org/kontalk/ui/view/CircleCheckBox.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* Kontalk Android client
* Copyright (C) 2016 Kontalk Devteam <[email protected]>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package org.kontalk.ui.view;

import android.content.Context;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.widget.Checkable;

import de.hdodenhof.circleimageview.CircleImageView;

import org.kontalk.R;


/**
* A simple image view to handle checked state through use of checkbox image.
* @author Andrea Cappelli
*/
public class CircleCheckBox extends CircleImageView implements Checkable {

private static final String KEY_INSTANCE_STATE = "InstanceState";

private boolean mChecked;
private OnCheckedChangeListener mListener;

public CircleCheckBox(Context context) {
this(context, null);
}

public CircleCheckBox(Context context, AttributeSet attrs) {
this(context, attrs, 0);
init();
}

public CircleCheckBox(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}

private void init() {
setImageResource(R.drawable.ic_checkbox);
}

@Override
protected Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable(KEY_INSTANCE_STATE, super.onSaveInstanceState());
bundle.putBoolean(KEY_INSTANCE_STATE, isChecked());
return bundle;
}

@Override
protected void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
boolean isChecked = bundle.getBoolean(KEY_INSTANCE_STATE);
setChecked(isChecked);
super.onRestoreInstanceState(bundle.getParcelable(KEY_INSTANCE_STATE));
return;
}
super.onRestoreInstanceState(state);
}


@Override
public boolean isChecked() {
return mChecked;
}

@Override
public void toggle() {
this.setChecked(!isChecked());
}

@Override
public void setChecked(boolean checked) {
setVisibility(checked ? VISIBLE : GONE);
mChecked = checked;
if (mListener != null) {
mListener.onCheckedChanged(CircleCheckBox.this, mChecked);
}
}

public void setOnCheckedChangeListener(CircleCheckBox.OnCheckedChangeListener l) {
this.mListener = l;
}

public interface OnCheckedChangeListener {
void onCheckedChanged(CircleCheckBox checkBox, boolean isChecked);
}
}
12 changes: 6 additions & 6 deletions app/src/main/java/org/kontalk/ui/view/ContactsListItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
import android.widget.ImageView;
import android.widget.TextView;

import cn.refactor.library.SmoothCheckBox;


public class ContactsListItem extends AvatarListItem implements Checkable {

Expand All @@ -44,7 +42,7 @@ public class ContactsListItem extends AvatarListItem implements Checkable {
private TextView mText1;
private TextView mText2;
private ImageView mTrustStatus;
private SmoothCheckBox mCheckbox;
private CircleCheckBox mCheckbox;

private boolean mChecked;

Expand All @@ -63,7 +61,7 @@ protected void onFinishInflate() {
mText1 = (TextView) findViewById(android.R.id.text1);
mText2 = (TextView) findViewById(android.R.id.text2);
mTrustStatus = (ImageView) findViewById(R.id.trust_status);
mCheckbox = (SmoothCheckBox) findViewById(R.id.checkbox);
mCheckbox = (CircleCheckBox) findViewById(R.id.checkbox);

if (isInEditMode()) {
mText1.setText("Test contact");
Expand Down Expand Up @@ -168,8 +166,10 @@ public boolean isChecked() {
public void setChecked(boolean checked) {
if (checked != mChecked) {
mChecked = checked;
if (mCheckbox != null)
mCheckbox.setChecked(checked, !SystemUtils.isLegacySystem());
if (mCheckbox != null) {
mCheckbox.setChecked(checked);
mAvatarView.setVisibility(checked ? GONE : VISIBLE);
}
refreshDrawableState();
}
}
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/drawable/ic_checkbox.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@color/app_primary_dark" />

<item android:drawable="@drawable/ic_checkbox_done"/>

</layer-list>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_checkbox_done.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">

<path
android:fillColor="#FFFFFF"
android:pathData="M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.2z"/>
</vector>
22 changes: 8 additions & 14 deletions app/src/main/res/layout/contacts_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

<org.kontalk.ui.view.ContactsListItem
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/avatar_list_item_height"
Expand All @@ -41,27 +40,22 @@
android:layout_toRightOf="@+id/header_container"
android:layout_toEndOf="@+id/header_container">

<RelativeLayout
<FrameLayout
android:id="@+id/avatar_container"
style="@style/AvatarListItemStyle">

<org.kontalk.ui.view.CircleContactBadge
android:id="@+id/avatar"
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size" />
android:layout_width="match_parent"
android:layout_height="match_parent" />

<cn.refactor.library.SmoothCheckBox
<org.kontalk.ui.view.CircleCheckBox
android:id="@+id/checkbox"
android:layout_width="@dimen/avatar_checkbox_size"
android:layout_height="@dimen/avatar_checkbox_size"
android:layout_alignBottom="@+id/avatar"
android:layout_alignRight="@+id/avatar"
android:layout_alignEnd="@+id/avatar"
app:color_checked="@color/app_primary_dark"
app:color_unchecked="@android:color/transparent"
app:color_unchecked_stroke="@android:color/transparent" />
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"/>

</RelativeLayout>
</FrameLayout>

<TextView
android:id="@android:id/text1"
Expand Down
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-ldpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0860f57

Please sign in to comment.