fc953314c25R9">9
import android.widget.PopupWindow;
10
import android.widget.TextView;
11
12
import com.electric.chargingpile.R;
13
14
/**
15
 * Created by demon on 2017/8/21.
16
 */
17
18
public class SortTopicPopWindow extends PopupWindow {
19
    private View conentView;
20
    private TextView tv1, tv2, tv3;
21
    private Activity context;
22
23
    public SortTopicPopWindow(final Activity context) {
24
        this.context = context;
25
        LayoutInflater inflater = (LayoutInflater) context
26
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
27
        conentView = inflater.inflate(R.layout.topic_sort_popup_dialog, null);
28
        tv1 = (TextView) conentView.findViewById(R.id.tv_1);
29
        tv2 = (TextView) conentView.findViewById(R.id.tv_2);
30
        tv3 = (TextView) conentView.findViewById(R.id.tv_3);
31
        int h = context.getWindowManager().getDefaultDisplay().getHeight();
32
        int w = context.getWindowManager().getDefaultDisplay().getWidth();
33
        // 设置SelectPicPopupWindow的View
34
        this.setContentView(conentView);
35
        // 设置SelectPicPopupWindow弹出窗体的宽
36
        this.setWidth(w / 2 - 120);
37
        // 设置SelectPicPopupWindow弹出窗体的高
38
        this.setHeight(LayoutParams.WRAP_CONTENT);
39
        // 设置SelectPicPopupWindow弹出窗体可点击
40
        this.setFocusable(true);
41
        this.setOutsideTouchable(true);
42
        // 刷新状态
43
        this.update();
44
        // 实例化一个ColorDrawable颜色为半透明
45
        ColorDrawable dw = new ColorDrawable(0000000000);
46
        // 点back键和其他地方使其消失,设置了这个才能触发OnDismisslistener ,设置其他控件变化等操作
47
        this.setBackgroundDrawable(dw);
48
        // mPopupWindow.setAnimationStyle(android.R.style.Animation_Dialog);
49
        // 设置SelectPicPopupWindow弹出窗体动画效果
50
        this.setAnimationStyle(R.style.AnimationPreview);
51
52
    }
53
54
    public void setUi(int sort) {
55
        //排序 ctime为时间顺序,agree为点赞排序
56
        if (sort == 1) {
57
            tv1.setTextColor(context.getResources().getColor(R.color.lvse));
58
            tv2.setTextColor(context.getResources().getColor(R.color.ui_68));
59
            tv3.setTextColor(context.getResources().getColor(R.color.ui_68));
60
        } else if(sort == 2){
61
            tv1.setTextColor(context.getResources().getColor(R.color.ui_68));
62
            tv2.setTextColor(context.getResources().getColor(R.color.lvse));
63
            tv3.setTextColor(context.getResources().getColor(R.color.ui_68));
64
        }else {
65
            tv1.setTextColor(context.getResources().getColor(R.color.ui_68));
66
            tv2.setTextColor(context.getResources().getColor(R.color.ui_68));
67
            tv3.setTextColor(context.getResources().getColor(R.color.lvse));
68
        }
69
    }
70
71
    public void showPopupWindow(View parent, final View.OnClickListener listener) {
72
        tv1.setOnClickListener(new View.OnClickListener() {
73
            @Override
74
            public void onClick(View v) {
75
                try {
76
                    listener.onClick(v);
77
78
                } catch (Exception e) {
79
                    e.printStackTrace();
80
                }
81
            }
82
        });
83
84
        tv2.setOnClickListener(new View.OnClickListener() {
85
            @Override
86
            public void onClick(View view) {
87
                try {
88
                    listener.onClick(view);
89
90
                } catch (Exception e) {
91
                    e.printStackTrace();
92
                }
93
            }
94
        });
95
        if (!this.isShowing()) {
96
            this.showAsDropDown(parent, parent.getLayoutParams().width / 2, -5);
97
98
        } else {
99
            this.dismiss();
100
        }
101
    }
102
103
104
}

+ 108 - 0
app/src/main/java/com/electric/chargingpile/view/footer/LoadMoreFooterView.java

@ -0,0 +1,108 @@
1
package com.electric.chargingpile.view.footer;
2
3
import android.content.Context;
4
import android.util.AttributeSet;
5
import android.view.LayoutInflater;
6
import android.view.View;
7
import android.widget.FrameLayout;
8
9
import com.electric.chargingpile.R;
10
11
12
/**
13
 * Created by aspsine on 16/3/14.
14
 */
15
public class LoadMoreFooterView extends FrameLayout {
16
17
    private Status mStatus;
18
19
    private View mLoadingView;
20
21
    private View mErrorView;
22
23
    private View mTheEndView;
24
25
    private OnRetryListener mOnRetryListener;
26
27
    public LoadMoreFooterView(Context context) {
28
        this(context, null);
29
    }
30
31
    public LoadMoreFooterView(Context context, AttributeSet attrs) {
32
        this(context, attrs, 0);
33
    }
34
35
    public LoadMoreFooterView(Context context, AttributeSet attrs, int defStyleAttr) {
36
        super(context, attrs, defStyleAttr);
37
        LayoutInflater.from(context).inflate(R.layout.layout_irecyclerview_load_more_footer_view, this, true);
38
39
        mLoadingView = findViewById(R.id.loadingView);
40
        mErrorView = findViewById(R.id.errorView);
41
        mTheEndView = findViewById(R.id.theEndView);
42
43
        mErrorView.setOnClickListener(new OnClickListener() {
44
            @Override
45
            public void onClick(View v) {
46
                if (mOnRetryListener != null) {
47
                    mOnRetryListener.onRetry(LoadMoreFooterView.this);
48
                }
49
            }
50
        });
51
52
        setStatus(Status.GONE);
53
    }
54
55
    public void setOnRetryListener(OnRetryListener listener) {
56
        this.mOnRetryListener = listener;
57
    }
58
59
    public Status getStatus() {
60
        return mStatus;
61
    }
62
63
    public void setStatus(Status status) {
64
        this.mStatus = status;
65
        change();
66
    }
67
68
    public boolean canLoadMore() {
69
        return mStatus == Status.GONE || mStatus == Status.ERROR;
70
    }
71
72
    private void change() {
73
        switch (mStatus) {
74
            case GONE:
75
                mLoadingView.setVisibility(GONE);
76
                mErrorView.setVisibility(GONE);
77
                mTheEndView.setVisibility(GONE);
78
                break;
79
80
            case LOADING:
81
                mLoadingView.setVisibility(VISIBLE);
82
                mErrorView.setVisibility(GONE);
83
                mTheEndView.setVisibility(GONE);
84
                break;
85
86
            case ERROR:
87
                mLoadingView.setVisibility(GONE);
88
                mErrorView.setVisibility(VISIBLE);
89
                mTheEndView.setVisibility(GONE);
90
                break;
91
92
            case THE_END:
93
                mLoadingView.setVisibility(GONE);
94
                mErrorView.setVisibility(GONE);
95
                mTheEndView.setVisibility(VISIBLE);
96
                break;
97
        }
98
    }
99
100
    public enum Status {
101
        GONE, LOADING, ERROR, THE_END
102
    }
103
104
    public interface OnRetryListener {
105
        void onRetry(LoadMoreFooterView view);
106
    }
107
108
}

BIN
app/src/main/res/drawable-hdpi/app_show_more_content.png


BIN
app/src/main/res/drawable-hdpi/app_topic_detaic_popup_icon.png


+ 27 - 0
app/src/main/res/layout/activity_topic_details_info.xml

@ -0,0 +1,27 @@
1
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
    xmlns:tools="http://schemas.android.com/tools"
3
    android:layout_width="match_parent"
4
    android:layout_height="match_parent"
5
    android:id="@+id/whole_view"
6
    android:scrollbars="none"
7
    android:orientation="vertical">
8
9
    <com.electric.chargingpile.view.PullToZoomScrollView3
10
        android:id="@+id/scroll_view"
11
        android:layout_width="match_parent"
12
        android:layout_height="wrap_content">
13
14
        <LinearLayout
15
            android:layout_width="match_parent"
16
            android:layout_height="wrap_content"
17
            android:gravity="center_horizontal"
18
            android:orientation="vertical">
19
20
            <include layout="@layout/activity_topic_info_top" />
21
22
            <include layout="@layout/activity_topic_infos_content" />
23
        </LinearLayout>
24
    </com.electric.chargingpile.view.PullToZoomScrollView3>
25
26
27
</RelativeLayout>

+ 85 - 0
app/src/main/res/layout/activity_topic_info_top.xml

@ -0,0 +1,85 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="match_parent"
4
    android:layout_height="wrap_content"
5
    android:id="@+id/top_view">
6
7
    <RelativeLayout
8
        android:id="@+id/rl_title"
9
        android:layout_width="fill_parent"
10
        android:layout_height="44dp"
11
        android:background="@color/title_background" >
12
13
        <ImageView
14
            android:id="@+id/iv_back"
15
            android:layout_width="wrap_content"
16
            android:layout_height="match_parent"
17
            android:layout_alignParentLeft="true"
18
            android:layout_centerVertical="true"
19
            android:contentDescription="@null"
20
            android:paddingLeft="15dp"
21
            android:paddingRight="15dp"
22
            android:src="@drawable/icon_lvback1119" />
23
24
        <TextView
25
            android:id="@+id/textview"
26
            android:layout_width="match_parent"
27
            android:layout_height="match_parent"
28
            android:layout_centerInParent="true"
29
            android:layout_toRightOf="@+id/iv_back"
30
            android:layout_toLeftOf="@+id/textview_share"
31
            android:gravity="center"
32
            android:singleLine="true"
33
            android:ellipsize="end"
34
            android:text="@string/about_name"
35
            android:textColor="#222222"
36
            android:textSize="16sp" />
37
38
        <TextView
39
            android:id="@+id/textview_share"
40
            android:layout_width="wrap_content"
41
            android:layout_height="match_parent"
42
            android:layout_alignParentRight="true"
43
            android:gravity="center"
44
            android:padding="15dp"
45
            android:text="分享"
46
            android:textColor="#222222"
47
            android:textSize="15sp"/>
48
    </RelativeLayout>
49
    <!--<View-->
50
        <!--android:id="@+id/view_title"-->
51
        <!--android:layout_width="match_parent"-->
52
        <!--android:layout_height="0.5dp"-->
53
        <!---->
54
        <!--android:background="@color/ui_titleline" />-->
55
56
    <LinearLayout
57
        android:layout_width="match_parent"
58
        android:layout_height="101dp"
59
        android:layout_below="@+id/rl_title"
60
        android:orientation="horizontal"
61
        android:gravity="center_vertical">
62
        <ImageView
63
            android:id="@+id/user_avater"
64
            android:layout_width="71dp"
65
            android:layout_height="71dp"
66
            android:layout_marginLeft="15dp"
67
            />
68
        <TextView
69
            android:id="@+id/topic_title"
70
            android:layout_width="match_parent"
71
            android:layout_height="match_parent"
72
            android:layout_marginLeft="5dp"
73
            android:layout_marginRight="15dp"
74
            android:text="111111"
75
            android:gravity="center_vertical"
76
            android:maxLines="2"
77
            android:ellipsize="end"
78
            android:textSize="17sp"
79
            android:textColor="#222222"/>
80
81
    </LinearLayout>
82
83
    <!--</LinearLayout>-->
84
85
</RelativeLayout>

+ 128 - 0
app/src/main/res/layout/activity_topic_infos_content.xml

@ -0,0 +1,128 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="match_parent"
4
    android:layout_height="match_parent"
5
    android:id="@+id/content_view"
6
    xmlns:app="http://schemas.android.com/apk/res-auto"
7
    android:orientation="vertical">
8
9
10
11
    <RelativeLayout
12
        android:layout_width="match_parent"
13
        android:layout_height="wrap_content"
14
        android:minHeight="51dp"
15
        android:orientation="horizontal">
16
        <TextView
17
            android:id="@+id/topic_content"
18
            android:layout_width="match_parent"
19
            android:layout_height="wrap_content"
20
            android:layout_marginLeft="15dp"
21
            android:layout_marginRight="15dp"
22
            android:text="111111"
23
            android:textSize="15sp"
24
            android:textColor="#555555"/>
25
26
        <ImageView
27
            android:id="@+id/user_content_more"
28
            android:layout_width="wrap_content"
29
            android:layout_height="wrap_content"
30
            android:layout_below="@+id/topic_content"
31
            android:layout_marginLeft="15dp"
32
            android:src="@drawable/app_show_more_content"
33
            android:layout_alignParentRight="true"
34
            android:visibility="gone"
35
            />
36
37
    </RelativeLayout>
38
39
    <LinearLayout
40
        android:layout_width="match_parent"
41
        android:layout_height="wrap_content"
42
        android:orientation="horizontal">
43
        <TextView
44
            android:layout_width="wrap_content"
45
            android:layout_height="wrap_content"
46
            android:layout_marginTop="13dp"
47
            android:layout_marginBottom="13dp"
48
            android:layout_marginLeft="15dp"
49
            android:text="阅读"
50
            android:textSize="12sp"
51
            android:textColor="#565656"/>
52
53
        <TextView
54
            android:id="@+id/read_data"
55
            android:layout_width="wrap_content"
56
            android:layout_height="wrap_content"
57
            android:layout_marginTop="13dp"
58
            android:layout_marginBottom="13dp"
59
            android:layout_marginLeft="5dp"
60
            android:text=""
61
            android:textSize="12sp"
62
            android:textColor="#565656"/>
63
64
        <TextView
65
            android:layout_width="wrap_content"
66
            android:layout_height="wrap_content"
67
            android:layout_marginTop="13dp"
68
            android:layout_marginBottom="13dp"
69
            android:layout_marginLeft="30dp"
70
            android:text="阅读"
71
            android:textSize="12sp"
72
            android:textColor="#565656"/>
73
74
        <TextView
75
            android:id="@+id/join_data"
76
            android:layout_width="wrap_content"
77
            android:layout_height="wrap_content"
78
            android:layout_marginTop="13dp"
79
            android:layout_marginBottom="13dp"
80
            android:layout_marginLeft="5dp"
81
            android:text="12"
82
            android:textSize="12sp"
83
            android:textColor="#565656"/>
84
    </LinearLayout>
85
86
    <View
87
        android:layout_width="match_parent"
88
        android:layout_height="10dp"
89
        android:background="@color/title_line"/>
90
91
    <LinearLayout
92
        android:id="@+id/ll_sort_view"
93
        android:layout_width="match_parent"
94
        android:layout_height="50dp"
95
        android:orientation="horizontal"
96
        android:gravity="center_vertical">
97
        <TextView
98
            android:id="@+id/sort_text_info"
99
            android:layout_width="wrap_content"
100
            android:layout_height="wrap_content"
101
            android:layout_marginTop="13dp"
102
            android:layout_marginBottom="13dp"
103
            android:layout_marginLeft="15dp"
104
            android:text="最热发布"
105
            android:textSize="12sp"
106
            android:textColor="#02b637"/>
107
108
        <ImageView
109
            android:layout_width="16dp"
110
            android:layout_height="16dp"
111
            android:layout_marginLeft="5dp"
112
            android:src="@drawable/app_topic_detaic_popup_icon"
113
            android:layout_alignParentRight="true"
114
            />
115
    </LinearLayout>
116
117
    <com.aspsine.irecyclerview.IRecyclerView
118
        android:id="@+id/recyclerView"
119
        android:layout_width="match_parent"
120
        android:layout_height="match_parent"
121
        app:loadMoreEnabled="true"
122
        app:refreshEnabled="false"
123
        app:loadMoreFooterLayout="@layout/layout_irecyclerview_load_more_footer"
124
        android:overScrollMode="never"
125
        />
126
127
128
</LinearLayout>

+ 4 - 0
app/src/main/res/layout/layout_irecyclerview_load_more_footer.xml

@ -0,0 +1,4 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<com.electric.chargingpile.view.footer.LoadMoreFooterView xmlns:android="http://schemas.android.com/apk/res/android"
3
                                              android:layout_width="match_parent"
4
                                              android:layout_height="48dp"/>

+ 8 - 0
app/src/main/res/layout/layout_irecyclerview_load_more_footer_error_view.xml

@ -0,0 +1,8 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:id="@+id/tvError"
4
    android:layout_width="match_parent"
5
    android:layout_height="36dp"
6
    android:gravity="center"
7
    android:layout_gravity="center"
8
    android:text="加载失败,请重试..." />

+ 23 - 0
app/src/main/res/layout/layout_irecyclerview_load_more_footer_loading_view.xml

@ -0,0 +1,23 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:id="@+id/full_view"
4
    android:layout_width="match_parent"
5
    android:layout_height="48dp"
6
    android:background="@color/color_white"
7
    android:gravity="center"
8
    android:orientation="horizontal">
9
<ProgressBar
10
    android:id="@+id/progressBar"
11
    android:indeterminateTint="#cecece"
12
    android:layout_width="20dp"
13
    android:layout_height="20dp"
14
    android:layout_gravity="center" />
15
16
    <TextView
17
        android:layout_width="wrap_content"
18
        android:layout_height="wrap_content"
19
        android:layout_marginLeft="10dp"
20
        android:text="加载中…"
21
        android:textSize="13sp"
22
        android:textColor="#565656"/>
23
</LinearLayout>

+ 9 - 0
app/src/main/res/layout/layout_irecyclerview_load_more_footer_the_end_view.xml

@ -0,0 +1,9 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:id="@+id/tvTheEnd"
4
    android:layout_width="match_parent"
5
    android:layout_height="48dp"
6
    android:gravity="center"
7
    android:text="已经显示全部了"
8
    android:layout_gravity="center"
9
    android:background="@color/color_white"/>

+ 17 - 0
app/src/main/res/layout/layout_irecyclerview_load_more_footer_view.xml

@ -0,0 +1,17 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<merge xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="match_parent"
4
    android:layout_height="48dp">
5
    <include
6
        android:id="@+id/theEndView"
7
        layout="@layout/layout_irecyclerview_load_more_footer_the_end_view" />
8
9
    <include
10
        android:id="@+id/errorView"
11
        layout="@layout/layout_irecyclerview_load_more_footer_error_view" />
12
13
    <include
14
        android:id="@+id/loadingView"
15
        layout="@layout/layout_irecyclerview_load_more_footer_loading_view" />
16
17
</merge>

+ 72 - 0
app/src/main/res/layout/topic_sort_popup_dialog.xml

@ -0,0 +1,72 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:orientation="vertical" android:layout_width="match_parent"
4
    android:layout_height="match_parent">
5
6
    <RelativeLayout
7
        android:layout_width="match_parent"
8
        android:layout_height="wrap_content"
9
        android:padding="5dp"
10
        android:background="@drawable/bg_popup_sort">
11
12
        <LinearLayout
13
            android:layout_width="match_parent"
14
            android:layout_height="wrap_content"
15
            android:padding="5dp"
16
            android:orientation="vertical">
17
18
            <TextView
19
                android:id="@+id/tv_1"
20
                android:layout_width="match_parent"
21
                android:layout_height="44dp"
22
                android:padding="5dp"
23
                android:gravity="center"
24
                android:text="最新发布"
25
                android:textSize="14sp"
26
                android:textColor="@color/lvse"/>
27
28
            <View
29
                android:layout_width="match_parent"
30
                android:layout_height="0.5dp"
31
                android:paddingLeft="5dp"
32
                android:paddingRight="5dp"
33
                android:background="@color/ui_6d"/>
34
35
36
            <TextView
37
                android:id="@+id/tv_2"
38
                android:layout_width="match_parent"
39
                android:layout_height="44dp"
40
                android:padding="5dp"
41
                android:gravity="center"
42
                android:text="最后回复"
43
                android:textSize="14sp"
44
                android:textColor="@color/ui_68"/>
45
46
            <View
47
                android:layout_width="match_parent"
48
                android:layout_height="0.5dp"
49
                android:paddingLeft="5dp"
50
                android:paddingRight="5dp"
51
                android:background="@color/ui_6d"/>
52
53
54
            <TextView
55
                android:id="@+id/tv_3"
56
                android:layout_width="match_parent"
57
                android:layout_height="44dp"
58
                android:padding="5dp"
59
                android:gravity="center"
60
                android:text="最热"
61
                android:textSize="14sp"
62
                android:textColor="@color/ui_68"/>
63
64
65
        </LinearLayout>
66
67
68
    </RelativeLayout>
69
    
70
71
72
</LinearLayout>

Edgardo Rico - Gogs: Go Git Service
Edgardo Rico edgardo9605028
9216678
0 0

Последна модификация преди 1 година