repo
stringclasses
1k values
file_url
stringlengths
96
373
file_path
stringlengths
11
294
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
6 values
commit_sha
stringclasses
1k values
retrieved_at
stringdate
2026-01-04 14:45:56
2026-01-04 18:30:23
truncated
bool
2 classes
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/activity/main/leftdrawer/LeftDrawerAdapter.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/activity/main/leftdrawer/LeftDrawerAdapter.java
package com.zhuinden.examplegithubclient.presentation.activity.main.leftdrawer; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.zhuinden.examplegithubclient.R; import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent; import com.zhuinden.examplegithubclient.presentation.activity.main.MainPresenter; import com.zhuinden.examplegithubclient.util.DaggerService; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import flowless.Flow; /** * Created by Zhuinden on 2016.12.10.. */ public class LeftDrawerAdapter extends RecyclerView.Adapter<LeftDrawerAdapter.LeftDrawerViewHolder> { @Override public LeftDrawerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new LeftDrawerViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_left_drawer_item, parent, false)); } @Override public void onBindViewHolder(LeftDrawerViewHolder holder, int position) { holder.bind(LeftDrawerItems.values()[position]); } @Override public int getItemCount() { return LeftDrawerItems.values().length; } public static class LeftDrawerViewHolder extends RecyclerView.ViewHolder { private final Context context; @BindView(R.id.left_drawer_item_text) TextView leftDrawerText; @BindView(R.id.left_drawer_item_picture) ImageView imageView; LeftDrawerItems leftDrawerItem; @OnClick(R.id.left_drawer_item) public void onClickDrawerItem(View view) { Object newKey = leftDrawerItem.getKeyCreator().createKey(); MainComponent component = DaggerService.getGlobalComponent(context); MainPresenter mainPresenter = component.mainPresenter(); mainPresenter.goToKey(newKey); } public LeftDrawerViewHolder(View itemView) { super(itemView); context = itemView.getContext(); ButterKnife.bind(this, itemView); } public void bind(LeftDrawerItems leftDrawerItem) { this.leftDrawerItem = leftDrawerItem; leftDrawerText.setText(leftDrawerItem.getLabelId()); Glide.with(context).load(leftDrawerItem.getImageId()).dontAnimate().into(imageView); } } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginComponentFactory.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginComponentFactory.java
package com.zhuinden.examplegithubclient.presentation.paths.login; import android.content.Context; import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent; import com.zhuinden.examplegithubclient.util.ComponentFactory; import com.zhuinden.examplegithubclient.util.DaggerService; /** * Created by Zhuinden on 2016.12.18.. */ public class LoginComponentFactory implements ComponentFactory.FactoryMethod<LoginComponent> { @Override public LoginComponent createComponent(Context context) { MainComponent mainComponent = DaggerService.getGlobalComponent(context); return DaggerLoginComponent.builder().mainComponent(mainComponent).build(); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginView.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginView.java
package com.zhuinden.examplegithubclient.presentation.paths.login; import android.annotation.TargetApi; import android.app.ProgressDialog; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.text.Editable; import android.util.AttributeSet; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.zhuinden.examplegithubclient.R; import com.zhuinden.examplegithubclient.presentation.paths.repositories.RepositoriesKey; import com.zhuinden.examplegithubclient.util.BundleFactory; import com.zhuinden.examplegithubclient.util.DaggerService; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import butterknife.OnTextChanged; import flowless.ActivityUtils; import flowless.Bundleable; import flowless.Direction; import flowless.Flow; import flowless.History; import flowless.preset.FlowLifecycles; /** * Created by Zhuinden on 2016.12.10.. */ public class LoginView extends RelativeLayout implements LoginPresenter.ViewContract, FlowLifecycles.ViewLifecycleListener, Bundleable { public LoginView(Context context) { super(context); init(); } public LoginView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public LoginView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } @TargetApi(21) public LoginView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(); } public void init() { if(!isInEditMode()) { LoginComponent loginComponent = DaggerService.getComponent(getContext()); loginComponent.inject(this); } } @Inject LoginPresenter loginPresenter; @BindView(R.id.login_username) TextView username; @BindView(R.id.login_password) TextView password; @OnTextChanged(R.id.login_username) public void onUsernameChanged(Editable username) { loginPresenter.updateUsername(username.toString()); } @OnTextChanged(R.id.login_password) public void onPasswordChanged(Editable password) { loginPresenter.updatePassword(password.toString()); } @OnClick(R.id.login_login) public void login() { loginPresenter.login(); } ProgressDialog progressDialog; @Override protected void onFinishInflate() { super.onFinishInflate(); if(!isInEditMode()) { ButterKnife.bind(this); } } @Override public void handleLoginSuccess() { Flow.get(this).setHistory(History.single(RepositoriesKey.create()), Direction.FORWARD); } @Override public void handleLoginError() { Toast.makeText(getContext(), R.string.failed_to_login, Toast.LENGTH_SHORT).show(); } @Override public void setUsername(String username) { this.username.setText(username); } @Override public void setPassword(String password) { this.password.setText(password); } @Override public void showLoading() { hideLoading(); progressDialog = new ProgressDialog(ActivityUtils.getActivity(getContext())); progressDialog.setMessage(getContext().getString(R.string.please_wait)); progressDialog.setIndeterminate(true); progressDialog.setCancelable(false); progressDialog.show(); } @Override public void hideLoading() { if(progressDialog != null) { progressDialog.hide(); progressDialog.dismiss(); progressDialog = null; } } @Override public void onViewRestored() { loginPresenter.attachView(this); } @Override public void onViewDestroyed(boolean removedByFlow) { loginPresenter.detachView(); hideLoading(); } @Override public Bundle toBundle() { Bundle bundle = BundleFactory.create(); bundle.putBundle("PRESENTER_STATE", loginPresenter.toBundle()); return bundle; } @Override public void fromBundle(@Nullable Bundle bundle) { if(bundle != null) { loginPresenter.fromBundle(bundle.getBundle("PRESENTER_STATE")); } } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginPresenter.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginPresenter.java
package com.zhuinden.examplegithubclient.presentation.paths.login; import android.os.Bundle; import android.support.annotation.Nullable; import com.zhuinden.examplegithubclient.application.injection.KeyScope; import com.zhuinden.examplegithubclient.domain.interactor.LoginInteractor; import com.zhuinden.examplegithubclient.util.BasePresenter; import com.zhuinden.examplegithubclient.util.BundleFactory; import javax.inject.Inject; import flowless.Bundleable; import io.reactivex.android.schedulers.AndroidSchedulers; /** * Created by Zhuinden on 2016.12.18.. */ @KeyScope(LoginKey.class) public class LoginPresenter extends BasePresenter<LoginPresenter.ViewContract> implements Bundleable { @Inject LoginInteractor loginInteractor; @Inject public LoginPresenter() { } public interface ViewContract extends BasePresenter.ViewContract { void handleLoginSuccess(); void handleLoginError(); void setUsername(String username); void setPassword(String password); void showLoading(); void hideLoading(); } @Override protected void initializeView(ViewContract view) { view.setUsername(username); view.setPassword(password); if(isLoading) { view.showLoading(); } else { view.hideLoading(); } } String username; String password; static boolean isLoading; public void updateUsername(String username) { this.username = username; } public void updatePassword(String password) { this.password = password; } public void login() { showLoading(); loginInteractor.login(username, password).observeOn(AndroidSchedulers.mainThread()).subscribe(result -> { hideLoading(); if(result) { view.handleLoginSuccess(); // can View be null here? } else { view.handleLoginError(); } }); } private void showLoading() { isLoading = true; if(hasView()) { view.showLoading(); } } private void hideLoading() { isLoading = false; if(hasView()) { view.hideLoading(); } } @Override public Bundle toBundle() { Bundle bundle = BundleFactory.create(); bundle.putString("username", username); bundle.putString("password", password); //bundle.putBoolean("isLoading", isLoading); return bundle; } @Override public void fromBundle(@Nullable Bundle bundle) { if(bundle != null) { username = bundle.getString("username"); password = bundle.getString("password"); //isLoading = bundle.getBoolean("isLoading"); } } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginKey.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginKey.java
package com.zhuinden.examplegithubclient.presentation.paths.login; import android.os.Parcelable; import com.google.auto.value.AutoValue; import com.zhuinden.examplegithubclient.R; import com.zhuinden.examplegithubclient.util.ComponentFactory; import com.zhuinden.examplegithubclient.util.Layout; import com.zhuinden.examplegithubclient.util.LeftDrawerEnabled; import com.zhuinden.examplegithubclient.util.Title; import com.zhuinden.examplegithubclient.util.ToolbarButtonVisibility; /** * Created by Zhuinden on 2016.12.10.. */ @AutoValue @Title(R.string.title_login) @Layout(R.layout.path_login) @ComponentFactory(LoginComponentFactory.class) @LeftDrawerEnabled(false) @ToolbarButtonVisibility(false) public abstract class LoginKey implements Parcelable { public static LoginKey create() { return new AutoValue_LoginKey(); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginComponent.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginComponent.java
package com.zhuinden.examplegithubclient.presentation.paths.login; import com.zhuinden.examplegithubclient.application.injection.KeyScope; import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent; import dagger.Component; /** * Created by Owner on 2016.12.10. */ @KeyScope(LoginKey.class) @Component(dependencies = MainComponent.class) public interface LoginComponent { LoginPresenter loginPresenter(); void inject(LoginView loginView); }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/about/AboutKey.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/about/AboutKey.java
package com.zhuinden.examplegithubclient.presentation.paths.about; import android.os.Parcelable; import com.google.auto.value.AutoValue; import com.zhuinden.examplegithubclient.R; import com.zhuinden.examplegithubclient.util.Layout; import com.zhuinden.examplegithubclient.util.Title; /** * Created by Zhuinden on 2016.12.10.. */ @AutoValue @Title(R.string.title_about) @Layout(R.layout.path_about) public abstract class AboutKey implements Parcelable { public static AboutKey create() { return new AutoValue_AboutKey(); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/about/AboutView.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/about/AboutView.java
package com.zhuinden.examplegithubclient.presentation.paths.about; import android.annotation.TargetApi; import android.content.Context; import android.util.AttributeSet; import android.widget.RelativeLayout; /** * Created by Zhuinden on 2016.12.10.. */ public class AboutView extends RelativeLayout { public AboutView(Context context) { super(context); init(); } public AboutView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public AboutView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } @TargetApi(21) public AboutView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(); } public void init() { if(!isInEditMode()) { // . } } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsKey.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsKey.java
package com.zhuinden.examplegithubclient.presentation.paths.repositorydetails; import android.os.Parcelable; import com.google.auto.value.AutoValue; import com.zhuinden.examplegithubclient.R; import com.zhuinden.examplegithubclient.presentation.paths.repositories.RepositoriesKey; import com.zhuinden.examplegithubclient.util.ComponentFactory; import com.zhuinden.examplegithubclient.util.IsChildOf; import com.zhuinden.examplegithubclient.util.Layout; import com.zhuinden.examplegithubclient.util.LeftDrawerEnabled; import com.zhuinden.examplegithubclient.util.Title; /** * Created by Zhuinden on 2016.12.10.. */ @AutoValue @Title(R.string.title_repository_details) @Layout(R.layout.path_repositorydetails) @ComponentFactory(RepositoryDetailsComponentFactory.class) @LeftDrawerEnabled(false) @IsChildOf(RepositoriesKey.class) public abstract class RepositoryDetailsKey implements Parcelable { abstract RepositoriesKey parent(); abstract String url(); public static RepositoryDetailsKey create(RepositoriesKey parent, String url) { return new AutoValue_RepositoryDetailsKey(parent, url); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsComponentFactory.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsComponentFactory.java
package com.zhuinden.examplegithubclient.presentation.paths.repositorydetails; import android.content.Context; import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent; import com.zhuinden.examplegithubclient.util.ComponentFactory; import com.zhuinden.examplegithubclient.util.DaggerService; /** * Created by Zhuinden on 2016.12.19.. */ public class RepositoryDetailsComponentFactory implements ComponentFactory.FactoryMethod<RepositoryDetailsComponent> { @Override public RepositoryDetailsComponent createComponent(Context context) { MainComponent mainComponent = DaggerService.getGlobalComponent(context); return DaggerRepositoryDetailsComponent.builder().mainComponent(mainComponent).build(); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsView.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsView.java
package com.zhuinden.examplegithubclient.presentation.paths.repositorydetails; import android.annotation.TargetApi; import android.content.Context; import android.text.Html; import android.util.AttributeSet; import android.widget.RelativeLayout; import android.widget.TextView; import com.zhuinden.examplegithubclient.R; import com.zhuinden.examplegithubclient.data.repository.GithubRepoRepository; import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo; import com.zhuinden.examplegithubclient.util.DaggerService; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; import flowless.Flow; import flowless.preset.FlowLifecycles; /** * Created by Zhuinden on 2016.12.10.. */ public class RepositoryDetailsView extends RelativeLayout implements FlowLifecycles.ViewLifecycleListener, RepositoryDetailsPresenter.ViewContract { public RepositoryDetailsView(Context context) { super(context); init(); } public RepositoryDetailsView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public RepositoryDetailsView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } @TargetApi(21) public RepositoryDetailsView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(); } @Inject RepositoryDetailsPresenter repositoryDetailsPresenter; @Inject GithubRepoRepository githubRepoRepository; GithubRepo selectedGithubRepo; public void init() { if(!isInEditMode()) { RepositoryDetailsComponent repositoryDetailsComponent = DaggerService.getComponent(getContext()); repositoryDetailsComponent.inject(this); RepositoryDetailsKey repositoryDetailsKey = Flow.getKey(this); selectedGithubRepo = githubRepoRepository.findByUrl(repositoryDetailsKey.url()); } } @Override protected void onFinishInflate() { super.onFinishInflate(); ButterKnife.bind(this); } @Override public void onViewRestored() { repositoryDetailsPresenter.attachView(this); } @Override public void onViewDestroyed(boolean removedByFlow) { repositoryDetailsPresenter.detachView(); } public GithubRepo getSelectedGithubRepo() { return selectedGithubRepo; } @BindView(R.id.repository_details_id) TextView repositoryDetailsid; @BindView(R.id.repository_details_name) TextView repositoryDetailsname; @BindView(R.id.repository_details_fullName) TextView repositoryDetailsfullName; @BindView(R.id.repository_details_owner) TextView repositoryDetailsowner; @BindView(R.id.repository_details__private) TextView repositoryDetails_private; @BindView(R.id.repository_details_htmlUrl) TextView repositoryDetailshtmlUrl; @BindView(R.id.repository_details_description) TextView repositoryDetailsdescription; @BindView(R.id.repository_details_fork) TextView repositoryDetailsfork; @BindView(R.id.repository_details_url) TextView repositoryDetailsurl; @BindView(R.id.repository_details_forksUrl) TextView repositoryDetailsforksUrl; @BindView(R.id.repository_details_keysUrl) TextView repositoryDetailskeysUrl; @BindView(R.id.repository_details_collaboratorsUrl) TextView repositoryDetailscollaboratorsUrl; @BindView(R.id.repository_details_teamsUrl) TextView repositoryDetailsteamsUrl; @BindView(R.id.repository_details_hooksUrl) TextView repositoryDetailshooksUrl; @BindView(R.id.repository_details_issueEventsUrl) TextView repositoryDetailsissueEventsUrl; @BindView(R.id.repository_details_eventsUrl) TextView repositoryDetailseventsUrl; @BindView(R.id.repository_details_assigneesUrl) TextView repositoryDetailsassigneesUrl; @BindView(R.id.repository_details_branchesUrl) TextView repositoryDetailsbranchesUrl; @BindView(R.id.repository_details_tagsUrl) TextView repositoryDetailstagsUrl; @BindView(R.id.repository_details_blobsUrl) TextView repositoryDetailsblobsUrl; @BindView(R.id.repository_details_gitTagsUrl) TextView repositoryDetailsgitTagsUrl; @BindView(R.id.repository_details_gitRefsUrl) TextView repositoryDetailsgitRefsUrl; @BindView(R.id.repository_details_treesUrl) TextView repositoryDetailstreesUrl; @BindView(R.id.repository_details_statusesUrl) TextView repositoryDetailsstatusesUrl; @BindView(R.id.repository_details_languagesUrl) TextView repositoryDetailslanguagesUrl; @BindView(R.id.repository_details_stargazersUrl) TextView repositoryDetailsstargazersUrl; @BindView(R.id.repository_details_contributorsUrl) TextView repositoryDetailscontributorsUrl; @BindView(R.id.repository_details_subscribersUrl) TextView repositoryDetailssubscribersUrl; @BindView(R.id.repository_details_subscriptionUrl) TextView repositoryDetailssubscriptionUrl; @BindView(R.id.repository_details_commitsUrl) TextView repositoryDetailscommitsUrl; @BindView(R.id.repository_details_gitCommitsUrl) TextView repositoryDetailsgitCommitsUrl; @BindView(R.id.repository_details_commentsUrl) TextView repositoryDetailscommentsUrl; @BindView(R.id.repository_details_issueCommentUrl) TextView repositoryDetailsissueCommentUrl; @BindView(R.id.repository_details_contentsUrl) TextView repositoryDetailscontentsUrl; @BindView(R.id.repository_details_compareUrl) TextView repositoryDetailscompareUrl; @BindView(R.id.repository_details_mergesUrl) TextView repositoryDetailsmergesUrl; @BindView(R.id.repository_details_archiveUrl) TextView repositoryDetailsarchiveUrl; @BindView(R.id.repository_details_downloadsUrl) TextView repositoryDetailsdownloadsUrl; @BindView(R.id.repository_details_issuesUrl) TextView repositoryDetailsissuesUrl; @BindView(R.id.repository_details_pullsUrl) TextView repositoryDetailspullsUrl; @BindView(R.id.repository_details_milestonesUrl) TextView repositoryDetailsmilestonesUrl; @BindView(R.id.repository_details_notificationsUrl) TextView repositoryDetailsnotificationsUrl; @BindView(R.id.repository_details_labelsUrl) TextView repositoryDetailslabelsUrl; @BindView(R.id.repository_details_releasesUrl) TextView repositoryDetailsreleasesUrl; @BindView(R.id.repository_details_deploymentsUrl) TextView repositoryDetailsdeploymentsUrl; @BindView(R.id.repository_details_createdAt) TextView repositoryDetailscreatedAt; @BindView(R.id.repository_details_updatedAt) TextView repositoryDetailsupdatedAt; @BindView(R.id.repository_details_pushedAt) TextView repositoryDetailspushedAt; @BindView(R.id.repository_details_gitUrl) TextView repositoryDetailsgitUrl; @BindView(R.id.repository_details_sshUrl) TextView repositoryDetailssshUrl; @BindView(R.id.repository_details_cloneUrl) TextView repositoryDetailscloneUrl; @BindView(R.id.repository_details_svnUrl) TextView repositoryDetailssvnUrl; @BindView(R.id.repository_details_homepage) TextView repositoryDetailshomepage; @BindView(R.id.repository_details_size) TextView repositoryDetailssize; @BindView(R.id.repository_details_stargazersCount) TextView repositoryDetailsstargazersCount; @BindView(R.id.repository_details_watchersCount) TextView repositoryDetailswatchersCount; @BindView(R.id.repository_details_language) TextView repositoryDetailslanguage; @BindView(R.id.repository_details_hasIssues) TextView repositoryDetailshasIssues; @BindView(R.id.repository_details_hasDownloads) TextView repositoryDetailshasDownloads; @BindView(R.id.repository_details_hasWiki) TextView repositoryDetailshasWiki; @BindView(R.id.repository_details_hasPages) TextView repositoryDetailshasPages; @BindView(R.id.repository_details_forksCount) TextView repositoryDetailsforksCount; @BindView(R.id.repository_details_mirrorUrl) TextView repositoryDetailsmirrorUrl; @BindView(R.id.repository_details_openIssuesCount) TextView repositoryDetailsopenIssuesCount; @BindView(R.id.repository_details_forks) TextView repositoryDetailsforks; @BindView(R.id.repository_details_openIssues) TextView repositoryDetailsopenIssues; @BindView(R.id.repository_details_watchers) TextView repositoryDetailswatchers; @BindView(R.id.repository_details_defaultBranch) TextView repositoryDetailsdefaultBranch; @Override public void setupView(GithubRepo githubRepo) { repositoryDetailsid.setText(Html.fromHtml("<strong>Id: </strong>" + String.valueOf(githubRepo.getId()))); repositoryDetailsname.setText(Html.fromHtml("<strong>Name: </strong>" + String.valueOf(githubRepo.getName()))); repositoryDetailsfullName.setText(Html.fromHtml("<strong>FullName: </strong>" + String.valueOf(githubRepo.getFullName()))); repositoryDetailsowner.setText(Html.fromHtml("<strong>Owner: </strong>" + (githubRepo.getOwner() == null ? "" : githubRepo.getOwner() .getLogin()))); repositoryDetails_private.setText(Html.fromHtml("<strong>_Private: </strong>" + String.valueOf(githubRepo.get_Private()))); repositoryDetailshtmlUrl.setText(Html.fromHtml("<strong>HtmlUrl: </strong>" + String.valueOf(githubRepo.getHtmlUrl()))); repositoryDetailsdescription.setText(Html.fromHtml("<strong>Description: </strong>" + String.valueOf(githubRepo.getDescription()))); repositoryDetailsfork.setText(Html.fromHtml("<strong>Fork: </strong>" + String.valueOf(githubRepo.getFork()))); repositoryDetailsurl.setText(Html.fromHtml("<strong>Url: </strong>" + String.valueOf(githubRepo.getUrl()))); repositoryDetailsforksUrl.setText(Html.fromHtml("<strong>ForksUrl: </strong>" + String.valueOf(githubRepo.getForksUrl()))); repositoryDetailskeysUrl.setText(Html.fromHtml("<strong>KeysUrl: </strong>" + String.valueOf(githubRepo.getKeysUrl()))); repositoryDetailscollaboratorsUrl.setText(Html.fromHtml("<strong>CollaboratorsUrl: </strong>" + String.valueOf(githubRepo.getCollaboratorsUrl()))); repositoryDetailsteamsUrl.setText(Html.fromHtml("<strong>TeamsUrl: </strong>" + String.valueOf(githubRepo.getTeamsUrl()))); repositoryDetailshooksUrl.setText(Html.fromHtml("<strong>HooksUrl: </strong>" + String.valueOf(githubRepo.getHooksUrl()))); repositoryDetailsissueEventsUrl.setText(Html.fromHtml("<strong>IssueEventsUrl: </strong>" + String.valueOf(githubRepo.getIssueEventsUrl()))); repositoryDetailseventsUrl.setText(Html.fromHtml("<strong>EventsUrl: </strong>" + String.valueOf(githubRepo.getEventsUrl()))); repositoryDetailsassigneesUrl.setText(Html.fromHtml("<strong>AssigneesUrl: </strong>" + String.valueOf(githubRepo.getAssigneesUrl()))); repositoryDetailsbranchesUrl.setText(Html.fromHtml("<strong>BranchesUrl: </strong>" + String.valueOf(githubRepo.getBranchesUrl()))); repositoryDetailstagsUrl.setText(Html.fromHtml("<strong>TagsUrl: </strong>" + String.valueOf(githubRepo.getTagsUrl()))); repositoryDetailsblobsUrl.setText(Html.fromHtml("<strong>BlobsUrl: </strong>" + String.valueOf(githubRepo.getBlobsUrl()))); repositoryDetailsgitTagsUrl.setText(Html.fromHtml("<strong>GitTagsUrl: </strong>" + String.valueOf(githubRepo.getGitTagsUrl()))); repositoryDetailsgitRefsUrl.setText(Html.fromHtml("<strong>GitRefsUrl: </strong>" + String.valueOf(githubRepo.getGitRefsUrl()))); repositoryDetailstreesUrl.setText(Html.fromHtml("<strong>TreesUrl: </strong>" + String.valueOf(githubRepo.getTreesUrl()))); repositoryDetailsstatusesUrl.setText(Html.fromHtml("<strong>StatusesUrl: </strong>" + String.valueOf(githubRepo.getStatusesUrl()))); repositoryDetailslanguagesUrl.setText(Html.fromHtml("<strong>LanguagesUrl: </strong>" + String.valueOf(githubRepo.getLanguagesUrl()))); repositoryDetailsstargazersUrl.setText(Html.fromHtml("<strong>StargazersUrl: </strong>" + String.valueOf(githubRepo.getStargazersUrl()))); repositoryDetailscontributorsUrl.setText(Html.fromHtml("<strong>ContributorsUrl: </strong>" + String.valueOf(githubRepo.getContributorsUrl()))); repositoryDetailssubscribersUrl.setText(Html.fromHtml("<strong>SubscribersUrl: </strong>" + String.valueOf(githubRepo.getSubscribersUrl()))); repositoryDetailssubscriptionUrl.setText(Html.fromHtml("<strong>SubscriptionUrl: </strong>" + String.valueOf(githubRepo.getSubscriptionUrl()))); repositoryDetailscommitsUrl.setText(Html.fromHtml("<strong>CommitsUrl: </strong>" + String.valueOf(githubRepo.getCommitsUrl()))); repositoryDetailsgitCommitsUrl.setText(Html.fromHtml("<strong>GitCommitsUrl: </strong>" + String.valueOf(githubRepo.getGitCommitsUrl()))); repositoryDetailscommentsUrl.setText(Html.fromHtml("<strong>CommentsUrl: </strong>" + String.valueOf(githubRepo.getCommentsUrl()))); repositoryDetailsissueCommentUrl.setText(Html.fromHtml("<strong>IssueCommentUrl: </strong>" + String.valueOf(githubRepo.getIssueCommentUrl()))); repositoryDetailscontentsUrl.setText(Html.fromHtml("<strong>ContentsUrl: </strong>" + String.valueOf(githubRepo.getContentsUrl()))); repositoryDetailscompareUrl.setText(Html.fromHtml("<strong>CompareUrl: </strong>" + String.valueOf(githubRepo.getCompareUrl()))); repositoryDetailsmergesUrl.setText(Html.fromHtml("<strong>MergesUrl: </strong>" + String.valueOf(githubRepo.getMergesUrl()))); repositoryDetailsarchiveUrl.setText(Html.fromHtml("<strong>ArchiveUrl: </strong>" + String.valueOf(githubRepo.getArchiveUrl()))); repositoryDetailsdownloadsUrl.setText(Html.fromHtml("<strong>DownloadsUrl: </strong>" + String.valueOf(githubRepo.getDownloadsUrl()))); repositoryDetailsissuesUrl.setText(Html.fromHtml("<strong>IssuesUrl: </strong>" + String.valueOf(githubRepo.getIssuesUrl()))); repositoryDetailspullsUrl.setText(Html.fromHtml("<strong>PullsUrl: </strong>" + String.valueOf(githubRepo.getPullsUrl()))); repositoryDetailsmilestonesUrl.setText(Html.fromHtml("<strong>MilestonesUrl: </strong>" + String.valueOf(githubRepo.getMilestonesUrl()))); repositoryDetailsnotificationsUrl.setText(Html.fromHtml("<strong>NotificationsUrl: </strong>" + String.valueOf(githubRepo.getNotificationsUrl()))); repositoryDetailslabelsUrl.setText(Html.fromHtml("<strong>LabelsUrl: </strong>" + String.valueOf(githubRepo.getLabelsUrl()))); repositoryDetailsreleasesUrl.setText(Html.fromHtml("<strong>ReleasesUrl: </strong>" + String.valueOf(githubRepo.getReleasesUrl()))); repositoryDetailsdeploymentsUrl.setText(Html.fromHtml("<strong>DeploymentsUrl: </strong>" + String.valueOf(githubRepo.getDeploymentsUrl()))); repositoryDetailscreatedAt.setText(Html.fromHtml("<strong>CreatedAt: </strong>" + String.valueOf(githubRepo.getCreatedAt()))); repositoryDetailsupdatedAt.setText(Html.fromHtml("<strong>UpdatedAt: </strong>" + String.valueOf(githubRepo.getUpdatedAt()))); repositoryDetailspushedAt.setText(Html.fromHtml("<strong>PushedAt: </strong>" + String.valueOf(githubRepo.getPushedAt()))); repositoryDetailsgitUrl.setText(Html.fromHtml("<strong>GitUrl: </strong>" + String.valueOf(githubRepo.getGitUrl()))); repositoryDetailssshUrl.setText(Html.fromHtml("<strong>SshUrl: </strong>" + String.valueOf(githubRepo.getSshUrl()))); repositoryDetailscloneUrl.setText(Html.fromHtml("<strong>CloneUrl: </strong>" + String.valueOf(githubRepo.getCloneUrl()))); repositoryDetailssvnUrl.setText(Html.fromHtml("<strong>SvnUrl: </strong>" + String.valueOf(githubRepo.getSvnUrl()))); repositoryDetailshomepage.setText(Html.fromHtml("<strong>Homepage: </strong>" + String.valueOf(githubRepo.getHomepage()))); repositoryDetailssize.setText(Html.fromHtml("<strong>Size: </strong>" + String.valueOf(githubRepo.getSize()))); repositoryDetailsstargazersCount.setText(Html.fromHtml("<strong>StargazersCount: </strong>" + String.valueOf(githubRepo.getStargazersCount()))); repositoryDetailswatchersCount.setText(Html.fromHtml("<strong>WatchersCount: </strong>" + String.valueOf(githubRepo.getWatchersCount()))); repositoryDetailslanguage.setText(Html.fromHtml("<strong>Language: </strong>" + String.valueOf(githubRepo.getLanguage()))); repositoryDetailshasIssues.setText(Html.fromHtml("<strong>HasIssues: </strong>" + String.valueOf(githubRepo.getHasIssues()))); repositoryDetailshasDownloads.setText(Html.fromHtml("<strong>HasDownloads: </strong>" + String.valueOf(githubRepo.getHasDownloads()))); repositoryDetailshasWiki.setText(Html.fromHtml("<strong>HasWiki: </strong>" + String.valueOf(githubRepo.getHasWiki()))); repositoryDetailshasPages.setText(Html.fromHtml("<strong>HasPages: </strong>" + String.valueOf(githubRepo.getHasPages()))); repositoryDetailsforksCount.setText(Html.fromHtml("<strong>ForksCount: </strong>" + String.valueOf(githubRepo.getForksCount()))); repositoryDetailsmirrorUrl.setText(Html.fromHtml("<strong>MirrorUrl: </strong>" + String.valueOf(githubRepo.getMirrorUrl()))); repositoryDetailsopenIssuesCount.setText(Html.fromHtml("<strong>OpenIssuesCount: </strong>" + String.valueOf(githubRepo.getOpenIssuesCount()))); repositoryDetailsforks.setText(Html.fromHtml("<strong>Forks: </strong>" + String.valueOf(githubRepo.getForks()))); repositoryDetailsopenIssues.setText(Html.fromHtml("<strong>OpenIssues: </strong>" + String.valueOf(githubRepo.getOpenIssues()))); repositoryDetailswatchers.setText(Html.fromHtml("<strong>Watchers: </strong>" + String.valueOf(githubRepo.getWatchers()))); repositoryDetailsdefaultBranch.setText(Html.fromHtml("<strong>DefaultBranch: </strong>" + String.valueOf(githubRepo.getDefaultBranch()))); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsPresenter.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsPresenter.java
package com.zhuinden.examplegithubclient.presentation.paths.repositorydetails; import com.zhuinden.examplegithubclient.application.injection.KeyScope; import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo; import com.zhuinden.examplegithubclient.util.BasePresenter; import com.zhuinden.examplegithubclient.util.Presenter; import javax.inject.Inject; /** * Created by Zhuinden on 2016.12.19.. */ @KeyScope(RepositoryDetailsKey.class) public class RepositoryDetailsPresenter extends BasePresenter<RepositoryDetailsPresenter.ViewContract> { public interface ViewContract extends Presenter.ViewContract { GithubRepo getSelectedGithubRepo(); void setupView(GithubRepo githubRepo); } @Inject public RepositoryDetailsPresenter() { } GithubRepo selectedGithubRepo; @Override protected void initializeView(ViewContract view) { selectedGithubRepo = view.getSelectedGithubRepo(); if(selectedGithubRepo != null) { // proper persistence would fix this across process death view.setupView(selectedGithubRepo); } } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsComponent.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsComponent.java
package com.zhuinden.examplegithubclient.presentation.paths.repositorydetails; import com.zhuinden.examplegithubclient.application.injection.KeyScope; import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent; import dagger.Component; /** * Created by Owner on 2016.12.10. */ @KeyScope(RepositoryDetailsKey.class) @Component(dependencies = MainComponent.class) public interface RepositoryDetailsComponent { RepositoryDetailsPresenter repositoryDetailsPresenter(); void inject(RepositoryDetailsView repositoryDetailsView); }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesKey.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesKey.java
package com.zhuinden.examplegithubclient.presentation.paths.repositories; import android.os.Parcelable; import com.google.auto.value.AutoValue; import com.zhuinden.examplegithubclient.R; import com.zhuinden.examplegithubclient.util.ComponentFactory; import com.zhuinden.examplegithubclient.util.Layout; import com.zhuinden.examplegithubclient.util.Title; /** * Created by Zhuinden on 2016.12.10.. */ @AutoValue @Title(R.string.title_repositories) @Layout(R.layout.path_repositories) @ComponentFactory(RepositoriesComponentFactory.class) public abstract class RepositoriesKey implements Parcelable { public static RepositoriesKey create() { return new AutoValue_RepositoriesKey(); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesComponentFactory.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesComponentFactory.java
package com.zhuinden.examplegithubclient.presentation.paths.repositories; import android.content.Context; import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent; import com.zhuinden.examplegithubclient.util.ComponentFactory; import com.zhuinden.examplegithubclient.util.DaggerService; /** * Created by Owner on 2016.12.10. */ public class RepositoriesComponentFactory implements ComponentFactory.FactoryMethod<RepositoriesComponent> { @Override public RepositoriesComponent createComponent(Context context) { MainComponent mainComponent = DaggerService.getGlobalComponent(context); return DaggerRepositoriesComponent.builder().mainComponent(mainComponent).build(); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesAdapter.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesAdapter.java
package com.zhuinden.examplegithubclient.presentation.paths.repositories; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.zhuinden.examplegithubclient.R; import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo; import com.zhuinden.examplegithubclient.util.DaggerService; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; /** * Created by Zhuinden on 2016.12.18.. */ public class RepositoriesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @Inject RepositoriesPresenter repositoriesPresenter; static final int ROW = 0; static final int LOAD_MORE = 1; public RepositoriesAdapter(Context context) { RepositoriesComponent repositoriesComponent = DaggerService.getComponent(context); repositoriesComponent.inject(this); } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if(viewType == ROW) { return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_repositories_row, parent, false)); } else if(viewType == LOAD_MORE) { return new LoadMoreHolder(LayoutInflater.from(parent.getContext()) .inflate(R.layout.view_repositories_load_more_row, parent, false)); } throw new IllegalArgumentException("Invalid view type [" + viewType + "]"); } @Override public void onBindViewHolder(RecyclerView.ViewHolder abstractHolder, int position) { if(abstractHolder instanceof ViewHolder) { ViewHolder holder = (ViewHolder) abstractHolder; holder.bind(repositoriesPresenter.getRepositories().get(position)); } } @Override public int getItemCount() { return (repositoriesPresenter.getRepositories() == null ? 0 : repositoriesPresenter.getRepositories() .size()) + (repositoriesPresenter.didDownloadAll() ? 0 : 1); } @Override public int getItemViewType(int position) { if((repositoriesPresenter.getRepositories() == null && position == 0) || (position == repositoriesPresenter.getRepositories() .size()) && !repositoriesPresenter.didDownloadAll()) { return LOAD_MORE; } return ROW; } public void updateRepositories() { notifyDataSetChanged(); } public static class ViewHolder extends RecyclerView.ViewHolder { @Inject RepositoriesPresenter repositoriesPresenter; @BindView(R.id.repositories_row_text) TextView row; private GithubRepo githubRepo; @OnClick(R.id.repositories_row) public void rowClicked() { repositoriesPresenter.openRepository(githubRepo); } public ViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); RepositoriesComponent repositoriesComponent = DaggerService.getComponent(itemView.getContext()); repositoriesComponent.inject(this); } public void bind(GithubRepo githubRepo) { this.githubRepo = githubRepo; row.setText(githubRepo.getName()); } } public static class LoadMoreHolder extends RecyclerView.ViewHolder { public LoadMoreHolder(View itemView) { super(itemView); } } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesPresenter.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesPresenter.java
package com.zhuinden.examplegithubclient.presentation.paths.repositories; import android.os.Bundle; import android.support.annotation.Nullable; import com.zhuinden.examplegithubclient.application.injection.KeyScope; import com.zhuinden.examplegithubclient.data.model.GithubRepoDataSource; import com.zhuinden.examplegithubclient.data.repository.GithubRepoRepository; import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo; import com.zhuinden.examplegithubclient.domain.interactor.GetRepositoriesInteractor; import com.zhuinden.examplegithubclient.util.BasePresenter; import com.zhuinden.examplegithubclient.util.BundleFactory; import com.zhuinden.examplegithubclient.util.Presenter; import java.util.List; import javax.inject.Inject; import flowless.Bundleable; import io.reactivex.android.schedulers.AndroidSchedulers; /** * Created by Zhuinden on 2016.12.18.. */ @KeyScope(RepositoriesKey.class) public class RepositoriesPresenter extends BasePresenter<RepositoriesPresenter.ViewContract> implements Bundleable { static final String REPO_NAME = "square"; @Inject GetRepositoriesInteractor getRepositoriesInteractor; @Inject GithubRepoRepository githubRepoRepository; @Inject public RepositoriesPresenter() { } List<GithubRepo> repositories; GithubRepoDataSource.Unbinder unbinder; @Override protected void onAttach() { unbinder = githubRepoRepository.subscribe( // newRepositories -> { RepositoriesPresenter.this.repositories = newRepositories; updateRepositoriesInView(); }); } @Override protected void onDetach() { unbinder.unbind(); } public interface ViewContract extends Presenter.ViewContract { void updateRepositories(List<GithubRepo> repositories); void openRepository(String url); } int currentPage = 1; boolean isDownloading; boolean downloadedAll; public boolean didDownloadAll() { return downloadedAll; } private void downloadPage() { if(!downloadedAll) { isDownloading = true; getRepositoriesInteractor.getRepositories(REPO_NAME, currentPage) .observeOn(AndroidSchedulers.mainThread()) .subscribe(repositories -> { isDownloading = false; if(repositories.size() <= 0) { downloadedAll = true; } else { currentPage++; } }); } } @Override protected void initializeView(ViewContract view) { if(repositories == null || repositories.isEmpty()) { downloadPage(); } else { updateRepositoriesInView(); } } private void updateRepositoriesInView() { if(hasView()) { view.updateRepositories(repositories); } } public List<GithubRepo> getRepositories() { return repositories; } public void openRepository(GithubRepo githubRepo) { view.openRepository(githubRepo.getUrl()); } public void downloadMore() { if(!isDownloading) { downloadPage(); } } @Override public Bundle toBundle() { Bundle bundle = BundleFactory.create(); bundle.putInt("currentPage", currentPage); bundle.putBoolean("downloadedAll", downloadedAll); return bundle; } @Override public void fromBundle(@Nullable Bundle bundle) { if(bundle != null) { currentPage = bundle.getInt("currentPage"); downloadedAll = bundle.getBoolean("downloadedAll"); } } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesView.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesView.java
package com.zhuinden.examplegithubclient.presentation.paths.repositories; import android.annotation.TargetApi; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.widget.RelativeLayout; import com.zhuinden.examplegithubclient.R; import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo; import com.zhuinden.examplegithubclient.presentation.paths.repositorydetails.RepositoryDetailsKey; import com.zhuinden.examplegithubclient.util.BundleFactory; import com.zhuinden.examplegithubclient.util.DaggerService; import java.util.List; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; import flowless.Bundleable; import flowless.Flow; import flowless.preset.FlowLifecycles; /** * Created by Zhuinden on 2016.12.10.. */ public class RepositoriesView extends RelativeLayout implements FlowLifecycles.ViewLifecycleListener, RepositoriesPresenter.ViewContract, Bundleable { public RepositoriesView(Context context) { super(context); init(); } public RepositoriesView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public RepositoriesView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } @TargetApi(21) public RepositoriesView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(); } public void init() { if(!isInEditMode()) { RepositoriesComponent repositoriesComponent = DaggerService.getComponent(getContext()); repositoriesComponent.inject(this); } } @BindView(R.id.repositories_recycler) RecyclerView recyclerView; @Inject RepositoriesPresenter repositoriesPresenter; RepositoriesAdapter repositoriesAdapter; @Override protected void onFinishInflate() { super.onFinishInflate(); if(!isInEditMode()) { ButterKnife.bind(this); repositoriesAdapter = new RepositoriesAdapter(getContext()); recyclerView.setAdapter(repositoriesAdapter); recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false)); recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public final void onScrolled(RecyclerView recyclerView, int dx, int dy) { if(!recyclerView.canScrollVertically(1)) { onScrolledToBottom(); } } public void onScrolledToBottom() { repositoriesPresenter.downloadMore(); } }); } } @Override public void onViewRestored() { repositoriesPresenter.attachView(this); } @Override public void onViewDestroyed(boolean removedByFlow) { repositoriesPresenter.detachView(); } @Override public void updateRepositories(List<GithubRepo> repositories) { repositoriesAdapter.updateRepositories(); } @Override public void openRepository(String url) { Flow.get(this).set(RepositoryDetailsKey.create(Flow.getKey(this), url)); } @Override public Bundle toBundle() { Bundle bundle = BundleFactory.create(); bundle.putBundle("PRESENTER_STATE", repositoriesPresenter.toBundle()); return bundle; } @Override public void fromBundle(@Nullable Bundle bundle) { if(bundle != null) { repositoriesPresenter.fromBundle(bundle.getBundle("PRESENTER_STATE")); } } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesComponent.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesComponent.java
package com.zhuinden.examplegithubclient.presentation.paths.repositories; import com.zhuinden.examplegithubclient.application.injection.KeyScope; import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent; import dagger.Component; /** * Created by Owner on 2016.12.10. */ @KeyScope(RepositoriesKey.class) @Component(dependencies = MainComponent.class) public interface RepositoriesComponent { RepositoriesPresenter repositoriesPresenter(); void inject(RepositoriesView repositoriesView); void inject(RepositoriesAdapter repositoriesAdapter); void inject(RepositoriesAdapter.ViewHolder repositoriesViewHolder); }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/service/GithubService.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/service/GithubService.java
package com.zhuinden.examplegithubclient.domain.service; import com.zhuinden.examplegithubclient.domain.data.response.organization.Organization; import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo; import java.util.List; import io.reactivex.Single; /** * Created by Owner on 2016.12.10. */ public interface GithubService { Single<List<Organization>> getOrganizations(String user); Single<List<GithubRepo>> getRepositories(String user, int page); }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/service/impl/GithubServiceImpl.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/service/impl/GithubServiceImpl.java
package com.zhuinden.examplegithubclient.domain.service.impl; import com.zhuinden.examplegithubclient.application.injection.ActivityScope; import com.zhuinden.examplegithubclient.domain.data.response.organization.Organization; import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo; import com.zhuinden.examplegithubclient.domain.service.GithubService; import com.zhuinden.examplegithubclient.domain.service.retrofit.RetrofitGithubService; import java.util.List; import javax.inject.Inject; import io.reactivex.Single; /** * Created by Owner on 2016.12.10. */ @ActivityScope public class GithubServiceImpl implements GithubService { private RetrofitGithubService retrofitGithubService; @Inject public GithubServiceImpl(RetrofitGithubService retrofitGithubService) { this.retrofitGithubService = retrofitGithubService; } @Override public Single<List<Organization>> getOrganizations(String user) { return retrofitGithubService.getOrganizations(user); } @Override public Single<List<GithubRepo>> getRepositories(String user, int page) { return retrofitGithubService.getRepositories(user, page); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/service/retrofit/RetrofitGithubService.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/service/retrofit/RetrofitGithubService.java
package com.zhuinden.examplegithubclient.domain.service.retrofit; import com.zhuinden.examplegithubclient.domain.data.response.organization.Organization; import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo; import java.util.List; import io.reactivex.Single; import retrofit2.http.GET; import retrofit2.http.Path; import retrofit2.http.Query; /** * Created by Owner on 2016.12.10. */ public interface RetrofitGithubService { @GET("orgs/{user}/repos") Single<List<Organization>> getOrganizations(@Path("user") String user); @GET("users/{user}/repos") Single<List<GithubRepo>> getRepositories(@Path("user") String user, @Query("page") int page); }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/networking/HeaderInterceptor.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/networking/HeaderInterceptor.java
package com.zhuinden.examplegithubclient.domain.networking; import com.zhuinden.examplegithubclient.application.injection.ActivityScope; import java.io.IOException; import javax.inject.Inject; import okhttp3.Interceptor; import okhttp3.Response; /** * Created by Owner on 2016.12.10. */ @ActivityScope public class HeaderInterceptor implements Interceptor { @Inject public HeaderInterceptor() { } @Override public Response intercept(Chain chain) throws IOException { return chain.proceed( // chain.request().newBuilder() // .addHeader("Accept", "application/vnd.github.v3+json") // .build()); // } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/Owner.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/Owner.java
package com.zhuinden.examplegithubclient.domain.data.response; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; /** * Created by Owner on 2016.12.10. */ @JsonObject public class Owner { @JsonField(name = "login") private String login; @JsonField(name = "id") private Integer id; @JsonField(name = "avatar_url") private String avatarUrl; @JsonField(name = "gravatar_id") private String gravatarId; @JsonField(name = "url") private String url; @JsonField(name = "html_url") private String htmlUrl; @JsonField(name = "followers_url") private String followersUrl; @JsonField(name = "following_url") private String followingUrl; @JsonField(name = "gists_url") private String gistsUrl; @JsonField(name = "starred_url") private String starredUrl; @JsonField(name = "subscriptions_url") private String subscriptionsUrl; @JsonField(name = "organizations_url") private String organizationsUrl; @JsonField(name = "repos_url") private String reposUrl; @JsonField(name = "events_url") private String eventsUrl; @JsonField(name = "received_events_url") private String receivedEventsUrl; @JsonField(name = "type") private String type; @JsonField(name = "site_admin") private Boolean siteAdmin; /** * @return The login */ public String getLogin() { return login; } /** * @param login The login */ public void setLogin(String login) { this.login = login; } /** * @return The id */ public Integer getId() { return id; } /** * @param id The id */ public void setId(Integer id) { this.id = id; } /** * @return The avatarUrl */ public String getAvatarUrl() { return avatarUrl; } /** * @param avatarUrl The avatar_url */ public void setAvatarUrl(String avatarUrl) { this.avatarUrl = avatarUrl; } /** * @return The gravatarId */ public String getGravatarId() { return gravatarId; } /** * @param gravatarId The gravatar_id */ public void setGravatarId(String gravatarId) { this.gravatarId = gravatarId; } /** * @return The url */ public String getUrl() { return url; } /** * @param url The url */ public void setUrl(String url) { this.url = url; } /** * @return The htmlUrl */ public String getHtmlUrl() { return htmlUrl; } /** * @param htmlUrl The html_url */ public void setHtmlUrl(String htmlUrl) { this.htmlUrl = htmlUrl; } /** * @return The followersUrl */ public String getFollowersUrl() { return followersUrl; } /** * @param followersUrl The followers_url */ public void setFollowersUrl(String followersUrl) { this.followersUrl = followersUrl; } /** * @return The followingUrl */ public String getFollowingUrl() { return followingUrl; } /** * @param followingUrl The following_url */ public void setFollowingUrl(String followingUrl) { this.followingUrl = followingUrl; } /** * @return The gistsUrl */ public String getGistsUrl() { return gistsUrl; } /** * @param gistsUrl The gists_url */ public void setGistsUrl(String gistsUrl) { this.gistsUrl = gistsUrl; } /** * @return The starredUrl */ public String getStarredUrl() { return starredUrl; } /** * @param starredUrl The starred_url */ public void setStarredUrl(String starredUrl) { this.starredUrl = starredUrl; } /** * @return The subscriptionsUrl */ public String getSubscriptionsUrl() { return subscriptionsUrl; } /** * @param subscriptionsUrl The subscriptions_url */ public void setSubscriptionsUrl(String subscriptionsUrl) { this.subscriptionsUrl = subscriptionsUrl; } /** * @return The organizationsUrl */ public String getOrganizationsUrl() { return organizationsUrl; } /** * @param organizationsUrl The organizations_url */ public void setOrganizationsUrl(String organizationsUrl) { this.organizationsUrl = organizationsUrl; } /** * @return The reposUrl */ public String getReposUrl() { return reposUrl; } /** * @param reposUrl The repos_url */ public void setReposUrl(String reposUrl) { this.reposUrl = reposUrl; } /** * @return The eventsUrl */ public String getEventsUrl() { return eventsUrl; } /** * @param eventsUrl The events_url */ public void setEventsUrl(String eventsUrl) { this.eventsUrl = eventsUrl; } /** * @return The receivedEventsUrl */ public String getReceivedEventsUrl() { return receivedEventsUrl; } /** * @param receivedEventsUrl The received_events_url */ public void setReceivedEventsUrl(String receivedEventsUrl) { this.receivedEventsUrl = receivedEventsUrl; } /** * @return The type */ public String getType() { return type; } /** * @param type The type */ public void setType(String type) { this.type = type; } /** * @return The siteAdmin */ public Boolean getSiteAdmin() { return siteAdmin; } /** * @param siteAdmin The site_admin */ public void setSiteAdmin(Boolean siteAdmin) { this.siteAdmin = siteAdmin; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/organization/Organization.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/organization/Organization.java
package com.zhuinden.examplegithubclient.domain.data.response.organization; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; import com.zhuinden.examplegithubclient.domain.data.response.Owner; /** * Created by Owner on 2016.12.10. */ @JsonObject public class Organization { @JsonField(name = "id") private Integer id; @JsonField(name = "name") private String name; @JsonField(name = "full_name") private String fullName; @JsonField(name = "owner") private Owner owner; @JsonField(name = "private") private Boolean _private; @JsonField(name = "html_url") private String htmlUrl; @JsonField(name = "description") private String description; @JsonField(name = "fork") private Boolean fork; @JsonField(name = "url") private String url; @JsonField(name = "forks_url") private String forksUrl; @JsonField(name = "keys_url") private String keysUrl; @JsonField(name = "collaborators_url") private String collaboratorsUrl; @JsonField(name = "teams_url") private String teamsUrl; @JsonField(name = "hooks_url") private String hooksUrl; @JsonField(name = "issue_events_url") private String issueEventsUrl; @JsonField(name = "events_url") private String eventsUrl; @JsonField(name = "assignees_url") private String assigneesUrl; @JsonField(name = "branches_url") private String branchesUrl; @JsonField(name = "tags_url") private String tagsUrl; @JsonField(name = "blobs_url") private String blobsUrl; @JsonField(name = "git_tags_url") private String gitTagsUrl; @JsonField(name = "git_refs_url") private String gitRefsUrl; @JsonField(name = "trees_url") private String treesUrl; @JsonField(name = "statuses_url") private String statusesUrl; @JsonField(name = "languages_url") private String languagesUrl; @JsonField(name = "stargazers_url") private String stargazersUrl; @JsonField(name = "contributors_url") private String contributorsUrl; @JsonField(name = "subscribers_url") private String subscribersUrl; @JsonField(name = "subscription_url") private String subscriptionUrl; @JsonField(name = "commits_url") private String commitsUrl; @JsonField(name = "git_commits_url") private String gitCommitsUrl; @JsonField(name = "comments_url") private String commentsUrl; @JsonField(name = "issue_comment_url") private String issueCommentUrl; @JsonField(name = "contents_url") private String contentsUrl; @JsonField(name = "compare_url") private String compareUrl; @JsonField(name = "merges_url") private String mergesUrl; @JsonField(name = "archive_url") private String archiveUrl; @JsonField(name = "downloads_url") private String downloadsUrl; @JsonField(name = "issues_url") private String issuesUrl; @JsonField(name = "pulls_url") private String pullsUrl; @JsonField(name = "milestones_url") private String milestonesUrl; @JsonField(name = "notifications_url") private String notificationsUrl; @JsonField(name = "labels_url") private String labelsUrl; @JsonField(name = "releases_url") private String releasesUrl; @JsonField(name = "deployments_url") private String deploymentsUrl; @JsonField(name = "created_at") private String createdAt; @JsonField(name = "updated_at") private String updatedAt; @JsonField(name = "pushed_at") private String pushedAt; @JsonField(name = "git_url") private String gitUrl; @JsonField(name = "ssh_url") private String sshUrl; @JsonField(name = "clone_url") private String cloneUrl; @JsonField(name = "svn_url") private String svnUrl; @JsonField(name = "homepage") private String homepage; @JsonField(name = "size") private Integer size; @JsonField(name = "stargazers_count") private Integer stargazersCount; @JsonField(name = "watchers_count") private Integer watchersCount; @JsonField(name = "language") private String language; @JsonField(name = "has_issues") private Boolean hasIssues; @JsonField(name = "has_downloads") private Boolean hasDownloads; @JsonField(name = "has_wiki") private Boolean hasWiki; @JsonField(name = "has_pages") private Boolean hasPages; @JsonField(name = "forks_count") private Integer forksCount; @JsonField(name = "mirror_url") private Object mirrorUrl; @JsonField(name = "open_issues_count") private Integer openIssuesCount; @JsonField(name = "forks") private Integer forks; @JsonField(name = "open_issues") private Integer openIssues; @JsonField(name = "watchers") private Integer watchers; @JsonField(name = "default_branch") private String defaultBranch; @JsonField(name = "permissions") private Permission permissions; /** * @return The id */ public Integer getId() { return id; } /** * @param id The id */ public void setId(Integer id) { this.id = id; } /** * @return The name */ public String getName() { return name; } /** * @param name The name */ public void setName(String name) { this.name = name; } /** * @return The fullName */ public String getFullName() { return fullName; } /** * @param fullName The full_name */ public void setFullName(String fullName) { this.fullName = fullName; } /** * @return The owner */ public Owner getOwner() { return owner; } /** * @param owner The owner */ public void setOwner(Owner owner) { this.owner = owner; } /** * @return The _private */ public Boolean get_Private() { return _private; } /** * @param _private The private */ public void set_Private(Boolean _private) { this._private = _private; } /** * @return The htmlUrl */ public String getHtmlUrl() { return htmlUrl; } /** * @param htmlUrl The html_url */ public void setHtmlUrl(String htmlUrl) { this.htmlUrl = htmlUrl; } /** * @return The description */ public String getDescription() { return description; } /** * @param description The description */ public void setDescription(String description) { this.description = description; } /** * @return The fork */ public Boolean getFork() { return fork; } /** * @param fork The fork */ public void setFork(Boolean fork) { this.fork = fork; } /** * @return The url */ public String getUrl() { return url; } /** * @param url The url */ public void setUrl(String url) { this.url = url; } /** * @return The forksUrl */ public String getForksUrl() { return forksUrl; } /** * @param forksUrl The forks_url */ public void setForksUrl(String forksUrl) { this.forksUrl = forksUrl; } /** * @return The keysUrl */ public String getKeysUrl() { return keysUrl; } /** * @param keysUrl The keys_url */ public void setKeysUrl(String keysUrl) { this.keysUrl = keysUrl; } /** * @return The collaboratorsUrl */ public String getCollaboratorsUrl() { return collaboratorsUrl; } /** * @param collaboratorsUrl The collaborators_url */ public void setCollaboratorsUrl(String collaboratorsUrl) { this.collaboratorsUrl = collaboratorsUrl; } /** * @return The teamsUrl */ public String getTeamsUrl() { return teamsUrl; } /** * @param teamsUrl The teams_url */ public void setTeamsUrl(String teamsUrl) { this.teamsUrl = teamsUrl; } /** * @return The hooksUrl */ public String getHooksUrl() { return hooksUrl; } /** * @param hooksUrl The hooks_url */ public void setHooksUrl(String hooksUrl) { this.hooksUrl = hooksUrl; } /** * @return The issueEventsUrl */ public String getIssueEventsUrl() { return issueEventsUrl; } /** * @param issueEventsUrl The issue_events_url */ public void setIssueEventsUrl(String issueEventsUrl) { this.issueEventsUrl = issueEventsUrl; } /** * @return The eventsUrl */ public String getEventsUrl() { return eventsUrl; } /** * @param eventsUrl The events_url */ public void setEventsUrl(String eventsUrl) { this.eventsUrl = eventsUrl; } /** * @return The assigneesUrl */ public String getAssigneesUrl() { return assigneesUrl; } /** * @param assigneesUrl The assignees_url */ public void setAssigneesUrl(String assigneesUrl) { this.assigneesUrl = assigneesUrl; } /** * @return The branchesUrl */ public String getBranchesUrl() { return branchesUrl; } /** * @param branchesUrl The branches_url */ public void setBranchesUrl(String branchesUrl) { this.branchesUrl = branchesUrl; } /** * @return The tagsUrl */ public String getTagsUrl() { return tagsUrl; } /** * @param tagsUrl The tags_url */ public void setTagsUrl(String tagsUrl) { this.tagsUrl = tagsUrl; } /** * @return The blobsUrl */ public String getBlobsUrl() { return blobsUrl; } /** * @param blobsUrl The blobs_url */ public void setBlobsUrl(String blobsUrl) { this.blobsUrl = blobsUrl; } /** * @return The gitTagsUrl */ public String getGitTagsUrl() { return gitTagsUrl; } /** * @param gitTagsUrl The git_tags_url */ public void setGitTagsUrl(String gitTagsUrl) { this.gitTagsUrl = gitTagsUrl; } /** * @return The gitRefsUrl */ public String getGitRefsUrl() { return gitRefsUrl; } /** * @param gitRefsUrl The git_refs_url */ public void setGitRefsUrl(String gitRefsUrl) { this.gitRefsUrl = gitRefsUrl; } /** * @return The treesUrl */ public String getTreesUrl() { return treesUrl; } /** * @param treesUrl The trees_url */ public void setTreesUrl(String treesUrl) { this.treesUrl = treesUrl; } /** * @return The statusesUrl */ public String getStatusesUrl() { return statusesUrl; } /** * @param statusesUrl The statuses_url */ public void setStatusesUrl(String statusesUrl) { this.statusesUrl = statusesUrl; } /** * @return The languagesUrl */ public String getLanguagesUrl() { return languagesUrl; } /** * @param languagesUrl The languages_url */ public void setLanguagesUrl(String languagesUrl) { this.languagesUrl = languagesUrl; } /** * @return The stargazersUrl */ public String getStargazersUrl() { return stargazersUrl; } /** * @param stargazersUrl The stargazers_url */ public void setStargazersUrl(String stargazersUrl) { this.stargazersUrl = stargazersUrl; } /** * @return The contributorsUrl */ public String getContributorsUrl() { return contributorsUrl; } /** * @param contributorsUrl The contributors_url */ public void setContributorsUrl(String contributorsUrl) { this.contributorsUrl = contributorsUrl; } /** * @return The subscribersUrl */ public String getSubscribersUrl() { return subscribersUrl; } /** * @param subscribersUrl The subscribers_url */ public void setSubscribersUrl(String subscribersUrl) { this.subscribersUrl = subscribersUrl; } /** * @return The subscriptionUrl */ public String getSubscriptionUrl() { return subscriptionUrl; } /** * @param subscriptionUrl The subscription_url */ public void setSubscriptionUrl(String subscriptionUrl) { this.subscriptionUrl = subscriptionUrl; } /** * @return The commitsUrl */ public String getCommitsUrl() { return commitsUrl; } /** * @param commitsUrl The commits_url */ public void setCommitsUrl(String commitsUrl) { this.commitsUrl = commitsUrl; } /** * @return The gitCommitsUrl */ public String getGitCommitsUrl() { return gitCommitsUrl; } /** * @param gitCommitsUrl The git_commits_url */ public void setGitCommitsUrl(String gitCommitsUrl) { this.gitCommitsUrl = gitCommitsUrl; } /** * @return The commentsUrl */ public String getCommentsUrl() { return commentsUrl; } /** * @param commentsUrl The comments_url */ public void setCommentsUrl(String commentsUrl) { this.commentsUrl = commentsUrl; } /** * @return The issueCommentUrl */ public String getIssueCommentUrl() { return issueCommentUrl; } /** * @param issueCommentUrl The issue_comment_url */ public void setIssueCommentUrl(String issueCommentUrl) { this.issueCommentUrl = issueCommentUrl; } /** * @return The contentsUrl */ public String getContentsUrl() { return contentsUrl; } /** * @param contentsUrl The contents_url */ public void setContentsUrl(String contentsUrl) { this.contentsUrl = contentsUrl; } /** * @return The compareUrl */ public String getCompareUrl() { return compareUrl; } /** * @param compareUrl The compare_url */ public void setCompareUrl(String compareUrl) { this.compareUrl = compareUrl; } /** * @return The mergesUrl */ public String getMergesUrl() { return mergesUrl; } /** * @param mergesUrl The merges_url */ public void setMergesUrl(String mergesUrl) { this.mergesUrl = mergesUrl; } /** * @return The archiveUrl */ public String getArchiveUrl() { return archiveUrl; } /** * @param archiveUrl The archive_url */ public void setArchiveUrl(String archiveUrl) { this.archiveUrl = archiveUrl; } /** * @return The downloadsUrl */ public String getDownloadsUrl() { return downloadsUrl; } /** * @param downloadsUrl The downloads_url */ public void setDownloadsUrl(String downloadsUrl) { this.downloadsUrl = downloadsUrl; } /** * @return The issuesUrl */ public String getIssuesUrl() { return issuesUrl; } /** * @param issuesUrl The issues_url */ public void setIssuesUrl(String issuesUrl) { this.issuesUrl = issuesUrl; } /** * @return The pullsUrl */ public String getPullsUrl() { return pullsUrl; } /** * @param pullsUrl The pulls_url */ public void setPullsUrl(String pullsUrl) { this.pullsUrl = pullsUrl; } /** * @return The milestonesUrl */ public String getMilestonesUrl() { return milestonesUrl; } /** * @param milestonesUrl The milestones_url */ public void setMilestonesUrl(String milestonesUrl) { this.milestonesUrl = milestonesUrl; } /** * @return The notificationsUrl */ public String getNotificationsUrl() { return notificationsUrl; } /** * @param notificationsUrl The notifications_url */ public void setNotificationsUrl(String notificationsUrl) { this.notificationsUrl = notificationsUrl; } /** * @return The labelsUrl */ public String getLabelsUrl() { return labelsUrl; } /** * @param labelsUrl The labels_url */ public void setLabelsUrl(String labelsUrl) { this.labelsUrl = labelsUrl; } /** * @return The releasesUrl */ public String getReleasesUrl() { return releasesUrl; } /** * @param releasesUrl The releases_url */ public void setReleasesUrl(String releasesUrl) { this.releasesUrl = releasesUrl; } /** * @return The deploymentsUrl */ public String getDeploymentsUrl() { return deploymentsUrl; } /** * @param deploymentsUrl The deployments_url */ public void setDeploymentsUrl(String deploymentsUrl) { this.deploymentsUrl = deploymentsUrl; } /** * @return The createdAt */ public String getCreatedAt() { return createdAt; } /** * @param createdAt The created_at */ public void setCreatedAt(String createdAt) { this.createdAt = createdAt; } /** * @return The updatedAt */ public String getUpdatedAt() { return updatedAt; } /** * @param updatedAt The updated_at */ public void setUpdatedAt(String updatedAt) { this.updatedAt = updatedAt; } /** * @return The pushedAt */ public String getPushedAt() { return pushedAt; } /** * @param pushedAt The pushed_at */ public void setPushedAt(String pushedAt) { this.pushedAt = pushedAt; } /** * @return The gitUrl */ public String getGitUrl() { return gitUrl; } /** * @param gitUrl The git_url */ public void setGitUrl(String gitUrl) { this.gitUrl = gitUrl; } /** * @return The sshUrl */ public String getSshUrl() { return sshUrl; } /** * @param sshUrl The ssh_url */ public void setSshUrl(String sshUrl) { this.sshUrl = sshUrl; } /** * @return The cloneUrl */ public String getCloneUrl() { return cloneUrl; } /** * @param cloneUrl The clone_url */ public void setCloneUrl(String cloneUrl) { this.cloneUrl = cloneUrl; } /** * @return The svnUrl */ public String getSvnUrl() { return svnUrl; } /** * @param svnUrl The svn_url */ public void setSvnUrl(String svnUrl) { this.svnUrl = svnUrl; } /** * @return The homepage */ public String getHomepage() { return homepage; } /** * @param homepage The homepage */ public void setHomepage(String homepage) { this.homepage = homepage; } /** * @return The size */ public Integer getSize() { return size; } /** * @param size The size */ public void setSize(Integer size) { this.size = size; } /** * @return The stargazersCount */ public Integer getStargazersCount() { return stargazersCount; } /** * @param stargazersCount The stargazers_count */ public void setStargazersCount(Integer stargazersCount) { this.stargazersCount = stargazersCount; } /** * @return The watchersCount */ public Integer getWatchersCount() { return watchersCount; } /** * @param watchersCount The watchers_count */ public void setWatchersCount(Integer watchersCount) { this.watchersCount = watchersCount; } /** * @return The language */ public String getLanguage() { return language; } /** * @param language The language */ public void setLanguage(String language) { this.language = language; } /** * @return The hasIssues */ public Boolean getHasIssues() { return hasIssues; } /** * @param hasIssues The has_issues */ public void setHasIssues(Boolean hasIssues) { this.hasIssues = hasIssues; } /** * @return The hasDownloads */ public Boolean getHasDownloads() { return hasDownloads; } /** * @param hasDownloads The has_downloads */ public void setHasDownloads(Boolean hasDownloads) { this.hasDownloads = hasDownloads; } /** * @return The hasWiki */ public Boolean getHasWiki() { return hasWiki; } /** * @param hasWiki The has_wiki */ public void setHasWiki(Boolean hasWiki) { this.hasWiki = hasWiki; } /** * @return The hasPages */ public Boolean getHasPages() { return hasPages; } /** * @param hasPages The has_pages */ public void setHasPages(Boolean hasPages) { this.hasPages = hasPages; } /** * @return The forksCount */ public Integer getForksCount() { return forksCount; } /** * @param forksCount The forks_count */ public void setForksCount(Integer forksCount) { this.forksCount = forksCount; } /** * @return The mirrorUrl */ public Object getMirrorUrl() { return mirrorUrl; } /** * @param mirrorUrl The mirror_url */ public void setMirrorUrl(Object mirrorUrl) { this.mirrorUrl = mirrorUrl; } /** * @return The openIssuesCount */ public Integer getOpenIssuesCount() { return openIssuesCount; } /** * @param openIssuesCount The open_issues_count */ public void setOpenIssuesCount(Integer openIssuesCount) { this.openIssuesCount = openIssuesCount; } /** * @return The forks */ public Integer getForks() { return forks; } /** * @param forks The forks */ public void setForks(Integer forks) { this.forks = forks; } /** * @return The openIssues */ public Integer getOpenIssues() { return openIssues; } /** * @param openIssues The open_issues */ public void setOpenIssues(Integer openIssues) { this.openIssues = openIssues; } /** * @return The watchers */ public Integer getWatchers() { return watchers; } /** * @param watchers The watchers */ public void setWatchers(Integer watchers) { this.watchers = watchers; } /** * @return The defaultBranch */ public String getDefaultBranch() { return defaultBranch; } /** * @param defaultBranch The default_branch */ public void setDefaultBranch(String defaultBranch) { this.defaultBranch = defaultBranch; } /** * @return The permissions */ public Permission getPermissions() { return permissions; } /** * @param permissions The permissions */ public void setPermissions(Permission permissions) { this.permissions = permissions; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/organization/Permission.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/organization/Permission.java
package com.zhuinden.examplegithubclient.domain.data.response.organization; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; /** * Created by Owner on 2016.12.10. */ @JsonObject public class Permission { @JsonField(name = "admin") private Boolean admin; @JsonField(name = "push") private Boolean push; @JsonField(name = "pull") private Boolean pull; /** * @return The admin */ public Boolean getAdmin() { return admin; } /** * @param admin The admin */ public void setAdmin(Boolean admin) { this.admin = admin; } /** * @return The push */ public Boolean getPush() { return push; } /** * @param push The push */ public void setPush(Boolean push) { this.push = push; } /** * @return The pull */ public Boolean getPull() { return pull; } /** * @param pull The pull */ public void setPull(Boolean pull) { this.pull = pull; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/error/Error.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/error/Error.java
package com.zhuinden.examplegithubclient.domain.data.response.error; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; @JsonObject public class Error { @JsonField(name = "resource") private String resource; @JsonField(name = "field") private String field; @JsonField(name = "code") private String code; /** * @return The resource */ public String getResource() { return resource; } /** * @param resource The resource */ public void setResource(String resource) { this.resource = resource; } /** * @return The field */ public String getField() { return field; } /** * @param field The field */ public void setField(String field) { this.field = field; } /** * @return The code */ public String getCode() { return code; } /** * @param code The code */ public void setCode(String code) { this.code = code; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/error/ErrorResponse.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/error/ErrorResponse.java
package com.zhuinden.examplegithubclient.domain.data.response.error; /** * Created by Owner on 2016.12.10. */ import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; import java.util.List; @JsonObject public class ErrorResponse { @JsonField(name = "message") private String message; @JsonField(name = "errors") private List<Error> errors = null; @JsonField(name = "documentation_url") private String documentationUrl; /** * @return The message */ public String getMessage() { return message; } /** * @param message The message */ public void setMessage(String message) { this.message = message; } /** * @return The errors */ public List<Error> getErrors() { return errors; } /** * @param errors The errors */ public void setErrors(List<Error> errors) { this.errors = errors; } public String getDocumentationUrl() { return documentationUrl; } public void setDocumentationUrl(String documentationUrl) { this.documentationUrl = documentationUrl; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/repositories/GithubRepo.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/repositories/GithubRepo.java
package com.zhuinden.examplegithubclient.domain.data.response.repositories; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; import com.zhuinden.examplegithubclient.domain.data.response.Owner; @JsonObject public class GithubRepo { @JsonField(name = "id") private Integer id; @JsonField(name = "name") private String name; @JsonField(name = "full_name") private String fullName; @JsonField(name = "owner") private Owner owner; @JsonField(name = "private") private Boolean _private; @JsonField(name = "html_url") private String htmlUrl; @JsonField(name = "description") private String description; @JsonField(name = "fork") private Boolean fork; @JsonField(name = "url") private String url; @JsonField(name = "forks_url") private String forksUrl; @JsonField(name = "keys_url") private String keysUrl; @JsonField(name = "collaborators_url") private String collaboratorsUrl; @JsonField(name = "teams_url") private String teamsUrl; @JsonField(name = "hooks_url") private String hooksUrl; @JsonField(name = "issue_events_url") private String issueEventsUrl; @JsonField(name = "events_url") private String eventsUrl; @JsonField(name = "assignees_url") private String assigneesUrl; @JsonField(name = "branches_url") private String branchesUrl; @JsonField(name = "tags_url") private String tagsUrl; @JsonField(name = "blobs_url") private String blobsUrl; @JsonField(name = "git_tags_url") private String gitTagsUrl; @JsonField(name = "git_refs_url") private String gitRefsUrl; @JsonField(name = "trees_url") private String treesUrl; @JsonField(name = "statuses_url") private String statusesUrl; @JsonField(name = "languages_url") private String languagesUrl; @JsonField(name = "stargazers_url") private String stargazersUrl; @JsonField(name = "contributors_url") private String contributorsUrl; @JsonField(name = "subscribers_url") private String subscribersUrl; @JsonField(name = "subscription_url") private String subscriptionUrl; @JsonField(name = "commits_url") private String commitsUrl; @JsonField(name = "git_commits_url") private String gitCommitsUrl; @JsonField(name = "comments_url") private String commentsUrl; @JsonField(name = "issue_comment_url") private String issueCommentUrl; @JsonField(name = "contents_url") private String contentsUrl; @JsonField(name = "compare_url") private String compareUrl; @JsonField(name = "merges_url") private String mergesUrl; @JsonField(name = "archive_url") private String archiveUrl; @JsonField(name = "downloads_url") private String downloadsUrl; @JsonField(name = "issues_url") private String issuesUrl; @JsonField(name = "pulls_url") private String pullsUrl; @JsonField(name = "milestones_url") private String milestonesUrl; @JsonField(name = "notifications_url") private String notificationsUrl; @JsonField(name = "labels_url") private String labelsUrl; @JsonField(name = "releases_url") private String releasesUrl; @JsonField(name = "deployments_url") private String deploymentsUrl; @JsonField(name = "created_at") private String createdAt; @JsonField(name = "updated_at") private String updatedAt; @JsonField(name = "pushed_at") private String pushedAt; @JsonField(name = "git_url") private String gitUrl; @JsonField(name = "ssh_url") private String sshUrl; @JsonField(name = "clone_url") private String cloneUrl; @JsonField(name = "svn_url") private String svnUrl; @JsonField(name = "homepage") private String homepage; @JsonField(name = "size") private Integer size; @JsonField(name = "stargazers_count") private Integer stargazersCount; @JsonField(name = "watchers_count") private Integer watchersCount; @JsonField(name = "language") private String language; @JsonField(name = "has_issues") private Boolean hasIssues; @JsonField(name = "has_downloads") private Boolean hasDownloads; @JsonField(name = "has_wiki") private Boolean hasWiki; @JsonField(name = "has_pages") private Boolean hasPages; @JsonField(name = "forks_count") private Integer forksCount; @JsonField(name = "mirror_url") private String mirrorUrl; @JsonField(name = "open_issues_count") private Integer openIssuesCount; @JsonField(name = "forks") private Integer forks; @JsonField(name = "open_issues") private Integer openIssues; @JsonField(name = "watchers") private Integer watchers; @JsonField(name = "default_branch") private String defaultBranch; /** * @return The id */ public Integer getId() { return id; } /** * @param id The id */ public void setId(Integer id) { this.id = id; } /** * @return The name */ public String getName() { return name; } /** * @param name The name */ public void setName(String name) { this.name = name; } /** * @return The fullName */ public String getFullName() { return fullName; } /** * @param fullName The full_name */ public void setFullName(String fullName) { this.fullName = fullName; } /** * @return The owner */ public Owner getOwner() { return owner; } /** * @param owner The owner */ public void setOwner(Owner owner) { this.owner = owner; } /** * @return The _private */ public Boolean get_Private() { return _private; } /** * @param _private The private */ public void set_Private(Boolean _private) { this._private = _private; } /** * @return The htmlUrl */ public String getHtmlUrl() { return htmlUrl; } /** * @param htmlUrl The html_url */ public void setHtmlUrl(String htmlUrl) { this.htmlUrl = htmlUrl; } /** * @return The description */ public String getDescription() { return description; } /** * @param description The description */ public void setDescription(String description) { this.description = description; } /** * @return The fork */ public Boolean getFork() { return fork; } /** * @param fork The fork */ public void setFork(Boolean fork) { this.fork = fork; } /** * @return The url */ public String getUrl() { return url; } /** * @param url The url */ public void setUrl(String url) { this.url = url; } /** * @return The forksUrl */ public String getForksUrl() { return forksUrl; } /** * @param forksUrl The forks_url */ public void setForksUrl(String forksUrl) { this.forksUrl = forksUrl; } /** * @return The keysUrl */ public String getKeysUrl() { return keysUrl; } /** * @param keysUrl The keys_url */ public void setKeysUrl(String keysUrl) { this.keysUrl = keysUrl; } /** * @return The collaboratorsUrl */ public String getCollaboratorsUrl() { return collaboratorsUrl; } /** * @param collaboratorsUrl The collaborators_url */ public void setCollaboratorsUrl(String collaboratorsUrl) { this.collaboratorsUrl = collaboratorsUrl; } /** * @return The teamsUrl */ public String getTeamsUrl() { return teamsUrl; } /** * @param teamsUrl The teams_url */ public void setTeamsUrl(String teamsUrl) { this.teamsUrl = teamsUrl; } /** * @return The hooksUrl */ public String getHooksUrl() { return hooksUrl; } /** * @param hooksUrl The hooks_url */ public void setHooksUrl(String hooksUrl) { this.hooksUrl = hooksUrl; } /** * @return The issueEventsUrl */ public String getIssueEventsUrl() { return issueEventsUrl; } /** * @param issueEventsUrl The issue_events_url */ public void setIssueEventsUrl(String issueEventsUrl) { this.issueEventsUrl = issueEventsUrl; } /** * @return The eventsUrl */ public String getEventsUrl() { return eventsUrl; } /** * @param eventsUrl The events_url */ public void setEventsUrl(String eventsUrl) { this.eventsUrl = eventsUrl; } /** * @return The assigneesUrl */ public String getAssigneesUrl() { return assigneesUrl; } /** * @param assigneesUrl The assignees_url */ public void setAssigneesUrl(String assigneesUrl) { this.assigneesUrl = assigneesUrl; } /** * @return The branchesUrl */ public String getBranchesUrl() { return branchesUrl; } /** * @param branchesUrl The branches_url */ public void setBranchesUrl(String branchesUrl) { this.branchesUrl = branchesUrl; } /** * @return The tagsUrl */ public String getTagsUrl() { return tagsUrl; } /** * @param tagsUrl The tags_url */ public void setTagsUrl(String tagsUrl) { this.tagsUrl = tagsUrl; } /** * @return The blobsUrl */ public String getBlobsUrl() { return blobsUrl; } /** * @param blobsUrl The blobs_url */ public void setBlobsUrl(String blobsUrl) { this.blobsUrl = blobsUrl; } /** * @return The gitTagsUrl */ public String getGitTagsUrl() { return gitTagsUrl; } /** * @param gitTagsUrl The git_tags_url */ public void setGitTagsUrl(String gitTagsUrl) { this.gitTagsUrl = gitTagsUrl; } /** * @return The gitRefsUrl */ public String getGitRefsUrl() { return gitRefsUrl; } /** * @param gitRefsUrl The git_refs_url */ public void setGitRefsUrl(String gitRefsUrl) { this.gitRefsUrl = gitRefsUrl; } /** * @return The treesUrl */ public String getTreesUrl() { return treesUrl; } /** * @param treesUrl The trees_url */ public void setTreesUrl(String treesUrl) { this.treesUrl = treesUrl; } /** * @return The statusesUrl */ public String getStatusesUrl() { return statusesUrl; } /** * @param statusesUrl The statuses_url */ public void setStatusesUrl(String statusesUrl) { this.statusesUrl = statusesUrl; } /** * @return The languagesUrl */ public String getLanguagesUrl() { return languagesUrl; } /** * @param languagesUrl The languages_url */ public void setLanguagesUrl(String languagesUrl) { this.languagesUrl = languagesUrl; } /** * @return The stargazersUrl */ public String getStargazersUrl() { return stargazersUrl; } /** * @param stargazersUrl The stargazers_url */ public void setStargazersUrl(String stargazersUrl) { this.stargazersUrl = stargazersUrl; } /** * @return The contributorsUrl */ public String getContributorsUrl() { return contributorsUrl; } /** * @param contributorsUrl The contributors_url */ public void setContributorsUrl(String contributorsUrl) { this.contributorsUrl = contributorsUrl; } /** * @return The subscribersUrl */ public String getSubscribersUrl() { return subscribersUrl; } /** * @param subscribersUrl The subscribers_url */ public void setSubscribersUrl(String subscribersUrl) { this.subscribersUrl = subscribersUrl; } /** * @return The subscriptionUrl */ public String getSubscriptionUrl() { return subscriptionUrl; } /** * @param subscriptionUrl The subscription_url */ public void setSubscriptionUrl(String subscriptionUrl) { this.subscriptionUrl = subscriptionUrl; } /** * @return The commitsUrl */ public String getCommitsUrl() { return commitsUrl; } /** * @param commitsUrl The commits_url */ public void setCommitsUrl(String commitsUrl) { this.commitsUrl = commitsUrl; } /** * @return The gitCommitsUrl */ public String getGitCommitsUrl() { return gitCommitsUrl; } /** * @param gitCommitsUrl The git_commits_url */ public void setGitCommitsUrl(String gitCommitsUrl) { this.gitCommitsUrl = gitCommitsUrl; } /** * @return The commentsUrl */ public String getCommentsUrl() { return commentsUrl; } /** * @param commentsUrl The comments_url */ public void setCommentsUrl(String commentsUrl) { this.commentsUrl = commentsUrl; } /** * @return The issueCommentUrl */ public String getIssueCommentUrl() { return issueCommentUrl; } /** * @param issueCommentUrl The issue_comment_url */ public void setIssueCommentUrl(String issueCommentUrl) { this.issueCommentUrl = issueCommentUrl; } /** * @return The contentsUrl */ public String getContentsUrl() { return contentsUrl; } /** * @param contentsUrl The contents_url */ public void setContentsUrl(String contentsUrl) { this.contentsUrl = contentsUrl; } /** * @return The compareUrl */ public String getCompareUrl() { return compareUrl; } /** * @param compareUrl The compare_url */ public void setCompareUrl(String compareUrl) { this.compareUrl = compareUrl; } /** * @return The mergesUrl */ public String getMergesUrl() { return mergesUrl; } /** * @param mergesUrl The merges_url */ public void setMergesUrl(String mergesUrl) { this.mergesUrl = mergesUrl; } /** * @return The archiveUrl */ public String getArchiveUrl() { return archiveUrl; } /** * @param archiveUrl The archive_url */ public void setArchiveUrl(String archiveUrl) { this.archiveUrl = archiveUrl; } /** * @return The downloadsUrl */ public String getDownloadsUrl() { return downloadsUrl; } /** * @param downloadsUrl The downloads_url */ public void setDownloadsUrl(String downloadsUrl) { this.downloadsUrl = downloadsUrl; } /** * @return The issuesUrl */ public String getIssuesUrl() { return issuesUrl; } /** * @param issuesUrl The issues_url */ public void setIssuesUrl(String issuesUrl) { this.issuesUrl = issuesUrl; } /** * @return The pullsUrl */ public String getPullsUrl() { return pullsUrl; } /** * @param pullsUrl The pulls_url */ public void setPullsUrl(String pullsUrl) { this.pullsUrl = pullsUrl; } /** * @return The milestonesUrl */ public String getMilestonesUrl() { return milestonesUrl; } /** * @param milestonesUrl The milestones_url */ public void setMilestonesUrl(String milestonesUrl) { this.milestonesUrl = milestonesUrl; } /** * @return The notificationsUrl */ public String getNotificationsUrl() { return notificationsUrl; } /** * @param notificationsUrl The notifications_url */ public void setNotificationsUrl(String notificationsUrl) { this.notificationsUrl = notificationsUrl; } /** * @return The labelsUrl */ public String getLabelsUrl() { return labelsUrl; } /** * @param labelsUrl The labels_url */ public void setLabelsUrl(String labelsUrl) { this.labelsUrl = labelsUrl; } /** * @return The releasesUrl */ public String getReleasesUrl() { return releasesUrl; } /** * @param releasesUrl The releases_url */ public void setReleasesUrl(String releasesUrl) { this.releasesUrl = releasesUrl; } /** * @return The deploymentsUrl */ public String getDeploymentsUrl() { return deploymentsUrl; } /** * @param deploymentsUrl The deployments_url */ public void setDeploymentsUrl(String deploymentsUrl) { this.deploymentsUrl = deploymentsUrl; } /** * @return The createdAt */ public String getCreatedAt() { return createdAt; } /** * @param createdAt The created_at */ public void setCreatedAt(String createdAt) { this.createdAt = createdAt; } /** * @return The updatedAt */ public String getUpdatedAt() { return updatedAt; } /** * @param updatedAt The updated_at */ public void setUpdatedAt(String updatedAt) { this.updatedAt = updatedAt; } /** * @return The pushedAt */ public String getPushedAt() { return pushedAt; } /** * @param pushedAt The pushed_at */ public void setPushedAt(String pushedAt) { this.pushedAt = pushedAt; } /** * @return The gitUrl */ public String getGitUrl() { return gitUrl; } /** * @param gitUrl The git_url */ public void setGitUrl(String gitUrl) { this.gitUrl = gitUrl; } /** * @return The sshUrl */ public String getSshUrl() { return sshUrl; } /** * @param sshUrl The ssh_url */ public void setSshUrl(String sshUrl) { this.sshUrl = sshUrl; } /** * @return The cloneUrl */ public String getCloneUrl() { return cloneUrl; } /** * @param cloneUrl The clone_url */ public void setCloneUrl(String cloneUrl) { this.cloneUrl = cloneUrl; } /** * @return The svnUrl */ public String getSvnUrl() { return svnUrl; } /** * @param svnUrl The svn_url */ public void setSvnUrl(String svnUrl) { this.svnUrl = svnUrl; } /** * @return The homepage */ public String getHomepage() { return homepage; } /** * @param homepage The homepage */ public void setHomepage(String homepage) { this.homepage = homepage; } /** * @return The size */ public Integer getSize() { return size; } /** * @param size The size */ public void setSize(Integer size) { this.size = size; } /** * @return The stargazersCount */ public Integer getStargazersCount() { return stargazersCount; } /** * @param stargazersCount The stargazers_count */ public void setStargazersCount(Integer stargazersCount) { this.stargazersCount = stargazersCount; } /** * @return The watchersCount */ public Integer getWatchersCount() { return watchersCount; } /** * @param watchersCount The watchers_count */ public void setWatchersCount(Integer watchersCount) { this.watchersCount = watchersCount; } /** * @return The language */ public String getLanguage() { return language; } /** * @param language The language */ public void setLanguage(String language) { this.language = language; } /** * @return The hasIssues */ public Boolean getHasIssues() { return hasIssues; } /** * @param hasIssues The has_issues */ public void setHasIssues(Boolean hasIssues) { this.hasIssues = hasIssues; } /** * @return The hasDownloads */ public Boolean getHasDownloads() { return hasDownloads; } /** * @param hasDownloads The has_downloads */ public void setHasDownloads(Boolean hasDownloads) { this.hasDownloads = hasDownloads; } /** * @return The hasWiki */ public Boolean getHasWiki() { return hasWiki; } /** * @param hasWiki The has_wiki */ public void setHasWiki(Boolean hasWiki) { this.hasWiki = hasWiki; } /** * @return The hasPages */ public Boolean getHasPages() { return hasPages; } /** * @param hasPages The has_pages */ public void setHasPages(Boolean hasPages) { this.hasPages = hasPages; } /** * @return The forksCount */ public Integer getForksCount() { return forksCount; } /** * @param forksCount The forks_count */ public void setForksCount(Integer forksCount) { this.forksCount = forksCount; } /** * @return The mirrorUrl */ public String getMirrorUrl() { return mirrorUrl; } /** * @param mirrorUrl The mirror_url */ public void setMirrorUrl(String mirrorUrl) { this.mirrorUrl = mirrorUrl; } /** * @return The openIssuesCount */ public Integer getOpenIssuesCount() { return openIssuesCount; } /** * @param openIssuesCount The open_issues_count */ public void setOpenIssuesCount(Integer openIssuesCount) { this.openIssuesCount = openIssuesCount; } /** * @return The forks */ public Integer getForks() { return forks; } /** * @param forks The forks */ public void setForks(Integer forks) { this.forks = forks; } /** * @return The openIssues */ public Integer getOpenIssues() { return openIssues; } /** * @param openIssues The open_issues */ public void setOpenIssues(Integer openIssues) { this.openIssues = openIssues; } /** * @return The watchers */ public Integer getWatchers() { return watchers; } /** * @param watchers The watchers */ public void setWatchers(Integer watchers) { this.watchers = watchers; } /** * @return The defaultBranch */ public String getDefaultBranch() { return defaultBranch; } /** * @param defaultBranch The default_branch */ public void setDefaultBranch(String defaultBranch) { this.defaultBranch = defaultBranch; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/interactor/LoginInteractor.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/interactor/LoginInteractor.java
package com.zhuinden.examplegithubclient.domain.interactor; import io.reactivex.Single; /** * Created by Zhuinden on 2016.12.18.. */ public interface LoginInteractor { Single<Boolean> login(String username, String password); }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/interactor/GetRepositoriesInteractor.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/interactor/GetRepositoriesInteractor.java
package com.zhuinden.examplegithubclient.domain.interactor; import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo; import java.util.List; import io.reactivex.Single; /** * Created by Owner on 2016.12.10. */ public interface GetRepositoriesInteractor { Single<List<GithubRepo>> getRepositories(String user, int page); }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/interactor/impl/LoginInteractorImpl.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/interactor/impl/LoginInteractorImpl.java
package com.zhuinden.examplegithubclient.domain.interactor.impl; import com.zhuinden.examplegithubclient.application.injection.ActivityScope; import com.zhuinden.examplegithubclient.domain.interactor.LoginInteractor; import java.util.concurrent.TimeUnit; import javax.inject.Inject; import io.reactivex.Single; /** * Created by Zhuinden on 2016.12.18.. */ @ActivityScope public class LoginInteractorImpl implements LoginInteractor { @Inject public LoginInteractorImpl() { } @Override public Single<Boolean> login(String username, String password) { return Single.just(true).delay(3250, TimeUnit.MILLISECONDS); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/interactor/impl/GetRepositoriesInteractorImpl.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/interactor/impl/GetRepositoriesInteractorImpl.java
package com.zhuinden.examplegithubclient.domain.interactor.impl; import com.zhuinden.examplegithubclient.application.injection.ActivityScope; import com.zhuinden.examplegithubclient.data.repository.GithubRepoRepository; import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo; import com.zhuinden.examplegithubclient.domain.interactor.GetRepositoriesInteractor; import com.zhuinden.examplegithubclient.domain.service.GithubService; import java.util.List; import javax.inject.Inject; import io.reactivex.Single; /** * Created by Owner on 2016.12.10. */ @ActivityScope public class GetRepositoriesInteractorImpl implements GetRepositoriesInteractor { @Inject GithubService githubService; @Inject GithubRepoRepository githubRepoRepository; @Inject public GetRepositoriesInteractorImpl() { } @Override public Single<List<GithubRepo>> getRepositories(final String user, int page) { return githubService.getRepositories(user, page).map(repositories -> githubRepoRepository.saveOrUpdate(repositories)); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/CustomApplication.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/CustomApplication.java
package com.zhuinden.examplegithubclient.application; import android.app.Application; import com.zhuinden.examplegithubclient.util.idlingresource.FlowlessIdlingResource; import flowless.Flow; /** * Created by Zhuinden on 2016.12.09.. */ public class CustomApplication extends Application { private static CustomApplication INSTANCE; @Override public void onCreate() { super.onCreate(); INSTANCE = this; Flow.setFlowIdlingResource(FlowlessIdlingResource.INSTANCE); } public static CustomApplication get() { return INSTANCE; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/KeyScope.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/KeyScope.java
package com.zhuinden.examplegithubclient.application.injection; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import javax.inject.Scope; /** * Created by Owner on 2016.12.10. */ @Scope @Retention(RetentionPolicy.RUNTIME) public @interface KeyScope { Class<?> value(); }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/ActivityScope.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/ActivityScope.java
package com.zhuinden.examplegithubclient.application.injection; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import javax.inject.Scope; /** * Created by Owner on 2016.12.10. */ @Scope @Retention(RetentionPolicy.RUNTIME) public @interface ActivityScope { }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/OkHttpModule.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/OkHttpModule.java
package com.zhuinden.examplegithubclient.application.injection.modules; import com.zhuinden.examplegithubclient.application.injection.ActivityScope; import com.zhuinden.examplegithubclient.domain.networking.HeaderInterceptor; import dagger.Module; import dagger.Provides; import okhttp3.OkHttpClient; /** * Created by Owner on 2016.12.10. */ @Module public class OkHttpModule { @Provides @ActivityScope OkHttpClient okHttpClient(HeaderInterceptor headerInterceptor) { return new OkHttpClient.Builder() // .addInterceptor(headerInterceptor) // .build(); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/NavigationModule.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/NavigationModule.java
package com.zhuinden.examplegithubclient.application.injection.modules; import dagger.Module; import dagger.Provides; import flowless.Flow; import flowless.KeyManager; import flowless.ServiceProvider; /** * Created by Owner on 2017. 01. 18.. */ @Module public class NavigationModule { private Flow flow; public NavigationModule(Flow flow) { this.flow = flow; } @Provides Flow flow() { return flow; } @Provides ServiceProvider serviceProvider() { return flow.getServices(); } @Provides KeyManager keyManager() { return flow.getStates(); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/RepositoryModule.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/RepositoryModule.java
package com.zhuinden.examplegithubclient.application.injection.modules; import com.zhuinden.examplegithubclient.data.repository.GithubRepoRepository; import com.zhuinden.examplegithubclient.data.repository.impl.GithubRepoRepositoryInMemoryImpl; import dagger.Module; import dagger.Provides; /** * Created by Zhuinden on 2017.01.02.. */ @Module public class RepositoryModule { @Provides GithubRepoRepository repositoryRepository(GithubRepoRepositoryInMemoryImpl repositoryRepositoryInMemory) { return repositoryRepositoryInMemory; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/RetrofitModule.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/RetrofitModule.java
package com.zhuinden.examplegithubclient.application.injection.modules; import com.github.aurae.retrofit2.LoganSquareConverterFactory; import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import com.zhuinden.examplegithubclient.application.injection.ActivityScope; import com.zhuinden.examplegithubclient.domain.service.retrofit.RetrofitGithubService; import dagger.Module; import dagger.Provides; import io.reactivex.schedulers.Schedulers; import okhttp3.OkHttpClient; import retrofit2.Retrofit; /** * Created by Owner on 2016.12.10. */ @Module public class RetrofitModule { @Provides @ActivityScope Retrofit retrofit(OkHttpClient okHttpClient, RxJava2CallAdapterFactory rxJava2CallAdapterFactory) { return new Retrofit.Builder().addConverterFactory(LoganSquareConverterFactory.create()) // .baseUrl("https://api.github.com/") // .addCallAdapterFactory(rxJava2CallAdapterFactory) .client(okHttpClient) // .build(); } @Provides @ActivityScope RxJava2CallAdapterFactory rxJava2CallAdapterFactory() { return RxJava2CallAdapterFactory.createWithScheduler(Schedulers.io()); } @Provides @ActivityScope RetrofitGithubService retrofitGithubService(Retrofit retrofit) { return retrofit.create(RetrofitGithubService.class); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/InteractorModule.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/InteractorModule.java
package com.zhuinden.examplegithubclient.application.injection.modules; import com.zhuinden.examplegithubclient.domain.interactor.GetRepositoriesInteractor; import com.zhuinden.examplegithubclient.domain.interactor.LoginInteractor; import com.zhuinden.examplegithubclient.domain.interactor.impl.GetRepositoriesInteractorImpl; import com.zhuinden.examplegithubclient.domain.interactor.impl.LoginInteractorImpl; import dagger.Module; import dagger.Provides; /** * Created by Owner on 2016.12.10. */ @Module public class InteractorModule { @Provides GetRepositoriesInteractor getRepositoriesInteractor(GetRepositoriesInteractorImpl getRepositoriesInteractor) { return getRepositoriesInteractor; } @Provides LoginInteractor loginInteractor(LoginInteractorImpl loginInteractor) { return loginInteractor; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/ServiceModule.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/ServiceModule.java
package com.zhuinden.examplegithubclient.application.injection.modules; import com.zhuinden.examplegithubclient.domain.service.GithubService; import com.zhuinden.examplegithubclient.domain.service.impl.GithubServiceImpl; import dagger.Module; import dagger.Provides; /** * Created by Owner on 2016.12.10. */ @Module public class ServiceModule { @Provides GithubService githubService(GithubServiceImpl githubService) { return githubService; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/config/MainComponentConfig.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/config/MainComponentConfig.java
package com.zhuinden.examplegithubclient.application.injection.config; import com.zhuinden.examplegithubclient.application.injection.modules.InteractorModule; import com.zhuinden.examplegithubclient.application.injection.modules.NavigationModule; import com.zhuinden.examplegithubclient.application.injection.modules.OkHttpModule; import com.zhuinden.examplegithubclient.application.injection.modules.RetrofitModule; import com.zhuinden.examplegithubclient.application.injection.modules.ServiceModule; import com.zhuinden.examplegithubclient.presentation.activity.main.DaggerMainComponent; import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent; import flowless.Flow; /** * Created by Zhuinden on 2016.12.21.. */ public class MainComponentConfig { public interface Provider<T> { T get(); } private MainComponentConfig() { } static OkHttpModule okHttpModule = new OkHttpModule(); static RetrofitModule retrofitModule = new RetrofitModule(); static InteractorModule interactorModule = new InteractorModule(); static ServiceModule serviceModule = new ServiceModule(); static Provider<NavigationModule> navigationModule(Flow flow) { return () -> new NavigationModule(flow); } public static MainComponent create(Flow flow) { return DaggerMainComponent.builder() // .navigationModule(navigationModule(flow).get()) // .okHttpModule(okHttpModule) // .retrofitModule(retrofitModule) // .interactorModule(interactorModule) // .serviceModule(serviceModule) // .build(); // } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/model/DataSource.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/model/DataSource.java
package com.zhuinden.examplegithubclient.data.model; import java.util.List; /** * Created by Zhuinden on 2017.01.02.. */ public interface DataSource<M> { interface ChangeListener<M> { void onChange(List<M> repositories); } interface Unbinder { void unbind(); } public interface Modify<R, M> { R modify(List<M> mutableRepositories); } public interface Search<R, M> { R search(List<M> immutableRepositories); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/model/BaseDataSource.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/model/BaseDataSource.java
package com.zhuinden.examplegithubclient.data.model; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import io.reactivex.Single; import io.reactivex.android.schedulers.AndroidSchedulers; /** * Created by Zhuinden on 2017.01.02.. */ public abstract class BaseDataSource<M> implements DataSource<M> { protected abstract List<M> getData(); private Set<ChangeListener<M>> changeListenerSet = new HashSet<>(); public Unbinder registerChangeListener(final ChangeListener<M> changeListener) { changeListenerSet.add(changeListener); changeListener.onChange(Collections.unmodifiableList(getData())); return () -> changeListenerSet.remove(changeListener); } private void notifyChangeListeners() { List<M> unmodifiable = Collections.unmodifiableList(getData()); for(ChangeListener<M> changeListener : changeListenerSet) { changeListener.onChange(unmodifiable); } } public <R> R modify(Modify<R, M> modify) { R m = modify.modify(getData()); Single.fromCallable(() -> true).subscribeOn(AndroidSchedulers.mainThread()).subscribe(ignored -> { notifyChangeListeners(); }); return m; } public <R> R search(Search<R, M> search) { return search.search(Collections.unmodifiableList(getData())); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/model/GithubRepoDataSource.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/model/GithubRepoDataSource.java
package com.zhuinden.examplegithubclient.data.model; import com.zhuinden.examplegithubclient.application.injection.ActivityScope; import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.inject.Inject; /** * Created by Owner on 2016.12.26. */ @ActivityScope public class GithubRepoDataSource extends BaseDataSource<GithubRepo> { @Inject public GithubRepoDataSource() { } private List<GithubRepo> repositories = Collections.synchronizedList(new ArrayList<>()); @Override protected List<GithubRepo> getData() { return repositories; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/repository/Repository.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/repository/Repository.java
package com.zhuinden.examplegithubclient.data.repository; import com.zhuinden.examplegithubclient.data.model.DataSource; import java.io.Serializable; import java.util.List; /** * Created by Zhuinden on 2017.01.02.. */ interface Repository<M, ID extends Serializable> { DataSource.Unbinder subscribe(DataSource.ChangeListener<M> changeListener); M findOne(ID id); List<M> findAll(); M saveOrUpdate(M m); List<M> saveOrUpdate(List<M> items); M delete(M m); M delete(ID id); List<M> delete(List<M> items); long count(); }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/repository/GithubRepoRepository.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/repository/GithubRepoRepository.java
package com.zhuinden.examplegithubclient.data.repository; import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo; /** * Created by Zhuinden on 2017.01.02.. */ public interface GithubRepoRepository extends Repository<GithubRepo, Integer> { GithubRepo findByUrl(String url); }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/repository/impl/GithubRepoRepositoryInMemoryImpl.java
flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/repository/impl/GithubRepoRepositoryInMemoryImpl.java
package com.zhuinden.examplegithubclient.data.repository.impl; import com.zhuinden.examplegithubclient.application.injection.ActivityScope; import com.zhuinden.examplegithubclient.data.model.DataSource; import com.zhuinden.examplegithubclient.data.model.GithubRepoDataSource; import com.zhuinden.examplegithubclient.data.repository.GithubRepoRepository; import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo; import java.util.List; import javax.inject.Inject; /** * Created by Zhuinden on 2017.01.02.. */ @ActivityScope public class GithubRepoRepositoryInMemoryImpl implements GithubRepoRepository { @Inject GithubRepoDataSource githubRepoDataSource; @Inject public GithubRepoRepositoryInMemoryImpl() { } @Override public DataSource.Unbinder subscribe(DataSource.ChangeListener<GithubRepo> changeListener) { return githubRepoDataSource.registerChangeListener(changeListener); } @Override public GithubRepo findOne(Integer id) { return githubRepoDataSource.search(repositories -> { if(repositories != null) { for(GithubRepo githubRepo : repositories) { if(githubRepo.getId().equals(id)) { return githubRepo; } } } return null; }); } @Override public List<GithubRepo> findAll() { return githubRepoDataSource.search(immutableRepositories -> immutableRepositories); } @Override public GithubRepo saveOrUpdate(final GithubRepo githubRepo) { if(githubRepo == null) { throw new NullPointerException(); } return githubRepoDataSource.modify(mutableRepositories -> { mutableRepositories.add(githubRepo); return githubRepo; }); } @Override public List<GithubRepo> saveOrUpdate(List<GithubRepo> items) { if(items == null) { throw new NullPointerException(); } return githubRepoDataSource.modify(mutableRepositories -> { mutableRepositories.addAll(items); return items; }); } @Override public GithubRepo delete(GithubRepo githubRepo) { if(githubRepo == null) { return null; } return githubRepoDataSource.modify(mutableRepositories -> delete(githubRepo.getId())); } @Override public GithubRepo delete(Integer id) { if(id == null) { return null; } return githubRepoDataSource.modify(mutableRepositories -> { GithubRepo _githubRepo = findOne(id); mutableRepositories.remove(_githubRepo); return _githubRepo; }); } @Override public List<GithubRepo> delete(List<GithubRepo> items) { if(items == null) { throw new NullPointerException(); } return githubRepoDataSource.modify(mutableRepositories -> { mutableRepositories.removeAll(items); return items; }); } @Override public long count() { return githubRepoDataSource.search(immutableRepositories -> ((Integer) immutableRepositories.size()).longValue()); } @Override public GithubRepo findByUrl(String url) { return githubRepoDataSource.search(repositories -> { if(repositories != null) { for(GithubRepo githubRepo : repositories) { if(githubRepo.getUrl().equals(url)) { return githubRepo; } } } return null; }); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/com/google/auto/value/AutoValue.java
flowless-mvp-example/src/main/java/com/google/auto/value/AutoValue.java
package com.google.auto.value; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.SOURCE) @Target(ElementType.TYPE) public @interface AutoValue { /** * Specifies that AutoValue should generate an implementation of the annotated class or interface, * to serve as a <i>builder</i> for the value-type class it is nested within. As a simple example, * here is an alternative way to write the {@code Person} class mentioned in the {@link AutoValue} * example: <pre> * * &#64;AutoValue * abstract class Person { * static Builder builder() { * return new AutoValue_Person.Builder(); * } * * abstract String name(); * abstract int id(); * * &#64;AutoValue.Builder * interface Builder { * Builder name(String x); * Builder id(int x); * Person build(); * } * }</pre> * * @author Éamonn McManus */ @Retention(RetentionPolicy.SOURCE) @Target(ElementType.TYPE) public @interface Builder { } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/main/java/javax/microedition/khronos/opengles/GL.java
flowless-mvp-example/src/main/java/javax/microedition/khronos/opengles/GL.java
package javax.microedition.khronos.opengles; /** * Robolectric support. */ public class GL { }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/InstrumentationSuite.java
flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/InstrumentationSuite.java
package com.zhuinden.examplegithubclient; import com.zhuinden.examplegithubclient.presentation.activity.main.MainInstrumentedTest; import com.zhuinden.examplegithubclient.presentation.paths.login.LoginInstrumentedTest; import com.zhuinden.examplegithubclient.presentation.paths.repositories.RepositoriesInstrumentedTest; import org.junit.runner.RunWith; import org.junit.runners.Suite; /** * Created by Zhuinden on 2016.12.19.. */ @RunWith(Suite.class) @Suite.SuiteClasses({MainInstrumentedTest.class, LoginInstrumentedTest.class, RepositoriesInstrumentedTest.class}) public class InstrumentationSuite { }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/util/FlowViewAssertions.java
flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/util/FlowViewAssertions.java
package com.zhuinden.examplegithubclient.util; /* * Copyright 2016 Square Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import android.support.test.espresso.NoMatchingViewException; import android.support.test.espresso.ViewAssertion; import android.view.View; import flowless.Flow; import flowless.ServiceProvider; public final class FlowViewAssertions { private FlowViewAssertions() { // No instances. } public static ViewAssertion doesNotHaveFlowService(final String serviceName) { return new FlowServiceIsNull(serviceName, false); } public static ViewAssertion hasFlowService(final String serviceName) { return new FlowServiceIsNull(serviceName, true); } public static <T> ViewAssertion hasKey(final T key) { return new FlowHasKey<T>(key); } private static final class FlowHasKey<T> implements ViewAssertion { private final T key; public FlowHasKey(T key) { this.key = key; } @Override public void check(View view, NoMatchingViewException noViewFoundException) { T key = Flow.getKey(view); if(key == null || !key.equals(this.key)) { throw new AssertionError("Key [" + key + "] does not equal [" + this.key + "]"); } } } private static final class FlowServiceIsNull implements ViewAssertion { private final String serviceName; private final boolean shouldHaveService; public FlowServiceIsNull(String serviceName, boolean shouldHaveService) { this.serviceName = serviceName; this.shouldHaveService = shouldHaveService; } @Override public void check(View view, NoMatchingViewException noViewFoundException) { if(ServiceProvider.get(view).hasService(view, serviceName) != shouldHaveService) { throw new AssertionError("Service [" + serviceName + "] was " + (shouldHaveService ? "not" : "") + " found, even though it should" + (shouldHaveService ? "" : "n't") + " have been"); } } } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/activity/main/MainInstrumentedTest.java
flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/activity/main/MainInstrumentedTest.java
package com.zhuinden.examplegithubclient.presentation.activity.main; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.espresso.Espresso; import android.support.test.espresso.assertion.ViewAssertions; import android.support.test.espresso.matcher.ViewMatchers; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import com.zhuinden.examplegithubclient.presentation.paths.login.LoginView; import com.zhuinden.examplegithubclient.util.DaggerService; import com.zhuinden.examplegithubclient.util.FlowViewAssertions; import com.zhuinden.examplegithubclient.util.idlingresource.EspressoIdlingResource; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import static org.assertj.core.api.Assertions.assertThat; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class MainInstrumentedTest { @Rule public ActivityTestRule<MainActivity> mainActivityActivityTestRule = new ActivityTestRule<MainActivity>(MainActivity.class, true, false); MainPage mainPage; @Before public void setup() { Espresso.registerIdlingResources(EspressoIdlingResource.getIdlingResource()); mainPage = new MainPage(); mainActivityActivityTestRule.launchActivity(null); } @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertThat(appContext.getPackageName()).isEqualTo("com.zhuinden.examplegithubclient"); } @Test public void assertHiddenToolbarIsNotVisible() { mainPage.hiddenToolbar().check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.GONE))); } @Test public void assertToolbarIsVisible() { mainPage.toolbar().check(ViewAssertions.matches(ViewMatchers.isDisplayed())); } @Test public void assertDefaultViewIsLogin() { mainPage.checkRootChildIs(LoginView.class); } @Test public void assertDaggerServiceExists() { mainPage.root().check(FlowViewAssertions.hasFlowService(DaggerService.TAG)); } @Test public void assertDoesNotHaveNonExistentService() { mainPage.root().check(FlowViewAssertions.doesNotHaveFlowService("BLAH")); } @Test public void assertMainHasMainKey() { mainPage.root().check(FlowViewAssertions.hasKey(MainKey.KEY)); } // // @Test // public void startSecondActivity() { // Espresso.onView(ViewMatchers.withId(R.id.main_hello_world)).check(ViewAssertions.matches(ViewMatchers.withText(R.string.hello_world))); // Espresso.onView(ViewMatchers.withId(R.id.main_start_next)).perform(ViewActions.click()); // Espresso.onView(ViewMatchers.withId(R.id.second_root)).check(ViewAssertions.matches(ViewMatchers.isDisplayed())); // } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/activity/main/MainPage.java
flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/activity/main/MainPage.java
package com.zhuinden.examplegithubclient.presentation.activity.main; import android.support.test.espresso.Espresso; import android.support.test.espresso.ViewInteraction; import android.support.test.espresso.action.ViewActions; import android.support.test.espresso.assertion.ViewAssertions; import android.support.test.espresso.matcher.ViewMatchers; import android.view.View; import com.zhuinden.examplegithubclient.R; /** * Created by Zhuinden on 2016.12.19.. */ public class MainPage { public ViewInteraction drawerLayout() { return Espresso.onView(ViewMatchers.withId(R.id.drawer_layout)); } public ViewInteraction root() { return Espresso.onView(ViewMatchers.withId(R.id.root)); } public void checkRootChildIs(Class<? extends View> clazz) { root().check(ViewAssertions.matches(ViewMatchers.hasDescendant(ViewMatchers.isAssignableFrom(clazz)))); } public ViewInteraction hiddenToolbar() { return Espresso.onView(ViewMatchers.withId(R.id.hidden_toolbar)); } public ViewInteraction toolbarText() { return Espresso.onView(ViewMatchers.withId(R.id.toolbar_text)); } public ViewInteraction toolbar() { return Espresso.onView(ViewMatchers.withId(R.id.toolbar)); } public ViewInteraction toolbarDrawerToggle() { return Espresso.onView(ViewMatchers.withId(R.id.toolbar_drawer_toggle)); } public ViewInteraction toolbarGoPrevious() { return Espresso.onView(ViewMatchers.withId(R.id.toolbar_go_previous)); } public void clickDrawerToggle() { toolbarDrawerToggle().perform(ViewActions.click()); } public void clickGoPrevious() { toolbarGoPrevious().perform(ViewActions.click()); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginPage.java
flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginPage.java
package com.zhuinden.examplegithubclient.presentation.paths.login; import android.support.test.espresso.Espresso; import android.support.test.espresso.ViewInteraction; import android.support.test.espresso.matcher.ViewMatchers; import com.zhuinden.examplegithubclient.R; /** * Created by Zhuinden on 2016.12.19.. */ public class LoginPage { public ViewInteraction loginView() { return Espresso.onView(ViewMatchers.isAssignableFrom(LoginView.class)); } public ViewInteraction username() { return Espresso.onView(ViewMatchers.withId(R.id.login_username)); } public ViewInteraction password() { return Espresso.onView(ViewMatchers.withId(R.id.login_password)); } public ViewInteraction loginButton() { return Espresso.onView(ViewMatchers.withId(R.id.login_login)); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginWaitForDialogInstruction.java
flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginWaitForDialogInstruction.java
package com.zhuinden.examplegithubclient.presentation.paths.login; import com.zhuinden.examplegithubclient.util.conditionwatcher.Instruction; /** * Created by F1sherKK on 15/04/16. */ public class LoginWaitForDialogInstruction extends Instruction { LoginPresenter loginPresenter; public LoginWaitForDialogInstruction(LoginPresenter loginPresenter) { this.loginPresenter = loginPresenter; } @Override public String getDescription() { return "Loading dialog shouldn't be in view hierarchy"; } @Override public boolean checkCondition() { return !LoginPresenter.isLoading; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginInstrumentedTest.java
flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginInstrumentedTest.java
package com.zhuinden.examplegithubclient.presentation.paths.login; import android.app.Instrumentation; import android.support.test.InstrumentationRegistry; import android.support.test.espresso.Espresso; import android.support.test.espresso.action.ViewActions; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import com.zhuinden.examplegithubclient.presentation.activity.main.MainActivity; import com.zhuinden.examplegithubclient.presentation.activity.main.MainPage; import com.zhuinden.examplegithubclient.presentation.paths.repositories.RepositoriesView; import com.zhuinden.examplegithubclient.util.DaggerService; import com.zhuinden.examplegithubclient.util.FlowViewAssertions; import com.zhuinden.examplegithubclient.util.conditionwatcher.ConditionWatcher; import com.zhuinden.examplegithubclient.util.idlingresource.EspressoIdlingResource; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import flowless.Direction; import flowless.Flow; import flowless.History; import flowless.ServiceProvider; import static org.assertj.core.api.Assertions.assertThat; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class LoginInstrumentedTest { @Rule public ActivityTestRule<MainActivity> mainActivityActivityTestRule = new ActivityTestRule<MainActivity>(MainActivity.class, true, false); MainPage mainPage = new MainPage(); LoginPage loginPage = new LoginPage(); LoginPresenter loginPresenter; @Before public void setup() { Espresso.registerIdlingResources(EspressoIdlingResource.getIdlingResource()); mainActivityActivityTestRule.launchActivity(null); Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); MainActivity mainActivity = mainActivityActivityTestRule.getActivity(); instrumentation.runOnMainSync(() -> { Flow.get(mainActivity.getBaseContext()).setHistory(History.single(LoginKey.create()), Direction.REPLACE); }); ServiceProvider serviceProvider = ServiceProvider.get(mainActivity.getBaseContext()); LoginComponent loginComponent = serviceProvider.getService(LoginKey.create(), DaggerService.TAG); loginPresenter = loginComponent.loginPresenter(); } @Test public void assertLoginViewIsActive() { mainPage.checkRootChildIs(LoginView.class); } @Test public void assertLoginViewHasLoginKey() { loginPage.loginView().check(FlowViewAssertions.hasKey(LoginKey.create())); } @Test public void assertGoesToRepositoryAfterSuccessfulLogin() throws Exception { loginPage.username().perform(ViewActions.typeText("hello")); assertThat(loginPresenter.username).isEqualTo("hello"); loginPage.password().perform(ViewActions.typeText("world")); assertThat(loginPresenter.password).isEqualTo("world"); loginPage.loginButton().perform(ViewActions.click()); ConditionWatcher.waitForCondition(new LoginWaitForDialogInstruction(loginPresenter)); mainPage.checkRootChildIs(RepositoriesView.class); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesInstrumentedTest.java
flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesInstrumentedTest.java
package com.zhuinden.examplegithubclient.presentation.paths.repositories; import android.app.Instrumentation; import android.support.test.InstrumentationRegistry; import android.support.test.espresso.Espresso; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import com.zhuinden.examplegithubclient.presentation.activity.main.MainActivity; import com.zhuinden.examplegithubclient.presentation.activity.main.MainPage; import com.zhuinden.examplegithubclient.util.FlowViewAssertions; import com.zhuinden.examplegithubclient.util.idlingresource.EspressoIdlingResource; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import flowless.Direction; import flowless.Flow; import flowless.History; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class RepositoriesInstrumentedTest { @Rule public ActivityTestRule<MainActivity> mainActivityActivityTestRule = new ActivityTestRule<MainActivity>(MainActivity.class, true, false); MainPage mainPage; RepositoriesPage repositoriesPage; @Before public void setup() { Espresso.registerIdlingResources(EspressoIdlingResource.getIdlingResource()); mainPage = new MainPage(); repositoriesPage = new RepositoriesPage(); mainActivityActivityTestRule.launchActivity(null); Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); MainActivity mainActivity = mainActivityActivityTestRule.getActivity(); instrumentation.runOnMainSync(() -> { Flow.get(mainActivity.getBaseContext()).setHistory(History.single(RepositoriesKey.create()), Direction.REPLACE); }); } @Test public void assertRepositoriesViewIsActive() { mainPage.checkRootChildIs(RepositoriesView.class); } @Test public void assertRepositoriesViewHasRepositoriesKey() { repositoriesPage.repositoriesView().check(FlowViewAssertions.hasKey(RepositoriesKey.create())); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesPage.java
flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesPage.java
package com.zhuinden.examplegithubclient.presentation.paths.repositories; import android.support.test.espresso.Espresso; import android.support.test.espresso.ViewInteraction; import android.support.test.espresso.matcher.ViewMatchers; /** * Created by Zhuinden on 2016.12.19.. */ public class RepositoriesPage { public ViewInteraction repositoriesView() { return Espresso.onView(ViewMatchers.isAssignableFrom(RepositoriesView.class)); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flow-sample-orientation-lock/src/main/java/flow/sample/orientation/LandscapeScreen.java
flow-sample-orientation-lock/src/main/java/flow/sample/orientation/LandscapeScreen.java
/* * Copyright 2016 Square Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package flow.sample.orientation; import android.os.Parcel; import android.os.Parcelable; import android.support.annotation.LayoutRes; /** * Screen that requires landscape orientation. */ final class LandscapeScreen extends OrientationSampleScreen implements Parcelable { static final LandscapeScreen INSTANCE = new LandscapeScreen(); private LandscapeScreen() { } @Override public @LayoutRes int getLayoutId() { return R.layout.landscape_screen; } @Override boolean requiresLandscape() { return true; } // parcelable protected LandscapeScreen(Parcel in) { } public static final Creator<LandscapeScreen> CREATOR = new Creator<LandscapeScreen>() { @Override public LandscapeScreen createFromParcel(Parcel in) { return new LandscapeScreen(in); } @Override public LandscapeScreen[] newArray(int size) { return new LandscapeScreen[size]; } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flow-sample-orientation-lock/src/main/java/flow/sample/orientation/LooseScreen.java
flow-sample-orientation-lock/src/main/java/flow/sample/orientation/LooseScreen.java
/* * Copyright 2016 Square Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package flow.sample.orientation; import android.os.Parcel; import android.os.Parcelable; import android.support.annotation.LayoutRes; /** * A screen that is willing to render in any orientation. */ final class LooseScreen extends OrientationSampleScreen implements Parcelable { static final LooseScreen INSTANCE = new LooseScreen(); @Override public @LayoutRes int getLayoutId() { return R.layout.loose_screen; } private LooseScreen() { } // parcelable protected LooseScreen(Parcel in) { } public static final Creator<LooseScreen> CREATOR = new Creator<LooseScreen>() { @Override public LooseScreen createFromParcel(Parcel in) { return new LooseScreen(in); } @Override public LooseScreen[] newArray(int size) { return new LooseScreen[size]; } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flow-sample-orientation-lock/src/main/java/flow/sample/orientation/LooseView.java
flow-sample-orientation-lock/src/main/java/flow/sample/orientation/LooseView.java
/* * Copyright 2016 Square Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package flow.sample.orientation; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; import flowless.Flow; public final class LooseView extends LinearLayout { public LooseView(Context context, AttributeSet attrs) { super(context, attrs); setOrientation(VERTICAL); } @Override protected void onFinishInflate() { super.onFinishInflate(); findViewById(R.id.loose_text).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Flow.get(getContext()).set(LandscapeScreen.INSTANCE); } }); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flow-sample-orientation-lock/src/main/java/flow/sample/orientation/OrientationSampleDispatcher.java
flow-sample-orientation-lock/src/main/java/flow/sample/orientation/OrientationSampleDispatcher.java
/* * Copyright 2016 Square Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package flow.sample.orientation; import android.app.Activity; import android.support.annotation.NonNull; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import flowless.Traversal; import flowless.TraversalCallback; import flowless.preset.SingleRootDispatcher; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; public class OrientationSampleDispatcher extends SingleRootDispatcher { /** * Using a static for this is a fragile hack for demo purposes. In * real life you'd want something hanging off of a custom application * class--perhaps a Mortar activity scope. */ private static TraversalCallback hangingCallback; public static void finishPendingTraversal() { if(hangingCallback != null) { // The previous dispatcher was unable to finish its traversal because it // required a configuration change. Let flow know that we're awake again // in our new orientation and that traversal is done. TraversalCallback ref = hangingCallback; hangingCallback = null; ref.onTraversalCompleted(); // TODO: check if this contradicts with Flow.executePendingTraversal() on `onDestroy()` } } protected final Activity activity; public OrientationSampleDispatcher(Activity activity) { this.activity = activity; } @Override public void dispatch(@NonNull Traversal traversal, @NonNull TraversalCallback callback) { Log.d("BasicDispatcher", "dispatching " + traversal); final OrientationSampleScreen destScreen = traversal.destination.top(); final boolean incomingNeedsLock = destScreen.requiresLandscape(); final boolean waitForOrientationChange = incomingNeedsLock && requestLandscapeLock(); if(waitForOrientationChange) { // There is about to be an orientation change, which means there will // soon be a new activity and a new dispatcher. Let them complete // this traversal, so that we don't try to show a landscape-only screen // in portrait. hangingCallback = callback; } else { ViewGroup frame = (ViewGroup) activity.findViewById(R.id.basic_activity_frame); View destView = LayoutInflater.from(traversal.createContext(destScreen, activity)) // .inflate(destScreen.getLayoutId(), frame, false); frame.removeAllViews(); frame.addView(destView); if(!incomingNeedsLock) { requestUnlock(); } callback.onTraversalCompleted(); } } /** * Returns true if we've requested a lock and are expecting an orientation change * as a result. */ boolean requestLandscapeLock() { int requestedOrientation = activity.getRequestedOrientation(); if(requestedOrientation == SCREEN_ORIENTATION_SENSOR_LANDSCAPE) { // We're already locked. return false; } activity.setRequestedOrientation(SCREEN_ORIENTATION_SENSOR_LANDSCAPE); // We've requested a lock, but there will only be an orientation change // if we're not already landscape. return isPortrait(); } void requestUnlock() { activity.setRequestedOrientation(SCREEN_ORIENTATION_UNSPECIFIED); } boolean isPortrait() { return activity.getResources().getBoolean(R.bool.is_portrait); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flow-sample-orientation-lock/src/main/java/flow/sample/orientation/OrientationSampleScreen.java
flow-sample-orientation-lock/src/main/java/flow/sample/orientation/OrientationSampleScreen.java
package flow.sample.orientation; import android.support.annotation.LayoutRes; abstract class OrientationSampleScreen { @LayoutRes abstract int getLayoutId(); boolean requiresLandscape() { return false; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flow-sample-orientation-lock/src/main/java/flow/sample/orientation/OrientationSampleActivity.java
flow-sample-orientation-lock/src/main/java/flow/sample/orientation/OrientationSampleActivity.java
/* * Copyright 2016 Square Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package flow.sample.orientation; import android.app.Activity; import android.content.Context; import android.os.Bundle; import flowless.Flow; public class OrientationSampleActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.orientation_activity_frame); OrientationSampleDispatcher.finishPendingTraversal(); } @Override protected void attachBaseContext(Context baseContext) { baseContext = Flow.configure(baseContext, this) // .dispatcher(new OrientationSampleDispatcher(this)) // .defaultKey(LooseScreen.INSTANCE) // .install(); super.attachBaseContext(baseContext); } @Override public void onBackPressed() { if(!Flow.get(this).goBack()) { super.onBackPressed(); } } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flow-sample-orientation-lock/src/main/java/flow/sample/orientation/LandscapeView.java
flow-sample-orientation-lock/src/main/java/flow/sample/orientation/LandscapeView.java
/* * Copyright 2016 Square Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package flow.sample.orientation; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; import flowless.Flow; public final class LandscapeView extends LinearLayout { public LandscapeView(Context context, AttributeSet attrs) { super(context, attrs); setOrientation(VERTICAL); } @Override protected void onFinishInflate() { super.onFinishInflate(); findViewById(R.id.landscape_text).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Flow.get(getContext()).set(LooseScreen.INSTANCE); } }); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-sample-transitions/src/test/java/com/zhuinden/flowtransitions/ExampleUnitTest.java
flowless-sample-transitions/src/test/java/com/zhuinden/flowtransitions/ExampleUnitTest.java
package com.zhuinden.flowtransitions; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/Layout.java
flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/Layout.java
package com.zhuinden.flowtransitions; import android.support.annotation.LayoutRes; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Created by Zhuinden on 2016.12.03.. */ @Retention(RetentionPolicy.RUNTIME) public @interface Layout { @LayoutRes int value(); }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/SceneMainDefaultKey.java
flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/SceneMainDefaultKey.java
package com.zhuinden.flowtransitions; import android.os.Parcel; import android.os.Parcelable; import flowless.ClassKey; /** * Created by Zhuinden on 2016.12.03.. */ @Layout(R.layout.scene_main_default) public class SceneMainDefaultKey extends ClassKey implements Parcelable { public static SceneMainDefaultKey create() { return new SceneMainDefaultKey(); } private SceneMainDefaultKey() { } protected SceneMainDefaultKey(Parcel in) { } public static final Creator<SceneMainDefaultKey> CREATOR = new Creator<SceneMainDefaultKey>() { @Override public SceneMainDefaultKey createFromParcel(Parcel in) { return new SceneMainDefaultKey(in); } @Override public SceneMainDefaultKey[] newArray(int size) { return new SceneMainDefaultKey[size]; } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/MainActivity.java
flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/MainActivity.java
package com.zhuinden.flowtransitions; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.ViewGroup; import butterknife.BindView; import butterknife.ButterKnife; import flowless.Flow; public class MainActivity extends AppCompatActivity { private static final String TAG = "MainActivity"; @BindView(R.id.path_container) ViewGroup root; TransitionDispatcher transitionDispatcher; @Override protected void attachBaseContext(Context newBase) { transitionDispatcher = new TransitionDispatcher(); newBase = Flow.configure(newBase, this) .defaultKey(SceneMainDefaultKey.create()) .dispatcher(transitionDispatcher) .install(); transitionDispatcher.setBaseContext(this); super.attachBaseContext(newBase); } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); transitionDispatcher.getRootHolder().setRoot(root); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); transitionDispatcher.onActivityResult(requestCode, resultCode, data); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); transitionDispatcher.onRequestPermissionsResult(requestCode, permissions, grantResults); } @Override protected void onSaveInstanceState(Bundle outState) { transitionDispatcher.preSaveViewState(); super.onSaveInstanceState(outState); } @Override public void onBackPressed() { if(transitionDispatcher.onBackPressed()) { return; } super.onBackPressed(); } } // @BindView(R.id.main_button) // Button button; // // @BindView(R.id.main_hello_world) // TextView helloWorld; // @OnClick(R.id.main_button) // public void goToFirstScene() { // Log.d(TAG, "Go to first scene!"); // ViewGroup newScene = (ViewGroup) LayoutInflater.from(MainActivity.this).inflate(R.layout.scene_main_default, root, false); // TransitionManager.beginDelayedTransition(root); // root.removeViewAt(0); // root.addView(newScene); // ButterKnife.bind(MainActivity.this); // goToSecondSceneWithDelay(); // } // // private void goToSecondSceneWithDelay() { // new AsyncTask<Void, Void, Void>() { // @Override // protected Void doInBackground(Void... params) { // try { // Log.d(TAG, "Do In Background"); // Thread.sleep(3000); // } catch(InterruptedException e) { // e.printStackTrace(); // } // return null; // } // // @Override // protected void onPostExecute(Void aVoid) { // Log.d(TAG, "OnPostExecute"); // super.onPostExecute(aVoid); // ViewGroup newScene = (ViewGroup) LayoutInflater.from(MainActivity.this).inflate(R.layout.scene_main_second, root, false); // TransitionManager.beginDelayedTransition(root); // root.removeViewAt(0); // root.addView(newScene); // ButterKnife.bind(MainActivity.this); // Log.d(TAG, "Button is [" + button.hashCode() + "]"); // } // }.execute(); // } // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_main); // ButterKnife.bind(this); // Log.d(TAG, "Button is [" + button.hashCode() + "]"); // goToSecondSceneWithDelay(); // } //}
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/TransitionDispatcher.java
flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/TransitionDispatcher.java
package com.zhuinden.flowtransitions; import android.content.Context; import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.transitionseverywhere.TransitionManager; import java.util.LinkedHashMap; import java.util.Map; import flowless.Traversal; import flowless.TraversalCallback; import flowless.preset.DispatcherUtils; import flowless.preset.SingleRootDispatcher; /** * Created by Zhuinden on 2016.12.02.. */ public class TransitionDispatcher extends SingleRootDispatcher { @Override public void dispatch(@NonNull Traversal traversal, @NonNull TraversalCallback callback) { if(DispatcherUtils.isPreviousKeySameAsNewKey(traversal.origin, traversal.destination)) { //short circuit on same key callback.onTraversalCompleted(); return; } final Object newKey = DispatcherUtils.getNewKey(traversal); int newKeyLayout = getLayout(newKey); final ViewGroup root = rootHolder.getRoot(); final View previousView = root.getChildAt(0); DispatcherUtils.persistViewToStateAndNotifyRemoval(traversal, previousView); Context internalContext = traversal.createContext(newKey, baseContext); LayoutInflater layoutInflater = LayoutInflater.from(internalContext); final View newView = layoutInflater.inflate(newKeyLayout, root, false); DispatcherUtils.restoreViewFromState(traversal, newView); TransitionManager.beginDelayedTransition(root); if(previousView != null) { root.removeView(previousView); } root.addView(newView); callback.onTraversalCompleted(); } // from flow-sample: https://github.com/Zhuinden/flow-sample/blob/master/src/main/java/com/example/flow/pathview/SimplePathContainer.java#L100-L114 private static final Map<Class, Integer> PATH_LAYOUT_CACHE = new LinkedHashMap<>(); protected int getLayout(Object path) { Class pathType = path.getClass(); Integer layoutResId = PATH_LAYOUT_CACHE.get(pathType); if (layoutResId == null) { Layout layout = (Layout) pathType.getAnnotation(Layout.class); if (layout == null) { throw new IllegalArgumentException( String.format("@%s annotation not found on class %s", Layout.class.getSimpleName(), pathType.getName())); } layoutResId = layout.value(); PATH_LAYOUT_CACHE.put(pathType, layoutResId); } return layoutResId; } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/SceneMainView.java
flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/SceneMainView.java
package com.zhuinden.flowtransitions; import android.annotation.TargetApi; import android.content.Context; import android.os.AsyncTask; import android.util.AttributeSet; import android.util.Log; import android.widget.Button; import android.widget.RelativeLayout; import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import flowless.Flow; /** * Created by Zhuinden on 2016.12.03.. */ public class SceneMainView extends RelativeLayout { private static final String TAG = "SceneMainView"; public SceneMainView(Context context) { super(context); init(); } public SceneMainView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public SceneMainView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } @TargetApi(21) public SceneMainView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(); } private void init() { if(!isInEditMode()) { // . } } @Override protected void onFinishInflate() { super.onFinishInflate(); ButterKnife.bind(this); if(Flow.getKey(this) instanceof SceneMainDefaultKey) { goToSecondSceneWithDelay(); } } @BindView(R.id.main_button) Button button; @BindView(R.id.main_hello_world) TextView helloWorld; @OnClick(R.id.main_button) public void goToFirstScene() { Log.d(TAG, "Go to first scene!"); Flow.get(this).set(SceneMainDefaultKey.create()); } private void goToSecondSceneWithDelay() { new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { try { Log.d(TAG, "Do In Background"); Thread.sleep(3000); } catch(InterruptedException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void aVoid) { Log.d(TAG, "OnPostExecute"); super.onPostExecute(aVoid); Flow.get(SceneMainView.this).set(SceneMainSecondKey.create()); } }.execute(); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/SceneMainSecondKey.java
flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/SceneMainSecondKey.java
package com.zhuinden.flowtransitions; import android.os.Parcel; import android.os.Parcelable; import flowless.ClassKey; /** * Created by Zhuinden on 2016.12.03.. */ @Layout(R.layout.scene_main_second) public class SceneMainSecondKey extends ClassKey implements Parcelable { public static SceneMainSecondKey create() { return new SceneMainSecondKey(); } private SceneMainSecondKey() { } protected SceneMainSecondKey(Parcel in) { } public static final Creator<SceneMainSecondKey> CREATOR = new Creator<SceneMainSecondKey>() { @Override public SceneMainSecondKey createFromParcel(Parcel in) { return new SceneMainSecondKey(in); } @Override public SceneMainSecondKey[] newArray(int size) { return new SceneMainSecondKey[size]; } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
Zhuinden/flowless
https://github.com/Zhuinden/flowless/blob/a958f08cd91352ad5430fb3bce986e6b132f5cd9/flowless-sample-transitions/src/androidTest/java/com/zhuinden/flowtransitions/ExampleInstrumentedTest.java
flowless-sample-transitions/src/androidTest/java/com/zhuinden/flowtransitions/ExampleInstrumentedTest.java
package com.zhuinden.flowtransitions; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.zhuinden.flowtransitions", appContext.getPackageName()); } }
java
Apache-2.0
a958f08cd91352ad5430fb3bce986e6b132f5cd9
2026-01-05T02:40:56.157166Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/test/java/com/xuexiang/templateproject/ExampleUnitTest.java
app/src/test/java/com/xuexiang/templateproject/ExampleUnitTest.java
package com.xuexiang.templateproject; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/main/java/com/xuexiang/templateproject/MyApp.java
app/src/main/java/com/xuexiang/templateproject/MyApp.java
/* * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.xuexiang.templateproject; import android.app.Application; import android.content.Context; import androidx.multidex.MultiDex; import com.xuexiang.templateproject.utils.sdkinit.UMengInit; import com.xuexiang.templateproject.utils.sdkinit.XBasicLibInit; /** * @author xuexiang * @since 2018/11/7 下午1:12 */ public class MyApp extends Application { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); //解决4.x运行崩溃的问题 MultiDex.install(this); } @Override public void onCreate() { super.onCreate(); initLibs(); } /** * 初始化基础库 */ private void initLibs() { XBasicLibInit.init(this); UMengInit.init(this); } /** * @return 当前app是否是调试开发模式 */ public static boolean isDebug() { return BuildConfig.DEBUG; } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/main/java/com/xuexiang/templateproject/fragment/MainFragment.java
app/src/main/java/com/xuexiang/templateproject/fragment/MainFragment.java
/* * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.xuexiang.templateproject.fragment; import android.view.KeyEvent; import com.xuexiang.templateproject.core.BaseContainerFragment; import com.xuexiang.xpage.annotation.Page; import com.xuexiang.xpage.enums.CoreAnim; import com.xuexiang.xui.utils.XToastUtils; import com.xuexiang.xui.widget.actionbar.TitleBar; import com.xuexiang.xutil.XUtil; import com.xuexiang.xutil.common.ClickUtils; /** * @author xuexiang * @since 2018/11/7 下午1:16 */ @Page(name = "模版程序", anim = CoreAnim.none) public class MainFragment extends BaseContainerFragment implements ClickUtils.OnClick2ExitListener { @Override protected Class<?>[] getPagesClasses() { return new Class[] { //此处填写fragment EmptyFragment.class }; } @Override protected TitleBar initTitle() { return super.initTitle().setLeftClickListener(view -> ClickUtils.exitBy2Click(2000, this)); } /** * 菜单、返回键响应 */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { ClickUtils.exitBy2Click(2000, this); } return true; } @Override public void onRetry() { XToastUtils.toast("再按一次退出程序"); } @Override public void onExit() { XUtil.exitApp(); } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/main/java/com/xuexiang/templateproject/fragment/EmptyFragment.java
app/src/main/java/com/xuexiang/templateproject/fragment/EmptyFragment.java
/* * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.xuexiang.templateproject.fragment; import android.view.LayoutInflater; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.xuexiang.templateproject.core.BaseFragment; import com.xuexiang.templateproject.databinding.FragmentEmptyBinding; import com.xuexiang.xpage.annotation.Page; /** * 这个只是一个空壳Fragment,只是用于演示而已 * * @author xuexiang * @since 2019-07-08 00:52 */ @Page(name = "空页面") public class EmptyFragment extends BaseFragment<FragmentEmptyBinding> { @NonNull @Override protected FragmentEmptyBinding viewBindingInflate(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, boolean attachToRoot) { return FragmentEmptyBinding.inflate(inflater, container, attachToRoot); } /** * 初始化控件 */ @Override protected void initViews() { } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/main/java/com/xuexiang/templateproject/activity/MainActivity.java
app/src/main/java/com/xuexiang/templateproject/activity/MainActivity.java
/* * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.xuexiang.templateproject.activity; import android.os.Bundle; import com.xuexiang.templateproject.core.BaseActivity; import com.xuexiang.templateproject.fragment.MainFragment; /** * 程序入口,空壳容器 * * @author xuexiang * @since 2019-07-07 23:53 */ public class MainActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); openPage(MainFragment.class); } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/main/java/com/xuexiang/templateproject/utils/service/JsonSerializationService.java
app/src/main/java/com/xuexiang/templateproject/utils/service/JsonSerializationService.java
/* * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.xuexiang.templateproject.utils.service; import android.content.Context; import com.xuexiang.xrouter.annotation.Router; import com.xuexiang.xrouter.facade.service.SerializationService; import com.xuexiang.xutil.net.JsonUtil; import java.lang.reflect.Type; /** * @author XUE * @since 2019/3/27 16:39 */ @Router(path = "/service/json") public class JsonSerializationService implements SerializationService { /** * 对象序列化为json * * @param instance obj * @return json string */ @Override public String object2Json(Object instance) { return JsonUtil.toJson(instance); } /** * json反序列化为对象 * * @param input json string * @param clazz object type * @return instance of object */ @Override public <T> T parseObject(String input, Type clazz) { return JsonUtil.fromJson(input, clazz); } /** * 进程初始化的方法 * * @param context 上下文 */ @Override public void init(Context context) { } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/main/java/com/xuexiang/templateproject/utils/sdkinit/UMengInit.java
app/src/main/java/com/xuexiang/templateproject/utils/sdkinit/UMengInit.java
/* * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.xuexiang.templateproject.utils.sdkinit; import android.app.Application; import android.content.Context; import androidx.annotation.NonNull; import com.meituan.android.walle.WalleChannelReader; import com.umeng.analytics.MobclickAgent; import com.umeng.commonsdk.UMConfigure; import com.xuexiang.templateproject.BuildConfig; import com.xuexiang.templateproject.MyApp; /** * UMeng 统计 SDK初始化 * * @author xuexiang * @since 2019-06-18 15:49 */ public final class UMengInit { private UMengInit() { throw new UnsupportedOperationException("u can't instantiate me..."); } private static String DEFAULT_CHANNEL_ID = "github"; /** * 初始化SDK,合规指南【先进行预初始化,如果用户隐私同意后可以初始化UmengSDK进行信息上报】 */ public static void init(@NonNull Context context) { Context appContext = context.getApplicationContext(); if (appContext instanceof Application) { init((Application) appContext); } } /** * 初始化SDK,合规指南【先进行预初始化,如果用户隐私同意后可以初始化UmengSDK进行信息上报】 */ public static void init(Application application) { // 运营统计数据调试运行时不初始化 if (MyApp.isDebug()) { return; } UMConfigure.setLogEnabled(false); UMConfigure.preInit(application, BuildConfig.APP_ID_UMENG, getChannel(application)); // 用户同意了隐私协议 if (isAgreePrivacy()) { realInit(application); } } /** * @return 用户是否同意了隐私协议 */ private static boolean isAgreePrivacy() { // TODO: 2021/5/11 隐私协议设置 return true; } /** * 真实的初始化UmengSDK【进行设备信息的统计上报,必须在获得用户隐私同意后方可调用】 */ private static void realInit(Application application) { // 运营统计数据调试运行时不初始化 if (MyApp.isDebug()) { return; } //初始化组件化基础库, 注意: 即使您已经在AndroidManifest.xml中配置过appkey和channel值,也需要在App代码中调用初始化接口(如需要使用AndroidManifest.xml中配置好的appkey和channel值,UMConfigure.init调用中appkey和channel参数请置为null)。 //第二个参数是appkey,最后一个参数是pushSecret //这里BuildConfig.APP_ID_UMENG是根据local.properties中定义的APP_ID_UMENG生成的,只是运行看效果的话,可以不初始化该SDK UMConfigure.init(application, BuildConfig.APP_ID_UMENG, getChannel(application), UMConfigure.DEVICE_TYPE_PHONE, ""); //统计SDK是否支持采集在子进程中打点的自定义事件,默认不支持 //支持多进程打点 UMConfigure.setProcessEvent(true); MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO); } /** * 获取渠道信息 */ private static String getChannel(final Context context) { return WalleChannelReader.getChannel(context, DEFAULT_CHANNEL_ID); } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/main/java/com/xuexiang/templateproject/utils/sdkinit/XBasicLibInit.java
app/src/main/java/com/xuexiang/templateproject/utils/sdkinit/XBasicLibInit.java
/* * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.xuexiang.templateproject.utils.sdkinit; import android.app.Application; import com.xuexiang.templateproject.MyApp; import com.xuexiang.templateproject.core.BaseActivity; import com.xuexiang.xaop.XAOP; import com.xuexiang.xpage.PageConfig; import com.xuexiang.xrouter.launcher.XRouter; import com.xuexiang.xui.XUI; import com.xuexiang.xui.utils.XToastUtils; import com.xuexiang.xutil.XUtil; import com.xuexiang.xutil.common.StringUtils; /** * X系列基础库初始化 * * @author xuexiang * @since 2019-06-30 23:54 */ public final class XBasicLibInit { private XBasicLibInit() { throw new UnsupportedOperationException("u can't instantiate me..."); } /** * 初始化基础库SDK */ public static void init(Application application) { //工具类 initXUtil(application); //页面框架 initXPage(application); //切片框架 initXAOP(application); //UI框架 initXUI(application); //路由框架 initRouter(application); } /** * 初始化XUtil工具类 */ private static void initXUtil(Application application) { XUtil.init(application); XUtil.debug(MyApp.isDebug()); } /** * 初始化XPage页面框架 */ private static void initXPage(Application application) { PageConfig.getInstance() .debug(MyApp.isDebug()) .setContainActivityClazz(BaseActivity.class) .init(application); } /** * 初始化XAOP */ private static void initXAOP(Application application) { XAOP.init(application); XAOP.debug(MyApp.isDebug()); //设置动态申请权限切片 申请权限被拒绝的事件响应监听 XAOP.setOnPermissionDeniedListener(permissionsDenied -> XToastUtils.error("权限申请被拒绝:" + StringUtils.listToString(permissionsDenied, ","))); } /** * 初始化XUI框架 */ private static void initXUI(Application application) { XUI.init(application); XUI.debug(MyApp.isDebug()); } /** * 初始化路由框架 */ private static void initRouter(Application application) { // 这两行必须写在init之前,否则这些配置在init过程中将无效 if (MyApp.isDebug()) { XRouter.openLog(); // 打印日志 XRouter.openDebug(); // 开启调试模式(如果在InstantRun模式下运行,必须开启调试模式!线上版本需要关闭,否则有安全风险) } XRouter.init(application); } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/main/java/com/xuexiang/templateproject/core/BaseFragment.java
app/src/main/java/com/xuexiang/templateproject/core/BaseFragment.java
/* * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.xuexiang.templateproject.core; import android.content.res.Configuration; import android.os.Parcelable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.viewbinding.ViewBinding; import com.umeng.analytics.MobclickAgent; import com.xuexiang.xpage.base.XPageActivity; import com.xuexiang.xpage.base.XPageFragment; import com.xuexiang.xpage.core.PageOption; import com.xuexiang.xpage.enums.CoreAnim; import com.xuexiang.xpage.utils.Utils; import com.xuexiang.xrouter.facade.service.SerializationService; import com.xuexiang.xrouter.launcher.XRouter; import com.xuexiang.xui.utils.WidgetUtils; import com.xuexiang.xui.widget.actionbar.TitleBar; import com.xuexiang.xui.widget.actionbar.TitleUtils; import com.xuexiang.xui.widget.progress.loading.IMessageLoader; import java.io.Serializable; import java.lang.reflect.Type; /** * 基础fragment * * @author xuexiang * @since 2018/5/25 下午3:44 */ public abstract class BaseFragment<Binding extends ViewBinding> extends XPageFragment { private IMessageLoader mIMessageLoader; /** * ViewBinding */ protected Binding binding; @Nullable @Override protected View onCreateContentView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, boolean attachToRoot) { binding = viewBindingInflate(inflater, container, attachToRoot); return binding.getRoot(); } /** * 构建ViewBinding * * @param inflater inflater * @param container 容器 * @return ViewBinding */ @NonNull protected abstract Binding viewBindingInflate(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, boolean attachToRoot); /** * 获取Binding * * @return Binding */ public Binding getBinding() { return binding; } @Override protected void initPage() { initTitle(); initViews(); initListeners(); } protected TitleBar initTitle() { return TitleUtils.addTitleBarDynamic(getToolbarContainer(), getPageTitle(), v -> popToBack()); } @Override protected void initListeners() { } public IMessageLoader getMessageLoader() { if (mIMessageLoader == null) { mIMessageLoader = WidgetUtils.getMiniLoadingDialog(getContext()); } return mIMessageLoader; } public IMessageLoader getMessageLoader(String message) { if (mIMessageLoader == null) { mIMessageLoader = WidgetUtils.getMiniLoadingDialog(getContext(), message); } else { mIMessageLoader.updateMessage(message); } return mIMessageLoader; } @Override public void onConfigurationChanged(Configuration newConfig) { //屏幕旋转时刷新一下title super.onConfigurationChanged(newConfig); ViewGroup root = (ViewGroup) getRootView(); if (root.getChildAt(0) instanceof TitleBar) { root.removeViewAt(0); initTitle(); } } @Override public void onDestroyView() { if (mIMessageLoader != null) { mIMessageLoader.dismiss(); } super.onDestroyView(); binding = null; } @Override public void onResume() { super.onResume(); MobclickAgent.onPageStart(getPageName()); } @Override public void onPause() { super.onPause(); MobclickAgent.onPageEnd(getPageName()); } //==============================页面跳转api===================================// /** * 打开一个新的页面【建议只在主tab页使用】 * * @param clazz 页面的类 * @param <T> * @return */ public <T extends XPageFragment> Fragment openNewPage(Class<T> clazz) { return new PageOption(clazz) .setNewActivity(true) .open(this); } /** * 打开一个新的页面【建议只在主tab页使用】 * * @param pageName 页面名 * @param <T> * @return */ public <T extends XPageFragment> Fragment openNewPage(String pageName) { return new PageOption(pageName) .setAnim(CoreAnim.slide) .setNewActivity(true) .open(this); } /** * 打开一个新的页面【建议只在主tab页使用】 * * @param clazz 页面的类 * @param containActivityClazz 页面容器 * @param <T> * @return */ public <T extends XPageFragment> Fragment openNewPage(Class<T> clazz, @NonNull Class<? extends XPageActivity> containActivityClazz) { return new PageOption(clazz) .setNewActivity(true) .setContainActivityClazz(containActivityClazz) .open(this); } /** * 打开一个新的页面【建议只在主tab页使用】 * * @param clazz 页面的类 * @param key 入参的键 * @param value 入参的值 * @param <T> * @return */ public <T extends XPageFragment> Fragment openNewPage(Class<T> clazz, String key, Object value) { PageOption option = new PageOption(clazz).setNewActivity(true); return openPage(option, key, value); } public Fragment openPage(PageOption option, String key, Object value) { if (value instanceof Integer) { option.putInt(key, (Integer) value); } else if (value instanceof Float) { option.putFloat(key, (Float) value); } else if (value instanceof String) { option.putString(key, (String) value); } else if (value instanceof Boolean) { option.putBoolean(key, (Boolean) value); } else if (value instanceof Long) { option.putLong(key, (Long) value); } else if (value instanceof Double) { option.putDouble(key, (Double) value); } else if (value instanceof Parcelable) { option.putParcelable(key, (Parcelable) value); } else if (value instanceof Serializable) { option.putSerializable(key, (Serializable) value); } else { option.putString(key, serializeObject(value)); } return option.open(this); } /** * 打开页面 * * @param clazz 页面的类 * @param addToBackStack 是否加入回退栈 * @param key 入参的键 * @param value 入参的值 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPage(Class<T> clazz, boolean addToBackStack, String key, String value) { return new PageOption(clazz) .setAddToBackStack(addToBackStack) .putString(key, value) .open(this); } /** * 打开页面 * * @param clazz 页面的类 * @param key 入参的键 * @param value 入参的值 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPage(Class<T> clazz, String key, Object value) { return openPage(clazz, true, key, value); } /** * 打开页面 * * @param clazz 页面的类 * @param addToBackStack 是否加入回退栈 * @param key 入参的键 * @param value 入参的值 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPage(Class<T> clazz, boolean addToBackStack, String key, Object value) { PageOption option = new PageOption(clazz).setAddToBackStack(addToBackStack); return openPage(option, key, value); } /** * 打开页面 * * @param clazz 页面的类 * @param key 入参的键 * @param value 入参的值 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPage(Class<T> clazz, String key, String value) { return new PageOption(clazz) .putString(key, value) .open(this); } /** * 打开页面,需要结果返回 * * @param clazz 页面的类 * @param key 入参的键 * @param value 入参的值 * @param requestCode 请求码 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPageForResult(Class<T> clazz, String key, Object value, int requestCode) { PageOption option = new PageOption(clazz).setRequestCode(requestCode); return openPage(option, key, value); } /** * 打开页面,需要结果返回 * * @param clazz 页面的类 * @param key 入参的键 * @param value 入参的值 * @param requestCode 请求码 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPageForResult(Class<T> clazz, String key, String value, int requestCode) { return new PageOption(clazz) .setRequestCode(requestCode) .putString(key, value) .open(this); } /** * 打开页面,需要结果返回 * * @param clazz 页面的类 * @param requestCode 请求码 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPageForResult(Class<T> clazz, int requestCode) { return new PageOption(clazz) .setRequestCode(requestCode) .open(this); } /** * 序列化对象 * * @param object 需要序列化的对象 * @return 序列化结果 */ public String serializeObject(Object object) { return XRouter.getInstance().navigation(SerializationService.class).object2Json(object); } /** * 反序列化对象 * * @param input 反序列化的内容 * @param clazz 类型 * @return 反序列化结果 */ public <T> T deserializeObject(String input, Type clazz) { return XRouter.getInstance().navigation(SerializationService.class).parseObject(input, clazz); } @Override protected void hideCurrentPageSoftInput() { if (getActivity() == null) { return; } // 记住,要在xml的父布局加上android:focusable="true" 和 android:focusableInTouchMode="true" Utils.hideSoftInputClearFocus(getActivity().getCurrentFocus()); } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/main/java/com/xuexiang/templateproject/core/BaseContainerFragment.java
app/src/main/java/com/xuexiang/templateproject/core/BaseContainerFragment.java
/* * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.xuexiang.templateproject.core; import android.content.res.Configuration; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import com.umeng.analytics.MobclickAgent; import com.xuexiang.xaop.annotation.SingleClick; import com.xuexiang.xpage.base.XPageContainerListFragment; import com.xuexiang.xui.widget.actionbar.TitleBar; import com.xuexiang.xui.widget.actionbar.TitleUtils; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import static com.xuexiang.templateproject.core.SimpleListAdapter.KEY_SUB_TITLE; import static com.xuexiang.templateproject.core.SimpleListAdapter.KEY_TITLE; /** * 修改列表样式为主副标题显示 * * @author xuexiang * @since 2018/11/22 上午11:26 */ public abstract class BaseContainerFragment extends XPageContainerListFragment { @Override protected void initPage() { initTitle(); initViews(); initListeners(); } protected TitleBar initTitle() { return TitleUtils.addTitleBarDynamic(getToolbarContainer(), getPageTitle(), v -> popToBack()); } @Override protected void initData() { mSimpleData = initSimpleData(mSimpleData); List<Map<String, String>> data = new ArrayList<>(); for (String content : mSimpleData) { Map<String, String> item = new HashMap<>(); int index = content.indexOf("\n"); if (index > 0) { item.put(KEY_TITLE, String.valueOf(content.subSequence(0, index))); item.put(KEY_SUB_TITLE, String.valueOf(content.subSequence(index + 1, content.length()))); } else { item.put(KEY_TITLE, content); item.put(KEY_SUB_TITLE, ""); } data.add(item); } getListView().setAdapter(new SimpleListAdapter(getContext(), data)); initSimply(); } @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { onItemClick(view, position); } @SingleClick private void onItemClick(View view, int position) { onItemClick(position); } @Override public void onDestroyView() { getListView().setOnItemClickListener(null); super.onDestroyView(); } @Override public void onConfigurationChanged(Configuration newConfig) { //屏幕旋转时刷新一下title super.onConfigurationChanged(newConfig); ViewGroup root = (ViewGroup) getRootView(); if (root.getChildAt(0) instanceof TitleBar) { root.removeViewAt(0); initTitle(); } } @Override public void onResume() { super.onResume(); MobclickAgent.onPageStart(getPageName()); } @Override public void onPause() { super.onPause(); MobclickAgent.onPageEnd(getPageName()); } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/main/java/com/xuexiang/templateproject/core/BaseSimpleListFragment.java
app/src/main/java/com/xuexiang/templateproject/core/BaseSimpleListFragment.java
/* * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.xuexiang.templateproject.core; import android.content.res.Configuration; import android.os.Parcelable; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import com.umeng.analytics.MobclickAgent; import com.xuexiang.xpage.base.XPageActivity; import com.xuexiang.xpage.base.XPageFragment; import com.xuexiang.xpage.base.XPageSimpleListFragment; import com.xuexiang.xpage.core.PageOption; import com.xuexiang.xpage.enums.CoreAnim; import com.xuexiang.xrouter.facade.service.SerializationService; import com.xuexiang.xrouter.launcher.XRouter; import com.xuexiang.xui.widget.actionbar.TitleBar; import com.xuexiang.xui.widget.actionbar.TitleUtils; import java.io.Serializable; /** * @author xuexiang * @since 2018/12/29 下午12:41 */ public abstract class BaseSimpleListFragment extends XPageSimpleListFragment { @Override protected void initPage() { initTitle(); initViews(); initListeners(); } protected TitleBar initTitle() { return TitleUtils.addTitleBarDynamic(getToolbarContainer(), getPageTitle(), v -> popToBack()); } @Override public void onConfigurationChanged(@NonNull Configuration newConfig) { //屏幕旋转时刷新一下title super.onConfigurationChanged(newConfig); ViewGroup root = (ViewGroup) getRootView(); if (root.getChildAt(0) instanceof TitleBar) { root.removeViewAt(0); initTitle(); } } @Override public void onResume() { super.onResume(); MobclickAgent.onPageStart(getPageName()); } @Override public void onPause() { super.onPause(); MobclickAgent.onPageEnd(getPageName()); } //==============================页面跳转api===================================// /** * 打开一个新的页面【建议只在主tab页使用】 * * @param clazz 页面的类 * @param <T> * @return */ public <T extends XPageFragment> Fragment openNewPage(Class<T> clazz) { return new PageOption(clazz) .setNewActivity(true) .open(this); } /** * 打开一个新的页面【建议只在主tab页使用】 * * @param pageName 页面名 * @param <T> * @return */ public <T extends XPageFragment> Fragment openNewPage(String pageName) { return new PageOption(pageName) .setAnim(CoreAnim.slide) .setNewActivity(true) .open(this); } /** * 打开一个新的页面【建议只在主tab页使用】 * * @param clazz 页面的类 * @param containActivityClazz 页面容器 * @param <T> * @return */ public <T extends XPageFragment> Fragment openNewPage(Class<T> clazz, @NonNull Class<? extends XPageActivity> containActivityClazz) { return new PageOption(clazz) .setNewActivity(true) .setContainActivityClazz(containActivityClazz) .open(this); } /** * 打开一个新的页面【建议只在主tab页使用】 * * @param clazz 页面的类 * @param key 入参的键 * @param value 入参的值 * @param <T> * @return */ public <T extends XPageFragment> Fragment openNewPage(Class<T> clazz, String key, Object value) { PageOption option = new PageOption(clazz).setNewActivity(true); return openPage(option, key, value); } public Fragment openPage(PageOption option, String key, Object value) { if (value instanceof Integer) { option.putInt(key, (Integer) value); } else if (value instanceof Float) { option.putFloat(key, (Float) value); } else if (value instanceof String) { option.putString(key, (String) value); } else if (value instanceof Boolean) { option.putBoolean(key, (Boolean) value); } else if (value instanceof Long) { option.putLong(key, (Long) value); } else if (value instanceof Double) { option.putDouble(key, (Double) value); } else if (value instanceof Parcelable) { option.putParcelable(key, (Parcelable) value); } else if (value instanceof Serializable) { option.putSerializable(key, (Serializable) value); } else { option.putString(key, serializeObject(value)); } return option.open(this); } /** * 打开页面 * * @param clazz 页面的类 * @param addToBackStack 是否加入回退栈 * @param key 入参的键 * @param value 入参的值 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPage(Class<T> clazz, boolean addToBackStack, String key, String value) { return new PageOption(clazz) .setAddToBackStack(addToBackStack) .putString(key, value) .open(this); } /** * 打开页面 * * @param clazz 页面的类 * @param key 入参的键 * @param value 入参的值 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPage(Class<T> clazz, String key, Object value) { return openPage(clazz, true, key, value); } /** * 打开页面 * * @param clazz 页面的类 * @param addToBackStack 是否加入回退栈 * @param key 入参的键 * @param value 入参的值 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPage(Class<T> clazz, boolean addToBackStack, String key, Object value) { PageOption option = new PageOption(clazz).setAddToBackStack(addToBackStack); return openPage(option, key, value); } /** * 打开页面 * * @param clazz 页面的类 * @param key 入参的键 * @param value 入参的值 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPage(Class<T> clazz, String key, String value) { return new PageOption(clazz) .putString(key, value) .open(this); } /** * 打开页面,需要结果返回 * * @param clazz 页面的类 * @param key 入参的键 * @param value 入参的值 * @param requestCode 请求码 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPageForResult(Class<T> clazz, String key, Object value, int requestCode) { PageOption option = new PageOption(clazz).setRequestCode(requestCode); return openPage(option, key, value); } /** * 打开页面,需要结果返回 * * @param clazz 页面的类 * @param key 入参的键 * @param value 入参的值 * @param requestCode 请求码 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPageForResult(Class<T> clazz, String key, String value, int requestCode) { return new PageOption(clazz) .setRequestCode(requestCode) .putString(key, value) .open(this); } /** * 打开页面,需要结果返回 * * @param clazz 页面的类 * @param requestCode 请求码 * @param <T> * @return */ public <T extends XPageFragment> Fragment openPageForResult(Class<T> clazz, int requestCode) { return new PageOption(clazz) .setRequestCode(requestCode) .open(this); } /** * 序列化对象 * * @param object 需要序列化的对象 * @return 序列化结果 */ public String serializeObject(Object object) { return XRouter.getInstance().navigation(SerializationService.class).object2Json(object); } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/main/java/com/xuexiang/templateproject/core/BaseActivity.java
app/src/main/java/com/xuexiang/templateproject/core/BaseActivity.java
/* * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.xuexiang.templateproject.core; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import androidx.annotation.Nullable; import androidx.viewbinding.ViewBinding; import com.xuexiang.xpage.base.XPageActivity; import com.xuexiang.xpage.base.XPageFragment; import com.xuexiang.xpage.core.CoreSwitchBean; import com.xuexiang.xrouter.facade.service.SerializationService; import com.xuexiang.xrouter.launcher.XRouter; import io.github.inflationx.viewpump.ViewPumpContextWrapper; /** * 基础容器Activity * * @author XUE * @since 2019/3/22 11:21 */ public class BaseActivity<Binding extends ViewBinding> extends XPageActivity { /** * ViewBinding */ protected Binding binding; @Override protected void attachBaseContext(Context newBase) { //注入字体 super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase)); } @Override protected View getCustomRootView() { binding = viewBindingInflate(getLayoutInflater()); return binding != null ? binding.getRoot() : null; } @Override protected void onCreate(Bundle savedInstanceState) { initStatusBarStyle(); super.onCreate(savedInstanceState); } /** * 构建ViewBinding * * @param inflater inflater * @return ViewBinding */ @Nullable protected Binding viewBindingInflate(LayoutInflater inflater) { return null; } /** * 获取Binding * * @return Binding */ public Binding getBinding() { return binding; } /** * 初始化状态栏的样式 */ protected void initStatusBarStyle() { } /** * 打开fragment * * @param clazz 页面类 * @param addToBackStack 是否添加到栈中 * @return 打开的fragment对象 */ public <T extends XPageFragment> T openPage(Class<T> clazz, boolean addToBackStack) { CoreSwitchBean page = new CoreSwitchBean(clazz) .setAddToBackStack(addToBackStack); return (T) openPage(page); } /** * 打开fragment * * @return 打开的fragment对象 */ public <T extends XPageFragment> T openNewPage(Class<T> clazz) { CoreSwitchBean page = new CoreSwitchBean(clazz) .setNewActivity(true); return (T) openPage(page); } /** * 切换fragment * * @param clazz 页面类 * @return 打开的fragment对象 */ public <T extends XPageFragment> T switchPage(Class<T> clazz) { return openPage(clazz, false); } /** * 序列化对象 * * @param object * @return */ public String serializeObject(Object object) { return XRouter.getInstance().navigation(SerializationService.class).object2Json(object); } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/main/java/com/xuexiang/templateproject/core/SimpleListAdapter.java
app/src/main/java/com/xuexiang/templateproject/core/SimpleListAdapter.java
/* * Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.xuexiang.templateproject.core; import android.content.Context; import android.view.View; import android.widget.TextView; import com.xuexiang.templateproject.R; import com.xuexiang.xui.adapter.listview.BaseListAdapter; import com.xuexiang.xutil.common.StringUtils; import java.util.List; import java.util.Map; /** * 主副标题显示适配器 * * @author xuexiang * @since 2018/12/19 上午12:19 */ public class SimpleListAdapter extends BaseListAdapter<Map<String, String>, SimpleListAdapter.ViewHolder> { public static final String KEY_TITLE = "title"; public static final String KEY_SUB_TITLE = "sub_title"; public SimpleListAdapter(Context context, List<Map<String, String>> data) { super(context, data); } @Override protected ViewHolder newViewHolder(View convertView) { ViewHolder holder = new ViewHolder(); holder.mTvTitle = convertView.findViewById(R.id.tv_title); holder.mTvSubTitle = convertView.findViewById(R.id.tv_sub_title); return holder; } @Override protected int getLayoutId() { return R.layout.adapter_item_simple_list_2; } @Override protected void convert(ViewHolder holder, Map<String, String> item, int position) { holder.mTvTitle.setText(item.get(KEY_TITLE)); if (!StringUtils.isEmpty(item.get(KEY_SUB_TITLE))) { holder.mTvSubTitle.setText(item.get(KEY_SUB_TITLE)); holder.mTvSubTitle.setVisibility(View.VISIBLE); } else { holder.mTvSubTitle.setVisibility(View.GONE); } } public static class ViewHolder { /** * 标题 */ public TextView mTvTitle; /** * 副标题 */ public TextView mTvSubTitle; } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
xuexiangjys/TemplateSimpleProject
https://github.com/xuexiangjys/TemplateSimpleProject/blob/cbf5508a2561f0e42ef9608885ba8b9b1fea33e0/app/src/androidTest/java/com/xuexiang/templateproject/ExampleInstrumentedTest.java
app/src/androidTest/java/com/xuexiang/templateproject/ExampleInstrumentedTest.java
package com.xuexiang.templateproject; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.assertEquals; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.xuexiang.templateproject", appContext.getPackageName()); } }
java
Apache-2.0
cbf5508a2561f0e42ef9608885ba8b9b1fea33e0
2026-01-05T02:41:00.228548Z
false
jenly1314/SplitEditText
https://github.com/jenly1314/SplitEditText/blob/924ca19427ca58712e72e74ad96566fdb7812491/splitedittext/src/test/java/com/king/view/splitedittext/ExampleUnitTest.java
splitedittext/src/test/java/com/king/view/splitedittext/ExampleUnitTest.java
package com.king.view.splitedittext; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
java
MIT
924ca19427ca58712e72e74ad96566fdb7812491
2026-01-05T02:41:00.756256Z
false
jenly1314/SplitEditText
https://github.com/jenly1314/SplitEditText/blob/924ca19427ca58712e72e74ad96566fdb7812491/splitedittext/src/main/java/com/king/view/splitedittext/SplitEditText.java
splitedittext/src/main/java/com/king/view/splitedittext/SplitEditText.java
package com.king.view.splitedittext; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Rect; import android.graphics.RectF; import android.text.InputFilter; import android.text.TextUtils; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.TypedValue; import androidx.annotation.IntDef; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.AppCompatEditText; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * @author <a href="mailto:jenly1314@gmail.com">Jenly</a> */ public class SplitEditText extends AppCompatEditText { /** * 画笔 */ private Paint mPaint; /** * 画笔宽度 */ private float mStrokeWidth; /** * 边框颜色 */ private int mBorderColor = 0xFF666666; /** * 输入的边框颜色 */ private int mInputBorderColor = 0xFF1E90FF; /** * 焦点的边框颜色 */ private int mFocusBorderColor; /** * 框的背景颜色 */ private int mBoxBackgroundColor; /** * 框的圆角大小 */ private float mBorderCornerRadius; /** * 框与框之间的间距大小 */ private float mBorderSpacing; /** * 输入框宽度 */ private float mBoxWidth; /** * 输入框高度 */ private float mBoxHeight; /** * 允许输入的最大长度 */ private int mMaxLength = 6; /** * 文本长度 */ private int mTextLength; /** * 路径 */ private Path mPath; private RectF mRectF; private float[] mRadiusFirstArray; private float[] mRadiusLastArray; /** * 边框风格 */ private @BorderStyle int mBorderStyle = BorderStyle.BOX; /** * 边框风格 */ @Retention(RetentionPolicy.SOURCE) @IntDef({BorderStyle.BOX, BorderStyle.LINE}) public @interface BorderStyle { /** * 框 */ int BOX = 0; /** * 线 */ int LINE = 1; } /** * 文本风格 */ private @TextStyle int mTextStyle = TextStyle.PLAIN_TEXT; /** * 文本风格 */ @Retention(RetentionPolicy.SOURCE) @IntDef({TextStyle.PLAIN_TEXT, TextStyle.CIPHER_TEXT}) public @interface TextStyle { /** * 明文 */ int PLAIN_TEXT = 0; /** * 密文 */ int CIPHER_TEXT = 1; } /** * 密文掩码 */ private String mCipherMask; /** * 是否是粗体 */ private boolean isFakeBoldText; /** * 默认密码显示的掩码 */ private static final String DEFAULT_CIPHER_MASK = "*"; private boolean isDraw; private OnTextInputListener mOnTextInputListener; public SplitEditText(@NonNull Context context) { this(context, null); } public SplitEditText(@NonNull Context context, @Nullable AttributeSet attrs) { this(context, attrs, android.R.attr.editTextStyle); } public SplitEditText(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context, attrs); } /** * 初始化 * * @param context * @param attrs */ private void init(@NonNull Context context, @Nullable AttributeSet attrs) { DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); mStrokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1f, displayMetrics); mBorderSpacing = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8f, displayMetrics); setPadding(0, 0, 0, 0); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SplitEditText); final int count = a.getIndexCount(); for (int i = 0; i < count; i++) { int attr = a.getIndex(i); if (attr == R.styleable.SplitEditText_setStrokeWidth) { mStrokeWidth = a.getDimension(attr, mStrokeWidth); } else if (attr == R.styleable.SplitEditText_setBorderColor) { mBorderColor = a.getColor(attr, mBorderColor); } else if (attr == R.styleable.SplitEditText_setInputBorderColor) { mInputBorderColor = a.getColor(attr, mInputBorderColor); } else if (attr == R.styleable.SplitEditText_setFocusBorderColor) { mFocusBorderColor = a.getColor(attr, mFocusBorderColor); } else if (attr == R.styleable.SplitEditText_setBoxBackgroundColor) { mBoxBackgroundColor = a.getColor(attr, mBoxBackgroundColor); } else if (attr == R.styleable.SplitEditText_setBorderCornerRadius) { mBorderCornerRadius = a.getDimension(attr, mBorderCornerRadius); } else if (attr == R.styleable.SplitEditText_setBorderSpacing) { mBorderSpacing = a.getDimension(attr, mBorderSpacing); } else if (attr == R.styleable.SplitEditText_setMaxLength) { mMaxLength = a.getInt(attr, mMaxLength); } else if (attr == R.styleable.SplitEditText_setBorderStyle) { mBorderStyle = a.getInt(attr, mBorderStyle); } else if (attr == R.styleable.SplitEditText_setTextStyle) { mTextStyle = a.getInt(attr, mTextStyle); } else if (attr == R.styleable.SplitEditText_setCipherMask) { mCipherMask = a.getString(attr); } else if (attr == R.styleable.SplitEditText_setFakeBoldText) { isFakeBoldText = a.getBoolean(attr, false); } } a.recycle(); mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPaint.setAntiAlias(true); mPaint.setTextAlign(Paint.Align.CENTER); mPath = new Path(); mRadiusFirstArray = new float[8]; mRadiusLastArray = new float[8]; mRectF = new RectF(0, 0, 0, 0); if (TextUtils.isEmpty(mCipherMask)) { mCipherMask = DEFAULT_CIPHER_MASK; } else if (mCipherMask.length() > 1) { mCipherMask = mCipherMask.substring(0, 1); } setBackground(null); setCursorVisible(false); setFilters(new InputFilter[]{new InputFilter.LengthFilter(mMaxLength)}); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); int width = w - getPaddingLeft() - getPaddingRight(); int height = h - getPaddingTop() - getPaddingBottom(); updateSizeChanged(width, height); } private void updateSizeChanged(int width, int height) { // 如果框与框之间的间距小于0或者总间距大于控件可用宽度则将间距重置为0 if (mBorderSpacing < 0 || (mMaxLength - 1) * mBorderSpacing > width) { mBorderSpacing = 0; } // 计算出每个框的宽度 mBoxWidth = (width - (mMaxLength - 1) * mBorderSpacing) / mMaxLength - mStrokeWidth; mBoxHeight = height - mStrokeWidth; } @Override protected void onDraw(Canvas canvas) { // 移除super.onDraw(canvas);不绘制EditText相关的 // 绘制边框 drawBorders(canvas); } /** * 绘制边框 - 根据最大长度绘制边框 * * @param canvas */ private void drawBorders(Canvas canvas) { isDraw = true; // 遍历绘制未输入文本的框边界 for (int i = mTextLength; i < mMaxLength; i++) { drawBorder(canvas, i, mBorderColor); } int color = mInputBorderColor != 0 ? mInputBorderColor : mBorderColor; // 遍历绘制已输入文本的框边界 for (int i = 0; i < mTextLength; i++) { drawBorder(canvas, i, color); } // 绘制焦点框边界 if (mTextLength < mMaxLength && mFocusBorderColor != 0 && isFocused()) { drawBorder(canvas, mTextLength, mFocusBorderColor); } } /** * 绘制边框 * * @param canvas * @param position * @param borderColor */ private void drawBorder(Canvas canvas, int position, int borderColor) { mPaint.setStrokeWidth(mStrokeWidth); mPaint.setStyle(Paint.Style.STROKE); mPaint.setFakeBoldText(false); mPaint.setColor(borderColor); // 计算出对应的矩形 float left = getPaddingLeft() + mStrokeWidth / 2 + (mBoxWidth + mBorderSpacing) * position; float top = getPaddingTop() + mStrokeWidth / 2; mRectF.set(left, top, left + mBoxWidth, top + mBoxHeight); // 边框风格 switch (mBorderStyle) { case BorderStyle.BOX: drawBorderBox(canvas, position, borderColor); break; case BorderStyle.LINE: drawBorderLine(canvas); break; } if (mTextLength > position && !TextUtils.isEmpty(getText())) { drawText(canvas, position); } } /** * 绘制文本内容 * @param canvas * @param position */ private void drawText(Canvas canvas, int position) { mPaint.setStrokeWidth(0); mPaint.setColor(getCurrentTextColor()); mPaint.setStyle(Paint.Style.FILL_AND_STROKE); mPaint.setTextSize(getTextSize()); mPaint.setFakeBoldText(isFakeBoldText); float x = mRectF.centerX(); // y轴坐标 = 中心线 + 文字高度的一半 - 基线到文字底部的距离(也就是bottom) float y = mRectF.centerY() + (mPaint.getFontMetrics().bottom - mPaint.getFontMetrics().top) / 2 - mPaint.getFontMetrics().bottom; switch (mTextStyle) { case TextStyle.PLAIN_TEXT: canvas.drawText(String.valueOf(getText().charAt(position)), x, y, mPaint); break; case TextStyle.CIPHER_TEXT: canvas.drawText(mCipherMask, x, y, mPaint); break; } } /** * 绘制框风格 * * @param canvas * @param position */ private void drawBorderBox(Canvas canvas, int position, int borderColor) { // 当边框带有圆角时 if (mBorderCornerRadius > 0) { // 当边框之间的间距为0时,只需要开始一个和最后一个框有圆角 if (mBorderSpacing == 0) { if (position == 0 || position == mMaxLength - 1) { if (mBoxBackgroundColor != 0) { mPaint.setStyle(Paint.Style.FILL); mPaint.setColor(mBoxBackgroundColor); canvas.drawPath(getRoundRectPath(mRectF, position == 0), mPaint); } mPaint.setStyle(Paint.Style.STROKE); mPaint.setColor(borderColor); canvas.drawPath(getRoundRectPath(mRectF, position == 0), mPaint); } else { if (mBoxBackgroundColor != 0) { mPaint.setStyle(Paint.Style.FILL); mPaint.setColor(mBoxBackgroundColor); canvas.drawRect(mRectF, mPaint); } mPaint.setStyle(Paint.Style.STROKE); mPaint.setColor(borderColor); canvas.drawRect(mRectF, mPaint); } } else { if (mBoxBackgroundColor != 0) { mPaint.setStyle(Paint.Style.FILL); mPaint.setColor(mBoxBackgroundColor); canvas.drawRoundRect(mRectF, mBorderCornerRadius, mBorderCornerRadius, mPaint); } mPaint.setStyle(Paint.Style.STROKE); mPaint.setColor(borderColor); canvas.drawRoundRect(mRectF, mBorderCornerRadius, mBorderCornerRadius, mPaint); } } else { if (mBoxBackgroundColor != 0) { mPaint.setStyle(Paint.Style.FILL); mPaint.setColor(mBoxBackgroundColor); canvas.drawRect(mRectF, mPaint); } mPaint.setStyle(Paint.Style.STROKE); mPaint.setColor(borderColor); canvas.drawRect(mRectF, mPaint); } } /** * 绘制线风格 * * @param canvas */ private void drawBorderLine(Canvas canvas) { float y = getPaddingTop() + mBoxHeight; canvas.drawLine(mRectF.left, y, mRectF.right, y, mPaint); } private Path getRoundRectPath(RectF rectF, boolean isFirst) { mPath.reset(); if (isFirst) { // 左上角 mRadiusFirstArray[0] = mBorderCornerRadius; mRadiusFirstArray[1] = mBorderCornerRadius; // 左下角 mRadiusFirstArray[6] = mBorderCornerRadius; mRadiusFirstArray[7] = mBorderCornerRadius; mPath.addRoundRect(rectF, mRadiusFirstArray, Path.Direction.CW); } else { // 右上角 mRadiusLastArray[2] = mBorderCornerRadius; mRadiusLastArray[3] = mBorderCornerRadius; // 右下角 mRadiusLastArray[4] = mBorderCornerRadius; mRadiusLastArray[5] = mBorderCornerRadius; mPath.addRoundRect(rectF, mRadiusLastArray, Path.Direction.CW); } return mPath; } @Override protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) { super.onTextChanged(text, start, lengthBefore, lengthAfter); mTextLength = text.length(); refreshView(); // 改变监听 if (mOnTextInputListener != null) { mOnTextInputListener.onTextInputChanged(text.toString(), mTextLength); if (mTextLength == mMaxLength) { mOnTextInputListener.onTextInputCompleted(text.toString()); } } } @Override protected void onSelectionChanged(int selStart, int selEnd) { super.onSelectionChanged(selStart, selEnd); if (selStart == selEnd) { setSelection(getText() == null ? 0 : getText().length()); } } @Override protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { super.onFocusChanged(focused, direction, previouslyFocusedRect); // 焦点改变时刷新状态 refreshView(); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); isDraw = false; } public int getBorderColor() { return mBorderColor; } public int getInputBorderColor() { return mInputBorderColor; } public int getFocusBorderColor() { return mFocusBorderColor; } public int getBoxBackgroundColor() { return mBoxBackgroundColor; } public float getBorderCornerRadius() { return mBorderCornerRadius; } public float getBorderSpacing() { return mBorderSpacing; } @BorderStyle public int getBorderStyle() { return mBorderStyle; } public void setBorderColor(int borderColor) { this.mBorderColor = borderColor; refreshView(); } public void setInputBorderColor(int inputBorderColor) { this.mInputBorderColor = inputBorderColor; refreshView(); } public void setFocusBorderColor(int focusBorderColor) { this.mFocusBorderColor = focusBorderColor; refreshView(); } public void setBoxBackgroundColor(int boxBackgroundColor) { this.mBoxBackgroundColor = boxBackgroundColor; refreshView(); } public void setBorderCornerRadius(float borderCornerRadius) { this.mBorderCornerRadius = borderCornerRadius; refreshView(); } public void setBorderSpacing(float borderSpacing) { this.mBorderSpacing = borderSpacing; refreshView(); } public void setBorderStyle(@TextStyle int borderStyle) { this.mBorderStyle = borderStyle; refreshView(); } @TextStyle public int getTextStyle() { return mTextStyle; } public void setTextStyle(@TextStyle int textStyle) { this.mTextStyle = textStyle; refreshView(); } public String getCipherMask() { return mCipherMask; } /** * 是否粗体 * * @param fakeBoldText */ public void setFakeBoldText(boolean fakeBoldText) { isFakeBoldText = fakeBoldText; refreshView(); } /** * 设置密文掩码 不设置时,默认为{@link #DEFAULT_CIPHER_MASK} * * @param cipherMask */ public void setCipherMask(String cipherMask) { this.mCipherMask = cipherMask; refreshView(); } /** * 刷新视图 */ private void refreshView() { if (isDraw) { invalidate(); } } /** * 设置文本输入监听 * * @param onTextInputListener */ public void setOnTextInputListener(OnTextInputListener onTextInputListener) { this.mOnTextInputListener = onTextInputListener; } public static abstract class OnSimpleTextInputListener implements OnTextInputListener { @Override public void onTextInputChanged(String text, int length) { } } /** * 文本输入监听 */ public interface OnTextInputListener { /** * Text改变监听 * * @param text * @param length */ void onTextInputChanged(@NonNull String text, int length); /** * Text输入完成 * * @param text */ void onTextInputCompleted(@NonNull String text); } }
java
MIT
924ca19427ca58712e72e74ad96566fdb7812491
2026-01-05T02:41:00.756256Z
false
jenly1314/SplitEditText
https://github.com/jenly1314/SplitEditText/blob/924ca19427ca58712e72e74ad96566fdb7812491/splitedittext/src/androidTest/java/com/king/view/splitedittext/ExampleInstrumentedTest.java
splitedittext/src/androidTest/java/com/king/view/splitedittext/ExampleInstrumentedTest.java
package com.king.view.splitedittext; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.king.view.splitedittext.test", appContext.getPackageName()); } }
java
MIT
924ca19427ca58712e72e74ad96566fdb7812491
2026-01-05T02:41:00.756256Z
false
chensoul/learning-hadoop
https://github.com/chensoul/learning-hadoop/blob/196093e9658d2d936e8a9d6680232377f735fdfa/cdh-hbase-examples/src/com/embracesource/edh/hbase/BlobStoreTest.java
cdh-hbase-examples/src/com/embracesource/edh/hbase/BlobStoreTest.java
package com.embracesource.edh.hbase; import java.io.IOException; import org.apache.hadoop.hbase.MasterNotRunningException; import org.apache.hadoop.hbase.ZooKeeperConnectionException; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.util.Bytes; import com.embracesource.edh.hbase.table.create.Configure; public class BlobStoreTest { private static String tableName = "blob5"; public static void main(String[] agrs) { HBaseAdmin hba = null; HTable table = null; try { hba = new HBaseAdmin(Configure.getHBaseConfig()); hba.createTable(Configure.genHTableDescriptor(tableName, (short) 4, true)); table = new HTable(Configure.getHBaseConfig(), tableName); table.setWriteBufferSize(11); for (int i = 1; i < 100000000; i++) { Put put = new Put(Bytes.toBytes("a" + i)); put.add(Bytes.toBytes(Configure.FAMILY_NAME), Bytes.toBytes("key"), Bytes.toBytes(i + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")); table.put(put); } table.flushCommits(); } catch (MasterNotRunningException e) { e.printStackTrace(); } catch (ZooKeeperConnectionException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (hba != null) { try { hba.close(); } catch (IOException e) { } } if (table != null) { try { table.close(); } catch (IOException e) { } } } } void testAdd() { } }
java
Apache-2.0
196093e9658d2d936e8a9d6680232377f735fdfa
2026-01-05T02:41:02.465238Z
false
chensoul/learning-hadoop
https://github.com/chensoul/learning-hadoop/blob/196093e9658d2d936e8a9d6680232377f735fdfa/cdh-hbase-examples/src/com/embracesource/edh/hbase/AggregateTest.java
cdh-hbase-examples/src/com/embracesource/edh/hbase/AggregateTest.java
package com.embracesource.edh.hbase; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.client.coprocessor.AggregationClient; import org.apache.hadoop.hbase.client.coprocessor.LongStrColumnInterpreter; import org.apache.hadoop.hbase.coprocessor.ColumnInterpreter; import org.apache.hadoop.hbase.util.Bytes; public class AggregateTest { public static void main(String[] args) { Configuration conf = HBaseConfiguration.create(); conf.setInt("hbase.client.retries.number", 1); conf.setInt("ipc.client.connect.max.retries", 1); byte[] table = Bytes.toBytes("t"); Scan scan = new Scan(); scan.addColumn(Bytes.toBytes("f"), Bytes.toBytes("id")); final ColumnInterpreter<Long, Long> columnInterpreter = new LongStrColumnInterpreter(); try { AggregationClient aClient = new AggregationClient(conf); Long rowCount = aClient.min(table, columnInterpreter, scan); System.out.println("The result is " + rowCount); } catch (Throwable e) { e.printStackTrace(); } } }
java
Apache-2.0
196093e9658d2d936e8a9d6680232377f735fdfa
2026-01-05T02:41:02.465238Z
false
chensoul/learning-hadoop
https://github.com/chensoul/learning-hadoop/blob/196093e9658d2d936e8a9d6680232377f735fdfa/cdh-hbase-examples/src/com/embracesource/edh/hbase/GroupByTest.java
cdh-hbase-examples/src/com/embracesource/edh/hbase/GroupByTest.java
package com.embracesource.edh.hbase; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.client.coprocessor.GroupByClient; import org.apache.hadoop.hbase.expression.Expression; import org.apache.hadoop.hbase.expression.ExpressionFactory; import org.apache.hadoop.hbase.expression.evaluation.EvaluationResult; import org.apache.hadoop.hbase.util.Bytes; public class GroupByTest { public static void main(String[] args) { Configuration conf = HBaseConfiguration.create(); conf.setInt("hbase.client.retries.number", 1); conf.setInt("ipc.client.connect.max.retries", 1); byte[] table = Bytes.toBytes("t"); try { GroupByClient groupByClient = new GroupByClient(conf); Scan[] scans = { new Scan() }; List<Expression> groupByExpresstions = new ArrayList<Expression>(); List<Expression> selectExpresstions = new ArrayList<Expression>(); groupByExpresstions.add(ExpressionFactory.columnValue( "f", "id")); selectExpresstions.add(ExpressionFactory .groupByKey(ExpressionFactory.columnValue( "f", "id"))); List<EvaluationResult[]> groupByResultList = groupByClient .groupBy(table, scans, groupByExpresstions, selectExpresstions, null); for (EvaluationResult[] res : groupByResultList) { String resultString = ""; for (int i = 0; i < res.length; i++) { EvaluationResult er = res[i]; resultString += "\t\t" + er.toString(); if (0 == ((i + 1) % selectExpresstions.size())) { System.out.println(resultString); resultString = ""; } } } } catch (Throwable e) { e.printStackTrace(); } } }
java
Apache-2.0
196093e9658d2d936e8a9d6680232377f735fdfa
2026-01-05T02:41:02.465238Z
false
chensoul/learning-hadoop
https://github.com/chensoul/learning-hadoop/blob/196093e9658d2d936e8a9d6680232377f735fdfa/cdh-hbase-examples/src/com/embracesource/edh/hbase/MultiRowRangeFilterTest.java
cdh-hbase-examples/src/com/embracesource/edh/hbase/MultiRowRangeFilterTest.java
package com.embracesource.edh.hbase; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.filter.Filter; import org.apache.hadoop.hbase.filter.MultiRowRangeFilter; import org.apache.hadoop.hbase.filter.MultiRowRangeFilter.RowKeyRange; import org.apache.hadoop.hbase.util.Bytes; public class MultiRowRangeFilterTest { public static void main(String[] args) throws Exception { if (args.length < 1) { throw new Exception("Table name not specified."); } Configuration conf = HBaseConfiguration.create(); HTable table = new HTable(conf, args[0]); Scan scan = new Scan(); List<RowKeyRange> ranges = new ArrayList<RowKeyRange>(); ranges.add(new RowKeyRange(Bytes.toBytes("001"), Bytes.toBytes("002"))); ranges.add(new RowKeyRange(Bytes.toBytes("003"), Bytes.toBytes("004"))); ranges.add(new RowKeyRange(Bytes.toBytes("005"), Bytes.toBytes("006"))); Filter filter = new MultiRowRangeFilter(ranges); scan.setFilter(filter); int count = 0; ResultScanner scanner = table.getScanner(scan); Result r = scanner.next(); while (r != null) { count++; r = scanner.next(); } System.out .println("++ Scanning finished with count : " + count + " ++"); scanner.close(); } }
java
Apache-2.0
196093e9658d2d936e8a9d6680232377f735fdfa
2026-01-05T02:41:02.465238Z
false
chensoul/learning-hadoop
https://github.com/chensoul/learning-hadoop/blob/196093e9658d2d936e8a9d6680232377f735fdfa/cdh-hbase-examples/src/com/embracesource/edh/hbase/ParallelScannerTest.java
cdh-hbase-examples/src/com/embracesource/edh/hbase/ParallelScannerTest.java
package com.embracesource.edh.hbase; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp; import org.apache.hadoop.hbase.filter.SingleColumnValueFilter; import org.apache.hadoop.hbase.util.Bytes; public class ParallelScannerTest { public static void main(String[] args) throws Exception { Configuration conf = HBaseConfiguration.create(); HTable table = new HTable(conf, "t"); String startKey = "1"; String stopKey = "3"; boolean isParallel = true; String familyName = "f"; String columnName = "id"; String remainder = "2"; Scan scan = new Scan(Bytes.toBytes(startKey), Bytes.toBytes(stopKey)); int count = 0; if (isParallel) { scan.setParallel(true); } scan.setFilter(new SingleColumnValueFilter(Bytes.toBytes(familyName), Bytes .toBytes(columnName), CompareOp.LESS, Bytes.toBytes(remainder))); ResultScanner scanner = table.getScanner(scan); Result r = scanner.next(); while (r != null) { count++; r = scanner.next(); } System.out.println("++ Scanning finished with count : " + count + " ++"); scanner.close(); table.close(); } }
java
Apache-2.0
196093e9658d2d936e8a9d6680232377f735fdfa
2026-01-05T02:41:02.465238Z
false
chensoul/learning-hadoop
https://github.com/chensoul/learning-hadoop/blob/196093e9658d2d936e8a9d6680232377f735fdfa/cdh-hbase-examples/src/com/embracesource/edh/hbase/TestGroupby.java
cdh-hbase-examples/src/com/embracesource/edh/hbase/TestGroupby.java
package com.embracesource.edh.hbase; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.client.coprocessor.GroupByClient; import org.apache.hadoop.hbase.expression.Expression; import org.apache.hadoop.hbase.expression.ExpressionFactory; import org.apache.hadoop.hbase.expression.GroupByAggregationExpression; import org.apache.hadoop.hbase.expression.evaluation.EvaluationResult; import org.apache.hadoop.hbase.util.Bytes; public class TestGroupby { private static GroupByClient groupByClient; private static byte[] table=null; void setup() { Configuration conf = HBaseConfiguration.create(); groupByClient = new GroupByClient(conf); table = Bytes.toBytes("t"); } public static void groupByCount() { List<Expression> groupByExpresstions = new ArrayList<Expression>(); List<Expression> selectExpresstions = new ArrayList<Expression>(); groupByExpresstions.add(ExpressionFactory.columnValue("f", "name")); selectExpresstions.add(ExpressionFactory.groupByKey(ExpressionFactory .columnValue("f", "name"))); selectExpresstions.add(ExpressionFactory.count(ExpressionFactory .columnValue("f", "name"))); groupBy(selectExpresstions, groupByExpresstions); } public static void groupBySum() { List<Expression> groupByExpresstions = new ArrayList<Expression>(); List<Expression> selectExpresstions = new ArrayList<Expression>(); groupByExpresstions.add(ExpressionFactory.columnValue("f", "name")); selectExpresstions.add(ExpressionFactory.groupByKey(ExpressionFactory .columnValue("f", "name"))); selectExpresstions.add(ExpressionFactory.sum(ExpressionFactory .columnValue("f", "name"))); groupBy(selectExpresstions, groupByExpresstions); } public static void distinct() { Scan[] scans = { new Scan() }; List<Expression> selectExpresstions = new ArrayList<Expression>(); selectExpresstions.add(ExpressionFactory.toLong(ExpressionFactory .columnValue("f", "name"))); try { List<EvaluationResult[]> result = groupByClient.distinct(table, scans, selectExpresstions, GroupByAggregationExpression.AggregationType.COUNT); } catch (Throwable e) { e.printStackTrace(); } } private static void groupBy(List<Expression> selectExpresstions, List<Expression> groupByExpresstions) { Scan[] scans = { new Scan() }; try { List<EvaluationResult[]> result = groupByClient.groupBy(table, scans, groupByExpresstions, selectExpresstions, null); System.out.println("-- Output groupby result START --"); for (EvaluationResult[] res : result) { String resultString = ""; for (int i = 0; i < res.length; i++) { EvaluationResult er = res[i]; resultString += "\t\t" + er.toString(); if (0 == ((i + 1) % selectExpresstions.size())) { System.out.println(resultString); resultString = ""; } } } System.out.println("-- Output groupby result END --"); } catch (Throwable e) { e.printStackTrace(); } } }
java
Apache-2.0
196093e9658d2d936e8a9d6680232377f735fdfa
2026-01-05T02:41:02.465238Z
false
chensoul/learning-hadoop
https://github.com/chensoul/learning-hadoop/blob/196093e9658d2d936e8a9d6680232377f735fdfa/cdh-hbase-examples/src/com/embracesource/edh/hbase/ReplicationTest.java
cdh-hbase-examples/src/com/embracesource/edh/hbase/ReplicationTest.java
package com.embracesource.edh.hbase; import java.io.IOException; import org.apache.hadoop.hbase.MasterNotRunningException; import org.apache.hadoop.hbase.ZooKeeperConnectionException; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.util.Bytes; import com.embracesource.edh.hbase.table.create.Configure; public class ReplicationTest { // private static String tableName = "blob1"; private static String tableName = "rep6"; public static void main(String[] agrs) { HBaseAdmin hba = null; HTable table = null; try { hba = new HBaseAdmin(Configure.getHBaseConfig()); hba.createTable(Configure.genHTableDescriptor(tableName, (short) 4)); table = new HTable(Configure.getHBaseConfig(), tableName); table.setWriteBufferSize(11); for (int i = 1; i < 60000; i++) { Put put = new Put(Bytes.toBytes("a" + i)); put.add( Bytes.toBytes(Configure.FAMILY_NAME), Bytes.toBytes("key"), Bytes .toBytes(i + "AAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")); table.put(put); } table.flushCommits(); } catch (MasterNotRunningException e) { e.printStackTrace(); } catch (ZooKeeperConnectionException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (hba != null) { try { hba.close(); } catch (IOException e) { } } if (table != null) { try { table.close(); } catch (IOException e) { } } } } }
java
Apache-2.0
196093e9658d2d936e8a9d6680232377f735fdfa
2026-01-05T02:41:02.465238Z
false
chensoul/learning-hadoop
https://github.com/chensoul/learning-hadoop/blob/196093e9658d2d936e8a9d6680232377f735fdfa/cdh-hbase-examples/src/com/embracesource/edh/hbase/ExpressionFilterTest.java
cdh-hbase-examples/src/com/embracesource/edh/hbase/ExpressionFilterTest.java
package com.embracesource.edh.hbase; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.expression.Expression; import org.apache.hadoop.hbase.expression.ExpressionFactory; import org.apache.hadoop.hbase.filter.ExpressionFilter; import org.apache.hadoop.hbase.util.Bytes; public class ExpressionFilterTest { public static void main(String[] args) throws Exception { if (args.length < 2) { throw new Exception("Table name not specified."); } Configuration conf = HBaseConfiguration.create(); HTable table = new HTable(conf, args[0]); String startKey = args[1]; Expression exp = ExpressionFactory.eq(ExpressionFactory .toLong(ExpressionFactory.toString(ExpressionFactory .columnValue("family", "longStr2"))), ExpressionFactory .constant(Long.parseLong("99"))); ExpressionFilter expressionFilter = new ExpressionFilter(exp); Scan scan = new Scan(Bytes.toBytes(startKey), expressionFilter); int count = 0; ResultScanner scanner = table.getScanner(scan); Result r = scanner.next(); while (r != null) { count++; r = scanner.next(); } System.out .println("++ Scanning finished with count : " + count + " ++"); scanner.close(); } }
java
Apache-2.0
196093e9658d2d936e8a9d6680232377f735fdfa
2026-01-05T02:41:02.465238Z
false