-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
140 additions
and
442 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
422
app/src/main/java/cn/refactor/library/SmoothCheckBox.java
This file was deleted.
Oops, something went wrong.
108 changes: 108 additions & 0 deletions
108
app/src/main/java/org/kontalk/ui/view/CircleCheckBox.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.