Browse Source

Progressbar & some layout changes

pull/24/head
Ezerous 8 years ago
parent
commit
c1eb623717
  1. 2
      app/build.gradle
  2. 5
      app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumFragment.java
  3. 12
      app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java
  4. 5
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  5. 14
      app/src/main/res/layout/activity_topic.xml
  6. 13
      app/src/main/res/layout/fragment_forum.xml
  7. 16
      app/src/main/res/layout/fragment_recent.xml
  8. 12
      app/src/main/res/layout/fragment_recent_row.xml

2
app/build.gradle

@ -43,8 +43,8 @@ dependencies {
}
compile 'com.mikepenz:fontawesome-typeface:4.7.0.0@aar'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.3'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
compile 'me.zhanghai.android.materialprogressbar:library:1.3.0'
}
apply plugin: 'com.google.gms.google-services'

5
app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumFragment.java

@ -29,6 +29,7 @@ import gr.thmmy.mthmmy.data.Board;
import gr.thmmy.mthmmy.data.Category;
import gr.thmmy.mthmmy.data.TopicSummary;
import gr.thmmy.mthmmy.session.SessionManager;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
import mthmmy.utils.Report;
import okhttp3.HttpUrl;
import okhttp3.Request;
@ -49,7 +50,7 @@ public class ForumFragment extends BaseFragment
private static final String TAG = "ForumFragment";
// Fragment initialization parameters, e.g. ARG_SECTION_NUMBER
private ProgressBar progressBar;
private MaterialProgressBar progressBar;
private ForumAdapter forumAdapter;
private List<Category> categories;
@ -99,7 +100,7 @@ public class ForumFragment extends BaseFragment
// Set the adapter
if (rootView instanceof RelativeLayout) {
progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);
progressBar = (MaterialProgressBar) rootView.findViewById(R.id.progressBar);
forumAdapter = new ForumAdapter(getContext(), categories, fragmentInteractionListener);
forumAdapter.setExpandCollapseListener(new ExpandableRecyclerAdapter.ExpandCollapseListener() {
@Override

12
app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java

@ -3,6 +3,7 @@ package gr.thmmy.mthmmy.activities.main.recent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
@ -26,6 +27,7 @@ import gr.thmmy.mthmmy.activities.base.BaseFragment;
import gr.thmmy.mthmmy.data.TopicSummary;
import gr.thmmy.mthmmy.session.SessionManager;
import gr.thmmy.mthmmy.utils.CustomRecyclerView;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
import mthmmy.utils.Report;
import okhttp3.HttpUrl;
import okhttp3.Request;
@ -43,7 +45,7 @@ public class RecentFragment extends BaseFragment {
private static final String TAG = "RecentFragment";
// Fragment initialization parameters, e.g. ARG_SECTION_NUMBER
private ProgressBar progressBar;
private MaterialProgressBar progressBar;
private SwipeRefreshLayout swipeRefreshLayout;
private RecentAdapter recentAdapter;
@ -95,11 +97,15 @@ public class RecentFragment extends BaseFragment {
// Set the adapter
if (rootView instanceof RelativeLayout) {
progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);
progressBar = (MaterialProgressBar) rootView.findViewById(R.id.progressBar);
recentAdapter = new RecentAdapter(getActivity(), topicSummaries, fragmentInteractionListener);
CustomRecyclerView recyclerView = (CustomRecyclerView) rootView.findViewById(R.id.list);
recyclerView.setLayoutManager(new LinearLayoutManager(rootView.findViewById(R.id.list).getContext()));
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(rootView.findViewById(R.id.list).getContext());
recyclerView.setLayoutManager(linearLayoutManager);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),
linearLayoutManager.getOrientation());
recyclerView.addItemDecoration(dividerItemDecoration);
recyclerView.setAdapter(recentAdapter);
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swiperefresh);

5
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java

@ -31,6 +31,7 @@ import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.activities.LoginActivity;
import gr.thmmy.mthmmy.activities.base.BaseActivity;
import gr.thmmy.mthmmy.data.Post;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
import mthmmy.utils.Report;
import okhttp3.Request;
import okhttp3.Response;
@ -87,7 +88,7 @@ public class TopicActivity extends BaseActivity {
private ImageButton nextPage;
private ImageButton lastPage;
//Other variables
private ProgressBar progressBar;
private MaterialProgressBar progressBar;
private String topicTitle;
private FloatingActionButton replyFAB;
private String parsedTitle;
@ -115,7 +116,7 @@ public class TopicActivity extends BaseActivity {
createDrawer();
progressBar = (ProgressBar) findViewById(R.id.progressBar);
progressBar = (MaterialProgressBar) findViewById(R.id.progressBar);
postsList = new ArrayList<>();

14
app/src/main/res/layout/activity_topic.xml

@ -90,16 +90,18 @@
app:srcCompat="@drawable/page_last"/>
</android.support.v7.widget.FitWindowsLinearLayout>
<ProgressBar
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
android:theme="@style/AppTheme"
android:visibility="invisible"
app:layout_anchor="@id/appbar"
app:layout_anchorGravity="bottom|center"/>
app:layout_anchorGravity="bottom|center"
app:mpb_indeterminateTint="@color/accent"
android:visibility="invisible"
android:indeterminate="true"
app:mpb_progressStyle="horizontal"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/topic_fab"

13
app/src/main/res/layout/fragment_forum.xml

@ -18,12 +18,15 @@
app:layoutManager="LinearLayoutManager"
tools:context=".activities.main.forum.ForumFragment" />
<ProgressBar
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="invisible"/>
android:layout_alignParentTop="true"
app:mpb_indeterminateTint="@color/accent"
android:visibility="invisible"
android:indeterminate="true"
app:mpb_progressStyle="horizontal"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding" />
</RelativeLayout>

16
app/src/main/res/layout/fragment_recent.xml

@ -17,20 +17,20 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
android:clipToPadding="false"
android:paddingBottom="4dp"
android:paddingTop="4dp"
app:layoutManager="LinearLayoutManager"
tools:context=".activities.main.recent.RecentFragment"
tools:listitem="@layout/fragment_recent_row"/>
</android.support.v4.widget.SwipeRefreshLayout>
<ProgressBar
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="invisible"/>
android:layout_alignParentTop="true"
app:mpb_indeterminateTint="@color/accent"
android:visibility="invisible"
android:indeterminate="true"
app:mpb_progressStyle="horizontal"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding" />
</RelativeLayout>

12
app/src/main/res/layout/fragment_recent_row.xml

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingEnd="4dp"
android:paddingStart="4dp">
>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
@ -14,15 +13,14 @@
android:layout_gravity="center"
android:foreground="?android:attr/selectableItemBackground"
card_view:cardCornerRadius="0dp"
card_view:cardElevation="2dp"
card_view:cardPreventCornerOverlap="true"
card_view:cardUseCompatPadding="true"
card_view:cardElevation="0dp"
card_view:cardBackgroundColor="?attr/cardBackgroundColor">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:foreground="?android:attr/selectableItemBackground"
android:paddingBottom="6dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"

Loading…
Cancel
Save