improvements in multi Accounts.

LoginChooser now has account switcher if ever the user clicks add Account and there are some accounts added.
This commit is contained in:
kosh 2017-07-12 02:21:58 +08:00
parent 6360f03986
commit 330421edaa
42 changed files with 804 additions and 416 deletions

View File

@ -6,6 +6,7 @@ import android.support.test.filters.LargeTest;
import android.support.test.runner.AndroidJUnit4;
import com.fastaccess.R;
import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity;
import org.junit.Rule;
import org.junit.Test;

View File

@ -53,7 +53,7 @@
</intent-filter>
</activity>
<activity
android:name=".ui.modules.login.LoginChooserActivity"
android:name=".ui.modules.login.chooser.LoginChooserActivity"
android:configChanges="keyboard|orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"

View File

@ -24,7 +24,7 @@ public class AuthModel implements Parcelable {
private List<String> scopes;
private String state;
private String note;
private String noteUr;
private String noteUrl;
@SerializedName("X-GitHub-OTP") private String otpCode;
@Override public int describeContents() { return 0; }
@ -36,7 +36,7 @@ public class AuthModel implements Parcelable {
dest.writeStringList(this.scopes);
dest.writeString(this.state);
dest.writeString(this.note);
dest.writeString(this.noteUr);
dest.writeString(this.noteUrl);
dest.writeString(this.otpCode);
}
@ -47,7 +47,7 @@ public class AuthModel implements Parcelable {
this.scopes = in.createStringArrayList();
this.state = in.readString();
this.note = in.readString();
this.noteUr = in.readString();
this.noteUrl = in.readString();
this.otpCode = in.readString();
}

View File

@ -194,14 +194,14 @@ import lombok.Setter;
.collect(Collectors.toList());
}
@NonNull public static List<FragmentPagerAdapterModel> buildForOrg(@NonNull Context context, @NonNull String login,
boolean isMember, boolean isEnterprise) {
@NonNull public static List<FragmentPagerAdapterModel> buildForOrg(@NonNull Context context, @NonNull String login, boolean isMember) {
return Stream.of(
new FragmentPagerAdapterModel(context.getString(R.string.feeds), isMember ? FeedsFragment.newInstance(login, true, isEnterprise) : null),
new FragmentPagerAdapterModel(context.getString(R.string.overview), OrgProfileOverviewFragment.newInstance(login, isEnterprise)),
new FragmentPagerAdapterModel(context.getString(R.string.repos), OrgReposFragment.newInstance(login, isEnterprise)),
new FragmentPagerAdapterModel(context.getString(R.string.people), OrgMembersFragment.newInstance(login, isEnterprise)),
new FragmentPagerAdapterModel(context.getString(R.string.teams), isMember ? OrgTeamFragment.newInstance(login, isEnterprise) : null))
new FragmentPagerAdapterModel(context.getString(R.string.feeds),
isMember ? FeedsFragment.newInstance(login, true) : null),
new FragmentPagerAdapterModel(context.getString(R.string.overview), OrgProfileOverviewFragment.newInstance(login)),
new FragmentPagerAdapterModel(context.getString(R.string.repos), OrgReposFragment.newInstance(login)),
new FragmentPagerAdapterModel(context.getString(R.string.people), OrgMembersFragment.newInstance(login)),
new FragmentPagerAdapterModel(context.getString(R.string.teams), isMember ? OrgTeamFragment.newInstance(login) : null))
.filter(fragmentPagerAdapterModel -> fragmentPagerAdapterModel.getFragment() != null)
.collect(Collectors.toList());
}

View File

@ -61,7 +61,8 @@ import lombok.NoArgsConstructor;
@Nullable String enterpriseUrl;
public Observable<Login> update(Login login) {
return RxHelper.safeObservable(App.getInstance().getDataStore().update(login).toObservable());
return RxHelper.safeObservable(App.getInstance().getDataStore().update(login)
.toObservable());
}
public void save(Login entity) {
@ -122,7 +123,9 @@ import lombok.NoArgsConstructor;
Login currentUser = Login.getUser();
if (currentUser != null) {
currentUser.setIsLoggedIn(false);
currentUser.save(currentUser);
App.getInstance().getDataStore()
.toBlocking()
.update(currentUser);
}
if (!isEnterprise) {
PrefGetter.resetEnterprise();
@ -130,10 +133,21 @@ import lombok.NoArgsConstructor;
userModel.setIsLoggedIn(true);
if (isNew) {
userModel.setIsEnterprise(isEnterprise);
userModel.setToken(isEnterprise ? PrefGetter.getEnterpriseToken() : PrefGetter.getToken());
userModel.setOtpCode(isEnterprise ? PrefGetter.getEnterpriseOtpCode() : PrefGetter.getOtpCode());
userModel.setToken(isEnterprise ? PrefGetter.getEnterpriseToken() : PrefGetter
.getToken());
userModel.setOtpCode(isEnterprise ? PrefGetter.getEnterpriseOtpCode() :
PrefGetter.getOtpCode());
userModel.setEnterpriseUrl(isEnterprise ? PrefGetter.getEnterpriseUrl() : null);
userModel.save(userModel);
App.getInstance().getDataStore()
.toBlocking()
.delete(Login.class)
.where(Login.ID.eq(userModel.getId())
.or(Login.LOGIN.eq(userModel.getLogin())))
.get()
.value();
App.getInstance().getDataStore()
.toBlocking()
.insert(userModel);
} else {
if (isEnterprise) {
PrefGetter.setTokenEnterprise(userModel.token);
@ -145,7 +159,9 @@ import lombok.NoArgsConstructor;
PrefGetter.setToken(userModel.token);
PrefGetter.setOtpCode(userModel.otpCode);
}
userModel.save(userModel);
App.getInstance().getDataStore()
.toBlocking()
.update(userModel);
}
s.onNext(true);
s.onComplete();

View File

@ -10,6 +10,7 @@ import com.fastaccess.helper.RxHelper;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.requery.Column;
import io.requery.Convert;
@ -62,7 +63,6 @@ import static com.fastaccess.data.dao.model.PinnedRepos.REPO_FULL_NAME;
.firstOrNull();
}
public static boolean isPinned(@NonNull String repoFullName) {
return get(repoFullName) != null;
}
@ -76,6 +76,16 @@ import static com.fastaccess.data.dao.model.PinnedRepos.REPO_FULL_NAME;
}
@NonNull public static Observable<List<PinnedRepos>> getMenuRepos() {
return App.getInstance().getDataStore().select(PinnedRepos.class)
.orderBy(ID.desc())
.limit(10)
.get()
.observable()
.toList()
.toObservable();
}
public static void delete(long id) {
App.getInstance().getDataStore().delete(PinnedRepos.class)
.where(ID.eq(id))

View File

@ -31,6 +31,7 @@ public class BundleConstant {
public static final String REVIEW_EXTRA = "review_extra";
public static final int REQUEST_CODE = 2016;
public static final int REVIEW_REQUEST_CODE = 2017;
public static int REFRESH_CODE = 64;
@StringDef({

View File

@ -11,7 +11,7 @@ import com.fastaccess.helper.PrefGetter
import com.fastaccess.helper.ViewHelper
import com.fastaccess.ui.base.BaseActivity
import com.fastaccess.ui.modules.login.LoginActivity
import com.fastaccess.ui.modules.login.LoginChooserActivity
import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity
import com.fastaccess.ui.modules.main.donation.DonateActivity
import com.fastaccess.ui.modules.reviews.changes.ReviewChangesActivity

View File

@ -9,13 +9,13 @@ import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder
/**
* Created by Kosh on 09 Jul 2017, 5:00 PM
*/
class LoginAdapter : BaseRecyclerAdapter<Login, LoginViewHolder, BaseViewHolder.OnItemClickListener<Login>>() {
class LoginAdapter constructor(val small: Boolean = false) : BaseRecyclerAdapter<Login, LoginViewHolder, BaseViewHolder.OnItemClickListener<Login>>() {
override fun onBindView(holder: LoginViewHolder, position: Int) {
holder.bind(getItem(position))
}
override fun viewHolder(parent: ViewGroup, viewType: Int): LoginViewHolder {
return LoginViewHolder.Companion.newInstance(parent, this)
return LoginViewHolder.Companion.newInstance(parent, this, small)
}
}

View File

@ -17,12 +17,18 @@ import java.util.List;
public class PinnedReposAdapter extends BaseRecyclerAdapter<PinnedRepos, PinnedReposViewHolder, BaseViewHolder.OnItemClickListener<PinnedRepos>> {
private boolean singleLine;
public PinnedReposAdapter(boolean singleLine) {
this.singleLine = singleLine;
}
public PinnedReposAdapter(@NonNull List<PinnedRepos> data, @Nullable BaseViewHolder.OnItemClickListener<PinnedRepos> listener) {
super(data, listener);
}
@Override protected PinnedReposViewHolder viewHolder(ViewGroup parent, int viewType) {
return PinnedReposViewHolder.newInstance(parent, this);
return PinnedReposViewHolder.newInstance(parent, this, singleLine);
}
@Override protected void onBindView(PinnedReposViewHolder holder, int position) {

View File

@ -20,13 +20,13 @@ class LoginViewHolder private constructor(itemView: View, adapter: BaseRecyclerA
val title: FontTextView by bindView(R.id.title)
override fun bind(login: Login) {
avatarLayout.setUrl(login.avatarUrl, login.login, false, false)
avatarLayout.setUrl(login.avatarUrl, null, false, false)
title.text = login.login
}
companion object {
fun newInstance(parent: ViewGroup, adapter: BaseRecyclerAdapter<*, *, *>): LoginViewHolder {
return LoginViewHolder(BaseViewHolder.getView(parent, R.layout.login_row_item), adapter)
fun newInstance(parent: ViewGroup, adapter: BaseRecyclerAdapter<*, *, *>, small: Boolean): LoginViewHolder {
return LoginViewHolder(BaseViewHolder.getView(parent, if (small) R.layout.login_row_item_menu else R.layout.login_row_item), adapter)
}
}
}

View File

@ -33,11 +33,11 @@ import butterknife.BindView;
public class PinnedReposViewHolder extends BaseViewHolder<PinnedRepos> {
@BindView(R.id.title) FontTextView title;
@BindView(R.id.date) FontTextView date;
@BindView(R.id.stars) FontTextView stars;
@BindView(R.id.forks) FontTextView forks;
@BindView(R.id.language) FontTextView language;
@BindView(R.id.avatarLayout) AvatarLayout avatarLayout;
@Nullable @BindView(R.id.avatarLayout) AvatarLayout avatarLayout;
@Nullable @BindView(R.id.date) FontTextView date;
@Nullable @BindView(R.id.stars) FontTextView stars;
@Nullable @BindView(R.id.forks) FontTextView forks;
@Nullable @BindView(R.id.language) FontTextView language;
@BindString(R.string.forked) String forked;
@BindString(R.string.private_repo) String privateRepo;
@BindColor(R.color.material_indigo_700) int forkColor;
@ -47,8 +47,9 @@ public class PinnedReposViewHolder extends BaseViewHolder<PinnedRepos> {
super(itemView, adapter);
}
public static PinnedReposViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter) {
return new PinnedReposViewHolder(getView(viewGroup, R.layout.repos_row_item), adapter);
public static PinnedReposViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter, boolean singleLine) {
return new PinnedReposViewHolder(getView(viewGroup,
singleLine ? R.layout.repos_row_item_menu : R.layout.repos_row_item), adapter);
}
@Override public void bind(@NonNull PinnedRepos pinnedRepos) {
@ -74,14 +75,16 @@ public class PinnedReposViewHolder extends BaseViewHolder<PinnedRepos> {
avatarLayout.setVisibility(View.VISIBLE);
avatarLayout.setUrl(avatar, login, isOrg, LinkParserHelper.isEnterprise(repo.getHtmlUrl()));
}
NumberFormat numberFormat = NumberFormat.getNumberInstance();
stars.setText(numberFormat.format(repo.getStargazersCount()));
forks.setText(numberFormat.format(repo.getForks()));
date.setText(ParseDateFormat.getTimeAgo(repo.getUpdatedAt()));
if (!InputHelper.isEmpty(repo.getLanguage())) {
language.setText(repo.getLanguage());
language.setTextColor(ColorsProvider.getColorAsColor(repo.getLanguage(), language.getContext()));
language.setVisibility(View.VISIBLE);
if (stars != null && forks != null && date != null && language != null) {
NumberFormat numberFormat = NumberFormat.getNumberInstance();
stars.setText(numberFormat.format(repo.getStargazersCount()));
forks.setText(numberFormat.format(repo.getForks()));
date.setText(ParseDateFormat.getTimeAgo(repo.getUpdatedAt()));
if (!InputHelper.isEmpty(repo.getLanguage())) {
language.setText(repo.getLanguage());
language.setTextColor(ColorsProvider.getColorAsColor(repo.getLanguage(), language.getContext()));
language.setVisibility(View.VISIBLE);
}
}
}
}

View File

@ -36,7 +36,7 @@ import com.fastaccess.provider.theme.ThemeEngine;
import com.fastaccess.ui.base.mvp.BaseMvp;
import com.fastaccess.ui.base.mvp.presenter.BasePresenter;
import com.fastaccess.ui.modules.changelog.ChangelogBottomSheetDialog;
import com.fastaccess.ui.modules.login.LoginChooserActivity;
import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity;
import com.fastaccess.ui.modules.main.MainActivity;
import com.fastaccess.ui.modules.main.orgs.OrgListDialogFragment;
import com.fastaccess.ui.modules.settings.SettingsActivity;
@ -70,11 +70,10 @@ public abstract class BaseActivity<V extends BaseMvp.FAView, P extends BasePrese
@Nullable @BindView(R.id.extrasNav) public NavigationView extraNav;
@Nullable @BindView(R.id.accountsNav) NavigationView accountsNav;
@Nullable @BindView(R.id.adView) AdView adView;
private MainNavDrawer mainNavDrawer;
@State Bundle presenterStateBundle = new Bundle();
private static int REFRESH_CODE = 64;
private MainNavDrawer mainNavDrawer;
private long backPressTimer;
private Toast toast;
@ -261,12 +260,12 @@ public abstract class BaseActivity<V extends BaseMvp.FAView, P extends BasePrese
}
@Override public void onOpenSettings() {
startActivityForResult(new Intent(this, SettingsActivity.class), REFRESH_CODE);
startActivityForResult(new Intent(this, SettingsActivity.class), BundleConstant.REFRESH_CODE);
}
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == REFRESH_CODE) {
if (requestCode == BundleConstant.REFRESH_CODE) {
onThemeChanged();
}
}

View File

@ -3,18 +3,22 @@ package com.fastaccess.ui.base
import android.content.Intent
import android.os.Handler
import android.support.design.widget.NavigationView
import android.support.transition.TransitionManager
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.fastaccess.R
import com.fastaccess.data.dao.model.Login
import com.fastaccess.data.dao.model.PinnedRepos
import com.fastaccess.helper.ActivityHelper
import com.fastaccess.helper.PrefGetter
import com.fastaccess.helper.RxHelper
import com.fastaccess.ui.adapter.LoginAdapter
import com.fastaccess.ui.adapter.PinnedReposAdapter
import com.fastaccess.ui.modules.about.FastHubAboutActivity
import com.fastaccess.ui.modules.gists.GistsListActivity
import com.fastaccess.ui.modules.login.LoginChooserActivity
import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity
import com.fastaccess.ui.modules.main.MainActivity
import com.fastaccess.ui.modules.main.donation.DonationActivity
import com.fastaccess.ui.modules.notification.NotificationActivity
@ -31,6 +35,12 @@ import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView
class MainNavDrawer(val view: BaseActivity<*, *>, val extraNav: NavigationView?, val accountsNav: NavigationView?)
: BaseViewHolder.OnItemClickListener<Login> {
var menusHolder: ViewGroup? = null
init {
menusHolder = view.findViewById<ViewGroup>(R.id.menusHolder)
}
fun setupViewDrawer() {
extraNav?.let {
val header = it.getHeaderView(0)
@ -38,28 +48,64 @@ class MainNavDrawer(val view: BaseActivity<*, *>, val extraNav: NavigationView?,
}
accountsNav?.let {
setupAccounts()
setupPinned()
}
}
private fun setupAccounts() {
val addAccount = view.findViewById<View>(R.id.addAccLayout)
val recyclerView = view.findViewById<DynamicRecyclerView>(R.id.accLists)
val toggleImage = view.findViewById<View>(R.id.toggleImage)
val toggle = view.findViewById<View>(R.id.toggle)
val toggleAccountsLayout = view.findViewById<View>(R.id.toggleAccountsLayout)
addAccount.setOnClickListener {
val intent = Intent(view, LoginChooserActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
view.startActivity(intent)
view.finish()
}
val adapter = LoginAdapter()
adapter.listener = this
recyclerView.adapter = adapter
toggle.setOnClickListener {
TransitionManager.beginDelayedTransition(menusHolder ?: extraNav!!)
val isVisible = recyclerView.visibility == View.VISIBLE
recyclerView.visibility = if (isVisible) View.GONE else View.VISIBLE
toggleImage.rotation = if (!isVisible) 180f else 0f
}
val adapter = LoginAdapter(true)
view.getPresenter().manageViewDisposable(Login.getAccounts()
.doFinally {
when (!adapter.isEmpty) {
true -> {
toggleAccountsLayout.visibility = View.VISIBLE
adapter.listener = this
recyclerView.adapter = adapter
}
else -> toggleAccountsLayout.visibility = View.GONE
}
}
.subscribe({ adapter.addItem(it) }, ::print))
}
private fun setupPinned() {
val togglePinnedImage = view.findViewById<View>(R.id.togglePinnedImage)
val togglePinned = view.findViewById<View>(R.id.togglePinned)
val pinnedList = view.findViewById<DynamicRecyclerView>(R.id.pinnedList)
val pinnedListAdapter = PinnedReposAdapter(true)
togglePinned.setOnClickListener {
TransitionManager.beginDelayedTransition(menusHolder ?: extraNav!!)
val isVisible = pinnedList.visibility == View.VISIBLE
pinnedList.visibility = if (isVisible) View.GONE else View.VISIBLE
togglePinnedImage.rotation = if (isVisible) 180f else 0f
}
view.getPresenter().manageViewDisposable(PinnedRepos.getMenuRepos()
.doFinally { pinnedList.adapter = pinnedListAdapter }
.subscribe({ pinnedListAdapter.insertItems(it) }, ::println))
}
private fun setupView(view: View) {
val userModel = Login.getUser() ?: return
(view.findViewById<View>(R.id.navAvatarLayout) as AvatarLayout).setUrl(userModel.avatarUrl, userModel.login, false, PrefGetter.isEnterprise())
(view.findViewById<View>(R.id.navAvatarLayout) as AvatarLayout).setUrl(userModel.avatarUrl, null, false,
PrefGetter.isEnterprise())
(view.findViewById<View>(R.id.navUsername) as TextView).text = userModel.login
when (userModel.name.isNullOrEmpty()) {
true -> view.findViewById<View>(R.id.navFullName).visibility = View.GONE

View File

@ -33,7 +33,8 @@ import butterknife.BindView;
* Created by Kosh on 11 Nov 2016, 12:36 PM
*/
public class FeedsFragment extends BaseFragment<FeedsMvp.View, FeedsPresenter> implements FeedsMvp.View {
public class FeedsFragment extends BaseFragment<FeedsMvp.View, FeedsPresenter> implements
FeedsMvp.View {
public static final String TAG = FeedsFragment.class.getSimpleName();
@ -43,28 +44,19 @@ public class FeedsFragment extends BaseFragment<FeedsMvp.View, FeedsPresenter> i
private FeedsAdapter adapter;
private OnLoadMore onLoadMore;
public static FeedsFragment newInstance(@NonNull String user) {
public static FeedsFragment newInstance(@Nullable String user) {
return newInstance(user, false);
}
public static FeedsFragment newInstance(@Nullable String user, boolean isOrg) {
return newInstance(user, isOrg, false);
}
public static FeedsFragment newInstance(@Nullable String user, boolean isOrg, boolean isEnterprise) {
FeedsFragment feedsFragment = new FeedsFragment();
feedsFragment.setArguments(Bundler.start()
.put(BundleConstant.EXTRA, user)
.put(BundleConstant.EXTRA_TWO, isOrg)
.put(BundleConstant.IS_ENTERPRISE, isEnterprise)
.end());
return feedsFragment;
}
public static FeedsFragment newInstance(boolean isEnterprise) {
return newInstance(null, false, isEnterprise);
}
@Override protected int fragmentLayout() {
return R.layout.micro_grid_refresh_list;
}
@ -76,7 +68,8 @@ public class FeedsFragment extends BaseFragment<FeedsMvp.View, FeedsPresenter> i
recycler.setEmptyView(stateLayout, refresh);
adapter = new FeedsAdapter(getPresenter().getEvents(), isProfile());
adapter.setListener(getPresenter());
getLoadMore().setCurrent_page(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal());
getLoadMore().setCurrent_page(getPresenter().getCurrentPage(), getPresenter()
.getPreviousTotal());
recycler.setAdapter(adapter);
if (isProfile()) {
recycler.addDivider();
@ -178,6 +171,7 @@ public class FeedsFragment extends BaseFragment<FeedsMvp.View, FeedsPresenter> i
}
public boolean isProfile() {
return !InputHelper.isEmpty(getArguments().getString(BundleConstant.EXTRA)) && !getArguments().getBoolean(BundleConstant.EXTRA_TWO);
return !InputHelper.isEmpty(getArguments().getString(BundleConstant.EXTRA)) &&
!getArguments().getBoolean(BundleConstant.EXTRA_TWO);
}
}

View File

@ -1,7 +1,6 @@
package com.fastaccess.ui.modules.login;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
@ -13,13 +12,11 @@ import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import com.evernote.android.state.State;
import com.fastaccess.App;
import com.fastaccess.BuildConfig;
import com.fastaccess.R;
import com.fastaccess.data.dao.model.Login;
import com.fastaccess.helper.ActivityHelper;
import com.fastaccess.helper.AnimHelper;
import com.fastaccess.helper.AppHelper;
@ -28,24 +25,17 @@ import com.fastaccess.helper.Bundler;
import com.fastaccess.helper.InputHelper;
import com.fastaccess.helper.Logger;
import com.fastaccess.helper.PrefGetter;
import com.fastaccess.helper.PrefHelper;
import com.fastaccess.ui.base.BaseActivity;
import com.fastaccess.ui.modules.main.MainActivity;
import com.fastaccess.ui.modules.settings.LanguageBottomSheetDialog;
import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity;
import com.fastaccess.ui.widgets.FontCheckbox;
import com.fastaccess.ui.widgets.dialog.MessageDialogView;
import com.miguelbcr.io.rx_billing_service.RxBillingService;
import com.miguelbcr.io.rx_billing_service.entities.ProductType;
import com.miguelbcr.io.rx_billing_service.entities.Purchase;
import java.util.Arrays;
import java.util.Locale;
import butterknife.BindView;
import butterknife.OnCheckedChanged;
import butterknife.OnClick;
import butterknife.OnEditorAction;
import butterknife.Optional;
import es.dmoral.toasty.Toasty;
import io.reactivex.functions.Action;
@ -272,7 +262,7 @@ public class LoginActivity extends BaseActivity<LoginMvp.View, LoginPresenter> i
getPresenter().login(InputHelper.toString(username),
InputHelper.toString(password),
InputHelper.toString(twoFactor),
isBasicAuth, endpoint != null ? InputHelper.toString(endpoint) : null, isEnterprise());
isBasicAuth, InputHelper.toString(endpoint));
}
}
}

View File

@ -1,103 +0,0 @@
package com.fastaccess.ui.modules.login;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.RelativeLayout;
import com.fastaccess.BuildConfig;
import com.fastaccess.R;
import com.fastaccess.data.dao.model.Login;
import com.fastaccess.helper.ActivityHelper;
import com.fastaccess.helper.InputHelper;
import com.fastaccess.helper.PrefHelper;
import com.fastaccess.ui.base.BaseActivity;
import com.fastaccess.ui.base.mvp.presenter.BasePresenter;
import com.fastaccess.ui.modules.settings.LanguageBottomSheetDialog;
import net.grandcentrix.thirtyinch.TiPresenter;
import java.util.Arrays;
import java.util.Locale;
import butterknife.BindView;
import butterknife.OnClick;
import io.reactivex.functions.Action;
/**
* Created by Kosh on 28 Apr 2017, 9:03 PM
*/
public class LoginChooserActivity extends BaseActivity implements LanguageBottomSheetDialog.LanguageDialogListener {
@BindView(R.id.language_selector) RelativeLayout language_selector;
@Override protected int layout() {
return R.layout.login_chooser_layout;
}
@Override protected boolean isTransparent() {
return true;
}
@Override protected boolean canBack() {
return false;
}
@Override protected boolean isSecured() {
return true;
}
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Arrays.asList(getResources().getStringArray(R.array.languages_array_values)).contains(Locale.getDefault().getLanguage())) {
String language = PrefHelper.getString("app_language");
PrefHelper.set("app_language", Locale.getDefault().getLanguage());
if (!BuildConfig.DEBUG) language_selector.setVisibility(View.GONE);
if (!Locale.getDefault().getLanguage().equals(language)) recreate();
}
}
@OnClick(R.id.basicAuth) public void onBasicAuthClicked() {
LoginActivity.start(this, true);
}
@OnClick(R.id.accessToken) public void onAccessTokenClicked() {
LoginActivity.start(this, false);
}
@OnClick(R.id.enterprise) void onEnterpriseClicked() {
if (Login.hasNormalLogin()) LoginActivity.start(this, true, true);
else showMessage(R.string.error, R.string.enterprise_login_warning);
}
@OnClick(R.id.browserLogin) void onOpenBrowser() {
LoginActivity.startOAuth(this);
}
@OnClick(R.id.language_selector_clicker) public void onChangeLanguage() {
showLanguage();
}
@Override public void onLanguageChanged(Action action) {
try {
action.run();
recreate();
} catch (Exception e) {
e.printStackTrace();
}
}
@NonNull @Override public BasePresenter providePresenter() {
return new BasePresenter();
}
private void showLanguage() {
LanguageBottomSheetDialog languageBottomSheetDialog = new LanguageBottomSheetDialog();
languageBottomSheetDialog.onAttach((Context) this);
languageBottomSheetDialog.show(getSupportFragmentManager(), "LanguageBottomSheetDialog");
}
}

View File

@ -36,10 +36,10 @@ public interface LoginMvp {
void onTokenResponse(@Nullable AccessTokenModel response);
void onUserResponse(@Nullable Login response, boolean isEnterprise);
void onUserResponse(@Nullable Login response);
void login(@NonNull String username, @NonNull String password,
@Nullable String twoFactorCode, boolean isBasicAuth,
@Nullable String endpoint, boolean isEnterprise);
@Nullable String endpoint);
}
}

View File

@ -20,7 +20,6 @@ import com.fastaccess.ui.base.mvp.presenter.BasePresenter;
import java.util.Arrays;
import io.reactivex.Observable;
import okhttp3.Credentials;
import retrofit2.HttpException;
@ -60,7 +59,7 @@ public class LoginPresenter extends BasePresenter<LoginMvp.View> implements Logi
String token = modelResponse.getToken() != null ? modelResponse.getToken() : modelResponse.getAccessToken();
if (!InputHelper.isEmpty(token)) {
PrefGetter.setToken(token);
makeRestCall(RestProvider.getUserService(false).getUser(), login -> onUserResponse(login, false));
makeRestCall(RestProvider.getUserService(false).getUser(), this::onUserResponse);
return;
}
}
@ -110,34 +109,33 @@ public class LoginPresenter extends BasePresenter<LoginMvp.View> implements Logi
}
}
@Override public void onUserResponse(@Nullable Login userModel, boolean isEnterprise) {
@Override public void onUserResponse(@Nullable Login userModel) {
if (userModel != null) {
manageObservable(Login.onMultipleLogin(userModel, isEnterprise, true)
.doOnComplete(() -> sendToView(view -> view.onSuccessfullyLoggedIn(isEnterprise))));
manageObservable(Login.onMultipleLogin(userModel, isEnterprise(), true)
.doOnComplete(() -> sendToView(view -> view.onSuccessfullyLoggedIn(isEnterprise()))));
return;
}
sendToView(view -> view.showMessage(R.string.error, R.string.failed_login));
}
@Override public void login(@NonNull String username, @NonNull String password, @Nullable String twoFactorCode,
boolean isBasicAuth, @Nullable String endpoint, boolean isEnterprise) {
setEnterprise(isEnterprise);
boolean isBasicAuth, @Nullable String endpoint) {
boolean usernameIsEmpty = InputHelper.isEmpty(username);
boolean passwordIsEmpty = InputHelper.isEmpty(password);
boolean endpointIsEmpty = InputHelper.isEmpty(endpoint) && isEnterprise;
boolean endpointIsEmpty = InputHelper.isEmpty(endpoint) && isEnterprise();
if (getView() == null) return;
getView().onEmptyUserName(usernameIsEmpty);
getView().onEmptyPassword(passwordIsEmpty);
getView().onEmptyEndpoint(endpointIsEmpty);
if ((!usernameIsEmpty && !passwordIsEmpty)) {
String authToken = Credentials.basic(username, password);
if (isBasicAuth && !isEnterprise) {
if (isBasicAuth && !isEnterprise()) {
AuthModel authModel = new AuthModel();
authModel.setScopes(Arrays.asList("user", "repo", "gist", "notifications", "read:org"));
authModel.setNote(BuildConfig.APPLICATION_ID);
authModel.setClientSecret(GithubConfigHelper.getSecret());
authModel.setClientId(GithubConfigHelper.getClientId());
authModel.setNoteUr(GithubConfigHelper.getRedirectUrl());
authModel.setNoteUrl(GithubConfigHelper.getRedirectUrl());
if (!InputHelper.isEmpty(twoFactorCode)) {
authModel.setOtpCode(twoFactorCode);
}
@ -148,23 +146,23 @@ public class LoginPresenter extends BasePresenter<LoginMvp.View> implements Logi
onTokenResponse(accessTokenModel);
});
} else {
accessTokenLogin(password, endpoint, twoFactorCode, authToken, isEnterprise);
accessTokenLogin(password, endpoint, twoFactorCode, authToken);
}
}
}
private void accessTokenLogin(@NonNull String password, @Nullable String endpoint, @Nullable String otp,
@NonNull String authToken, boolean isEnterprise) {
@NonNull String authToken) {
makeRestCall(LoginProvider.getLoginRestService(authToken, otp, endpoint).loginAccessToken(),
login -> {
if (!isEnterprise) {
if (!isEnterprise()) {
PrefGetter.setToken(password);
} else {
PrefGetter.setEnterpriseOtpCode(otp);
PrefGetter.setTokenEnterprise(authToken);
PrefGetter.setEnterpriseUrl(endpoint);
}
onUserResponse(login, isEnterprise);
onUserResponse(login);
});
}
}

View File

@ -0,0 +1,124 @@
package com.fastaccess.ui.modules.login.chooser
import android.content.Context
import android.os.Bundle
import android.support.design.widget.CoordinatorLayout
import android.support.transition.TransitionManager
import android.view.View
import android.widget.RelativeLayout
import butterknife.OnClick
import com.fastaccess.BuildConfig
import com.fastaccess.R
import com.fastaccess.data.dao.model.Login
import com.fastaccess.helper.PrefHelper
import com.fastaccess.ui.adapter.LoginAdapter
import com.fastaccess.ui.base.BaseActivity
import com.fastaccess.ui.modules.login.LoginActivity
import com.fastaccess.ui.modules.settings.LanguageBottomSheetDialog
import com.fastaccess.ui.widgets.bindView
import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView
import io.reactivex.functions.Action
import java.util.*
/**
* Created by Kosh on 28 Apr 2017, 9:03 PM
*/
class LoginChooserActivity : BaseActivity<LoginChooserMvp.View, LoginChooserPresenter>(), LoginChooserMvp.View {
val language_selector: RelativeLayout by bindView(R.id.language_selector)
val recycler: DynamicRecyclerView by bindView(R.id.recycler)
val multiAccLayout: View by bindView(R.id.multiAccLayout)
val viewGroup: CoordinatorLayout by bindView(R.id.viewGroup)
val toggleImage: View by bindView(R.id.toggleImage)
val adapter = LoginAdapter()
override fun layout(): Int = R.layout.login_chooser_layout
override fun isTransparent(): Boolean = true
override fun canBack(): Boolean = false
override fun isSecured(): Boolean = true
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
adapter.listener = this
recycler.adapter = adapter
if (Arrays.asList(*resources.getStringArray(R.array.languages_array_values)).contains(Locale.getDefault().language)) {
val language = PrefHelper.getString("app_language")
PrefHelper.set("app_language", Locale.getDefault().language)
if (!BuildConfig.DEBUG) language_selector.visibility = View.GONE
if (Locale.getDefault().language != language) recreate()
}
}
@OnClick(R.id.basicAuth) fun onBasicAuthClicked() {
LoginActivity.start(this, true)
}
@OnClick(R.id.accessToken) fun onAccessTokenClicked() {
LoginActivity.start(this, false)
}
@OnClick(R.id.enterprise) internal fun onEnterpriseClicked() {
if (Login.hasNormalLogin())
LoginActivity.start(this, true, true)
else
showMessage(R.string.error, R.string.enterprise_login_warning)
}
@OnClick(R.id.browserLogin) internal fun onOpenBrowser() {
LoginActivity.startOAuth(this)
}
@OnClick(R.id.language_selector_clicker) fun onChangeLanguage() {
showLanguage()
}
@OnClick(R.id.toggle) internal fun onToggle() {
TransitionManager.beginDelayedTransition(viewGroup)
val isVisible = recycler.visibility == View.VISIBLE
recycler.visibility = if (isVisible) View.GONE else View.VISIBLE
toggleImage.rotation = if (!isVisible) 180f else 0f
}
override fun onLanguageChanged(action: Action) {
try {
action.run()
recreate()
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun providePresenter(): LoginChooserPresenter {
return LoginChooserPresenter()
}
override fun onAccountsLoaded(accounts: List<Login>?) {
if (accounts == null || accounts.isEmpty()) {
multiAccLayout.visibility = View.GONE
} else {
TransitionManager.beginDelayedTransition(viewGroup)
adapter.insertItems(accounts)
multiAccLayout.visibility = View.VISIBLE
}
}
override fun onItemClick(position: Int, v: View, item: Login) {
presenter.manageViewDisposable(Login.onMultipleLogin(item, item.isIsEnterprise, false)
.doOnSubscribe { showProgress(0) }
.doFinally { this.hideProgress() }
.subscribe({ onRestartApp() }, ::println))
}
override fun onItemLongClick(position: Int, v: View, item: Login) {}
private fun showLanguage() {
val languageBottomSheetDialog = LanguageBottomSheetDialog()
languageBottomSheetDialog.onAttach(this as Context)
languageBottomSheetDialog.show(supportFragmentManager, "LanguageBottomSheetDialog")
}
}

View File

@ -0,0 +1,14 @@
package com.fastaccess.ui.modules.login.chooser
import com.fastaccess.data.dao.model.Login
import com.fastaccess.ui.base.mvp.BaseMvp
import com.fastaccess.ui.modules.settings.LanguageBottomSheetDialog
import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder
interface LoginChooserMvp {
interface View : BaseMvp.FAView, LanguageBottomSheetDialog.LanguageDialogListener,
BaseViewHolder.OnItemClickListener<Login> {
fun onAccountsLoaded(accounts: List<Login>?)
}
}

View File

@ -0,0 +1,12 @@
package com.fastaccess.ui.modules.login.chooser
import com.fastaccess.data.dao.model.Login
import com.fastaccess.ui.base.mvp.presenter.BasePresenter
class LoginChooserPresenter : BasePresenter<LoginChooserMvp.View>() {
init {
manageObservable(Login.getAccounts().toList()
.toObservable()
.doOnNext { sendToView { view -> view.onAccountsLoaded(it) } })
}
}

View File

@ -68,6 +68,7 @@ public class MainActivity extends BaseActivity<MainMvp.View, MainPresenter> impl
new SlackBottomSheetDialog().show(getSupportFragmentManager(), SlackBottomSheetDialog.TAG);
}
}
getPresenter().setEnterprise(PrefGetter.isEnterprise());
selectHome(false);
hideShowShadow(navType == MainMvp.FEEDS);
setToolbarIcon(R.drawable.ic_menu);
@ -143,7 +144,7 @@ public class MainActivity extends BaseActivity<MainMvp.View, MainPresenter> impl
navType = MainMvp.PULL_REQUESTS;
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.container, MyPullsPagerFragment.newInstance(false), MyPullsPagerFragment.TAG)
.replace(R.id.container, MyPullsPagerFragment.newInstance(), MyPullsPagerFragment.TAG)
.commit();
bottomNavigation.setSelectedIndex(2, true);
attachFeeds = false;
@ -151,7 +152,7 @@ public class MainActivity extends BaseActivity<MainMvp.View, MainPresenter> impl
navType = MainMvp.ISSUES;
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.container, MyIssuesPagerFragment.newInstance(false), MyIssuesPagerFragment.TAG)
.replace(R.id.container, MyIssuesPagerFragment.newInstance(), MyIssuesPagerFragment.TAG)
.commit();
bottomNavigation.setSelectedIndex(1, true);
attachFeeds = false;
@ -161,7 +162,7 @@ public class MainActivity extends BaseActivity<MainMvp.View, MainPresenter> impl
if (attachFeeds) {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.container, FeedsFragment.newInstance(false), FeedsFragment.TAG)
.replace(R.id.container, FeedsFragment.newInstance(null), FeedsFragment.TAG)
.commit();
}
}

View File

@ -8,7 +8,7 @@ import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import com.fastaccess.R;
import com.fastaccess.helper.Logger;
import com.fastaccess.data.dao.model.Login;
import com.fastaccess.helper.PrefGetter;
import com.fastaccess.helper.RxHelper;
import com.fastaccess.provider.rest.RestProvider;
@ -17,8 +17,6 @@ import com.fastaccess.ui.modules.feeds.FeedsFragment;
import com.fastaccess.ui.modules.main.issues.pager.MyIssuesPagerFragment;
import com.fastaccess.ui.modules.main.pullrequests.pager.MyPullsPagerFragment;
import java.util.Observable;
import static com.fastaccess.helper.ActivityHelper.getVisibleFragment;
import static com.fastaccess.helper.AppHelper.getFragmentByTag;
@ -32,18 +30,18 @@ public class MainPresenter extends BasePresenter<MainMvp.View> implements MainMv
setEnterprise(PrefGetter.isEnterprise());
manageDisposable(RxHelper.getObserver(RestProvider.getUserService(isEnterprise()).getUser())
.flatMap(login -> {
login.setIsLoggedIn(true);
login.setEnterpriseUrl(isEnterprise() ? PrefGetter.getEnterpriseUrl() : null);
login.setToken(isEnterprise() ? PrefGetter.getEnterpriseToken() : PrefGetter.getToken());
login.setOtpCode(isEnterprise() ? PrefGetter.getEnterpriseOtpCode() : PrefGetter.getOtpCode());
login.setIsEnterprise(isEnterprise());
return login.update(login);
Login current = Login.getUser();
current.setLogin(login.getLogin());
current.setName(login.getName());
current.setAvatarUrl(login.getAvatarUrl());
current.setEmail(login.getEmail());
current.setBio(login.getBio());
current.setBlog(login.getBlog());
current.setCompany(current.getCompany());
return login.update(current);
})
.subscribe(login -> {
Logger.e(login.getToken());
if (login != null) {
sendToView(MainMvp.View::onUpdateDrawerMenuHeader);
}
sendToView(MainMvp.View::onUpdateDrawerMenuHeader);
}, Throwable::printStackTrace/*fail silently*/));
}
@ -52,32 +50,38 @@ public class MainPresenter extends BasePresenter<MainMvp.View> implements MainMv
}
@SuppressWarnings("ConstantConditions")
@Override public void onModuleChanged(@NonNull FragmentManager fragmentManager, @MainMvp.NavigationType int type) {
@Override public void onModuleChanged(@NonNull FragmentManager fragmentManager, @MainMvp.NavigationType
int type) {
Fragment currentVisible = getVisibleFragment(fragmentManager);
FeedsFragment homeView = (FeedsFragment) getFragmentByTag(fragmentManager, FeedsFragment.TAG);
MyPullsPagerFragment pullRequestView = (MyPullsPagerFragment) getFragmentByTag(fragmentManager, MyPullsPagerFragment.TAG);
MyIssuesPagerFragment issuesView = (MyIssuesPagerFragment) getFragmentByTag(fragmentManager, MyIssuesPagerFragment.TAG);
FeedsFragment homeView = (FeedsFragment) getFragmentByTag(fragmentManager, FeedsFragment
.TAG);
MyPullsPagerFragment pullRequestView = (MyPullsPagerFragment) getFragmentByTag
(fragmentManager, MyPullsPagerFragment.TAG);
MyIssuesPagerFragment issuesView = (MyIssuesPagerFragment) getFragmentByTag
(fragmentManager, MyIssuesPagerFragment.TAG);
switch (type) {
case MainMvp.PROFILE:
sendToView(MainMvp.View::onOpenProfile);
break;
case MainMvp.FEEDS:
if (homeView == null) {
onAddAndHide(fragmentManager, FeedsFragment.newInstance(isEnterprise()), currentVisible);
onAddAndHide(fragmentManager, FeedsFragment.newInstance(null),
currentVisible);
} else {
onShowHideFragment(fragmentManager, homeView, currentVisible);
}
break;
case MainMvp.PULL_REQUESTS:
if (pullRequestView == null) {
onAddAndHide(fragmentManager, MyPullsPagerFragment.newInstance(isEnterprise()), currentVisible);
onAddAndHide(fragmentManager, MyPullsPagerFragment.newInstance(
), currentVisible);
} else {
onShowHideFragment(fragmentManager, pullRequestView, currentVisible);
}
break;
case MainMvp.ISSUES:
if (issuesView == null) {
onAddAndHide(fragmentManager, MyIssuesPagerFragment.newInstance(isEnterprise()), currentVisible);
onAddAndHide(fragmentManager, MyIssuesPagerFragment.newInstance(), currentVisible);
} else {
onShowHideFragment(fragmentManager, issuesView, currentVisible);
}
@ -85,7 +89,8 @@ public class MainPresenter extends BasePresenter<MainMvp.View> implements MainMv
}
}
@Override public void onShowHideFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment toShow, @NonNull Fragment toHide) {
@Override public void onShowHideFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment toShow,
@NonNull Fragment toHide) {
toHide.onHiddenChanged(true);
fragmentManager
.beginTransaction()
@ -95,7 +100,8 @@ public class MainPresenter extends BasePresenter<MainMvp.View> implements MainMv
toShow.onHiddenChanged(false);
}
@Override public void onAddAndHide(@NonNull FragmentManager fragmentManager, @NonNull Fragment toAdd, @NonNull Fragment toHide) {
@Override public void onAddAndHide(@NonNull FragmentManager fragmentManager, @NonNull Fragment toAdd,
@NonNull Fragment toHide) {
toHide.onHiddenChanged(true);
fragmentManager
.beginTransaction()

View File

@ -16,8 +16,6 @@ import com.fastaccess.R;
import com.fastaccess.data.dao.FragmentPagerAdapterModel;
import com.fastaccess.data.dao.TabsCountStateModel;
import com.fastaccess.data.dao.types.IssueState;
import com.fastaccess.helper.BundleConstant;
import com.fastaccess.helper.Bundler;
import com.fastaccess.helper.ViewHelper;
import com.fastaccess.ui.adapter.FragmentsPagerAdapter;
import com.fastaccess.ui.base.BaseFragment;
@ -41,12 +39,8 @@ public class MyIssuesPagerFragment extends BaseFragment<MyIssuesPagerMvp.View, M
@BindView(R.id.pager) ViewPagerView pager;
@State HashSet<TabsCountStateModel> counts = new HashSet<>();
public static MyIssuesPagerFragment newInstance(boolean isEnterprise) {
MyIssuesPagerFragment fragment = new MyIssuesPagerFragment();
fragment.setArguments(Bundler.start()
.put(BundleConstant.IS_ENTERPRISE, isEnterprise)
.end());
return fragment;
public static MyIssuesPagerFragment newInstance() {
return new MyIssuesPagerFragment();
}
@Override protected int fragmentLayout() {

View File

@ -16,8 +16,6 @@ import com.fastaccess.R;
import com.fastaccess.data.dao.FragmentPagerAdapterModel;
import com.fastaccess.data.dao.TabsCountStateModel;
import com.fastaccess.data.dao.types.IssueState;
import com.fastaccess.helper.BundleConstant;
import com.fastaccess.helper.Bundler;
import com.fastaccess.helper.ViewHelper;
import com.fastaccess.ui.adapter.FragmentsPagerAdapter;
import com.fastaccess.ui.base.BaseFragment;
@ -41,12 +39,8 @@ public class MyPullsPagerFragment extends BaseFragment<MyPullsPagerMvp.View, MyP
@BindView(R.id.pager) ViewPagerView pager;
@State HashSet<TabsCountStateModel> counts = new HashSet<>();
public static MyPullsPagerFragment newInstance(boolean isEnterprise) {
MyPullsPagerFragment fragment = new MyPullsPagerFragment();
fragment.setArguments(Bundler.start()
.put(BundleConstant.IS_ENTERPRISE, isEnterprise)
.end());
return fragment;
public static MyPullsPagerFragment newInstance() {
return new MyPullsPagerFragment();
}
@Override protected int fragmentLayout() {

View File

@ -6,7 +6,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.util.Linkify;
import android.widget.Toast;
import com.fastaccess.App;
@ -14,8 +13,7 @@ import com.fastaccess.R;
import com.fastaccess.data.dao.model.Login;
import com.fastaccess.helper.InputHelper;
import com.fastaccess.provider.scheme.SchemeParser;
import com.fastaccess.ui.modules.login.LoginActivity;
import com.fastaccess.ui.modules.login.LoginChooserActivity;
import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity;
import org.apache.tools.ant.ExitException;

View File

@ -47,7 +47,7 @@ public class OrgProfileOverviewFragment extends BaseFragment<OrgProfileOverviewM
@State User userModel;
public static OrgProfileOverviewFragment newInstance(@NonNull String login, boolean isEnterprise) {
public static OrgProfileOverviewFragment newInstance(@NonNull String login) {
OrgProfileOverviewFragment view = new OrgProfileOverviewFragment();
view.setArguments(Bundler.start().put(BundleConstant.EXTRA, login).end());
return view;

View File

@ -33,7 +33,7 @@ public class OrgMembersFragment extends BaseFragment<OrgMembersMvp.View, OrgMemb
private OnLoadMore<String> onLoadMore;
private UsersAdapter adapter;
public static OrgMembersFragment newInstance(@NonNull String username, boolean isEnterprise) {
public static OrgMembersFragment newInstance(@NonNull String username) {
OrgMembersFragment view = new OrgMembersFragment();
view.setArguments(Bundler.start().put(BundleConstant.EXTRA, username).end());
return view;

View File

@ -35,7 +35,7 @@ public class OrgReposFragment extends BaseFragment<OrgReposMvp.View, OrgReposPre
private ReposAdapter adapter;
private ProfileReposFilterBottomSheetDialog dialog;
public static OrgReposFragment newInstance(@NonNull String username, boolean isEnterprise) {
public static OrgReposFragment newInstance(@NonNull String username) {
OrgReposFragment view = new OrgReposFragment();
view.setArguments(Bundler.start().put(BundleConstant.EXTRA, username).end());
return view;

View File

@ -33,7 +33,7 @@ public class OrgTeamFragment extends BaseFragment<OrgTeamMvp.View, OrgTeamPresen
private OnLoadMore<String> onLoadMore;
private TeamsAdapter adapter;
public static OrgTeamFragment newInstance(@NonNull String username, boolean isEnterprise) {
public static OrgTeamFragment newInstance(@NonNull String username) {
OrgTeamFragment view = new OrgTeamFragment();
view.setArguments(Bundler.start().put(BundleConstant.EXTRA, username).end());
return view;

View File

@ -345,7 +345,11 @@ public class IssuePagerActivity extends BaseActivity<IssuePagerMvp.View, IssuePa
}
@Override protected void onNavToRepoClicked() {
startActivity(RepoPagerActivity.createIntent(this, getPresenter().getRepoId(), getPresenter().getLogin(), RepoPagerMvp.ISSUES));
Intent intent = RepoPagerActivity.createIntent(this, getPresenter().getRepoId(), getPresenter().getLogin(), RepoPagerMvp.ISSUES);
Bundle bundle = intent.getExtras();
bundle.putBoolean(BundleConstant.IS_ENTERPRISE, isEnterprise());
intent.putExtras(bundle);
startActivity(intent);
finish();
}

View File

@ -175,7 +175,7 @@ public class UserPagerActivity extends BaseActivity<UserPagerMvp.View, UserPager
@Override public void onInitOrg(boolean isMember) {
hideProgress();
FragmentsPagerAdapter adapter = new FragmentsPagerAdapter(getSupportFragmentManager(),
FragmentPagerAdapterModel.buildForOrg(this, login, isMember, isEnterprise()));
FragmentPagerAdapterModel.buildForOrg(this, login, isMember));
pager.setAdapter(adapter);
tabs.setTabGravity(TabLayout.GRAVITY_FILL);
tabs.setTabMode(TabLayout.MODE_SCROLLABLE);

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:width="234dp"
android:height="215dp"
android:viewportHeight="215"
android:viewportWidth="234">
<group
android:translateX="-1691"
android:translateY="-710">
<group>
<clip-path android:pathData="M1691 710l234 0 0 215 -234 0 0 -215z" />
<group
android:translateX="1691"
android:translateY="710">
<path
android:fillColor="#317afe"
android:pathData="M100 80.9986C100 87.6274 95.5227 93 90 93 84.4773 93 80 87.6274 80 80.9986 80 74.3707 84.4773 69 90 69c5.5227 0.0048 10 5.3717 10 11.9986z" />
</group>
<group
android:translateX="1691"
android:translateY="710">
<path
android:fillColor="#317afe"
android:pathData="M146.5 93C151.747 93 156 87.6274 156 80.9986 156 74.3717 151.747 69.0048 146.5 69 141.253 69 137 74.3707 137 80.9986 137 87.6274 141.253 93 146.5 93Z" />
</group>
<group
android:translateX="1691"
android:translateY="710">
<path
android:fillColor="#317afe"
android:pathData="M172.805 9.50178L156.717 25.8959c5.29 3.9459 9.997 8.6604 13.95 13.9864C179.04 51.066 184 64.9538 184 80l0 0.2102 0 0.1305 0 23.6593 0 59 0 19c0 6.075 -4.925 11 -11 11 -6.075 0 -11 -4.925 -11 -11l0 -19 -0.016 0c0.011 -0.165 0.016 -0.332 0.016 -0.5 0 -4.142 -3.358 -7.5 -7.5 -7.5 -4.142 0 -7.5 3.358 -7.5 7.5 0 0.168 0.005 0.335 0.016 0.5l-0.016 0 0 41c0 6.075 -4.925 11 -11 11 -6.075 0 -11 -4.925 -11 -11l0 -41c0 -4.418 -3.582 -8 -8 -8 -4.418 0 -8 3.582 -8 8l0 41c0 6.075 -4.925 11 -11 11 -6.0751 0 -11 -4.925 -11 -11l0 -40.5 0 -0.5 -0.0164 0c-0.2573 -3.909 -3.5095 -7 -7.4836 -7 -3.9741 0 -7.2263 3.091 -7.4836 7L72 163l0 0.5 0 18.5c0 6.075 -4.9249 11 -11 11 -6.0751 0 -11 -4.925 -11 -11l0 -19 0 -38.824C45.6964 125.995 40.9656 127 36 127 16.1178 127 0 110.882 0 91 0 84.9249 4.92493 80 11 80c6.0751 0 11 4.9249 11 11 0 7.732 6.2681 14 14 14 7.7319 0 14 -6.268 14 -14L50 80C50 57.5324 61.059 37.6478 78.0304 25.4926L62.3384 9.50178c-2.1328 -2.17337 -2.1328 -5.65427 0 -7.82767 2.1904 -2.232147 5.7862 -2.232147 7.9767 0L87.9257 19.62c4.1488 -2.0014 8.5355 -3.5878 13.1063 -4.7054 5.279 -1.4576 10.805 -2.2672 16.54 -2.2672 10.581 0 20.45 2.7561 29.371 7.2528L164.828 1.67411c2.191 -2.232147 5.786 -2.232147 7.977 0 2.133 2.1734 2.133 5.6543 0 7.82767zM95.0219 58.4901c-12.5925 -1.669 -24.1536 7.1862 -25.8226 19.7786 -1.6689 12.5925 7.1863 24.1533 19.7787 25.8223 9.247 1.214 19.438 1.896 29.022 1.909 9.584 -0.013 19.775 -0.695 29.022 -1.909 12.592 -1.669 21.447 -13.2298 19.779 -25.8223C165.132 65.6763 153.57 56.8211 140.978 58.4901 133.212 59.5316 126.045 60.0129 118 60 109.955 60.0129 102.788 59.5316 95.0219 58.4901Z"
tools:ignore="VectorPath" />
</group>
</group>
</group>
</vector>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/viewGroup"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
@ -17,156 +18,221 @@
android:layout_height="wrap_content"
android:layout_gravity="center">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/spacing_s_large"
android:minHeight="350dp"
android:minWidth="250dp"
app:cardElevation="@dimen/spacing_normal">
android:orientation="vertical">
<LinearLayout
android:id="@+id/loginForm"
<android.support.v7.widget.CardView
android:id="@+id/multiAccLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_gravity="center"
android:layout_marginBottom="@dimen/spacing_xs_large"
android:layout_marginEnd="@dimen/spacing_s_large"
android:layout_marginStart="@dimen/spacing_s_large"
android:minWidth="250dp"
android:visibility="gone"
app:cardElevation="@dimen/spacing_normal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorAccent"
android:orientation="vertical"
android:paddingBottom="@dimen/spacing_xs_large"
android:paddingEnd="@dimen/spacing_xs_large"
android:paddingStart="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_xs_large">
android:orientation="vertical">
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/mainCard"
style="@style/TextAppearance.AppCompat.Title.Inverse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingBottom="@dimen/spacing_xs_large"
android:text="@string/sign_in_to_github"/>
<com.fastaccess.ui.widgets.FontTextView
style="@style/TextAppearance.AppCompat.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/choose_your_login_type"
android:textColor="@color/material_blue_accent_100"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/spacing_normal"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="@dimen/spacing_normal"
android:paddingEnd="@dimen/spacing_xs_large"
android:paddingStart="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_normal">
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/basicAuth"
style="@style/TextAppearance.AppCompat.Title"
<LinearLayout
android:id="@+id/toggle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:gravity="center"
android:padding="@dimen/spacing_xs_large"
android:text="@string/basic_authentication"
android:textColor="@color/material_green_700"/>
<com.fastaccess.ui.widgets.FontTextView
style="@style/TextAppearance.AppCompat.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bottom_border"
android:gravity="center"
android:orientation="horizontal"
android:paddingBottom="@dimen/spacing_normal"
android:paddingEnd="@dimen/spacing_large"
android:paddingStart="@dimen/spacing_large"
android:text="@string/or_character"/>
android:paddingTop="@dimen/spacing_normal">
<com.fastaccess.ui.widgets.FontTextView
style="@style/Base.TextAppearance.AppCompat.Subhead"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingEnd="@dimen/spacing_xs_large"
android:paddingStart="@dimen/spacing_xs_large"
android:text="@string/choose_account"
android:textColor="@color/search_tab_highlighter"/>
<com.fastaccess.ui.widgets.ForegroundImageView
android:id="@+id/toggleImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
android:src="@drawable/ic_arrow_drop_down"
android:tint="@color/black"/>
</LinearLayout>
<com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_normal"
android:visibility="gone"
app:layoutManager="@string/linear_layout_manager"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/spacing_s_large"
android:minHeight="350dp"
android:minWidth="250dp"
app:cardElevation="@dimen/spacing_normal">
<LinearLayout
android:id="@+id/loginForm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:background="?colorAccent"
android:orientation="vertical"
android:paddingBottom="@dimen/spacing_xs_large"
android:paddingEnd="@dimen/spacing_xs_large"
android:paddingStart="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_xs_large">
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/accessToken"
style="@style/TextAppearance.AppCompat.Medium"
android:layout_width="0dp"
android:id="@+id/mainCard"
style="@style/TextAppearance.AppCompat.Title.Inverse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?selectableItemBackground"
android:layout_gravity="center"
android:gravity="center"
android:paddingBottom="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_xs_large"
android:text="@string/access_token"
android:textColor="@color/material_pink_700"/>
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginTop="@dimen/spacing_normal"
android:background="@drawable/left_border"/>
android:text="@string/sign_in_to_github"/>
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/enterprise"
style="@style/TextAppearance.AppCompat.Medium"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?selectableItemBackground"
android:gravity="center"
android:paddingBottom="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_xs_large"
android:text="@string/enterprise"
android:textColor="@color/material_purple_700"/>
android:text="@string/choose_your_login_type"
android:textColor="@color/material_blue_accent_100"/>
</LinearLayout>
<com.fastaccess.ui.widgets.FontTextView
style="@style/TextAppearance.AppCompat.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bottom_border"
android:gravity="center"
android:paddingBottom="@dimen/spacing_normal"
android:paddingEnd="@dimen/spacing_large"
android:paddingStart="@dimen/spacing_large"
android:text="@string/or_character"/>
<com.fastaccess.ui.widgets.FontTextView
style="@style/TextAppearance.AppCompat.Small"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_xs_large"
android:layout_gravity="center"
android:layout_marginTop="@dimen/spacing_normal"
android:gravity="center"
android:text="@string/login_using_your_default_browser"/>
android:orientation="vertical"
android:paddingBottom="@dimen/spacing_normal"
android:paddingEnd="@dimen/spacing_xs_large"
android:paddingStart="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_normal">
<com.fastaccess.ui.widgets.FontButton
android:id="@+id/browserLogin"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:text="@string/open_in_browser"/>
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/basicAuth"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:gravity="center"
android:padding="@dimen/spacing_xs_large"
android:text="@string/basic_authentication"
android:textColor="@color/material_green_700"/>
<com.fastaccess.ui.widgets.FontTextView
style="@style/TextAppearance.AppCompat.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bottom_border"
android:gravity="center"
android:paddingBottom="@dimen/spacing_normal"
android:paddingEnd="@dimen/spacing_large"
android:paddingStart="@dimen/spacing_large"
android:text="@string/or_character"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/accessToken"
style="@style/TextAppearance.AppCompat.Medium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?selectableItemBackground"
android:gravity="center"
android:paddingBottom="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_xs_large"
android:text="@string/access_token"
android:textColor="@color/material_pink_700"/>
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginTop="@dimen/spacing_normal"
android:background="@drawable/left_border"/>
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/enterprise"
style="@style/TextAppearance.AppCompat.Medium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?selectableItemBackground"
android:gravity="center"
android:paddingBottom="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_xs_large"
android:text="@string/enterprise"
android:textColor="@color/material_purple_700"/>
</LinearLayout>
<com.fastaccess.ui.widgets.FontTextView
style="@style/TextAppearance.AppCompat.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bottom_border"
android:gravity="center"
android:paddingBottom="@dimen/spacing_normal"
android:paddingEnd="@dimen/spacing_large"
android:paddingStart="@dimen/spacing_large"
android:text="@string/or_character"/>
<com.fastaccess.ui.widgets.FontTextView
style="@style/TextAppearance.AppCompat.Small"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_xs_large"
android:gravity="center"
android:text="@string/login_using_your_default_browser"/>
<com.fastaccess.ui.widgets.FontButton
android:id="@+id/browserLogin"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:text="@string/open_in_browser"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>

View File

@ -1,25 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="172dp"
android:orientation="vertical"
android:paddingTop="@dimen/spacing_s_large">
android:layout_height="120dp"
android:gravity="bottom"
android:paddingBottom="@dimen/spacing_s_large"
android:orientation="horizontal">
<com.fastaccess.ui.widgets.AvatarLayout
android:id="@+id/navAvatarLayout"
android:layout_width="@dimen/header_icon_zie"
android:layout_height="@dimen/header_icon_zie"
android:layout_margin="@dimen/spacing_xs_large" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center">
<com.fastaccess.ui.widgets.AvatarLayout
android:id="@+id/navAvatarLayout"
android:layout_width="@dimen/large_icon_zie"
android:layout_height="@dimen/large_icon_zie"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/spacing_xs_large"
android:layout_marginStart="@dimen/spacing_xs_large"/>
<com.fastaccess.ui.widgets.ForegroundImageView
android:id="@+id/donatedIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/navAvatarLayout"
android:layout_alignStart="@+id/navAvatarLayout"
android:layout_marginStart="@dimen/spacing_large"
android:contentDescription="@string/success_purchase_message"
android:src="@drawable/ic_heart_full"
android:visibility="gone"
tools:visibility="visible"/>
</RelativeLayout>
<LinearLayout
android:id="@+id/navAccHolder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_gravity="bottom|center"
android:background="?selectableItemBackground"
android:orientation="horizontal">
@ -40,7 +59,7 @@
android:layout_marginStart="@dimen/spacing_xs_large"
android:ellipsize="marquee"
android:singleLine="true"
android:text="@string/app_name" />
android:text="@string/app_name"/>
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/navUsername"
@ -52,7 +71,7 @@
android:layout_marginStart="@dimen/spacing_xs_large"
android:ellipsize="marquee"
android:singleLine="true"
android:text="@string/app_name" />
android:text="@string/app_name"/>
</LinearLayout>
<com.fastaccess.ui.widgets.ForegroundImageView
@ -61,21 +80,9 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="@dimen/spacing_normal"
android:src="@drawable/ic_arrow_drop_down" />
android:src="@drawable/ic_arrow_drop_down"/>
</LinearLayout>
<com.fastaccess.ui.widgets.ForegroundImageView
android:id="@+id/donatedIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/navAvatarLayout"
android:layout_alignStart="@+id/navAvatarLayout"
android:layout_marginStart="@dimen/spacing_xlarge"
android:contentDescription="@string/success_purchase_message"
android:src="@drawable/ic_heart_full"
android:visibility="gone"
tools:visibility="visible" />
</RelativeLayout>
</LinearLayout>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.NavigationView
android:id="@+id/menusHolder"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
@ -12,8 +13,6 @@
<android.support.design.widget.NavigationView
android:id="@+id/extrasNav"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
@ -28,12 +27,10 @@
<android.support.design.widget.NavigationView
android:id="@+id/accountsNav"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginTop="172dp"
android:layout_marginTop="120dp"
android:background="?android:windowBackground"
android:clickable="true"
android:clipToPadding="false"
@ -49,36 +46,139 @@
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/addAccLayout"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:orientation="horizontal"
android:padding="@dimen/spacing_xs_large">
android:background="@drawable/bottom_border">
<android.support.v7.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center"
android:src="@drawable/ic_add"/>
<com.fastaccess.ui.widgets.FontTextView
style="@style/TextAppearance.AppCompat.Subhead"
<FrameLayout
android:id="@+id/addAccLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center"
android:paddingStart="@dimen/spacing_xlarge"
android:text="@string/add_account"
android:textColor="@color/search_tab_highlighter"/>
</FrameLayout>
android:background="?selectableItemBackground"
android:orientation="horizontal"
android:paddingBottom="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_xs_large">
<com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView
android:id="@+id/accLists"
<android.support.v7.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center"
android:layout_marginStart="@dimen/spacing_xs_large"
android:src="@drawable/ic_add"/>
<com.fastaccess.ui.widgets.FontTextView
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center"
android:paddingStart="@dimen/keyline_1"
android:text="@string/add_account"
android:textColor="@color/search_tab_highlighter"/>
</FrameLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/toggleAccountsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="@string/linear_layout_manager"/>
android:layout_marginBottom="@dimen/spacing_normal"
android:background="@drawable/bottom_border"
android:orientation="vertical"
android:visibility="gone">
<FrameLayout
android:id="@+id/toggle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:orientation="horizontal"
android:paddingBottom="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_xs_large">
<android.support.v7.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center"
android:layout_marginStart="@dimen/spacing_xs_large"
android:src="@drawable/ic_profile"/>
<com.fastaccess.ui.widgets.FontTextView
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center"
android:paddingEnd="@dimen/keyline_1"
android:paddingStart="@dimen/keyline_1"
android:text="@string/choose_account"
android:textColor="@color/search_tab_highlighter"/>
<com.fastaccess.ui.widgets.ForegroundImageView
android:id="@+id/toggleImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center"
android:layout_marginEnd="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
android:src="@drawable/ic_arrow_drop_down"/>
</FrameLayout>
<com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView
android:id="@+id/accLists"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:layoutManager="@string/linear_layout_manager"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:id="@+id/togglePinned"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:orientation="horizontal"
android:paddingBottom="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_xs_large">
<android.support.v7.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center"
android:layout_marginStart="@dimen/spacing_xs_large"
android:src="@drawable/ic_pin"/>
<com.fastaccess.ui.widgets.FontTextView
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center"
android:paddingEnd="@dimen/keyline_1"
android:paddingStart="@dimen/keyline_1"
android:text="@string/pinned"
android:textColor="@color/search_tab_highlighter"/>
<com.fastaccess.ui.widgets.ForegroundImageView
android:id="@+id/togglePinnedImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center"
android:layout_marginEnd="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
android:rotation="180"
android:src="@drawable/ic_arrow_drop_down"/>
</FrameLayout>
<com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView
android:id="@+id/pinnedList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="@string/linear_layout_manager"/>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<com.fastaccess.ui.widgets.ForegroundRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?android:selectableItemBackground"
android:paddingBottom="@dimen/spacing_normal"
android:paddingEnd="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_normal"
tools:ignore="RtlSymmetry">
<com.fastaccess.ui.widgets.AvatarLayout
android:id="@+id/avatarLayout"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:layout_marginStart="@dimen/avatar_margin"/>
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/title"
style="@style/TextAppearance.AppCompat.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/keyline_1"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/search_tab_highlighter"
tools:text="When one acquires music and afterlife, one is able to capture heaven."/>
</com.fastaccess.ui.widgets.ForegroundRelativeLayout>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<com.fastaccess.ui.widgets.ForegroundRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?android:selectableItemBackground"
android:paddingBottom="@dimen/spacing_normal"
android:paddingEnd="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_normal"
tools:ignore="RtlSymmetry">
<com.fastaccess.ui.widgets.AvatarLayout
android:id="@+id/avatarLayout"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/avatar_margin"
android:visibility="gone"
tools:visibility="visible"/>
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/title"
style="@style/TextAppearance.AppCompat.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/keyline_1"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorPrimary"
android:textStyle="bold"
tools:text="When one acquires music and afterlife, one is able to capture heaven."/>
</com.fastaccess.ui.widgets.ForegroundRelativeLayout>

View File

@ -502,4 +502,5 @@
otherwise you\'ll end be kicked out every time you access anything rather than your Enterprise GitHub due to the token transmitted to GitHub
API is coming from your Enterprise Account.</string>
<string name="add_account">Add Account</string>
<string name="choose_account">Choose Account</string>
</resources>

View File

@ -21,10 +21,10 @@ buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
classpath 'com.android.tools.build:gradle:3.0.0-alpha6'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.novoda:gradle-build-properties-plugin:0.3'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'
@ -36,7 +36,7 @@ buildscript {
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
google()
}
}

Binary file not shown.