Skip to content

Commit

Permalink
* Remove Flipboard BottomSheet.
Browse files Browse the repository at this point in the history
* Update Libs
  • Loading branch information
Andr3Carvalh0 committed May 11, 2018
1 parent aec091c commit c8b6f40
Show file tree
Hide file tree
Showing 20 changed files with 115 additions and 253 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
17 changes: 8 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ android {
}

dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.github.hotchemi:permissionsdispatcher:3.0.1'
implementation ('com.mikepenz:aboutlibraries:6.0.6@aar') { transitive = true }
Expand All @@ -62,35 +62,34 @@ dependencies {
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.10'
implementation ('com.github.florent37:glidepalette:2.1.1', { exclude group: 'com.android.support', 'module': 'palette-v7' })
implementation 'com.github.bumptech.glide:glide:4.3.1'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation "com.android.support:support-v4:" + project.ext.AppCompatVersion
implementation "com.android.support:cardview-v7:" + project.ext.AppCompatVersion
implementation "com.android.support:palette-v7:" + project.ext.AppCompatVersion
implementation "com.android.support:design:" + project.ext.AppCompatVersion
implementation 'com.flipboard:bottomsheet-core:1.5.2'
implementation 'com.google.dagger:dagger:2.14.1'
implementation 'com.google.dagger:dagger-android:2.11'
implementation 'com.google.dagger:dagger-android-support:2.11'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
implementation 'me.grantland:autofittextview:0.2.1'
implementation 'com.google.guava:guava:23.2-android'
implementation 'com.google.guava:guava:24.1-jre'
implementation 'com.github.apl-devs:appintro:v4.2.2'
implementation 'com.annimon:stream:1.1.9'
implementation 'com.annimon:stream:1.2.0'
implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.2.1'
implementation "android.arch.persistence.room:runtime:1.0.0"
implementation "android.arch.persistence.room:runtime:1.1.0"
implementation "com.android.support:preference-v7:" + project.ext.AppCompatVersion
implementation "com.android.support:preference-v14:" + project.ext.AppCompatVersion

//Tests
testImplementation 'org.mockito:mockito-core:2.15.0'
androidTestImplementation 'org.mockito:mockito-android:2.6.3'
testImplementation "android.arch.persistence.room:testing:1.0.0"
testImplementation "android.arch.persistence.room:testing:1.1.0"
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' })

//Annotations
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.1.0"
annotationProcessor 'com.google.dagger:dagger-compiler:2.14.1'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.11'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/io/mgba/Model/Library.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ private void removeGamesFromDatabase(List<Game> games){
private List<Game> processNewGames(List<Game> games){
return Stream.of(filesService.getGameList())
.map(file -> new Game(file.getAbsolutePath(), getPlatform(file)))
.filter(file -> games.size() == 0 || Stream.of(games)
.anyMatch(game -> game.getFile().equals(file.getFile()) && game.needsUpdate()))
.filter(file -> games.size() == 0 || Stream.of(games).anyMatch(game -> !game.getFile().equals(file.getFile())))
.map(game -> {
Stream.of(games).filter(otherGame -> otherGame.equals(game)).forEach(games::remove);

Expand Down Expand Up @@ -147,8 +146,7 @@ private void storeInDatabase(Game game){

private void searchWeb(Game game){
try {
final GameJSON json = webManager
.get()
final GameJSON json = webManager.get()
.getGameInformation(game.getMD5(), deviceManager.getDeviceLanguage())
.execute()
.body();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
package io.mgba.Presenter.Interfaces;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.MenuItem;

import com.arlib.floatingsearchview.FloatingSearchView;
import com.flipboard.bottomsheet.BottomSheetLayout;

import io.mgba.Data.Database.Game;
import io.mgba.Model.Interfaces.ILibrary;

public interface IMainPresenter {

void onActivityResult(int requestCode, int resultCode, Intent intent);
void showBottomSheet(Game game);
void onDestroy();
ILibrary getILibrary();
void onMenuItemSelected(MenuItem item);
Expand Down
9 changes: 1 addition & 8 deletions app/src/main/java/io/mgba/Presenter/MainPresenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ public void onMenuItemSelected(MenuItem item) {
}
}

@Override
public void showBottomSheet(Game game) {
view.showGameInformation(game);
}

@Override
public void onDestroy() {
Expand All @@ -83,10 +79,7 @@ public void onSearchTextChanged(String oldQuery, String newQuery) {
.query(newQuery)
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(games -> {
view.showSuggestions(games);
onDestroy();
}));
.subscribe(view::showSuggestions));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package io.mgba.UI.Activities.Interfaces;

import io.mgba.Data.Database.Game;

public interface ILibrary {
void showBottomSheet(Game game);
io.mgba.Model.Interfaces.ILibrary getLibraryService();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import io.mgba.Data.Database.Game;

public interface IMainView {
void showGameInformation(Game game);
void clearSuggestions();
void showSuggestions(List<? extends SearchSuggestion> list);
void startAboutPanel(LibsBuilder aboutPanel);
Expand Down
57 changes: 1 addition & 56 deletions app/src/main/java/io/mgba/UI/Activities/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,29 @@
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.view.View;

import com.arlib.floatingsearchview.FloatingSearchView;
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion;
import com.flipboard.bottomsheet.BottomSheetLayout;
import com.flipboard.bottomsheet.ViewTransformer;
import com.mikepenz.aboutlibraries.LibsBuilder;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import io.mgba.Adapters.TabViewPager;
import io.mgba.Constants;
import io.mgba.Presenter.Interfaces.IMainPresenter;
import io.mgba.Presenter.MainPresenter;
import io.mgba.Data.Database.Game;
import io.mgba.Model.Interfaces.ILibrary;
import io.mgba.R;
import io.mgba.UI.Activities.Interfaces.IMainView;
import io.mgba.UI.Views.CustomBottomSheetLayout;
import io.mgba.UI.Views.GameInformationView;
import io.mgba.UI.Views.Interfaces.IGameInformationView;
import io.mgba.Utils.IDependencyInjector;
import io.mgba.Utils.IResourcesManager;

import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
import static io.mgba.Presenter.MainPresenter.DEFAULT_PANEL;

public class MainActivity extends AppCompatActivity implements TabLayout.OnTabSelectedListener, io.mgba.UI.Activities.Interfaces.ILibrary, FloatingSearchView.OnMenuItemClickListener, FloatingSearchView.OnQueryChangeListener, FloatingSearchView.OnSearchListener, IMainView{

@BindView(R.id.floating_search_view) FloatingSearchView toolbar;
@BindView(R.id.pager) ViewPager viewPager;
@BindView(R.id.bottomsheet) CustomBottomSheetLayout sheetDialog;
@BindView(R.id.tabLayout) TabLayout tabLayout;

private IMainPresenter controller;
private IGameInformationView sheetController;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -59,10 +44,6 @@ protected void onCreate(Bundle savedInstanceState) {
if(savedInstanceState != null){
toolbar.onRestoreInstanceState(savedInstanceState.getParcelable(Constants.MAIN_TOOLBAR_STATE));
viewPager.onRestoreInstanceState(savedInstanceState.getParcelable(Constants.MAIN_VIEWPAGE_STATE));

if(savedInstanceState.getBoolean(Constants.ARG_SHEET_IS_SHOWING, false))
showGameInformation(savedInstanceState);

}
}

Expand Down Expand Up @@ -102,10 +83,6 @@ public void onTabReselected(TabLayout.Tab tab) {
viewPager.setCurrentItem(tab.getPosition());
}

@Override
public void showBottomSheet(Game game) {
controller.showBottomSheet(game);
}

@Override
public ILibrary getLibraryService() {
Expand Down Expand Up @@ -133,12 +110,6 @@ public void onActionMenuItemSelected(MenuItem item) {
controller.onMenuItemSelected(item);
}

@Override
public void showGameInformation(Game game) {
initializeSheetController();
showSheetWithView(sheetController.prepareView(sheetDialog, game));
}

@Override
public void clearSuggestions() {
toolbar.clearSuggestions();
Expand Down Expand Up @@ -166,38 +137,11 @@ public void showProgress() {
toolbar.showProgress();
}

private void showGameInformation(Bundle bundle) {
initializeSheetController();
showSheetWithView(sheetController.prepareView(sheetDialog, bundle));
}

private void showSheetWithView(View view) {
if(view != null){
sheetDialog.showWithSheetView(view);
}
}

private void initializeSheetController(){
if(sheetController == null)
sheetController = new GameInformationView(getApplicationContext());

}

@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelable(Constants.MAIN_TOOLBAR_STATE, toolbar.onSaveInstanceState());
outState.putParcelable(Constants.MAIN_VIEWPAGE_STATE, viewPager.onSaveInstanceState());

if(sheetController != null && sheetDialog.getState().equals(BottomSheetLayout.State.PEEKED)
|| sheetDialog.getState().equals(BottomSheetLayout.State.EXPANDED)) {

outState.putBoolean(Constants.ARG_SHEET_IS_SHOWING, true);
sheetController.onSaveInstanceState(outState);
}



}

@Override
Expand All @@ -209,4 +153,5 @@ public void onSuggestionClicked(SearchSuggestion searchSuggestion) {
public void onSearchAction(String currentQuery) {

}

}
24 changes: 9 additions & 15 deletions app/src/main/java/io/mgba/UI/Fragments/Main/GameFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import org.lucasr.twowayview.layout.TwoWayView;

import java.io.Serializable;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import io.mgba.Adapters.GameAdapter;
Expand All @@ -27,21 +23,17 @@
import io.mgba.Data.Database.Game;
import io.mgba.R;
import io.mgba.UI.Fragments.Interfaces.IGamesFragment;
import io.mgba.UI.Views.GameInformationView;

public class GameFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener, IGamesFragment<Game> {

private static final String TAG = "BaseFragment";

@BindView(R.id.no_content_container)
protected RelativeLayout noContentView;
@BindView(R.id.content_recyclerView)
protected TwoWayView recyclerView;
@BindView(R.id.no_content_image)
protected ImageView noContentImage;
@BindView(R.id.no_content_message)
protected TextView noContentMessage;
@BindView(R.id.swipeRefreshLayout)
SwipeRefreshLayout swipeRefreshLayout;
@BindView(R.id.no_content_container) protected RelativeLayout noContentView;
@BindView(R.id.content_recyclerView) protected TwoWayView recyclerView;
@BindView(R.id.no_content_image) protected ImageView noContentImage;
@BindView(R.id.no_content_message) protected TextView noContentMessage;
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout swipeRefreshLayout;

private GameAdapter adapter;
protected IGamesPresenter controller;
Expand Down Expand Up @@ -123,6 +115,7 @@ public void onStop() {

@Override
public void swapContent(List<Game> items) {
showContent(items.size() > 0);
adapter.swap(items);
}

Expand All @@ -134,7 +127,8 @@ public void stopRefreshing() {

@Override
public void handleItemClick(Game game) {
getILibrary().showBottomSheet(game);
GameInformationView sheet = GameInformationView.newInstance(game);
sheet.show(getFragmentManager(), TAG + "_SHEET");
}

@Override
Expand Down
45 changes: 0 additions & 45 deletions app/src/main/java/io/mgba/UI/Views/CustomBottomSheetLayout.java

This file was deleted.

Loading

0 comments on commit c8b6f40

Please sign in to comment.