mirror of https://github.com/kurisufriend/Clover
parent
49f628a4f1
commit
8a86b2d7c3
@ -0,0 +1,38 @@ |
|||||||
|
/* |
||||||
|
* Clover - 4chan browser https://github.com/Floens/Clover/
|
||||||
|
* Copyright (C) 2014 Floens |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
package org.floens.chan.core.presenter; |
||||||
|
|
||||||
|
public class SetupPresenter { |
||||||
|
private Callback callback; |
||||||
|
|
||||||
|
public void create(Callback callback) { |
||||||
|
this.callback = callback; |
||||||
|
|
||||||
|
callback.moveToIntro(); |
||||||
|
} |
||||||
|
|
||||||
|
public void startClicked() { |
||||||
|
callback.moveToSiteSetup(); |
||||||
|
} |
||||||
|
|
||||||
|
public interface Callback { |
||||||
|
void moveToIntro(); |
||||||
|
|
||||||
|
void moveToSiteSetup(); |
||||||
|
} |
||||||
|
} |
@ -1,106 +1,34 @@ |
|||||||
/* |
|
||||||
* Clover - 4chan browser https://github.com/Floens/Clover/
|
|
||||||
* Copyright (C) 2014 Floens |
|
||||||
* |
|
||||||
* This program is free software: you can redistribute it and/or modify |
|
||||||
* it under the terms of the GNU General Public License as published by |
|
||||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||||
* (at your option) any later version. |
|
||||||
* |
|
||||||
* This program is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
* GNU General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU General Public License |
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/ |
|
||||||
package org.floens.chan.core.presenter; |
package org.floens.chan.core.presenter; |
||||||
|
|
||||||
|
import org.floens.chan.core.database.DatabaseManager; |
||||||
import org.floens.chan.core.site.Site; |
import org.floens.chan.core.site.Site; |
||||||
import org.floens.chan.core.site.SiteManager; |
|
||||||
import org.floens.chan.core.site.Sites; |
|
||||||
|
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
import javax.inject.Inject; |
import javax.inject.Inject; |
||||||
|
|
||||||
import static org.floens.chan.Chan.getGraph; |
|
||||||
|
|
||||||
public class SiteSetupPresenter { |
public class SiteSetupPresenter { |
||||||
@Inject |
|
||||||
SiteManager siteManager; |
|
||||||
|
|
||||||
private Callback callback; |
private Callback callback; |
||||||
|
private Site site; |
||||||
private List<Site> sites = new ArrayList<>(); |
private DatabaseManager databaseManager; |
||||||
|
|
||||||
@Inject |
@Inject |
||||||
public SiteSetupPresenter() { |
public SiteSetupPresenter(DatabaseManager databaseManager) { |
||||||
getGraph().inject(this); |
this.databaseManager = databaseManager; |
||||||
} |
} |
||||||
|
|
||||||
public void create(Callback callback) { |
public void create(Callback callback, Site site) { |
||||||
this.callback = callback; |
this.callback = callback; |
||||||
|
this.site = site; |
||||||
sites.addAll(Sites.allSites()); |
|
||||||
|
|
||||||
this.callback.setAddedSites(sites); |
|
||||||
|
|
||||||
this.callback.setNextAllowed(!sites.isEmpty(), false); |
|
||||||
} |
|
||||||
|
|
||||||
public boolean mayExit() { |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
public void onUrlSubmitClicked(String url) { |
|
||||||
callback.goToUrlSubmittedState(); |
|
||||||
|
|
||||||
siteManager.addSite(url, new SiteManager.SiteAddCallback() { |
|
||||||
@Override |
|
||||||
public void onSiteAdded(Site site) { |
|
||||||
siteAdded(site); |
|
||||||
} |
} |
||||||
|
|
||||||
@Override |
public void show() { |
||||||
public void onSiteAddFailed(String message) { |
callback.setBoardCount( |
||||||
callback.showUrlHint(message); |
databaseManager.runTaskSync( |
||||||
|
databaseManager.getDatabaseBoardManager().getSiteSavedBoards(site) |
||||||
|
).size() |
||||||
|
); |
||||||
} |
} |
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
public void onNextClicked() { |
|
||||||
if (!sites.isEmpty()) { |
|
||||||
callback.moveToSavedBoards(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void siteAdded(Site site) { |
|
||||||
sites.clear(); |
|
||||||
sites.addAll(Sites.allSites()); |
|
||||||
|
|
||||||
callback.setAddedSites(sites); |
|
||||||
callback.runSiteAddedAnimation(site); |
|
||||||
|
|
||||||
callback.setNextAllowed(!sites.isEmpty(), true); |
|
||||||
} |
|
||||||
|
|
||||||
private int counter; |
|
||||||
|
|
||||||
public interface Callback { |
public interface Callback { |
||||||
void goToUrlSubmittedState(); |
void setBoardCount(int boardCount); |
||||||
|
|
||||||
void runSiteAddedAnimation(Site site); |
|
||||||
|
|
||||||
void setAddedSites(List<Site> sites); |
|
||||||
|
|
||||||
void setNextAllowed(boolean nextAllowed, boolean animate); |
|
||||||
|
|
||||||
void showUrlHint(String text); |
|
||||||
|
|
||||||
void moveToSavedBoards(); |
|
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -0,0 +1,109 @@ |
|||||||
|
/* |
||||||
|
* Clover - 4chan browser https://github.com/Floens/Clover/
|
||||||
|
* Copyright (C) 2014 Floens |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
package org.floens.chan.core.presenter; |
||||||
|
|
||||||
|
|
||||||
|
import org.floens.chan.core.manager.BoardManager; |
||||||
|
import org.floens.chan.core.site.Site; |
||||||
|
import org.floens.chan.core.site.SiteManager; |
||||||
|
import org.floens.chan.core.site.Sites; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import javax.inject.Inject; |
||||||
|
|
||||||
|
public class SitesSetupPresenter { |
||||||
|
private SiteManager siteManager; |
||||||
|
private BoardManager boardManager; |
||||||
|
|
||||||
|
private Callback callback; |
||||||
|
|
||||||
|
private List<Site> sites = new ArrayList<>(); |
||||||
|
|
||||||
|
@Inject |
||||||
|
public SitesSetupPresenter(SiteManager siteManager, BoardManager boardManager) { |
||||||
|
this.siteManager = siteManager; |
||||||
|
this.boardManager = boardManager; |
||||||
|
} |
||||||
|
|
||||||
|
public void create(Callback callback) { |
||||||
|
this.callback = callback; |
||||||
|
|
||||||
|
sites.addAll(Sites.allSites()); |
||||||
|
|
||||||
|
this.callback.setAddedSites(sites); |
||||||
|
|
||||||
|
this.callback.setNextAllowed(!sites.isEmpty(), false); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean mayExit() { |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
public void onShowDialogClicked() { |
||||||
|
callback.showAddDialog(); |
||||||
|
} |
||||||
|
|
||||||
|
public void onAddClicked(String url) { |
||||||
|
siteManager.addSite(url, new SiteManager.SiteAddCallback() { |
||||||
|
@Override |
||||||
|
public void onSiteAdded(Site site) { |
||||||
|
siteAdded(site); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onSiteAddFailed(String message) { |
||||||
|
// TODO
|
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
public void onDoneClicked() { |
||||||
|
callback.dismiss(); |
||||||
|
} |
||||||
|
|
||||||
|
public int getSiteBoardCount(Site site) { |
||||||
|
return boardManager.getSiteSavedBoards(site).size(); |
||||||
|
} |
||||||
|
|
||||||
|
private void siteAdded(Site site) { |
||||||
|
sites.clear(); |
||||||
|
sites.addAll(Sites.allSites()); |
||||||
|
|
||||||
|
callback.setAddedSites(sites); |
||||||
|
|
||||||
|
callback.setNextAllowed(!sites.isEmpty(), true); |
||||||
|
} |
||||||
|
|
||||||
|
public void onSiteCellSettingsClicked(Site site) { |
||||||
|
callback.openSiteConfiguration(site); |
||||||
|
} |
||||||
|
|
||||||
|
public interface Callback { |
||||||
|
void showAddDialog(); |
||||||
|
|
||||||
|
void dismiss(); |
||||||
|
|
||||||
|
void setAddedSites(List<Site> sites); |
||||||
|
|
||||||
|
void setNextAllowed(boolean nextAllowed, boolean animate); |
||||||
|
|
||||||
|
void openSiteConfiguration(Site site); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,52 @@ |
|||||||
|
/* |
||||||
|
* Clover - 4chan browser https://github.com/Floens/Clover/
|
||||||
|
* Copyright (C) 2014 Floens |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
package org.floens.chan.ui.controller; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.view.View; |
||||||
|
import android.widget.Button; |
||||||
|
|
||||||
|
import org.floens.chan.R; |
||||||
|
import org.floens.chan.controller.Controller; |
||||||
|
import org.floens.chan.core.presenter.SetupPresenter; |
||||||
|
|
||||||
|
public class IntroController extends Controller implements View.OnClickListener { |
||||||
|
private Button start; |
||||||
|
|
||||||
|
public IntroController(Context context) { |
||||||
|
super(context); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onCreate() { |
||||||
|
super.onCreate(); |
||||||
|
|
||||||
|
view = inflateRes(R.layout.controller_intro); |
||||||
|
|
||||||
|
start = view.findViewById(R.id.start); |
||||||
|
start.setOnClickListener(this); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onClick(View v) { |
||||||
|
if (v == start) { |
||||||
|
SetupPresenter presenter = ((SetupController) navigationController).getPresenter(); |
||||||
|
presenter.startClicked(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,82 @@ |
|||||||
|
/* |
||||||
|
* Clover - 4chan browser https://github.com/Floens/Clover/
|
||||||
|
* Copyright (C) 2014 Floens |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
package org.floens.chan.ui.controller; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.view.animation.DecelerateInterpolator; |
||||||
|
|
||||||
|
import org.floens.chan.R; |
||||||
|
import org.floens.chan.controller.Controller; |
||||||
|
import org.floens.chan.controller.transition.FadeInTransition; |
||||||
|
import org.floens.chan.core.presenter.SetupPresenter; |
||||||
|
import org.floens.chan.ui.theme.ThemeHelper; |
||||||
|
import org.floens.chan.ui.toolbar.Toolbar; |
||||||
|
|
||||||
|
public class SetupController extends ToolbarNavigationController implements SetupPresenter.Callback { |
||||||
|
private SetupPresenter presenter; |
||||||
|
|
||||||
|
public SetupController(Context context) { |
||||||
|
super(context); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onCreate() { |
||||||
|
super.onCreate(); |
||||||
|
|
||||||
|
view = inflateRes(R.layout.controller_navigation_setup); |
||||||
|
container = view.findViewById(R.id.container); |
||||||
|
toolbar = view.findViewById(R.id.toolbar); |
||||||
|
toolbar.setArrowMenuIconShown(false); |
||||||
|
toolbar.setBackgroundColor(ThemeHelper.getInstance().getTheme().primaryColor.color); |
||||||
|
toolbar.setCallback(new Toolbar.SimpleToolbarCallback() { |
||||||
|
@Override |
||||||
|
public void onMenuOrBackClicked(boolean isArrow) { |
||||||
|
} |
||||||
|
}); |
||||||
|
toolbar.setAlpha(0f); |
||||||
|
requireSpaceForToolbar = false; |
||||||
|
|
||||||
|
presenter = new SetupPresenter(); |
||||||
|
presenter.create(this); |
||||||
|
} |
||||||
|
|
||||||
|
public SetupPresenter getPresenter() { |
||||||
|
return presenter; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void moveToIntro() { |
||||||
|
replaceController(new IntroController(context), false); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void moveToSiteSetup() { |
||||||
|
replaceController(new SitesSetupController(context), true); |
||||||
|
} |
||||||
|
|
||||||
|
private void replaceController(Controller to, boolean showToolbar) { |
||||||
|
if (blockingInput || toolbar.isTransitioning()) return; |
||||||
|
|
||||||
|
boolean animated = getTop() != null; |
||||||
|
|
||||||
|
transition(getTop(), to, true, animated ? new FadeInTransition() : null); |
||||||
|
|
||||||
|
toolbar.animate().alpha(showToolbar ? 1f : 0f) |
||||||
|
.setInterpolator(new DecelerateInterpolator(2f)).start(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,258 @@ |
|||||||
|
/* |
||||||
|
* Clover - 4chan browser https://github.com/Floens/Clover/
|
||||||
|
* Copyright (C) 2014 Floens |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
package org.floens.chan.ui.controller; |
||||||
|
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint; |
||||||
|
import android.content.Context; |
||||||
|
import android.content.DialogInterface; |
||||||
|
import android.graphics.drawable.Drawable; |
||||||
|
import android.support.design.widget.FloatingActionButton; |
||||||
|
import android.support.v7.app.AlertDialog; |
||||||
|
import android.support.v7.widget.LinearLayoutManager; |
||||||
|
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 org.floens.chan.R; |
||||||
|
import org.floens.chan.core.presenter.SitesSetupPresenter; |
||||||
|
import org.floens.chan.core.site.Site; |
||||||
|
import org.floens.chan.core.site.SiteIcon; |
||||||
|
import org.floens.chan.ui.layout.SiteAddLayout; |
||||||
|
import org.floens.chan.ui.toolbar.ToolbarMenu; |
||||||
|
import org.floens.chan.ui.toolbar.ToolbarMenuItem; |
||||||
|
import org.floens.chan.ui.view.FloatingMenuItem; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import javax.inject.Inject; |
||||||
|
|
||||||
|
import static org.floens.chan.Chan.getGraph; |
||||||
|
import static org.floens.chan.ui.theme.ThemeHelper.theme; |
||||||
|
import static org.floens.chan.utils.AndroidUtils.setRoundItemBackground; |
||||||
|
|
||||||
|
public class SitesSetupController extends StyledToolbarNavigationController implements SitesSetupPresenter.Callback, ToolbarMenuItem.ToolbarMenuItemCallback, View.OnClickListener { |
||||||
|
private static final int DONE_ID = 1; |
||||||
|
|
||||||
|
@Inject |
||||||
|
SitesSetupPresenter presenter; |
||||||
|
|
||||||
|
private ToolbarMenuItem doneMenuItem; |
||||||
|
|
||||||
|
private RecyclerView sitesRecyclerview; |
||||||
|
private FloatingActionButton addButton; |
||||||
|
|
||||||
|
private SitesAdapter sitesAdapter; |
||||||
|
private List<Site> sites = new ArrayList<>(); |
||||||
|
|
||||||
|
public SitesSetupController(Context context) { |
||||||
|
super(context); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onCreate() { |
||||||
|
super.onCreate(); |
||||||
|
|
||||||
|
getGraph().inject(this); |
||||||
|
|
||||||
|
// Inflate
|
||||||
|
view = inflateRes(R.layout.controller_sites_setup); |
||||||
|
|
||||||
|
// Navigation
|
||||||
|
navigationItem.setTitle(R.string.setup_sites_title); |
||||||
|
navigationItem.swipeable = false; |
||||||
|
navigationItem.menu = new ToolbarMenu(context); |
||||||
|
doneMenuItem = navigationItem.menu.addItem( |
||||||
|
new ToolbarMenuItem(context, this, DONE_ID, 0, R.drawable.ic_done_white_24dp)); |
||||||
|
doneMenuItem.getView().setAlpha(0f); |
||||||
|
|
||||||
|
// View binding
|
||||||
|
sitesRecyclerview = view.findViewById(R.id.sites_recycler); |
||||||
|
addButton = view.findViewById(R.id.add); |
||||||
|
|
||||||
|
// Adapters
|
||||||
|
sitesAdapter = new SitesAdapter(); |
||||||
|
|
||||||
|
// View setup
|
||||||
|
sitesRecyclerview.setLayoutManager(new LinearLayoutManager(context)); |
||||||
|
sitesRecyclerview.setAdapter(sitesAdapter); |
||||||
|
addButton.setOnClickListener(this); |
||||||
|
theme().applyFabColor(addButton); |
||||||
|
|
||||||
|
// Presenter
|
||||||
|
presenter.create(this); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onMenuItemClicked(ToolbarMenuItem item) { |
||||||
|
if ((Integer) item.getId() == DONE_ID) { |
||||||
|
presenter.onDoneClicked(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onSubMenuItemClicked(ToolbarMenuItem parent, FloatingMenuItem item) { |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onClick(View v) { |
||||||
|
if (v == addButton) { |
||||||
|
presenter.onShowDialogClicked(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean onBack() { |
||||||
|
if (presenter.mayExit()) { |
||||||
|
return super.onBack(); |
||||||
|
} else { |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void showAddDialog() { |
||||||
|
@SuppressLint("InflateParams") final SiteAddLayout dialogView = |
||||||
|
(SiteAddLayout) LayoutInflater.from(context) |
||||||
|
.inflate(R.layout.layout_site_add, null); |
||||||
|
|
||||||
|
dialogView.setPresenter(presenter); |
||||||
|
|
||||||
|
new AlertDialog.Builder(context) |
||||||
|
.setView(dialogView) |
||||||
|
.setTitle(R.string.setup_sites_add_title) |
||||||
|
.setPositiveButton(R.string.add, new DialogInterface.OnClickListener() { |
||||||
|
@Override |
||||||
|
public void onClick(DialogInterface dialog, int which) { |
||||||
|
dialogView.onPositiveClicked(); |
||||||
|
} |
||||||
|
}) |
||||||
|
.setNegativeButton(R.string.cancel, null) |
||||||
|
.show(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void dismiss() { |
||||||
|
navigationController.stopPresenting(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void openSiteConfiguration(Site site) { |
||||||
|
SiteSetupController c = new SiteSetupController(context); |
||||||
|
c.setSite(site); |
||||||
|
navigationController.pushController(c); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void setAddedSites(List<Site> sites) { |
||||||
|
this.sites.clear(); |
||||||
|
this.sites.addAll(sites); |
||||||
|
sitesAdapter.notifyDataSetChanged(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void setNextAllowed(boolean nextAllowed, boolean animate) { |
||||||
|
doneMenuItem.getView().animate().alpha(nextAllowed ? 1f : 0f).start(); |
||||||
|
} |
||||||
|
|
||||||
|
private void onSiteCellSettingsClicked(Site site) { |
||||||
|
presenter.onSiteCellSettingsClicked(site); |
||||||
|
} |
||||||
|
|
||||||
|
private class SitesAdapter extends RecyclerView.Adapter<SiteCell> { |
||||||
|
public SitesAdapter() { |
||||||
|
setHasStableIds(true); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public long getItemId(int position) { |
||||||
|
return sites.get(position).id(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public SiteCell onCreateViewHolder(ViewGroup parent, int viewType) { |
||||||
|
return new SiteCell(LayoutInflater.from(context).inflate(R.layout.cell_site, parent, false)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onBindViewHolder(SiteCell holder, int position) { |
||||||
|
Site site = sites.get(position); |
||||||
|
holder.setSite(site); |
||||||
|
holder.setSiteIcon(site); |
||||||
|
holder.text.setText(site.name()); |
||||||
|
|
||||||
|
int boards = presenter.getSiteBoardCount(site); |
||||||
|
String boardsString = context.getResources().getQuantityString(R.plurals.board, boards, boards); |
||||||
|
String descriptionText = context.getString(R.string.setup_sites_site_description, boardsString); |
||||||
|
holder.description.setText(descriptionText); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int getItemCount() { |
||||||
|
return sites.size(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private class SiteCell extends RecyclerView.ViewHolder implements View.OnClickListener { |
||||||
|
private ImageView image; |
||||||
|
private TextView text; |
||||||
|
private TextView description; |
||||||
|
private SiteIcon siteIcon; |
||||||
|
private ImageView settings; |
||||||
|
|
||||||
|
private Site site; |
||||||
|
|
||||||
|
public SiteCell(View itemView) { |
||||||
|
super(itemView); |
||||||
|
image = itemView.findViewById(R.id.image); |
||||||
|
text = itemView.findViewById(R.id.text); |
||||||
|
description = itemView.findViewById(R.id.description); |
||||||
|
settings = itemView.findViewById(R.id.settings); |
||||||
|
setRoundItemBackground(settings); |
||||||
|
theme().settingsDrawable.apply(settings); |
||||||
|
settings.setOnClickListener(this); |
||||||
|
} |
||||||
|
|
||||||
|
private void setSite(Site site) { |
||||||
|
this.site = site; |
||||||
|
} |
||||||
|
|
||||||
|
private void setSiteIcon(Site site) { |
||||||
|
siteIcon = site.icon(); |
||||||
|
siteIcon.get(new SiteIcon.SiteIconResult() { |
||||||
|
@Override |
||||||
|
public void onSiteIcon(SiteIcon siteIcon, Drawable icon) { |
||||||
|
if (SiteCell.this.siteIcon == siteIcon) { |
||||||
|
image.setImageDrawable(icon); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onClick(View v) { |
||||||
|
if (v == settings) { |
||||||
|
onSiteCellSettingsClicked(site); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,174 @@ |
|||||||
|
/* |
||||||
|
* Clover - 4chan browser https://github.com/Floens/Clover/
|
||||||
|
* Copyright (C) 2014 Floens |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
package org.floens.chan.ui.layout; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.support.v7.app.AlertDialog; |
||||||
|
import android.support.v7.widget.LinearLayoutManager; |
||||||
|
import android.support.v7.widget.RecyclerView; |
||||||
|
import android.util.AttributeSet; |
||||||
|
import android.view.LayoutInflater; |
||||||
|
import android.view.View; |
||||||
|
import android.view.ViewGroup; |
||||||
|
import android.widget.ImageView; |
||||||
|
import android.widget.LinearLayout; |
||||||
|
import android.widget.TextView; |
||||||
|
|
||||||
|
import org.floens.chan.R; |
||||||
|
import org.floens.chan.core.presenter.BoardSetupPresenter; |
||||||
|
|
||||||
|
import static org.floens.chan.ui.theme.ThemeHelper.theme; |
||||||
|
import static org.floens.chan.utils.AndroidUtils.getAttrColor; |
||||||
|
import static org.floens.chan.utils.AndroidUtils.getString; |
||||||
|
|
||||||
|
public class BoardAddLayout extends LinearLayout implements SearchLayout.SearchLayoutCallback, BoardSetupPresenter.AddCallback { |
||||||
|
private BoardSetupPresenter presenter; |
||||||
|
|
||||||
|
private SuggestionsAdapter suggestionsAdapter; |
||||||
|
|
||||||
|
private SearchLayout search; |
||||||
|
private RecyclerView suggestionsRecycler; |
||||||
|
|
||||||
|
private AlertDialog dialog; |
||||||
|
|
||||||
|
public BoardAddLayout(Context context) { |
||||||
|
this(context, null); |
||||||
|
} |
||||||
|
|
||||||
|
public BoardAddLayout(Context context, AttributeSet attrs) { |
||||||
|
this(context, attrs, 0); |
||||||
|
} |
||||||
|
|
||||||
|
public BoardAddLayout(Context context, AttributeSet attrs, int defStyle) { |
||||||
|
super(context, attrs, defStyle); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onFinishInflate() { |
||||||
|
super.onFinishInflate(); |
||||||
|
|
||||||
|
// View binding
|
||||||
|
search = findViewById(R.id.search); |
||||||
|
suggestionsRecycler = findViewById(R.id.suggestions); |
||||||
|
|
||||||
|
// Adapters
|
||||||
|
suggestionsAdapter = new SuggestionsAdapter(); |
||||||
|
|
||||||
|
// View setup
|
||||||
|
search.setCallback(this); |
||||||
|
search.setHint(getString(R.string.search_hint)); |
||||||
|
search.setTextColor(getAttrColor(getContext(), R.attr.text_color_primary)); |
||||||
|
search.setHintColor(getAttrColor(getContext(), R.attr.text_color_hint)); |
||||||
|
search.setClearButtonImage(R.drawable.ic_clear_black_24dp); |
||||||
|
search.openKeyboard(); |
||||||
|
suggestionsRecycler.setLayoutManager(new LinearLayoutManager(getContext())); |
||||||
|
suggestionsRecycler.setAdapter(suggestionsAdapter); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onAttachedToWindow() { |
||||||
|
super.onAttachedToWindow(); |
||||||
|
presenter.setAddCallback(this); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onDetachedFromWindow() { |
||||||
|
super.onDetachedFromWindow(); |
||||||
|
presenter.setAddCallback(null); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onSearchEntered(String entered) { |
||||||
|
presenter.searchEntered(entered); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void updateSuggestions() { |
||||||
|
suggestionsAdapter.notifyDataSetChanged(); |
||||||
|
} |
||||||
|
|
||||||
|
public void setPresenter(BoardSetupPresenter presenter) { |
||||||
|
this.presenter = presenter; |
||||||
|
} |
||||||
|
|
||||||
|
public void setDialog(AlertDialog dialog) { |
||||||
|
this.dialog = dialog; |
||||||
|
} |
||||||
|
|
||||||
|
private void onSuggestionClicked(BoardSetupPresenter.BoardSuggestion suggestion) { |
||||||
|
presenter.onSuggestionClicked(suggestion); |
||||||
|
} |
||||||
|
|
||||||
|
public void onPositiveClicked() { |
||||||
|
presenter.onAddDialogPositiveClicked(); |
||||||
|
} |
||||||
|
|
||||||
|
private class SuggestionsAdapter extends RecyclerView.Adapter<SuggestionCell> { |
||||||
|
@Override |
||||||
|
public int getItemCount() { |
||||||
|
return presenter.getSuggestions().size(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public SuggestionCell onCreateViewHolder(ViewGroup parent, int viewType) { |
||||||
|
return new SuggestionCell( |
||||||
|
LayoutInflater.from(parent.getContext()) |
||||||
|
.inflate(R.layout.cell_board_suggestion, parent, false)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onBindViewHolder(SuggestionCell holder, int position) { |
||||||
|
BoardSetupPresenter.BoardSuggestion boardSuggestion = presenter.getSuggestions().get(position); |
||||||
|
holder.setSuggestion(boardSuggestion); |
||||||
|
holder.text.setText(boardSuggestion.getName()); |
||||||
|
holder.description.setText(boardSuggestion.getDescription()); |
||||||
|
holder.check.setVisibility(boardSuggestion.isChecked() ? View.VISIBLE : View.INVISIBLE); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private class SuggestionCell extends RecyclerView.ViewHolder implements OnClickListener { |
||||||
|
private TextView text; |
||||||
|
private TextView description; |
||||||
|
private ImageView check; |
||||||
|
|
||||||
|
private BoardSetupPresenter.BoardSuggestion suggestion; |
||||||
|
|
||||||
|
public SuggestionCell(View itemView) { |
||||||
|
super(itemView); |
||||||
|
|
||||||
|
text = itemView.findViewById(R.id.text); |
||||||
|
description = itemView.findViewById(R.id.description); |
||||||
|
check = itemView.findViewById(R.id.check); |
||||||
|
theme().doneDrawable.apply(check); |
||||||
|
|
||||||
|
itemView.setOnClickListener(this); |
||||||
|
} |
||||||
|
|
||||||
|
public void setSuggestion(BoardSetupPresenter.BoardSuggestion suggestion) { |
||||||
|
this.suggestion = suggestion; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onClick(View v) { |
||||||
|
if (v == itemView) { |
||||||
|
onSuggestionClicked(suggestion); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,41 @@ |
|||||||
|
package org.floens.chan.ui.layout; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.support.constraint.ConstraintLayout; |
||||||
|
import android.util.AttributeSet; |
||||||
|
import android.widget.EditText; |
||||||
|
|
||||||
|
import org.floens.chan.R; |
||||||
|
import org.floens.chan.core.presenter.SitesSetupPresenter; |
||||||
|
|
||||||
|
public class SiteAddLayout extends ConstraintLayout { |
||||||
|
private EditText url; |
||||||
|
private SitesSetupPresenter presenter; |
||||||
|
|
||||||
|
public SiteAddLayout(Context context) { |
||||||
|
this(context, null); |
||||||
|
} |
||||||
|
|
||||||
|
public SiteAddLayout(Context context, AttributeSet attrs) { |
||||||
|
this(context, attrs, 0); |
||||||
|
} |
||||||
|
|
||||||
|
public SiteAddLayout(Context context, AttributeSet attrs, int defStyle) { |
||||||
|
super(context, attrs, defStyle); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onFinishInflate() { |
||||||
|
super.onFinishInflate(); |
||||||
|
|
||||||
|
url = findViewById(R.id.url); |
||||||
|
} |
||||||
|
|
||||||
|
public void setPresenter(SitesSetupPresenter presenter) { |
||||||
|
this.presenter = presenter; |
||||||
|
} |
||||||
|
|
||||||
|
public void onPositiveClicked() { |
||||||
|
presenter.onAddClicked(url.getText().toString()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,71 @@ |
|||||||
|
/* |
||||||
|
* Clover - 4chan browser https://github.com/Floens/Clover/
|
||||||
|
* Copyright (C) 2014 Floens |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
package org.floens.chan.utils; |
||||||
|
|
||||||
|
import java.util.concurrent.Callable; |
||||||
|
import java.util.concurrent.Executor; |
||||||
|
import java.util.concurrent.atomic.AtomicBoolean; |
||||||
|
|
||||||
|
public class BackgroundUtils { |
||||||
|
public static <T> Cancelable runWithExecutor(Executor executor, final Callable<T> background, |
||||||
|
final BackgroundResult<T> result) { |
||||||
|
final AtomicBoolean cancelled = new AtomicBoolean(false); |
||||||
|
Cancelable cancelable = new Cancelable() { |
||||||
|
@Override |
||||||
|
public void cancel() { |
||||||
|
cancelled.set(true); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
executor.execute(new Runnable() { |
||||||
|
@Override |
||||||
|
public void run() { |
||||||
|
if (!cancelled.get()) { |
||||||
|
try { |
||||||
|
final T res = background.call(); |
||||||
|
AndroidUtils.runOnUiThread(new Runnable() { |
||||||
|
@Override |
||||||
|
public void run() { |
||||||
|
if (!cancelled.get()) { |
||||||
|
result.onResult(res); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
} catch (final Exception e) { |
||||||
|
AndroidUtils.runOnUiThread(new Runnable() { |
||||||
|
@Override |
||||||
|
public void run() { |
||||||
|
throw new RuntimeException(e); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
return cancelable; |
||||||
|
} |
||||||
|
|
||||||
|
public interface BackgroundResult<T> { |
||||||
|
void onResult(T result); |
||||||
|
} |
||||||
|
|
||||||
|
public interface Cancelable { |
||||||
|
void cancel(); |
||||||
|
} |
||||||
|
} |
After Width: | Height: | Size: 46 KiB |
@ -0,0 +1,64 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!-- |
||||||
|
Clover - 4chan browser https://github.com/Floens/Clover/ |
||||||
|
Copyright (C) 2014 Floens |
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify |
||||||
|
it under the terms of the GNU General Public License as published by |
||||||
|
the Free Software Foundation, either version 3 of the License, or |
||||||
|
(at your option) any later version. |
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, |
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
GNU General Public License for more details. |
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License |
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
--> |
||||||
|
<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="wrap_content" |
||||||
|
android:background="?attr/backcolor" |
||||||
|
android:orientation="horizontal" |
||||||
|
android:paddingLeft="8dp" |
||||||
|
android:paddingRight="8dp"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:layout_weight="1" |
||||||
|
android:orientation="vertical"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/text" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:ellipsize="end" |
||||||
|
android:paddingTop="8dp" |
||||||
|
android:singleLine="true" |
||||||
|
android:textColor="?text_color_primary" |
||||||
|
android:textSize="14sp" |
||||||
|
tools:text="Technology" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/description" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:ellipsize="end" |
||||||
|
android:paddingBottom="8dp" |
||||||
|
android:textColor="?text_color_secondary" |
||||||
|
android:textSize="12sp" |
||||||
|
tools:text="Description is here" /> |
||||||
|
|
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
<ImageView |
||||||
|
android:id="@+id/reorder" |
||||||
|
android:layout_width="48dp" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:padding="8dp" |
||||||
|
android:scaleType="centerInside" |
||||||
|
tools:src="@drawable/ic_reorder_black_24dp" /> |
||||||
|
|
||||||
|
</LinearLayout> |
@ -1,49 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?><!-- |
|
||||||
Clover - 4chan browser https://github.com/Floens/Clover/ |
|
||||||
Copyright (C) 2014 Floens |
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify |
|
||||||
it under the terms of the GNU General Public License as published by |
|
||||||
the Free Software Foundation, either version 3 of the License, or |
|
||||||
(at your option) any later version. |
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, |
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
GNU General Public License for more details. |
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
||||||
--> |
|
||||||
<LinearLayout |
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="48dp" |
|
||||||
android:background="?attr/backcolor" |
|
||||||
android:orientation="horizontal"> |
|
||||||
|
|
||||||
<ImageView |
|
||||||
android:id="@+id/image" |
|
||||||
android:layout_width="48dp" |
|
||||||
android:layout_height="48dp" |
|
||||||
android:padding="8dp" |
|
||||||
android:scaleType="fitCenter"/> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/text" |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="48dp" |
|
||||||
android:layout_weight="1" |
|
||||||
android:gravity="center_vertical" |
|
||||||
android:maxLines="1" |
|
||||||
android:textColor="?text_color_primary" |
|
||||||
android:textSize="14sp"/> |
|
||||||
|
|
||||||
<ImageView |
|
||||||
android:id="@+id/reorder" |
|
||||||
android:layout_width="48dp" |
|
||||||
android:layout_height="48dp" |
|
||||||
android:padding="8dp" |
|
||||||
android:scaleType="centerInside"/> |
|
||||||
|
|
||||||
</LinearLayout> |
|
@ -0,0 +1,89 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!-- |
||||||
|
Clover - 4chan browser https://github.com/Floens/Clover/ |
||||||
|
Copyright (C) 2014 Floens |
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify |
||||||
|
it under the terms of the GNU General Public License as published by |
||||||
|
the Free Software Foundation, either version 3 of the License, or |
||||||
|
(at your option) any later version. |
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, |
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
GNU General Public License for more details. |
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License |
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
--> |
||||||
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:orientation="vertical"> |
||||||
|
|
||||||
|
<ImageView |
||||||
|
android:id="@+id/logo" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="0dp" |
||||||
|
android:layout_margin="16dp" |
||||||
|
android:layout_marginBottom="8dp" |
||||||
|
android:layout_marginEnd="8dp" |
||||||
|
android:layout_marginStart="8dp" |
||||||
|
android:layout_marginTop="8dp" |
||||||
|
android:layout_weight="1" |
||||||
|
android:gravity="center" |
||||||
|
android:src="@drawable/logo" |
||||||
|
app:layout_constraintBottom_toTopOf="@+id/guideline" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="parent" |
||||||
|
app:layout_constraintVertical_bias="1.0" /> |
||||||
|
|
||||||
|
<android.support.constraint.Guideline |
||||||
|
android:id="@+id/guideline" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="0dp" |
||||||
|
android:orientation="horizontal" |
||||||
|
app:layout_constraintBottom_toBottomOf="parent" |
||||||
|
app:layout_constraintGuide_percent="0.45" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/title" |
||||||
|
style="@style/TextAppearance.AppCompat.Display1" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginEnd="8dp" |
||||||
|
android:layout_marginStart="8dp" |
||||||
|
android:layout_marginTop="8dp" |
||||||
|
android:text="@string/intro_title" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="@+id/guideline" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/content" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginEnd="8dp" |
||||||
|
android:layout_marginStart="8dp" |
||||||
|
android:layout_marginTop="8dp" |
||||||
|
android:text="@string/intro_content" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@+id/title" /> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/start" |
||||||
|
style="@style/Widget.AppCompat.Button" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginBottom="32dp" |
||||||
|
android:layout_marginEnd="8dp" |
||||||
|
android:layout_marginStart="8dp" |
||||||
|
android:foreground="?selectableItemBackground" |
||||||
|
android:text="@string/intro_start" |
||||||
|
app:layout_constraintBottom_toBottomOf="parent" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" /> |
||||||
|
|
||||||
|
</android.support.constraint.ConstraintLayout> |
@ -0,0 +1,34 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!-- |
||||||
|
Clover - 4chan browser https://github.com/Floens/Clover/ |
||||||
|
Copyright (C) 2014 Floens |
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify |
||||||
|
it under the terms of the GNU General Public License as published by |
||||||
|
the Free Software Foundation, either version 3 of the License, or |
||||||
|
(at your option) any later version. |
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, |
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
GNU General Public License for more details. |
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License |
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
--> |
||||||
|
<org.floens.chan.ui.view.TouchBlockingLinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:background="?backcolor" |
||||||
|
android:orientation="vertical"> |
||||||
|
|
||||||
|
<org.floens.chan.ui.toolbar.Toolbar |
||||||
|
android:id="@+id/toolbar" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="@dimen/toolbar_height" /> |
||||||
|
|
||||||
|
<FrameLayout |
||||||
|
android:id="@+id/container" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" /> |
||||||
|
|
||||||
|
</org.floens.chan.ui.view.TouchBlockingLinearLayout> |
@ -1,150 +1,6 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?><!-- |
<?xml version="1.0" encoding="utf-8"?> |
||||||
Clover - 4chan browser https://github.com/Floens/Clover/ |
|
||||||
Copyright (C) 2014 Floens |
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify |
|
||||||
it under the terms of the GNU General Public License as published by |
|
||||||
the Free Software Foundation, either version 3 of the License, or |
|
||||||
(at your option) any later version. |
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, |
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
GNU General Public License for more details. |
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License |
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
||||||
--> |
|
||||||
<android.support.constraint.ConstraintLayout |
<android.support.constraint.ConstraintLayout |
||||||
xmlns:android="http://schemas.android.com/apk/res/android" |
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" |
||||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
android:layout_height="match_parent"> |
||||||
xmlns:tools="http://schemas.android.com/tools" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="match_parent" |
|
||||||
android:animateLayoutChanges="true" |
|
||||||
android:background="?attr/backcolor" |
|
||||||
tools:ignore="ContentDescription,RtlHardcoded"> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/introduction" |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_marginEnd="8dp" |
|
||||||
android:layout_marginLeft="8dp" |
|
||||||
android:layout_marginRight="8dp" |
|
||||||
android:layout_marginStart="8dp" |
|
||||||
android:layout_marginTop="8dp" |
|
||||||
android:text="@string/setup_introduction" |
|
||||||
app:layout_constraintHorizontal_bias="0.0" |
|
||||||
app:layout_constraintLeft_toLeftOf="parent" |
|
||||||
app:layout_constraintRight_toRightOf="parent" |
|
||||||
app:layout_constraintTop_toTopOf="parent"/> |
|
||||||
|
|
||||||
<EditText |
|
||||||
android:id="@+id/site_url" |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_marginEnd="8dp" |
|
||||||
android:layout_marginLeft="8dp" |
|
||||||
android:layout_marginRight="8dp" |
|
||||||
android:layout_marginStart="8dp" |
|
||||||
android:layout_marginTop="8dp" |
|
||||||
android:hint="@string/setup_site_url_hint" |
|
||||||
android:inputType="textUri" |
|
||||||
android:textSize="14sp" |
|
||||||
app:layout_constraintHorizontal_bias="0.0" |
|
||||||
app:layout_constraintLeft_toRightOf="@+id/site_url_label" |
|
||||||
app:layout_constraintRight_toLeftOf="@+id/site_url_submit" |
|
||||||
app:layout_constraintTop_toBottomOf="@+id/introduction"/> |
|
||||||
|
|
||||||
<ImageButton |
|
||||||
android:id="@+id/site_url_submit" |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="0dp" |
|
||||||
android:layout_marginEnd="7dp" |
|
||||||
android:layout_marginRight="7dp" |
|
||||||
android:layout_marginTop="8dp" |
|
||||||
android:background="?selectableItemBackground" |
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/site_url" |
|
||||||
app:layout_constraintDimensionRatio="w,1:1" |
|
||||||
app:layout_constraintRight_toRightOf="parent" |
|
||||||
app:layout_constraintTop_toBottomOf="@+id/introduction" |
|
||||||
app:layout_constraintVertical_bias="0.0" |
|
||||||
app:srcCompat="@drawable/ic_add_black_24dp"/> |
|
||||||
|
|
||||||
<ProgressBar |
|
||||||
android:id="@+id/progress" |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="0dp" |
|
||||||
android:layout_marginEnd="8dp" |
|
||||||
android:layout_marginRight="8dp" |
|
||||||
android:layout_marginTop="8dp" |
|
||||||
android:padding="8dp" |
|
||||||
android:visibility="invisible" |
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/site_url" |
|
||||||
app:layout_constraintDimensionRatio="w,1:1" |
|
||||||
app:layout_constraintRight_toRightOf="parent" |
|
||||||
app:layout_constraintTop_toBottomOf="@+id/introduction"/> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/site_url_label" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="0dp" |
|
||||||
android:layout_marginBottom="0dp" |
|
||||||
android:layout_marginLeft="8dp" |
|
||||||
android:layout_marginStart="8dp" |
|
||||||
android:layout_marginTop="8dp" |
|
||||||
android:gravity="center" |
|
||||||
android:text="@string/setup_site_url" |
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/site_url" |
|
||||||
app:layout_constraintLeft_toLeftOf="parent" |
|
||||||
app:layout_constraintTop_toBottomOf="@+id/introduction" |
|
||||||
app:layout_constraintVertical_bias="0.0"/> |
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView |
|
||||||
android:id="@+id/sites_recycler" |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="0dp" |
|
||||||
android:layout_marginBottom="0dp" |
|
||||||
android:layout_marginLeft="0dp" |
|
||||||
android:layout_marginRight="0dp" |
|
||||||
android:layout_marginTop="0dp" |
|
||||||
android:padding="8dp" |
|
||||||
android:scrollbarStyle="outsideOverlay" |
|
||||||
android:scrollbars="vertical" |
|
||||||
app:layout_constraintBottom_toTopOf="@+id/next_button" |
|
||||||
app:layout_constraintHorizontal_bias="0.0" |
|
||||||
app:layout_constraintLeft_toLeftOf="parent" |
|
||||||
app:layout_constraintRight_toRightOf="parent" |
|
||||||
app:layout_constraintTop_toBottomOf="@+id/divider"/> |
|
||||||
|
|
||||||
<View |
|
||||||
android:id="@+id/divider" |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="1dp" |
|
||||||
android:layout_marginLeft="0dp" |
|
||||||
android:layout_marginRight="0dp" |
|
||||||
android:layout_marginTop="8dp" |
|
||||||
android:background="?attr/divider_color" |
|
||||||
app:layout_constraintLeft_toLeftOf="parent" |
|
||||||
app:layout_constraintRight_toRightOf="parent" |
|
||||||
app:layout_constraintTop_toBottomOf="@+id/site_url"/> |
|
||||||
|
|
||||||
<Button |
|
||||||
android:id="@+id/next_button" |
|
||||||
style="@style/Widget.AppCompat.Button.Borderless" |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_marginBottom="0dp" |
|
||||||
android:layout_marginLeft="0dp" |
|
||||||
android:layout_marginRight="0dp" |
|
||||||
android:background="@android:color/white" |
|
||||||
android:elevation="12dp" |
|
||||||
android:foreground="?selectableItemBackground" |
|
||||||
android:text="@string/next" |
|
||||||
android:textColor="?text_color_hint" |
|
||||||
app:layout_constraintBottom_toBottomOf="parent" |
|
||||||
app:layout_constraintLeft_toLeftOf="parent" |
|
||||||
app:layout_constraintRight_toRightOf="parent"/> |
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout> |
</android.support.constraint.ConstraintLayout> |
@ -0,0 +1,44 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!-- |
||||||
|
Clover - 4chan browser https://github.com/Floens/Clover/ |
||||||
|
Copyright (C) 2014 Floens |
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify |
||||||
|
it under the terms of the GNU General Public License as published by |
||||||
|
the Free Software Foundation, either version 3 of the License, or |
||||||
|
(at your option) any later version. |
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, |
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
GNU General Public License for more details. |
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License |
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
--> |
||||||
|
<android.support.design.widget.CoordinatorLayout 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" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:animateLayoutChanges="true" |
||||||
|
android:background="?attr/backcolor" |
||||||
|
tools:ignore="ContentDescription,RtlHardcoded"> |
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView |
||||||
|
android:id="@+id/sites_recycler" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:padding="16dp" |
||||||
|
android:paddingBottom="72dp" |
||||||
|
android:scrollbarStyle="outsideOverlay" |
||||||
|
android:scrollbars="vertical" /> |
||||||
|
|
||||||
|
<android.support.design.widget.FloatingActionButton |
||||||
|
android:id="@+id/add" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_gravity="right|bottom" |
||||||
|
android:layout_margin="16dp" |
||||||
|
android:src="@drawable/ic_add_white_24dp" /> |
||||||
|
|
||||||
|
</android.support.design.widget.CoordinatorLayout> |
@ -0,0 +1,42 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!-- |
||||||
|
Clover - 4chan browser https://github.com/Floens/Clover/ |
||||||
|
Copyright (C) 2014 Floens |
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify |
||||||
|
it under the terms of the GNU General Public License as published by |
||||||
|
the Free Software Foundation, either version 3 of the License, or |
||||||
|
(at your option) any later version. |
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, |
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
GNU General Public License for more details. |
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License |
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
--> |
||||||
|
<org.floens.chan.ui.layout.BoardAddLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:minHeight="10000dp" |
||||||
|
android:minWidth="10000dp" |
||||||
|
android:orientation="vertical" |
||||||
|
android:paddingLeft="16dp" |
||||||
|
android:paddingRight="16dp"> |
||||||
|
|
||||||
|
<org.floens.chan.ui.layout.SearchLayout |
||||||
|
android:id="@+id/search" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:paddingBottom="8dp" |
||||||
|
android:paddingTop="8dp" /> |
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView |
||||||
|
android:id="@+id/suggestions" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:clipToPadding="false" |
||||||
|
android:scrollbarStyle="outsideOverlay" |
||||||
|
android:scrollbars="vertical" /> |
||||||
|
|
||||||
|
</org.floens.chan.ui.layout.BoardAddLayout> |
@ -0,0 +1,42 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!-- |
||||||
|
Clover - 4chan browser https://github.com/Floens/Clover/ |
||||||
|
Copyright (C) 2014 Floens |
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify |
||||||
|
it under the terms of the GNU General Public License as published by |
||||||
|
the Free Software Foundation, either version 3 of the License, or |
||||||
|
(at your option) any later version. |
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, |
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
GNU General Public License for more details. |
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License |
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
--> |
||||||
|
<org.floens.chan.ui.layout.SiteAddLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent"> |
||||||
|
|
||||||
|
<android.support.design.widget.TextInputLayout |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginEnd="8dp" |
||||||
|
android:layout_marginStart="8dp" |
||||||
|
android:layout_marginTop="8dp" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="parent"> |
||||||
|
|
||||||
|
<android.support.design.widget.TextInputEditText |
||||||
|
android:id="@+id/url" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/setup_sites_url" |
||||||
|
android:inputType="textUri" /> |
||||||
|
|
||||||
|
</android.support.design.widget.TextInputLayout> |
||||||
|
|
||||||
|
</org.floens.chan.ui.layout.SiteAddLayout> |
Loading…
Reference in new issue