mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
change Id of a textview
This commit is contained in:
parent
467161a5f2
commit
0b2361b8fa
6 changed files with 72 additions and 103 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/TV_habit"
|
||||
android:id="@+id/TV_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
android:layout_gravity="right"
|
||||
android:src="@drawable/triangle_neutral"/>
|
||||
<CheckedTextView
|
||||
android:id="@+id/TV_habit"
|
||||
android:id="@+id/TV_title"
|
||||
style="@style/CardText"
|
||||
android:layout_gravity="center|left"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
<CheckedTextView
|
||||
android:id="@+id/TV_reward"
|
||||
android:id="@+id/TV_title"
|
||||
style="@style/CardText"
|
||||
android:layout_gravity="center|left"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
android:layout_height="@dimen/avatar_height"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="fitStart"
|
||||
android:src="@drawable/ic_launcher"
|
||||
android:src="@mipmap/ic_launcher"
|
||||
/>
|
||||
|
||||
<FrameLayout
|
||||
|
|
|
|||
|
|
@ -1,66 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.habitrpg.android.habitica.CheckableLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/row_size"
|
||||
android:background="@drawable/item_background"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingBottom="0dp"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="0dp"
|
||||
android:paddingTop="0dp"
|
||||
style="@style/CardText"
|
||||
>
|
||||
|
||||
style="@style/CardText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/row_size"
|
||||
android:background="@drawable/item_background"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingBottom="0dp"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="0dp"
|
||||
android:paddingTop="0dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/plus"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:button="@android:color/transparent"
|
||||
android:background="@drawable/btn_check_holo_light"
|
||||
android:gravity="center" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!-- <View -->
|
||||
<!-- android:id="@+id/V_color_indic" -->
|
||||
<!-- android:layout_width="50dp" -->
|
||||
<!-- android:layout_height="10dp" -->
|
||||
<!-- android:layout_marginRight="30dp" -->
|
||||
<!-- android:background="@color/bad" -->
|
||||
<!-- android:layout_gravity="top|right" /> -->
|
||||
<ImageView
|
||||
android:id="@+id/IV_task_color"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="right"
|
||||
android:src="@drawable/triangle_worst"/>
|
||||
<CheckedTextView
|
||||
android:id="@+id/TV_title"
|
||||
style="@style/CardText"
|
||||
android:layout_gravity="center|left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="left"/>
|
||||
<!-- <View -->
|
||||
<!-- android:id="@+id/V_color_indic" -->
|
||||
<!-- android:layout_width="50dp" -->
|
||||
<!-- android:layout_height="10dp" -->
|
||||
<!-- android:layout_marginRight="30dp" -->
|
||||
<!-- android:background="@color/bad" -->
|
||||
<!-- android:layout_gravity="top|right" /> -->
|
||||
<ImageView
|
||||
android:id="@+id/IV_task_color"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="right"
|
||||
android:src="@drawable/triangle_worst" />
|
||||
|
||||
</FrameLayout>
|
||||
<!-- <CheckBox -->
|
||||
<!-- android:id="@+id/check_todo" -->
|
||||
<!-- style="@style/CardLightText" -->
|
||||
<!-- android:text="Habit 1" -->
|
||||
<!-- android:layout_width="wrap_content" -->
|
||||
<!-- android:layout_height="50dp" -->
|
||||
<!-- android:background="@drawable/selectable_background_cardbank" -->
|
||||
<!-- android:gravity="center_vertical" -->
|
||||
<!-- android:layout_marginLeft="10dp" -->
|
||||
<!-- android:paddingLeft="10dp" -->
|
||||
<!-- /> -->
|
||||
<CheckedTextView
|
||||
android:id="@+id/TV_title"
|
||||
style="@style/CardText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|left"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="left" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</com.habitrpg.android.habitica.CheckableLinearLayout>
|
||||
|
|
@ -11,58 +11,41 @@ import android.widget.LinearLayout;
|
|||
* This class is useful for using inside of ListView that needs to have checkable items.
|
||||
*/
|
||||
public class CheckableLinearLayout extends LinearLayout implements Checkable {
|
||||
private CheckedTextView _checkbox;
|
||||
private CheckedTextView _checkbox;
|
||||
|
||||
public CheckableLinearLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
public CheckableLinearLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
// find checked text view
|
||||
int childCount = getChildCount();
|
||||
/*for (int i = 0; i < childCount; ++i) {
|
||||
View v = getChildAt(i);
|
||||
if (v instanceof CheckedTextView) {
|
||||
_checkbox = (CheckedTextView)v;
|
||||
Log.v("Checkable", "found CheckedTextViex");
|
||||
}
|
||||
}*/
|
||||
View v = findViewById(R.id.TV_habit);
|
||||
if(v==null) {
|
||||
v= findViewById(R.id.TV_reward);
|
||||
}
|
||||
if(v==null) {
|
||||
v=findViewById(R.id.TV_title);
|
||||
}
|
||||
if(v instanceof CheckedTextView) {
|
||||
_checkbox = (CheckedTextView)v;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
// find checked text view
|
||||
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return _checkbox != null ? _checkbox.isChecked() : false;
|
||||
}
|
||||
View v = findViewById(R.id.TV_title);
|
||||
|
||||
@Override
|
||||
public void setChecked(boolean checked) {
|
||||
if (_checkbox != null) {
|
||||
_checkbox.setChecked(checked);
|
||||
if(checked) {
|
||||
this.setBackgroundResource(R.drawable.list_focused_holo);
|
||||
} else {
|
||||
this.setBackgroundResource(R.drawable.item_background);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (v instanceof CheckedTextView) {
|
||||
_checkbox = (CheckedTextView) v;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggle() {
|
||||
if (_checkbox != null) {
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return _checkbox != null ? _checkbox.isChecked() : false;
|
||||
}
|
||||
|
||||
_checkbox.toggle();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setChecked(boolean checked) {
|
||||
if (_checkbox != null) {
|
||||
_checkbox.setChecked(checked);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggle() {
|
||||
if (_checkbox != null) {
|
||||
|
||||
_checkbox.toggle();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue