File tree Expand file tree Collapse file tree 6 files changed +35
-12
lines changed
java/com/mohamedfadel91/mainthreadscheduler Expand file tree Collapse file tree 6 files changed +35
-12
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ android {
2121dependencies {
2222 implementation fileTree(dir : ' libs' , include : [' *.jar' ])
2323 implementation ' com.android.support:appcompat-v7:26.1.0'
24- implementation ' com.android.support.constraint:constraint-layout:1.0.2 '
24+ implementation ' com.github.Mohamed-Fadel:MainThreadScheduler:v1.0-alpha '
2525 testImplementation ' junit:junit:4.12'
2626 androidTestImplementation ' com.android.support.test:runner:1.0.1'
2727 androidTestImplementation ' com.android.support.test.espresso:espresso-core:3.0.1'
Original file line number Diff line number Diff line change 11package com .mohamedfadel91 .mainthreadscheduler ;
22
3- import android .support .v7 .app .AppCompatActivity ;
43import android .os .Bundle ;
4+ import android .support .v7 .app .AppCompatActivity ;
5+ import android .widget .EditText ;
6+ import android .widget .Toast ;
7+
8+ import com .mohamedfadel91 .mainthreadschedulerlib .MainThreadScheduler ;
59
610public class MainActivity extends AppCompatActivity {
711
12+ EditText edtEmail ;
13+
814 @ Override
915 protected void onCreate (Bundle savedInstanceState ) {
1016 super .onCreate (savedInstanceState );
1117 setContentView (R .layout .activity_main );
18+
19+ edtEmail = findViewById (R .id .edt_email );
20+
21+ MainThreadScheduler .scheduleWhenIdle (new Runnable () {
22+ @ Override
23+ public void run () {
24+ Toast .makeText (MainActivity .this ,
25+ " " + edtEmail .getWidth (),
26+ Toast .LENGTH_SHORT ).show ();
27+ }
28+ });
29+
1230 }
1331}
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
2- <android .support.constraint.ConstraintLayout xmlns : android =" http://schemas.android.com/apk/res/android"
3- xmlns : app =" http://schemas.android.com/apk/res-auto"
2+ <LinearLayout xmlns : android =" http://schemas.android.com/apk/res/android"
43 xmlns : tools =" http://schemas.android.com/tools"
54 android : layout_width =" match_parent"
5+ android : orientation =" vertical"
6+ android : padding =" @dimen/frame_padding"
67 android : layout_height =" match_parent"
78 tools : context =" com.mohamedfadel91.mainthreadscheduler.MainActivity" >
89
9- <TextView
10- android : layout_width =" wrap_content"
10+ <EditText
11+ android : id =" @+id/edt_email"
12+ android : layout_width =" match_parent"
1113 android : layout_height =" wrap_content"
12- android : text =" Hello World!"
13- app : layout_constraintBottom_toBottomOf =" parent"
14- app : layout_constraintLeft_toLeftOf =" parent"
15- app : layout_constraintRight_toRightOf =" parent"
16- app : layout_constraintTop_toTopOf =" parent" />
14+ android : inputType =" textEmailAddress"
15+ android : hint =" @string/email_hint" />
1716
18- </android .support.constraint.ConstraintLayout >
17+ </LinearLayout >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <resources >
3+ <dimen name =" frame_padding" >16dp</dimen >
4+ </resources >
Original file line number Diff line number Diff line change 11<resources >
22 <string name =" app_name" >MainThreadScheduler</string >
3+ <string name =" email_hint" >Email Address</string >
34</resources >
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ allprojects {
1919 repositories {
2020 google()
2121 jcenter()
22+ maven { url ' https://jitpack.io' }
2223 }
2324}
2425
You can’t perform that action at this time.
0 commit comments