more trending preparation.

This commit is contained in:
Kosh 2017-06-02 09:16:27 +08:00
parent 39087f9a47
commit e584de0cf7
4 changed files with 117 additions and 278 deletions

View File

@ -8,7 +8,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import com.fastaccess.R;
@ -24,7 +23,7 @@ public class ProfileReposFilterBottomSheetDialog extends BaseBottomSheetDialog {
@BindView(R.id.type_selection) Spinner typeSelectionSpinner;
@BindView(R.id.sort_selection) Spinner sortSelectionSpinner;
@BindView(R.id.filter_sheet_apply_btn) Button applyBtn;
@BindView(R.id.filter_sheet_apply_btn) View applyBtn;
@BindView(R.id.sort_direction_selection) Spinner sortDirectionSpinner;
private ProfileReposFilterChangeListener listener;

View File

@ -30,7 +30,6 @@ class TrendingActivity : BaseActivity<TrendingMvp.View, TrendingPresenter>(), Tr
@State var selectedTitle: String = ""
fun onDailyClicked() {
Toasty.info(applicationContext, "Hello").show()
Logger.e()
@ -56,11 +55,6 @@ class TrendingActivity : BaseActivity<TrendingMvp.View, TrendingPresenter>(), Tr
setValues()
}
private fun setValues() {
closeDrawerLayout()
if (selectedTitle.isNotBlank()) trendingFragment?.onSetQuery(selectedTitle, getSince())
}
override fun layout(): Int {
return R.layout.trending_activity_layout
}
@ -115,6 +109,7 @@ class TrendingActivity : BaseActivity<TrendingMvp.View, TrendingPresenter>(), Tr
private fun onItemClicked(item: MenuItem?): Boolean {
this.selectedTitle = item?.title.toString()
setValues()
return true
}
@ -127,7 +122,12 @@ class TrendingActivity : BaseActivity<TrendingMvp.View, TrendingPresenter>(), Tr
drawerLayout.closeDrawer(Gravity.END)
}
fun getSince(): String {
private fun setValues() {
closeDrawerLayout()
if (selectedTitle.isNotBlank()) trendingFragment?.onSetQuery(selectedTitle, getSince())
}
private fun getSince(): String {
when {
daily.isSelected -> return "daily"
weekly.isSelected -> return "weekly"

View File

@ -1,141 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
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="vertical">
<RelativeLayout
android:id="@+id/filter_header_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/material_blue_accent_400"
android:elevation="4dp">
<TextView
android:id="@+id/filter_sheet_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:text="@string/filter"
android:textColor="@color/white" />
<Button
android:id="@+id/filter_sheet_apply_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@null"
android:drawablePadding="0dp"
android:includeFontPadding="false"
android:minWidth="0dp"
android:paddingLeft="28dp"
android:paddingRight="16dp"
android:text="@string/apply"
android:textColor="@color/white" />
<Button
android:id="@+id/filter_sheet_reset_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/filter_sheet_apply_btn"
android:background="@null"
android:drawablePadding="0dp"
android:includeFontPadding="false"
android:minWidth="0dp"
android:paddingRight="0dp"
android:text="@string/reset"
android:textColor="@color/white" />
</RelativeLayout>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/type" />
<Spinner
android:id="@+id/type_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/sort"/>
<Spinner
android:id="@+id/sort_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/sort_direction"/>
<Spinner
android:id="@+id/sort_direction_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</FrameLayout>

View File

@ -1,141 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
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="wrap_content"
android:background="?android:windowBackground"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="?android:toolbarStyle">
<android.support.v7.widget.Toolbar
android:id="@+id/filter_header_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="?android:toolbarStyle"
app:title="@string/filter">
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/filter_sheet_apply_btn"
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_xs_large"
android:background="?selectableItemBackground"
android:padding="@dimen/spacing_normal"
android:text="@string/apply"
android:textColor="?android:textColorPrimary"/>
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/filter_sheet_reset_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|end"
android:background="?selectableItemBackground"
android:padding="@dimen/spacing_normal"
android:text="@string/reset"
android:textColor="?android:textColorPrimary"/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
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">
<RelativeLayout
android:id="@+id/filter_header_layout"
android:layout_width="match_parent"
<com.fastaccess.ui.widgets.FontTextView
style="@style/TextAppearance.AppCompat.Medium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/material_blue_accent_400"
android:elevation="4dp">
android:layout_gravity="center"
android:layout_weight="1"
android:text="@string/type"/>
<TextView
android:id="@+id/filter_sheet_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:text="@string/filter"
android:textColor="@color/white" />
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/type_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<Button
android:id="@+id/filter_sheet_apply_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@null"
android:drawablePadding="0dp"
android:includeFontPadding="false"
android:minWidth="0dp"
android:paddingLeft="28dp"
android:paddingRight="16dp"
android:text="@string/apply"
android:textColor="@color/white" />
<Button
android:id="@+id/filter_sheet_reset_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/filter_sheet_apply_btn"
android:background="@null"
android:drawablePadding="0dp"
android:includeFontPadding="false"
android:minWidth="0dp"
android:paddingRight="0dp"
android:text="@string/reset"
android:textColor="@color/white" />
</RelativeLayout>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/type" />
<Spinner
android:id="@+id/type_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/sort"/>
<Spinner
android:id="@+id/sort_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/sort_direction"/>
<Spinner
android:id="@+id/sort_direction_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
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
style="@style/TextAppearance.AppCompat.Medium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="@string/sort"/>
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/sort_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
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
style="@style/TextAppearance.AppCompat.Medium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="@string/sort_direction"/>
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/sort_direction_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
</LinearLayout>
</LinearLayout>