Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd0fe007

Browse files
authored
Merge pull request#4 from skydoves/feature/androidx
Migrating to AndroidX & Publish v2.0.2
2 parents5393bb1 +612b344 commitd0fe007

File tree

17 files changed

+64
-63
lines changed

17 files changed

+64
-63
lines changed

‎app/build.gradle‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ android {
2020
}
2121

2222
dependencies {
23-
implementation"com.android.support:appcompat-v7:$support_version"
24-
implementation"com.android.support:design:$support_version"
25-
26-
implementation"com.jakewharton:butterknife:8.8.1"
27-
annotationProcessor"com.jakewharton:butterknife-compiler:8.8.1"
23+
implementation"androidx.appcompat:appcompat:1.0.2"
24+
implementation'com.google.android.material:material:1.1.0-alpha01'
2825

2926
implementation project(":elasticviews")
3027
}

‎app/src/main/java/com/skydoves/elasticviewsdemo/ExampleActivity0.java‎

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
importandroid.graphics.Color;
44
importandroid.os.Bundle;
5-
importandroid.support.design.widget.Snackbar;
6-
importandroid.support.v7.app.AppCompatActivity;
75
importandroid.view.View;
86
importandroid.widget.Toast;
97

8+
importcom.google.android.material.snackbar.Snackbar;
109
importcom.skydoves.elasticviews.ElasticCheckButton;
1110

12-
importbutterknife.ButterKnife;
13-
importbutterknife.OnClick;
11+
importandroidx.appcompat.app.AppCompatActivity;
1412

1513
/**
1614
* Developed by skydoves on 2017-01-21.
@@ -23,35 +21,30 @@ public class ExampleActivity0 extends AppCompatActivity {
2321
protectedvoidonCreate(BundlesavedInstanceState) {
2422
super.onCreate(savedInstanceState);
2523
setContentView(R.layout.activity_example0);
26-
ButterKnife.bind(this);
2724
}
2825

29-
@OnClick({R.id.daybtn0,R.id.daybtn1,R.id.daybtn2,R.id.daybtn3,R.id.daybtn4,R.id.daybtn5,R.id.daybtn6})
3026
publicvoidElasticCheckButtons(Viewv){
3127
ElasticCheckButtonelasticCheckButton = (ElasticCheckButton)v;
32-
Snackbar.make(v,"[Change checked state] " +elasticCheckButton.getText().toString() +" : " +elasticCheckButton.isChecked(),Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
28+
Snackbar.make(v,"[Change checked state] " +elasticCheckButton.getText().toString() +" : " +elasticCheckButton.isChecked(),200).setActionTextColor(Color.WHITE).show();
3329
}
3430

35-
@OnClick({R.id.layout_starttime,R.id.layout_endtime,R.id.layout_timeinterval})
3631
publicvoidElasticLayout(Viewv){
37-
Snackbar.make(v,"Pop-up likes 'TimePickerDialog'",Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
32+
Snackbar.make(v,"Pop-up likes 'TimePickerDialog'",200).setActionTextColor(Color.WHITE).show();
3833
}
3934

40-
@OnClick({R.id.example0_ibtn_q_timeset01,R.id.example0_ibtn_q_timeset02})
4135
publicvoidElasticImageViews(Viewv){
4236
switch (v.getId()) {
4337
caseR.id.example0_ibtn_q_timeset01 :
44-
Snackbar.make(v,"Alarm goes off between start-time and end-time",Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
38+
Snackbar.make(v,"Alarm goes off between start-time and end-time",200).setActionTextColor(Color.WHITE).show();
4539
break;
4640
caseR.id.example0_ibtn_q_timeset02 :
47-
Snackbar.make(v,"This is time interval description",Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
41+
Snackbar.make(v,"This is time interval description",200).setActionTextColor(Color.WHITE).show();
4842
break;
4943
}
5044
}
5145

52-
@OnClick(R.id.elasticbtn_addalarm)
5346
publicvoidaddNewAlarm(Viewv){
54-
Toast.makeText(this,"a new Alarm added!",Toast.LENGTH_SHORT).show();
47+
Toast.makeText(getBaseContext(),"a new Alarm added!",Toast.LENGTH_SHORT).show();
5548
finish();
5649
}
5750
}

‎app/src/main/java/com/skydoves/elasticviewsdemo/ExampleActivity1.java‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
importandroid.content.Context;
44
importandroid.os.Bundle;
5-
importandroid.support.v7.app.AppCompatActivity;
65
importandroid.view.LayoutInflater;
76
importandroid.view.View;
87
importandroid.view.ViewGroup;
@@ -17,9 +16,7 @@
1716

1817
importjava.util.ArrayList;
1918

20-
importbutterknife.BindView;
21-
importbutterknife.ButterKnife;
22-
importbutterknife.OnClick;
19+
importandroidx.appcompat.app.AppCompatActivity;
2320

2421
/**
2522
* Developed by skydoves on 2017-01-21.
@@ -28,25 +25,21 @@
2825

2926
publicclassExampleActivity1extendsAppCompatActivity {
3027

31-
privateArrayList<Listviewitem>data;
28+
privateArrayList<Listviewitem>data =newArrayList<>();
3229
privateListviewAdapteradapter;
33-
34-
@BindView(R.id.example1_listview)
35-
ListViewlistView;
30+
privateListViewlistView;
3631

3732
@Override
3833
protectedvoidonCreate(BundlesavedInstanceState) {
3934
super.onCreate(savedInstanceState);
4035
setContentView(R.layout.activity_example1);
41-
ButterKnife.bind(this);
4236

43-
data=newArrayList();
44-
adapter=newListviewAdapter(this,R.layout.item,data);
37+
adapter =newListviewAdapter(this,R.layout.item,data);
38+
listView =findViewById(R.id.example1_listview);
4539
listView.setAdapter(adapter);
4640
listView.setOnItemClickListener(newListViewItemClickListener());
4741
}
4842

49-
@OnClick(R.id.example1_fab)
5043
publicvoidElasticFloatingButtons(Viewv){
5144
Listviewitemlistviewitem =newListviewitem(data.size()+"");
5245
data.add(listviewitem);

‎app/src/main/java/com/skydoves/elasticviewsdemo/ExampleActivity2.java‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
importandroid.graphics.Color;
44
importandroid.os.Bundle;
5-
importandroid.support.design.widget.Snackbar;
6-
importandroid.support.v7.app.AppCompatActivity;
75
importandroid.view.View;
86

7+
importcom.google.android.material.snackbar.Snackbar;
98
importcom.skydoves.elasticviews.ElasticAnimation;
109
importcom.skydoves.elasticviews.ElasticFinishListener;
1110

12-
importbutterknife.ButterKnife;
13-
importbutterknife.OnClick;
11+
importandroidx.appcompat.app.AppCompatActivity;
1412

1513
/**
1614
* Developed by skydoves on 2017-01-21.
@@ -23,10 +21,8 @@ public class ExampleActivity2 extends AppCompatActivity {
2321
protectedvoidonCreate(BundlesavedInstanceState) {
2422
super.onCreate(savedInstanceState);
2523
setContentView(R.layout.activity_example2);
26-
ButterKnife.bind(this);
2724
}
2825

29-
@OnClick({R.id.example2_view0,R.id.example2_view1,R.id.example2_view2,R.id.example2_view3,R.id.example2_imv,R.id.example2_textView0,R.id.example2_fab})
3026
publicvoidViews(Viewv) {
3127
if(v.getId() ==R.id.example2_view3) {
3228
newElasticAnimation(v).setScaleX(0.85f).setScaleY(0.85f).setDuration(500).setOnFinishListener(newElasticFinishListener() {
@@ -37,10 +33,10 @@ public void onFinished() {
3733
}).doAction();
3834
}
3935
elseif(v.getId() ==R.id.example2_imv)
40-
Snackbar.make(v,"This is ElasticImageView",Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
36+
Snackbar.make(v,"This is ElasticImageView",200).setActionTextColor(Color.WHITE).show();
4137
elseif(v.getId() ==R.id.example2_textView0)
4238
newElasticAnimation(v).setScaleX(0.75f).setScaleY(0.75f).setDuration(500).doAction();
4339
elseif(v.getId() ==R.id.example2_fab)
44-
Snackbar.make(v,"This is ElasticFloatActionButton",Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
40+
Snackbar.make(v,"This is ElasticFloatActionButton",200).setActionTextColor(Color.WHITE).show();
4541
}
4642
}

‎app/src/main/java/com/skydoves/elasticviewsdemo/MainActivity.java‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
importandroid.content.Intent;
44
importandroid.os.Bundle;
5-
importandroid.support.v7.app.AppCompatActivity;
65
importandroid.view.View;
76

8-
importbutterknife.ButterKnife;
9-
importbutterknife.OnClick;
7+
importandroidx.appcompat.app.AppCompatActivity;
108

119
/**
1210
* Developed by skydoves on 2017-01-21.
@@ -19,20 +17,18 @@ public class MainActivity extends AppCompatActivity {
1917
protectedvoidonCreate(BundlesavedInstanceState) {
2018
super.onCreate(savedInstanceState);
2119
setContentView(R.layout.activity_main);
22-
ButterKnife.bind(this);
2320
}
2421

25-
@OnClick({R.id.elasticbtn0,R.id.elasticbtn1,R.id.elasticbtn2})
2622
publicvoidElasticButtons(Viewv) {
2723
switch (v.getId()){
2824
caseR.id.elasticbtn0 :
29-
startActivity(newIntent(this,ExampleActivity0.class));
25+
startActivity(newIntent(getBaseContext(),ExampleActivity0.class));
3026
break;
3127
caseR.id.elasticbtn1 :
32-
startActivity(newIntent(this,ExampleActivity1.class));
28+
startActivity(newIntent(getBaseContext(),ExampleActivity1.class));
3329
break;
3430
caseR.id.elasticbtn2 :
35-
startActivity(newIntent(this,ExampleActivity2.class));
31+
startActivity(newIntent(getBaseContext(),ExampleActivity2.class));
3632
break;
3733
}
3834
}

‎app/src/main/res/layout/activity_example0.xml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
android:layout_width="0dp"
5757
android:layout_weight="1"
5858
android:layout_height="45dp"
59+
android:onClick="ElasticCheckButtons"
5960
app:checkbutton_backgroundColor="#30354b"
6061
app:checkbutton_duration="400"
6162
app:checkbutton_labelColor="#ffffff"
@@ -70,6 +71,7 @@
7071
android:layout_width="0dp"
7172
android:layout_weight="1"
7273
android:layout_height="45dp"
74+
android:onClick="ElasticCheckButtons"
7375
app:checkbutton_backgroundColor="#30354b"
7476
app:checkbutton_duration="400"
7577
app:checkbutton_labelColor="#ffffff"
@@ -84,6 +86,7 @@
8486
android:layout_width="0dp"
8587
android:layout_weight="1"
8688
android:layout_height="45dp"
89+
android:onClick="ElasticCheckButtons"
8790
app:checkbutton_backgroundColor="#30354b"
8891
app:checkbutton_duration="400"
8992
app:checkbutton_labelColor="#ffffff"
@@ -98,6 +101,7 @@
98101
android:layout_width="0dp"
99102
android:layout_weight="1"
100103
android:layout_height="45dp"
104+
android:onClick="ElasticCheckButtons"
101105
app:checkbutton_backgroundColor="#30354b"
102106
app:checkbutton_duration="400"
103107
app:checkbutton_labelColor="#ffffff"
@@ -112,6 +116,7 @@
112116
android:layout_width="0dp"
113117
android:layout_weight="1"
114118
android:layout_height="45dp"
119+
android:onClick="ElasticCheckButtons"
115120
app:checkbutton_backgroundColor="#30354b"
116121
app:checkbutton_duration="400"
117122
app:checkbutton_labelColor="#ffffff"
@@ -126,6 +131,7 @@
126131
android:layout_width="0dp"
127132
android:layout_weight="1"
128133
android:layout_height="45dp"
134+
android:onClick="ElasticCheckButtons"
129135
app:checkbutton_backgroundColor="#30354b"
130136
app:checkbutton_duration="400"
131137
app:checkbutton_labelColor="#ffffff"
@@ -140,6 +146,7 @@
140146
android:layout_width="0dp"
141147
android:layout_weight="1"
142148
android:layout_height="45dp"
149+
android:onClick="ElasticCheckButtons"
143150
app:checkbutton_backgroundColor="#30354b"
144151
app:checkbutton_duration="400"
145152
app:checkbutton_labelColor="#ffffff"
@@ -190,6 +197,7 @@
190197
android:layout_alignParentEnd="true"
191198
android:src="@drawable/ic_question"
192199
android:tint="#3d95c9"
200+
android:onClick="ElasticImageViews"
193201
app:imageview_scale="0.7"/>
194202

195203
</RelativeLayout>
@@ -200,6 +208,7 @@
200208
android:layout_height="50dp"
201209
android:layout_below="@+id/example0_tv02"
202210
android:layout_marginTop="15dp"
211+
android:onClick="ElasticLayout"
203212
app:layout_round="20"
204213
app:layout_scale="0.9"
205214
app:layout_backgroundColor="#30354b">
@@ -240,6 +249,7 @@
240249
android:layout_height="50dp"
241250
android:layout_below="@+id/makealram_tv02"
242251
android:layout_marginTop="15dp"
252+
android:onClick="ElasticLayout"
243253
app:layout_round="20"
244254
app:layout_scale="0.9"
245255
app:layout_backgroundColor="#30354b">
@@ -307,6 +317,7 @@
307317
android:layout_alignParentEnd="true"
308318
android:src="@drawable/ic_question"
309319
android:tint="#3d95c9"
320+
android:onClick="ElasticImageViews"
310321
app:imageview_scale="0.7"/>
311322

312323
<com.skydoves.elasticviews.ElasticLayout
@@ -315,6 +326,7 @@
315326
android:layout_height="50dp"
316327
android:layout_below="@+id/example0_ibtn_q_timeset02"
317328
android:layout_marginTop="15dp"
329+
android:onClick="ElasticLayout"
318330
app:layout_round="20"
319331
app:layout_scale="0.9"
320332
app:layout_backgroundColor="#30354b">
@@ -365,6 +377,7 @@
365377
android:layout_centerHorizontal="true"
366378
android:layout_marginLeft="64dp"
367379
android:layout_marginRight="64dp"
380+
android:onClick="addNewAlarm"
368381
app:button_backgroundColor="#3d95c9"
369382
app:button_round="0"
370383
app:button_labelText="Add new alarm"

‎app/src/main/res/layout/activity_example1.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
android:layout_alignParentEnd="true"
2626
android:layout_alignParentBottom="true"
2727
android:layout_margin="16dp"
28+
android:onClick="ElasticFloatingButtons"
2829
app:fabSize="normal"
2930
app:fabutton_duration="250"
3031
app:fabutton_scale="0.85"/>

‎app/src/main/res/layout/activity_example2.xml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
android:layout_width="match_parent"
4040
android:layout_height="50dp"
4141
android:layout_margin="10dp"
42+
android:onClick="Views"
4243
app:button_backgroundColor="#30354b"
4344
app:button_labelText="Elastic Button"
4445
app:button_labelSize="16"
@@ -50,6 +51,7 @@
5051
android:layout_width="match_parent"
5152
android:layout_height="50dp"
5253
android:layout_margin="10dp"
54+
android:onClick="Views"
5355
app:checkbutton_backgroundColor="#30354b"
5456
app:checkbutton_duration="400"
5557
app:checkbutton_labelColor="#ffffff"
@@ -65,6 +67,7 @@
6567
android:layout_width="match_parent"
6668
android:layout_height="80dp"
6769
android:layout_margin="10dp"
70+
android:onClick="Views"
6871
app:layout_backgroundColor="#30354b"
6972
app:layout_round="30"
7073
app:layout_duration="500"
@@ -104,7 +107,8 @@
104107
android:layout_width="match_parent"
105108
android:layout_height="80dp"
106109
android:layout_margin="10dp"
107-
android:background="#30354b">
110+
android:background="#30354b"
111+
android:onClick="Views">
108112

109113
<TextView
110114
android:id="@+id/example2_tv2"
@@ -144,6 +148,7 @@
144148
android:layout_alignParentStart="true"
145149
android:src="@drawable/ic_question"
146150
android:tint="#3d95c9"
151+
android:onClick="Views"
147152
app:imageview_scale="0.7"/>
148153

149154
<TextView
@@ -154,7 +159,8 @@
154159
android:text="TextView"
155160
android:textColor="#ffffff"
156161
android:textStyle="bold"
157-
android:textSize="25dp"/>
162+
android:textSize="25dp"
163+
android:onClick="Views"/>
158164

159165
<com.skydoves.elasticviews.ElasticFloatingActionButton
160166
android:id="@+id/example2_fab"
@@ -165,6 +171,7 @@
165171
android:layout_alignParentEnd="true"
166172
android:layout_centerVertical="true"
167173
android:layout_marginLeft="16dp"
174+
android:onClick="Views"
168175
app:fabSize="normal"
169176
app:fabutton_duration="400"
170177
app:fabutton_scale="0.85"/>

‎app/src/main/res/layout/activity_main.xml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
android:layout_height="0dp"
5656
android:layout_margin="20dp"
5757
android:layout_weight="1"
58+
android:onClick="ElasticButtons"
5859
app:button_backgroundColor="#30354b"
5960
app:button_duration="250"
6061
app:button_labelSize="17"
@@ -70,6 +71,7 @@
7071
android:layout_weight="1"
7172
android:layout_marginLeft="20dp"
7273
android:layout_marginRight="20dp"
74+
android:onClick="ElasticButtons"
7375
app:button_backgroundColor="#30354b"
7476
app:button_duration="250"
7577
app:button_round="20"
@@ -84,6 +86,7 @@
8486
android:layout_height="0dp"
8587
android:layout_weight="1"
8688
android:layout_margin="20dp"
89+
android:onClick="ElasticButtons"
8790
app:button_backgroundColor="#30354b"
8891
app:button_duration="250"
8992
app:button_round="20"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp