Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

Commit

Permalink
Bottom sheet max width on tablet
Browse files Browse the repository at this point in the history
  • Loading branch information
alorma committed Nov 12, 2016
1 parent c111eeb commit 45fff40
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.alorma.github.ui.fragment;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.design.widget.BottomSheetDialog;
import android.support.design.widget.BottomSheetDialogFragment;
import android.view.ViewGroup;
import com.alorma.github.R;

public class BaseBottomSheetDialogFragment extends BottomSheetDialogFragment {

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new CustomWidthBottomSheetDialog(getActivity(), getTheme());
}

static class CustomWidthBottomSheetDialog extends BottomSheetDialog {
public CustomWidthBottomSheetDialog(@NonNull Context context, @StyleRes int theme) {
super(context, theme);
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int width = getContext().getResources().getDimensionPixelSize(R.dimen.bottom_sheet_width);
getWindow().setLayout(width > 0 ? width : ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.BottomSheetDialogFragment;
import android.support.design.widget.Snackbar;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
Expand All @@ -18,6 +17,7 @@
import com.alorma.github.GitskariosApplication;
import com.alorma.github.R;
import com.alorma.github.injector.component.ApplicationComponent;
import com.alorma.github.ui.fragment.BaseBottomSheetDialogFragment;
import com.alorma.github.ui.view.UserAvatarView;
import com.alorma.github.utils.GitskariosDownloadManager;
import com.alorma.github.utils.TimeUtils;
Expand All @@ -27,10 +27,9 @@
import java.util.List;
import javax.inject.Inject;

public class ReleaseBottomSheetDialogFragment extends BottomSheetDialogFragment implements ReleaseAssetsAdapter.OnReleaseAssetClicked {
public class ReleaseBottomSheetDialogFragment extends BaseBottomSheetDialogFragment implements ReleaseAssetsAdapter.OnReleaseAssetClicked {

private static final String RELEASE = "RELEASE";
private static final String REPOINFO = "REPOINFO";

@Inject GitskariosDownloadManager gitskariosDownloadManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.alorma.github.presenter.CommitInfoPresenter;
import com.alorma.github.sdk.bean.info.CommitInfo;
import com.alorma.github.sdk.bean.info.RepoInfo;
import com.alorma.github.ui.fragment.BaseBottomSheetDialogFragment;
import com.alorma.github.ui.view.UserAvatarView;
import com.alorma.github.utils.GitskariosDownloadManager;
import com.alorma.github.utils.TimeUtils;
Expand All @@ -31,7 +32,7 @@
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

public class TagBottomSheetDialogFragment extends BottomSheetDialogFragment implements com.alorma.github.presenter.View<Commit> {
public class TagBottomSheetDialogFragment extends BaseBottomSheetDialogFragment implements com.alorma.github.presenter.View<Commit> {

private static final String TAG = "TAG";
private static final String REPOINFO = "REPOINFO";
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-sw600dp/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="bottom_sheet_width">600dp</dimen>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<dimen name="gapLarge">16dp</dimen>
<dimen name="gapXLarge">32dp</dimen>

<dimen name="bottom_sheet_width">0dp</dimen>

<!-- http://developer.android.com/design/style/typography.html -->
<dimen name="textSizeXMicro">10sp</dimen>
Expand Down
1 change: 1 addition & 0 deletions version_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ rev=$(git rev-parse --short HEAD)

git add .
git commit -am "From Travis Generated credentials for $TRAVIS_TAG - $rev"
git pull --no-edit
git push --set-upstream origin HEAD:develop

0 comments on commit 45fff40

Please sign in to comment.