THẢO LUẬN

thg 3 2, 2018 1:32 SA
  1. Bạn nên post câu hỏi sang phần Questions.
  2. Bạn nên dùng Bootstrap 3 hoặc 4 CSS trong trường hợp này.
0

awesome!

0
thg 3 2, 2018 12:47 SA

thanks bạn!

0
thg 3 2, 2018 12:47 SA

thanks bạn!

0

Mình sẽ tiếp tục nghiên cứu ^^

0
thg 3 1, 2018 9:04 SA

(like)

0

Tks anh nhiều ạ, hóa ra SCSS với SASS là một à

0
thg 3 1, 2018 8:10 SA

awesome

0

Quản lý source code có thể kể thêm SourceTree (https://www.sourcetreeapp.com/), miễn phí, giao diện thân thiện, dùng khá tốt.

+1
thg 3 1, 2018 7:44 SA

Mình đã fix được bạn tham khảo xem sao:

@ActivityScope

@Component(dependencies = NetComponent.class, modules= AppModule.class)

public interface AppComponent {

    void inject(MyActivity activity);

}

ở đây bạn phải sữa "NetModule.class" thành AppModule.class vì mình đang viết component với AppModule --> thiếu AppModule.class:

-đây là AppModule class:

@Module
public class AppModule {

    Application mApplication;

    public AppModule(Application application) {
        mApplication = application;
    }

    @Provides
    @Singleton
    Application providesApplication() {
        return mApplication;
    }
}
  • Cuoi cung trong MyApp extends Application ban sữa khởi tạo netComponent lai thành thế nay them vao ".appModule(new AppModule(this))":
public class MyApp extends Application {

    private NetComponent mNetComponent;

    @Override
    public void onCreate() {
        super.onCreate();

        mNetComponent = DaggerNetComponent.builder().appModule(new AppModule(this))
                // list of modules that are part of this component need to be created here too
                .netModule(new NetModule())
                .build();
    }

    public NetComponent getNetComponent() {
       return mNetComponent;
    }
}

-> vay la xong

Noi them: ngoai ra trong MyActivity.class ban co the tim phu thuoc bang cach nay thi khong can AppComponent.class:

thu nhat them method "void inject(MyActivity activity);" vao NetComponent.class nhu sau:

@Singleton
@Component(modules={NetModule.class, AppModule.class})
public interface NetComponent {

    void inject(MyActivity activity);

    Retrofit retrofit();
    OkHttpClient okHttpClient();
    Gson gson();
}

cuoi cung trong MyActivity.class

public class MyActivity extends AppCompatActivity {

    @Inject
    Retrofit retrofit;
    @Inject
    Gson gson;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ((MyApp) getApplication()).getNetComponent().inject(this);

    }
}
0

còn nhiều cái thú vị lắm. tiếp tục viết bài về Apollo nhé bạn.

0
thg 3 1, 2018 3:42 SA

tks tác giả

0
thg 3 1, 2018 3:36 SA

tks tác giả

0

Đây là bài mình dịch thôi bạn, mình có ghi nguồn ở phần tham khảo đấy. Cái thiếu là mình không ghi rõ đây là bài dịch. Cảm ơn bạn đã góp ý

0
thg 2 28, 2018 7:22 CH

bài này ôm từ Howkteam qua thì phải? thấy logo Kteam!

0
thg 2 28, 2018 4:39 CH

Hehe đang cần cái này. Cảm ơn bạn.

0
thg 2 28, 2018 11:17 SA

bài viết rất hay, thanks bro (Y)

+1
thg 2 28, 2018 8:29 SA

tks tác giả ạ

0

thanks tác giả với những chia sẻ trên

0
Viblo
Hãy đăng ký một tài khoản Viblo để nhận được nhiều bài viết thú vị hơn.
Đăng kí