Browse Source

More code cleanup, profile parsing with wap

pull/24/head
Apostolos Fanakis 8 years ago
parent
commit
0293b50d36
  1. 34
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java
  2. 76
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileParser.java
  3. 12
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  4. 7
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
  5. 2
      app/src/main/res/drawable/ic_add_fab.xml
  6. 9
      app/src/main/res/drawable/ic_pm_fab.xml
  7. 118
      app/src/main/res/layout-v21/activity_profile.xml
  8. 246
      app/src/main/res/layout-v21/activity_topic_post_row.xml
  9. 4
      app/src/main/res/layout/activity_profile.xml
  10. 10
      app/src/main/res/layout/activity_topic_post_row.xml
  11. 1
      app/src/main/res/layout/fragment_recent_row.xml
  12. 2
      app/src/main/res/values/colors.xml

34
app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java

@ -4,13 +4,16 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.v4.content.res.ResourcesCompat; import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.Html; import android.text.Html;
import android.util.Log;
import android.view.View; import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
@ -66,15 +69,15 @@ public class ProfileActivity extends BaseActivity {
PACKAGE_NAME = getApplicationContext().getPackageName(); PACKAGE_NAME = getApplicationContext().getPackageName();
Bundle extras = getIntent().getExtras(); Bundle extras = getIntent().getExtras();
//username = getIntent().getExtras().getString("TOPIC_TITLE");
//Initialize toolbar, drawer and ProgressBar //Initialize toolbar, drawer and ProgressBar
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(null); toolbar.setTitle(null);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
createDrawer(); createDrawer();
@ -148,8 +151,7 @@ public class ProfileActivity extends BaseActivity {
protected Boolean doInBackground(String... strings) { protected Boolean doInBackground(String... strings) {
Document document; Document document;
String pageUrl = strings[0]; //This page's url String pageUrl = strings[0] + ";wap"; //Profile's page wap url
Request request = new Request.Builder() Request request = new Request.Builder()
.url(pageUrl) .url(pageUrl)
@ -184,6 +186,7 @@ public class ProfileActivity extends BaseActivity {
private void populateLayout() { private void populateLayout() {
if (parsedProfileData.get(THUMBNAIL_URL) != null) if (parsedProfileData.get(THUMBNAIL_URL) != null)
//noinspection ConstantConditions
Picasso.with(this) Picasso.with(this)
.load(parsedProfileData.get(THUMBNAIL_URL)) .load(parsedProfileData.get(THUMBNAIL_URL))
.resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE)
@ -194,7 +197,9 @@ public class ProfileActivity extends BaseActivity {
, R.drawable.ic_default_user_thumbnail, null)) , R.drawable.ic_default_user_thumbnail, null))
.transform(new CircleTransform()) .transform(new CircleTransform())
.into(userThumbnail); .into(userThumbnail);
userName.setText(parsedProfileData.get(NAME_INDEX)); userName.setText(parsedProfileData.get(NAME_INDEX));
if (parsedProfileData.get(PERSONAL_TEXT_INDEX) != null) { if (parsedProfileData.get(PERSONAL_TEXT_INDEX) != null) {
personalText.setVisibility(View.VISIBLE); personalText.setVisibility(View.VISIBLE);
personalText.setText(parsedProfileData.get(PERSONAL_TEXT_INDEX)); personalText.setText(parsedProfileData.get(PERSONAL_TEXT_INDEX));
@ -202,11 +207,30 @@ public class ProfileActivity extends BaseActivity {
personalText.setVisibility(View.GONE); personalText.setVisibility(View.GONE);
} }
for (int i = PERSONAL_TEXT_INDEX; i < parsedProfileData.size(); ++i) { for (int i = PERSONAL_TEXT_INDEX + 1; i < parsedProfileData.size(); ++i) {
if (parsedProfileData.get(i).contains("Signature")
|| parsedProfileData.get(i).contains("Υπογραφή")) {
WebView signatureEntry = new WebView(this);
signatureEntry.loadDataWithBaseURL("file:///android_asset/", parsedProfileData.get(i), "text/html", "UTF-8", null);
}
TextView entry = new TextView(this); TextView entry = new TextView(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
entry.setTextColor(getResources().getColor(R.color.primary_text, null));
} else {
//noinspection deprecation
entry.setTextColor(getResources().getColor(R.color.primary_text)); entry.setTextColor(getResources().getColor(R.color.primary_text));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
entry.setText(Html.fromHtml(parsedProfileData.get(i), Html.FROM_HTML_MODE_LEGACY));
} else {
//noinspection deprecation
entry.setText(Html.fromHtml(parsedProfileData.get(i))); entry.setText(Html.fromHtml(parsedProfileData.get(i)));
}
mainContent.addView(entry); mainContent.addView(entry);
Log.d(TAG, "new: " + parsedProfileData.get(i));
} }
} }
} }

76
app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileParser.java

@ -10,10 +10,6 @@ import java.util.Objects;
import mthmmy.utils.Report; import mthmmy.utils.Report;
class ProfileParser { class ProfileParser {
//Parsing variables
private static String nameSelect;
private static String signatureSelect;
//Other variables //Other variables
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static final String TAG = "ProfileParser"; private static final String TAG = "ProfileParser";
@ -22,13 +18,11 @@ class ProfileParser {
static final int PERSONAL_TEXT_INDEX = 2; static final int PERSONAL_TEXT_INDEX = 2;
static ArrayList<String> parseProfile(Document doc) { static ArrayList<String> parseProfile(Document doc) {
defineLanguage(doc);
//Method's variables //Method's variables
ArrayList<String> returnArray = new ArrayList<>(); ArrayList<String> returnArray = new ArrayList<>();
//Contains all summary's rows //Contains all summary's rows
Elements summaryRows = doc.select("td.windowbg:nth-child(1)"); Elements summaryRows = doc.select(".bordercolor > tbody:nth-child(1) > tr:nth-child(2) tr");
{ //Find thumbnail url { //Find thumbnail url
Element tmpEl = doc.select(".bordercolor img.avatar").first(); Element tmpEl = doc.select(".bordercolor img.avatar").first();
@ -39,7 +33,7 @@ class ProfileParser {
} }
{ //Find username { //Find username
Element tmpEl = summaryRows.select("tr:contains(" + nameSelect + ")").first(); Element tmpEl = summaryRows.first();
if (tmpEl != null) { if (tmpEl != null) {
returnArray.add(NAME_INDEX, tmpEl.select("td").get(1).text()); returnArray.add(NAME_INDEX, tmpEl.select("td").get(1).text());
} else { } else {
@ -54,40 +48,52 @@ class ProfileParser {
returnArray.add(PERSONAL_TEXT_INDEX, tmpPersonalText); returnArray.add(PERSONAL_TEXT_INDEX, tmpPersonalText);
} }
for (Element row : summaryRows.select("tr")) { for (Element row : summaryRows) {
String rowText = row.text(), tmpHtml = ""; String rowText = row.text(), pHtml = "";
if (row.select("td").size() == 1) if (row.select("td").size() == 1)
tmpHtml = ""; pHtml = "";
else if (rowText.contains(signatureSelect)) { else if (rowText.contains("Signature") || rowText.contains("Υπογραφή")) {
tmpHtml = row.html(); { //Fix embedded videos
} else if (!rowText.contains(nameSelect)) { Elements noembedTag = row.select("noembed");
ArrayList<String> embededVideosUrls = new ArrayList<>();
for (Element _noembed : noembedTag) {
embededVideosUrls.add(_noembed.text().substring(_noembed.text()
.indexOf("href=\"https://www.youtube.com/watch?") + 38
, _noembed.text().indexOf("target") - 2));
}
pHtml = row.html();
int tmp_counter = 0;
while (pHtml.contains("<embed")) {
if (tmp_counter > embededVideosUrls.size())
break;
pHtml = pHtml.replace(
pHtml.substring(pHtml.indexOf("<embed"), pHtml.indexOf("/noembed>") + 9)
, "<div class=\"embedded-video\">"
+ "<a href=\"https://www.youtube.com/"
+ embededVideosUrls.get(tmp_counter) + "\" target=\"_blank\">"
+ "<img src=\"https://img.youtube.com/vi/"
+ embededVideosUrls.get(tmp_counter) + "/default.jpg\" alt=\"\" border=\"0\">"
+ "</a>"
//+ "<img class=\"embedded-video-play\" src=\"http://www.youtube.com/yt/brand/media/image/YouTube_light_color_icon.png\">"
+ "</div>");
}
}
//Add stuff to make it work in WebView
//style.css
pHtml = ("<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />" + pHtml);
} else if (!rowText.contains("Name") && !rowText.contains("Όνομα")) {
if (Objects.equals(row.select("td").get(1).text(), "")) if (Objects.equals(row.select("td").get(1).text(), ""))
continue; continue;
tmpHtml = "<b>" + row.select("td").first().text() + "</b> " pHtml = "<b>" + row.select("td").first().text() + "</b> "
+ row.select("td").get(1).text(); + row.select("td").get(1).text();
} }
returnArray.add(tmpHtml); returnArray.add(pHtml);
} }
return returnArray; return returnArray;
} }
private static void defineLanguage(Document doc) {
//English parsing variables
final String en_nameSelect = "Name";
final String en_signatureSelect = "Signature";
//Greek parsing variables
final String gr_nameSelect = "Όνομα";
final String gr_signatureSelect = "Υπογραφή";
if (doc.select("h3").text().contains("Καλώς ορίσατε")) {
nameSelect = gr_nameSelect;
signatureSelect = gr_signatureSelect;
} else { //Default is english (eg. guest's language)
nameSelect = en_nameSelect;
signatureSelect = en_signatureSelect;
}
}
} }

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

@ -52,7 +52,7 @@ import static gr.thmmy.mthmmy.session.SessionManager.LOGIN_STATUS;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public class TopicActivity extends BaseActivity { public class TopicActivity extends BaseActivity {
//-----------------------------------------CLASS VARIABLES------------------------------------------ //-----------------------------------------CLASS VARIABLES------------------------------------------
private TopicTask topicTask; private TopicTask topicTask;
/* --Posts-- */ /* --Posts-- */
@ -106,8 +106,10 @@ public class TopicActivity extends BaseActivity {
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(topicTitle); toolbar.setTitle(topicTitle);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true);
}
createDrawer(); createDrawer();
@ -207,7 +209,7 @@ public class TopicActivity extends BaseActivity {
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
if(topicTask!=null&&topicTask.getStatus()!= AsyncTask.Status.RUNNING) if (topicTask != null && topicTask.getStatus() != AsyncTask.Status.RUNNING)
topicTask.cancel(true); topicTask.cancel(true);
} }
@ -314,7 +316,7 @@ public class TopicActivity extends BaseActivity {
private void changePage(int pageRequested) { private void changePage(int pageRequested) {
if (pageRequested != thisPage - 1) { if (pageRequested != thisPage - 1) {
if(topicTask!=null&&topicTask.getStatus()!= AsyncTask.Status.RUNNING) if (topicTask != null && topicTask.getStatus() != AsyncTask.Status.RUNNING)
topicTask.cancel(true); topicTask.cancel(true);
topicTask = new TopicTask(); topicTask = new TopicTask();
@ -324,7 +326,7 @@ public class TopicActivity extends BaseActivity {
} }
//------------------------------------BOTTOM NAV BAR METHODS END------------------------------------ //------------------------------------BOTTOM NAV BAR METHODS END------------------------------------
//---------------------------------------TOPIC ASYNC TASK------------------------------------------- //---------------------------------------TOPIC ASYNC TASK-------------------------------------------
public class TopicTask extends AsyncTask<String, Void, Integer> { public class TopicTask extends AsyncTask<String, Void, Integer> {
//Class variables //Class variables
private static final String TAG = "TopicTask"; //Separate tag for AsyncTask private static final String TAG = "TopicTask"; //Separate tag for AsyncTask
@ -364,7 +366,7 @@ public class TopicActivity extends BaseActivity {
parse(document); //Parse data parse(document); //Parse data
return SUCCESS; return SUCCESS;
} catch (IOException e) { } catch (IOException e) {
Report.i(TAG, "IO Exception",e); Report.i(TAG, "IO Exception", e);
return NETWORK_ERROR; return NETWORK_ERROR;
} catch (Exception e) { } catch (Exception e) {
Report.e(TAG, "Exception", e); Report.e(TAG, "Exception", e);

7
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

@ -196,7 +196,11 @@ class TopicAdapter extends RecyclerView.Adapter<TopicAdapter.MyViewHolder> {
if (currentPost.getAttachedFiles().size() != 0) { if (currentPost.getAttachedFiles().size() != 0) {
holder.bodyFooterDivider.setVisibility(View.VISIBLE); holder.bodyFooterDivider.setVisibility(View.VISIBLE);
int filesTextColor = context.getResources().getColor(R.color.accent); int filesTextColor = 0;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
filesTextColor = context.getResources().getColor(R.color.accent, null);
} else //noinspection deprecation
filesTextColor = context.getResources().getColor(R.color.accent);
for (final String[] attachedFile : currentPost.getAttachedFiles()) { for (final String[] attachedFile : currentPost.getAttachedFiles()) {
final TextView attached = new TextView(context); final TextView attached = new TextView(context);
@ -500,6 +504,7 @@ class TopicAdapter extends RecyclerView.Adapter<TopicAdapter.MyViewHolder> {
} }
//Handle url clicks //Handle url clicks
@SuppressWarnings("SameReturnValue")
private boolean handleUri(final Uri uri) { private boolean handleUri(final Uri uri) {
//Method always returns true as we don't want any url to be loaded in WebViews //Method always returns true as we don't want any url to be loaded in WebViews

2
app/src/main/res/drawable/ic_add_fab.xml

@ -4,6 +4,6 @@
android:viewportWidth="24.0" android:viewportWidth="24.0"
android:viewportHeight="24.0"> android:viewportHeight="24.0">
<path <path
android:fillColor="#FFF" android:fillColor="#FFFFFF"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/> android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector> </vector>

9
app/src/main/res/drawable/ic_pm_fab.xml

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFF"
android:pathData="M21.99,4c0,-1.1 -0.89,-2 -1.99,-2L4,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4 -0.01,-18zM18,14L6,14v-2h12v2zM18,11L6,11L6,9h12v2zM18,8L6,8L6,6h12v2z"/>
</vector>

118
app/src/main/res/layout-v21/activity_profile.xml

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activities.profile.ProfileActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/main.collapsing"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/user_thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:contentDescription="@string/thumbnail"
android:fitsSystemWindows="true"
android:src="@drawable/ic_default_user_thumbnail"
android:transitionName="user_thumbnail"
app:layout_collapseMode="parallax"/>
<TextView
android:id="@+id/profile_act_personal_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="@color/primary_text"
android:visibility="gone"/>
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:gravity="center"
app:popupTheme="@style/ToolbarTheme">
<TextView
android:id="@+id/profile_act_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="@color/accent"
android:textSize="25sp"/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<ProgressBar
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"/>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top|start"
android:background="@color/background"
android:paddingEnd="16dp"
android:paddingStart="16dp"
android:scrollbars="none"
app:layout_anchor="@id/appbar"
app:layout_anchorGravity="bottom|center"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/profile_act_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/profile_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margins"
app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_pm_fab"/>
</android.support.design.widget.CoordinatorLayout>

246
app/src/main/res/layout-v21/activity_topic_post_row.xml

@ -0,0 +1,246 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:paddingEnd="4dp"
android:paddingStart="4dp"
tools:ignore="SmallSp">
<FrameLayout
android:id="@+id/post_date_and_number_exp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:animateLayoutChanges="true"
android:visibility="gone">
<TextView
android:id="@+id/post_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:paddingEnd="5dp"
android:paddingStart="5dp"
android:text=""
android:textColor="@color/card_expand_text_color"
android:textSize="8sp"
/>
<TextView
android:id="@+id/post_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:paddingEnd="5dp"
android:paddingStart="5dp"
android:text=""
android:textColor="@color/card_expand_text_color"
android:textSize="8sp"
/>
</FrameLayout>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:foreground="?android:attr/selectableItemBackground"
card_view:cardBackgroundColor="@color/card_background"
card_view:cardCornerRadius="0dp"
card_view:cardElevation="2dp"
card_view:cardPreventCornerOverlap="true"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/header"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:clickable="true"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp">
<FrameLayout
android:id="@+id/thumbnail_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp">
<ImageView
android:id="@+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:contentDescription="@string/thumbnail"
android:maxHeight="@dimen/thumbnail_size"
android:maxWidth="@dimen/thumbnail_size"
android:src="@drawable/ic_default_user_thumbnail"
android:transitionName="user_thumbnail"/>
</FrameLayout>
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/thumbnail_holder"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/username"
android:textColor="@color/primary_text"
android:textStyle="bold"/>
<TextView
android:id="@+id/subject"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/username"
android:layout_toEndOf="@+id/thumbnail_holder"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/subject"
/>
</RelativeLayout>
<ImageButton
android:id="@+id/toggle_quote_button"
android:layout_width="@dimen/quote_button"
android:layout_height="@dimen/quote_button"
android:layout_marginEnd="9dp"
android:layout_marginTop="9dp"
android:background="@drawable/ic_toggle_quote_bg"
android:contentDescription="@string/quote"/>
</LinearLayout>
<LinearLayout
android:id="@+id/user_extra_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="3dp"
android:visibility="gone"
android:weightSum="1.0">
<TextView
android:id="@+id/special_rank"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/card_expand_text_color"
android:textSize="10sp"
android:visibility="gone"/>
<TextView
android:id="@+id/rank"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/card_expand_text_color"
android:textSize="10sp"
android:visibility="gone"/>
<TextView
android:id="@+id/stars"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:textSize="10sp"
android:visibility="gone">
</TextView>
<TextView
android:id="@+id/gender"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/card_expand_text_color"
android:textSize="10sp"
android:visibility="gone"/>
<TextView
android:id="@+id/number_of_posts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/card_expand_text_color"
android:textSize="10sp"
android:visibility="gone"/>
<TextView
android:id="@+id/personal_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/card_expand_text_color"
android:textSize="10sp"
android:textStyle="italic"
android:visibility="gone"/>
</LinearLayout>
<View
android:id="@+id/header_body_devider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="9dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:background="@color/divider"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="16dp">
<WebView
android:id="@+id/post"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@color/card_background"
android:clickable="true"
android:text="@string/post"
/>
</FrameLayout>
<View
android:id="@+id/body_footer_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="9dp"
android:background="@color/divider"
android:visibility="gone"/>
<LinearLayout
android:id="@+id/post_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="9dp"
android:paddingLeft="16dp"
android:paddingRight="16dp">
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>

4
app/src/main/res/layout/activity_profile.xml

@ -42,7 +42,6 @@
android:contentDescription="@string/thumbnail" android:contentDescription="@string/thumbnail"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:src="@drawable/ic_default_user_thumbnail" android:src="@drawable/ic_default_user_thumbnail"
android:transitionName="user_thumbnail"
app:layout_collapseMode="parallax"/> app:layout_collapseMode="parallax"/>
<TextView <TextView
@ -111,9 +110,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margins" android:layout_margin="@dimen/fab_margins"
android:transitionName="fab"
app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior" app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_add_fab"/> app:srcCompat="@drawable/ic_pm_fab"/>
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

10
app/src/main/res/layout/activity_topic_post_row.xml

@ -1,10 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:paddingEnd="4dp" android:paddingEnd="4dp"
android:paddingStart="4dp"> android:paddingStart="4dp"
tools:ignore="SmallSp">
<FrameLayout <FrameLayout
android:id="@+id/post_date_and_number_exp" android:id="@+id/post_date_and_number_exp"
@ -23,8 +25,7 @@
android:paddingStart="5dp" android:paddingStart="5dp"
android:text="" android:text=""
android:textColor="@color/card_expand_text_color" android:textColor="@color/card_expand_text_color"
android:textSize="8sp" android:textSize="8sp"/>
/>
<TextView <TextView
android:id="@+id/post_number" android:id="@+id/post_number"
@ -89,8 +90,7 @@
android:contentDescription="@string/thumbnail" android:contentDescription="@string/thumbnail"
android:maxHeight="@dimen/thumbnail_size" android:maxHeight="@dimen/thumbnail_size"
android:maxWidth="@dimen/thumbnail_size" android:maxWidth="@dimen/thumbnail_size"
android:src="@drawable/ic_default_user_thumbnail" android:src="@drawable/ic_default_user_thumbnail"/>
android:transitionName="user_thumbnail"/>
</FrameLayout> </FrameLayout>
<TextView <TextView

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

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"

2
app/src/main/res/values/colors.xml

@ -34,9 +34,7 @@
<color name="card_background">#3C3F41</color> <color name="card_background">#3C3F41</color>
<color name="divider">#8B8B8B</color> <color name="divider">#8B8B8B</color>
<color name="transparent">#00000000</color>
<color name="white">#FFFFFF</color> <color name="white">#FFFFFF</color>
<color name="black">#000000</color>
<color name="iron">#CCCCCC</color> <color name="iron">#CCCCCC</color>
<color name="card_expand_text_color">#E7E7E7</color> <color name="card_expand_text_color">#E7E7E7</color>
<color name="dialog_bg_semi_transparent">#80BF4040</color> <color name="dialog_bg_semi_transparent">#80BF4040</color>

Loading…
Cancel
Save