Browse Source

Code rearrange and cleaned, moved card_view backgroundColor to theme

Work on topic layout, activity and helper classes
Thumbnail images may not appear or be mixed app --> holder bug!!
pull/24/head
Apostolos Fanakis 8 years ago
parent
commit
4186327981
  1. 11
      app/build.gradle
  2. 3
      app/src/main/AndroidManifest.xml
  3. 838
      app/src/main/assets/style.css
  4. 32
      app/src/main/java/gr/thmmy/mthmmy/activities/BaseActivity.java
  5. 54
      app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java
  6. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/MainActivity.java
  7. 194
      app/src/main/java/gr/thmmy/mthmmy/activities/TopicActivity.java
  8. 15
      app/src/main/java/gr/thmmy/mthmmy/data/Post.java
  9. 87
      app/src/main/java/gr/thmmy/mthmmy/utils/CircularNetworkImageView.java
  10. 63
      app/src/main/java/gr/thmmy/mthmmy/utils/ImageController.java
  11. 41
      app/src/main/java/gr/thmmy/mthmmy/utils/LruBitmapCache.java
  12. 8
      app/src/main/res/anim/push_right_in.xml
  13. 8
      app/src/main/res/anim/push_right_out.xml
  14. 8
      app/src/main/res/drawable/page_first.xml
  15. 8
      app/src/main/res/drawable/page_last.xml
  16. 8
      app/src/main/res/drawable/page_next.xml
  17. 8
      app/src/main/res/drawable/page_previous.xml
  18. 8
      app/src/main/res/layout/activity_main.xml
  19. 20
      app/src/main/res/layout/activity_topic.xml
  20. 183
      app/src/main/res/layout/activity_topic_post_row.xml
  21. 19
      app/src/main/res/layout/fragment_recent.xml
  22. 35
      app/src/main/res/layout/fragment_recent_row.xml
  23. 14
      app/src/main/res/layout/topic_page_select.xml
  24. 21
      app/src/main/res/values/colors.xml
  25. 1
      app/src/main/res/values/styles.xml

11
app/build.gradle

@ -21,13 +21,14 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'org.jsoup:jsoup:1.10.1'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.franmontiel:PersistentCookieJar:v1.0.0'
compile('com.mikepenz:materialdrawer:5.7.0@aar') {
transitive = true

3
app/src/main/AndroidManifest.xml

@ -6,6 +6,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:name=".utils.ImageController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@ -23,8 +24,8 @@
</activity>
<activity
android:name=".activities.MainActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/AppTheme.NoActionBar">
</activity>

838
app/src/main/assets/style.css

@ -0,0 +1,838 @@
/* TP specific classes */
.sitemap{
margin: 0;
padding: 0;
list-style: none;
}
.sitemap_topheader{
background: #ECEDF3;
border-bottom: solid 1px #ffffff;
padding: 4px;
}
.sitemap_header{
background: #ECEDF3;
border-bottom: solid 1px #ffffff;
padding: 4px;
display: block;
font-weight: bold;
}
.sitemap_header_active{
background: #C8D6E1;
border-bottom: solid 1px #ffffff;
padding: 4px;
display: block;
font-weight: bold;
}
.sitemap_header:hover , .sitemap_header_active:hover{
background: #DBE4ED;
border-bottom: solid 1px #ffffff;
padding: 4px;
display: block;
text-decoration: none;
}
/* TP other styles */
ul#articlelist
{
margin: 0;
padding: 0.5ex 0;
list-style: none;
}
ul#catlist
{
margin: 0;
padding: 0;
list-style: none;
border-top: solid 1px #d0d0d0;
}
ul#articlelist li
{
margin: 0;
display: block;
padding: 0 0 0 3ex;
background: url(images/divider.gif) no-repeat 5px 3px;
}
ul#catlist li
{
display: block;
padding: 0 0 0 3ex;
margin: 0;
}
/* TP rss feed styles */
.rss_title{
font-weight: bold;
}
.rss_body{
margin-bottom: 1ex;
}
.rss_image{
margin: 4px 0 4px 0;
}
/* Normal, standard links. */
a:link, a:visited
{
color: #004080;
text-decoration: none;
}
a:hover
{
text-decoration: underline;
}
/* Navigation links - for the link tree. */
.nav, .nav:link, .nav:visited
{
color: #000000;
text-decoration: none;
}
a.nav:hover
{
color: #cc3333;
}
/* Tables should show empty cells. */
table
{
empty-cells: show;
}
/* The main body of the entire forum. */
body
{
background: white;
margin: 0;
padding: 0;
}
/* By default (td, body..) use verdana in black. */
body, td, th , tr
{
color: #000000;
font-size: small;
font-family: Trebuchet, sans-serif;
}
/* Input boxes - just a bit smaller than normal so they align well. */
input, textarea, button
{
color: #000000;
font-family: Trebuchet, sans-serif;
border: 1px solid #aaa;
}
input, button
{
font-size: 90%;
}
textarea
{
font-size: 100%;
color: #000000;
font-family: Trebuchet, sans-serif;
}
/* All input elements that are checkboxes or radio buttons. */
input.check
{
}
/* Selects are a bit smaller, because it makes them look even better 8). */
select
{
font-size: 90%;
font-weight: normal;
color: #000000;
font-family: Trebuchet, sans-serif;
}
/* Standard horizontal rule.. ([hr], etc.) */
hr, .hrcolor
{
height: 1px;
border: 0;
color: #666666;
background-color: #666666;
}
/* No image should have a border when linked */
a img
{
border: 0;
}
/* A quote, perhaps from another post. */
.quote
{
font-family: tahoma, sans-serif;
color: #000000;
background-color: #D7DAEC;
border: 1px solid #000000;
margin: 1px;
padding: 1px;
font-size: x-small;
line-height: 1.4em;
}
/* A code block - maybe even PHP ;). */
.code
{
color: #000000;
background-color: #dddddd;
font-family: "Comic Sans MS", "times new roman", monospace;
font-size: x-small;
line-height: 1.3em;
/* Put a nice border around it. */
border: 1px solid #000000;
margin: 1px auto 1px auto;
padding: 1px;
width: 99%;
/* Don't wrap its contents, and show scrollbars. */
white-space: nowrap;
overflow: auto;
/* Stop after about 24 lines, and just show a scrollbar. */
max-height: 24em;
}
/* The "Quote:" and "Code:" header parts... */
.quoteheader, .codeheader
{
font-family: tahoma, sans-serif;
color: #000000;
text-decoration: none;
font-style: normal;
font-weight: bold;
font-size: x-small;
line-height: 1.2em;
}
/* Generally, those [?] icons. This makes your cursor a help icon. */
.help
{
cursor: help;
}
/* /me uses this a lot. (emote, try typing /me in a post.) */
.meaction
{
color: red;
}
/* The main post box - this makes it as wide as possible. */
.editor
{
width: 96%;
}
/* Highlighted text - such as search results. */
.highlight
{
background-color: yellow;
font-weight: bold;
color: black;
}
/* Alternating backgrounds for posts, and several other sections of the forum. */
.windowbg
{
color: #000000;
background-color: #E3E6E1;
}
.windowbg2
{
color: #000000;
background-color: #F2F5F0;
}
.windowbg3
{
color: #000000;
background-color: #E1E8E0;
}
/* the today container in calendar */
.calendar_today
{
background-color: #FFFFFF;
}
/* These are used primarily for titles, but also for headers (the row that says what everything in the table is.) */
.titlebg, tr.titlebg th, tr.titlebg td, .titlebg2, tr.titlebg2 th, tr.titlebg2 td
{
background-color: #A3A392;
padding-top: 10px;
}
.titlebg, tr.titlebg th, tr.titlebg td, .titlebg a:link, .titlebg a:visited, .titlebg2, tr.titlebg2 th, tr.titlebg2 td, .titlebg2 a:link, .titlebg2 a:visited
{
color: white;
font-style: normal;
}
.titlebg a:hover
{
color: #dfdfdf;
}
.catbg, .catbg2, .catbg3
{
font-weight: bold;
background-color: #e4e2e0;
color: #000000;
}
/* This is used for tables that have a grid/border background color (such as the topic listing.) */
.bordercolor
{
background-color: white;
}
/* This is used on tables that should just have a border around them. */
.tborder
{
background-color: #FFFFFF;
}
/* Default font sizes: small (8pt), normal (10pt), and large (14pt). */
.smalltext
{
font-size: x-small;
font-family: tahoma, sans-serif;
}
.middletext
{
font-size: 90%;
}
.normaltext
{
font-size: small;
}
.largetext
{
font-size: large;
}
/* Posts and personal messages displayed throughout the forum. */
.post, .personalmessage
{
width: 100%;
overflow: auto;
line-height: 1.3em;
}
/* All the signatures used in the forum. If your forum users use Mozilla, Opera, or Safari, you might add max-height here ;). */
.signature
{
width: 100%;
overflow: auto;
padding-bottom: 3px;
line-height: 1.3em;
}
/* Sometimes there will be an error when you post */
.error
{
color: red;
}
/* definitions for the main tab, active means the tab reflects which page is displayed */
.maintab_first, .maintab_back, .maintab_last, .maintab_active_first, .maintab_active_back, .maintab_active_last
{
text-transform: uppercase;
vertical-align: top;
}
.maintab_back, .maintab_active_back
{
text-decoration: none;
font-size: 9px;
vertical-align: top;
padding: 2px 6px 6px 6px;
font-family: Trebuchet, sans-serif;
}
.maintab_first
{
display: none;
}
.maintab_back
{
}
.maintab_last
{
display: none;
}
.maintab_active_first
{
display: none;
}
.maintab_active_back
{
background: #ffd;
}
.maintab_active_last
{
display: none;
}
/* how links behave in main tab. */
.maintab_back a:link , .maintab_back a:visited, .maintab_active_back a:link , .maintab_active_back a:visited
{
color: black;
text-decoration: none;
}
.maintab_back a:hover, .maintab_active_back a:hover
{
text-decoration: underline;
}
/* definitions for the mirror tab */
.mirrortab_first, .mirrortab_back, .mirrortab_last, .mirrortab_active_first, .mirrortab_active_back, .mirrortab_active_last
{
color: black;
text-transform: uppercase;
vertical-align: top;
}
.mirrortab_back, .mirrortab_active_back
{
text-decoration: none;
font-size: 9px;
vertical-align: bottom;
padding: 6px 6px 2px 6px;
font-family: Trebuchet, sans-serif;
}
.mirrortab_first
{
display: none;
}
.mirrortab_back
{
}
.mirrortab_last
{
display: none;
}
.mirrortab_active_first
{
display: none;
}
.mirrortab_active_back
{
background: #ffd;
}
.mirrortab_active_last
{
display: none;
}
/* how links behave in mirror tab. */
.mirrortab_back a:link , .mirrortab_back a:visited, .mirrortab_active_back a:link , .mirrortab_active_back a:visited
{
color: black;
text-decoration: none;
}
.mirrortab_back a:hover, .mirrortab_active_back a:hover
{
text-decoration: underline;
}
/* The AJAX notifier */
#ajax_in_progress
{
background: #32CD32;
color: white;
text-align: center;
font-weight: bold;
font-size: 18pt;
padding: 3px;
width: 100%;
position: fixed;
top: 0;
left: 0;
}
/* ################################### */
#left
{
background: url(images/img2/leftbg.jpg) repeat-y white;
margin: auto;
}
#right
{
background: url(images/img2/rightbg.gif) repeat-y top right;
}
#top
{
background: url(images/img2/top.jpg) repeat-x;
}
#topleft
{
background: url(images/img2/lefttop.jpg) no-repeat;
}
#topright
{
background: url(images/img2/logo.jpg) no-repeat top right;
}
#main
{
padding: 100px 81px 20px 81px;
}
/* #################### */
ul#menubox
{
padding: 0 0 44px 0;
margin: 0;
list-style: none;
position: absolute;
left: 0;
top: 87px;
background: url(images/img2/leftbot.gif) no-repeat bottom left;
}
#smfshout
{
padding: 6px;
font-size: xx-small;
}
.smfshout_delete
{
border: solid 1px #888;
background: white;
padding: 1px;
}
.smfshout_body
{
border: solid 1px #888;
background: white;
padding: 3px;
text-align: left;
}
.smfshout_frame
{
padding: 5px 0 0 0;
}
ul#menubox li
{
padding: 0 0 0 8px;
width: 65px;
height: 44px;
margin: 0;
background: url(images/img2/left.gif) repeat-y;
}
ul#menubox li a
{
font-family: "Comic Sans MS", serif;
display: block;
color: black;
width: 45px;
height: 42px;
padding: 0 0 0 6px;
}
ul#menubox li a span
{
display: none;
}
ul#menubox li.m1
{
padding-left: 2px;
}
ul#menubox li.m2
{
padding-left: 6px;
}
ul#menubox li.m3
{
padding-left: 10px;
}
ul#menubox li.m4
{
padding-left: 14px;
}
ul#menubox li.m5
{
padding-left: 18px;
}
/* home button */
a#homebtn
{
background: url(images/features/home.gif) no-repeat;
}
a#homebtn:hover
{
background: url(images/features/home-over.gif) no-repeat;
}
a.chosen#homebtn
{
background: url(images/features/home-select.gif) no-repeat;
}
/* help button */
a#helpbtn
{
background: url(images/features/help.gif) no-repeat;
}
a#helpbtn:hover
{
background: url(images/features/help-over.gif) no-repeat;
}
a.chosen#helpbtn
{
background: url(images/features/help-select.gif) no-repeat;
}
/* forum button */
a#forumbtn
{
background: url(images/features/forum.gif) no-repeat;
}
a#forumbtn:hover
{
background: url(images/features/forum-over.gif) no-repeat;
}
a.chosen#forumbtn
{
background: url(images/features/forum-select.gif) no-repeat;
}
/* search button */
a#searchbtn
{
background: url(images/features/search.gif) no-repeat;
}
a#searchbtn:hover
{
background: url(images/features/search-over.gif) no-repeat;
}
a.chosen#searchbtn
{
background: url(images/features/search-select.gif) no-repeat;
}
/* profile button */
a#profilebtn
{
background: url(images/features/profile.gif) no-repeat;
}
a#profilebtn:hover
{
background: url(images/features/profile-over.gif) no-repeat;
}
a.chosen#profilebtn
{
background: url(images/features/profile-select.gif) no-repeat;
}
/* admin button */
a#adminbtn
{
background: url(images/features/admin.gif) no-repeat;
}
a#adminbtn:hover
{
background: url(images/features/admin-over.gif) no-repeat;
}
a.chosen#adminbtn
{
background: url(images/features/admin-select.gif) no-repeat;
}
/* pm button */
a#pmbtn
{
background: url(images/features/pm.gif) no-repeat;
}
a#pmbtn:hover
{
background: url(images/features/pm-over.gif) no-repeat;
}
a.chosen#pmbtn
{
background: url(images/features/pm-select.gif) no-repeat;
}
/* calendar button */
a#calendarbtn
{
background: url(images/features/calendar.gif) no-repeat;
}
a#calendarbtn:hover
{
background: url(images/features/calendar-over.gif) no-repeat;
}
a.chosen#calendarbtn
{
background: url(images/features/calendar-select.gif) no-repeat;
}
/* register button */
a#registerbtn
{
background: url(images/features/register.gif) no-repeat;
}
a#registerbtn:hover
{
background: url(images/features/register-over.gif) no-repeat;
}
a.chosen#registerbtn
{
background: url(images/features/register-select.gif) no-repeat;
}
/* login button */
a#loginbtn
{
background: url(images/features/login.gif) no-repeat;
}
a#loginbtn:hover
{
background: url(images/features/login-over.gif) no-repeat;
}
a.chosen#loginbtn
{
background: url(images/features/login-select.gif) no-repeat;
}
/* logout button */
a#logoutbtn
{
background: url(images/features/logout.gif) no-repeat;
}
a#logoutbtn:hover
{
background: url(images/features/logout-over.gif) no-repeat;
}
a.chosen#logoutbtn
{
background: url(images/features/logout-select.gif) no-repeat;
}
/* shop button */
a#shopbtn
{
background: url(images/features/shop.gif) no-repeat;
}
a#shopbtn:hover
{
background: url(images/features/shop-over.gif) no-repeat;
}
a.chosen#shopbtn
{
background: url(images/features/shop-select.gif) no-repeat;
}
/* arcade button */
a#arcadebtn
{
background: url(images/features/arcade.gif) no-repeat;
}
a#arcadebtn:hover
{
background: url(images/features/arcade-over.gif) no-repeat;
}
a.chosen#arcadebtn
{
background: url(images/features/arcade-select.gif) no-repeat;
}
/* gallery button */
a#gallerybtn
{
background: url(images/features/gallery.gif) no-repeat;
}
a#gallerybtn:hover
{
background: url(images/features/gallery-over.gif) no-repeat;
}
a.chosen#gallerybtn
{
background: url(images/features/gallery-select.gif) no-repeat;
}
#myuser
{
font-size: small;
padding-bottom: 1em;
}
#ava
{
float: right;
margin-right: 10px;
text-align: right;
font-family: "Comic Sans MS", sans-serif;
}
#bodyarea
{
border-bottom: solid 1px #ddd;
margin-bottom: 1em;
padding-bottom: 1em;
}
.clearfix:after
{
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.clearfix
{
display: inline-block;
}
/* Hides from IE-mac \*/
* html .clearfix , * html .catbg, * html .catbg2, * html .catbg3
{
height: 1%;
}
/* End hide from IE-mac */
ul#topmenu
{
position: absolute;
top: 45px;
margin: 0 195px 0 40px;
padding: 0 5px 4px 5px;
list-style: none;
font-weight: bold;
font-size: 11px;
border-bottom: groove 2px #EDF4ED;
}
ul#topmenu li
{
float: left;
}
ul#topmenu li a
{
display: block;
padding: 2px 5px 2px 5px;
border-style: solid solid;
border-width: 0px 1px;
border-color: #E3E6E1;
font-size: 11px;
color: #004080;
}
ul#topmenu li a:hover
{
background: #E3E6E1;
text-decoration: none;
color: #E78E13;
}
#pages
{
padding-top: 1em;
}
#uppersection
{
padding: 1em;
background: url(images/img/upper.jpg) repeat-x;
}
.errorbar
{
color: white;
font-size: xx-small;
text-align: center;
padding: 3px;
border-bottom: solid 1px black;
}
#errorpanel
{
position: absolute;
top: 0;
left: 0;
z-index: 90;
width: 100%;
}

32
app/src/main/java/gr/thmmy/mthmmy/activities/BaseActivity.java

@ -13,13 +13,24 @@ import okhttp3.OkHttpClient;
public class BaseActivity extends AppCompatActivity {
private static boolean init =false; //To initialize stuff only once per app start
protected static OkHttpClient client;
protected static CookieJar cookieJar;
protected static SharedPrefsCookiePersistor sharedPrefsCookiePersistor;
protected static Thmmy.LoginData loginData;
private static boolean init =false; //To initialize stuff only once per app start
public static CookieJar getCookieJar()
{
return cookieJar;
}
public static SharedPrefsCookiePersistor getSharedPrefsCookiePersistor() {
return sharedPrefsCookiePersistor;
}
public static OkHttpClient getClient() {
return client;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -39,20 +50,7 @@ public class BaseActivity extends AppCompatActivity {
}
public static CookieJar getCookieJar()
{
return cookieJar;
}
public static SharedPrefsCookiePersistor getSharedPrefsCookiePersistor() {
return sharedPrefsCookiePersistor;
}
public static OkHttpClient getClient() {
return client;
}
public void setLoginData(Thmmy.LoginData loginData) {
this.loginData = loginData;
BaseActivity.loginData = loginData;
}
}

54
app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java

@ -23,19 +23,19 @@ import static gr.thmmy.mthmmy.utils.Thmmy.login;
public class LoginActivity extends BaseActivity {
private static final String TAG = "LoginActivity";
private static boolean passed=false; //becomes true after (guest) login - to redirect to Main
private EditText inputUsername;
private EditText inputPassword;
Button btnLogin;
Button btnGuest;
private EditText inputUsername;
private EditText inputPassword;
@Override
public void onCreate(Bundle savedInstanceState) {
if(passed) //redirect to MainActivity if user passed this one at least once
/*if(passed) //redirect to MainActivity if user passed this one at least once
{
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
}*/
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
@ -89,6 +89,29 @@ public class LoginActivity extends BaseActivity {
btnLogin.setEnabled(true);
}
public boolean validate() {
boolean valid = true;
String email = inputUsername.getText().toString();
String password = inputPassword.getText().toString();
if (email.isEmpty()) {
inputUsername.setError("Enter a valid username");
valid = false;
} else {
inputUsername.setError(null);
}
if (password.isEmpty()) {
inputPassword.setError("Enter a valid password");
valid = false;
} else {
inputPassword.setError(null);
}
return valid;
}
private class LoginTask extends AsyncTask<String, Void, Integer>
{
ProgressDialog progressDialog;
@ -154,28 +177,5 @@ public class LoginActivity extends BaseActivity {
progressDialog.dismiss();
}
}
public boolean validate() {
boolean valid = true;
String email = inputUsername.getText().toString();
String password = inputPassword.getText().toString();
if (email.isEmpty()) {
inputUsername.setError("Enter a valid username");
valid = false;
} else {
inputUsername.setError(null);
}
if (password.isEmpty()) {
inputPassword.setError("Enter a valid password");
valid = false;
} else {
inputPassword.setError(null);
}
return valid;
}
}

6
app/src/main/java/gr/thmmy/mthmmy/activities/MainActivity.java

@ -79,6 +79,12 @@ public class MainActivity extends BaseActivity implements RecentFragment.OnListF
}
else if (id == R.id.action_logout)
new LogoutTask().execute();
else{
Intent intent = new Intent(MainActivity.this,LoginActivity.class);
startActivity(intent);
finish();
overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out);
}
return super.onOptionsItemSelected(item);
}

194
app/src/main/java/gr/thmmy/mthmmy/activities/TopicActivity.java

@ -1,20 +1,32 @@
package gr.thmmy.mthmmy.activities;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.util.SparseArray;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.webkit.WebView;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.toolbox.ImageLoader;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.ArrayList;
import java.util.List;
@ -23,46 +35,87 @@ import javax.net.ssl.SSLHandshakeException;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.data.Post;
import gr.thmmy.mthmmy.utils.CircularNetworkImageView;
import gr.thmmy.mthmmy.utils.CustomRecyclerView;
import gr.thmmy.mthmmy.utils.ImageController;
import okhttp3.Request;
import okhttp3.Response;
public class TopicActivity extends BaseActivity {
private CustomRecyclerView recyclerView;
private ImageLoader imageLoader = ImageController.getInstance().getImageLoader();
private TopicAdapter topicAdapter;
private ProgressBar progressBar;
private List<Post> postsList;
private EditText pageSelect;
private int thisPage = 1;
private SparseArray<String> pagesUrls = new SparseArray<>();
private String base_url = "";
private int numberOfPages = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_topic);
Bundle extras = getIntent().getExtras();
final String topicTitle = getIntent().getExtras().getString("TOPIC_TITLE");
progressBar = (ProgressBar) findViewById(R.id.progressBar);
if (imageLoader == null)
imageLoader = ImageController.getInstance().getImageLoader();
Bundle extras = getIntent().getExtras();
ActionBar actionbar = getSupportActionBar();
if (actionbar != null)
actionbar.setTitle(extras.getString("TOPIC_TITLE"));
actionbar.setTitle(topicTitle);
postsList = new ArrayList<>();
ActionBar.LayoutParams lp = new ActionBar.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT
, LinearLayout.LayoutParams.WRAP_CONTENT
, Gravity.END | Gravity.CENTER_VERTICAL);
View customNav = LayoutInflater.from(this).inflate(R.layout.topic_page_select, null);
pageSelect = (EditText) customNav.findViewById(R.id.select_page);
pageSelect.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_GO) {
int pageRequested = Integer.parseInt(pageSelect.getText().toString());
if (pageRequested == thisPage) {
Toast.makeText(getBaseContext()
, "You already are here!", Toast.LENGTH_LONG).show();
} else if (pageRequested >= 1 && pageRequested <= numberOfPages) {
Intent intent = getIntent();
intent.putExtra("TOPIC_URL", pagesUrls.get(pageRequested - 1));
intent.putExtra("TOPIC_TITLE", topicTitle);
finish();
startActivity(intent);
} else {
Toast.makeText(getBaseContext()
, "There is no such page!", Toast.LENGTH_LONG).show();
}
}
return true;
}
});
assert actionbar != null;
actionbar.setCustomView(customNav, lp);
actionbar.setDisplayShowCustomEnabled(true);
postsList = new ArrayList<>();
topicAdapter = new TopicAdapter();
recyclerView = (CustomRecyclerView) findViewById(R.id.list);
recyclerView.setLayoutManager(new LinearLayoutManager(findViewById(R.id.list).getContext()));
CustomRecyclerView recyclerView = (CustomRecyclerView) findViewById(R.id.posts_list);
recyclerView.setLayoutManager(new LinearLayoutManager(findViewById(R.id.posts_list).getContext()));
recyclerView.setAdapter(topicAdapter);
new TopicTask().execute(extras.getString("TOPIC_URL"));
}
private class TopicAdapter extends RecyclerView.Adapter<TopicAdapter.ViewHolder>
{
private class TopicAdapter extends RecyclerView.Adapter<TopicAdapter.ViewHolder> {
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
@ -71,29 +124,19 @@ public class TopicActivity extends BaseActivity {
}
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
//----------------------------------- Holder behaves erratically -----------------------------------
if (postsList.get(position).getThumbnailUrl() != "") {
holder.mThumbnailView.setImageUrl(postsList.get(position).getThumbnailUrl(), imageLoader);
}
holder.mAuthorView.setText(postsList.get(position).getAuthor());
holder.mDateTimeView.setText(postsList.get(position).getDateTime());
holder.mContentView.loadData(postsList.get(position).getContent(), "text/html", null);
// holder.topic = recentList.get(position);
//
// holder.mView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
//
// if (null != mListener) {
// // Notify the active callbacks interface (the activity, if the
// // fragment is attached to one) that an item has been selected.
// mListener.onFragmentInteraction(holder.topic); //?
//
// }
//
// }
// });
holder.mSubjectView.setText(postsList.get(position).getDateTime());
holder.mContentView.loadDataWithBaseURL("file:///android_asset/"
, postsList.get(position).getContent()
, "text/html", "UTF-8", null);
//----------------------------------- Holder behaves erratically -----------------------------------
}
@Override
@ -101,29 +144,29 @@ public class TopicActivity extends BaseActivity {
return postsList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public final View mView;
public final TextView mAuthorView;
public final WebView mContentView;
public final TextView mDateTimeView;
class ViewHolder extends RecyclerView.ViewHolder {
final View mView;
final CircularNetworkImageView mThumbnailView;
final TextView mAuthorView;
final TextView mSubjectView;
final WebView mContentView;
public ViewHolder(View view) {
ViewHolder(View view) {
super(view);
mView = view;
mAuthorView = (TextView) view.findViewById(R.id.author);
mContentView = (WebView) view.findViewById(R.id.content);
mDateTimeView = (TextView) view.findViewById(R.id.dateTime);
mThumbnailView = (CircularNetworkImageView) view.findViewById(R.id.thumbnail);
mAuthorView = (TextView) view.findViewById(R.id.username);
mSubjectView = (TextView) view.findViewById(R.id.subject);
mContentView = (WebView) view.findViewById(R.id.post);
}
}
}
//---------------------------------------TOPIC ASYNC TASK-------------------------------------------
public class TopicTask extends AsyncTask<String, Void, Boolean>
{
public class TopicTask extends AsyncTask<String, Void, Boolean> {
private static final String TAG = "TopicTask";
private String pageLink;
@ -134,8 +177,9 @@ public class TopicActivity extends BaseActivity {
progressBar.setVisibility(ProgressBar.VISIBLE);
}
protected Boolean doInBackground(String... strings)
{
protected Boolean doInBackground(String... strings) {
base_url = strings[0].substring(0, strings[0].lastIndexOf("."));
pageLink = strings[0];
Request request = new Request.Builder()
@ -154,23 +198,73 @@ public class TopicActivity extends BaseActivity {
Log.e("TAG", "ERROR", e);
return false;
}
}
protected void onPostExecute(Boolean result)
{
protected void onPostExecute(Boolean result) {
progressBar.setVisibility(ProgressBar.INVISIBLE);
topicAdapter.notifyDataSetChanged();
pageSelect.setHint(String.valueOf(thisPage) + "/" + String.valueOf(numberOfPages));
}
private boolean parse(Document document)
private boolean parse(Document document) {
{
return true;
Elements findCurrentPage = document.select("td:contains(Pages:)>b");
for (Element item : findCurrentPage) {
if (!item.text().contains("...")
&& !item.text().contains("Pages")) {
thisPage = Integer.parseInt(item.text());
break;
}
}
}
{
Elements footer_pages = document.select("td:contains(Pages:)>a.navPages");
if (footer_pages.size() != 0) {
numberOfPages = thisPage;
for (Element item : footer_pages) {
if (Integer.parseInt(item.text()) > numberOfPages)
numberOfPages = Integer.parseInt(item.text());
}
}
for (int i = 0; i < numberOfPages; i++) {
pagesUrls.put(i, base_url + "." + String.valueOf(i * 15));
}
}
Elements form_quickModForm = document.select("form[id=quickModForm]");
Elements nickNames = form_quickModForm.select("a[title^=View the profile of]");
Elements topic_subjectS = form_quickModForm.select("div[id^=subject_]");
Elements postTextS = form_quickModForm.select("div").select(".post");
Elements img_smalltexts = form_quickModForm.select("div").select(":matches(Posts:)");
//Elements replies_smalltexts = form_quickModForm.select("div.smalltext:matches(Reply #)");
for (int i = 0; i < nickNames.size(); i++) {
String tmp_nickName = nickNames.get(i).html();
Element thumbnail_urls = img_smalltexts.get(i).select("img").select(".avatar").first();
String tmp_url = "";
if (thumbnail_urls != null) {
tmp_url = thumbnail_urls.attr("abs:src");
}
String tmp_topic_subject = topic_subjectS.get(i).select("a").first().text();
String tmp_post_text = postTextS.get(i).html();
tmp_post_text = ("<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />" + tmp_post_text); //style.css
/*int tmp_postNum = 0; //topic starter
if (replies_smalltexts.size() == nickNames.size()) {
String tmp_prep = replies_smalltexts.get(i).text().substring(9);
tmp_postNum = Integer.parseInt(tmp_prep.substring(0, tmp_prep.indexOf(" on")));
} else if (i != 0) {
String tmp_prep = replies_smalltexts.get(i - 1).text().substring(9);
tmp_postNum = Integer.parseInt(tmp_prep.substring(0, tmp_prep.indexOf(" on")));
}*/
postsList.add(new Post(tmp_url, tmp_nickName, tmp_topic_subject, tmp_post_text));
}
return true;
}
}
}

15
app/src/main/java/gr/thmmy/mthmmy/data/Post.java

@ -1,20 +1,21 @@
package gr.thmmy.mthmmy.data;
/**
* Created by ezero on 14/9/2016.
*/
public class Post
{
private final String thumbnailUrl;
private final String author;
private final String dateTime;
private final String subject;
private String content;
public Post(String author, String dateTime, String content) {
public Post(String thumbnailUrl, String author, String subject, String content) {
this.thumbnailUrl = thumbnailUrl;
this.author = author;
this.dateTime = dateTime;
this.subject = subject;
this.content = content;
}
public String getThumbnailUrl() { return thumbnailUrl;}
public String getContent() {
return content;
}
@ -24,6 +25,6 @@ public class Post
}
public String getDateTime() {
return dateTime;
return subject;
}
}

87
app/src/main/java/gr/thmmy/mthmmy/utils/CircularNetworkImageView.java

@ -0,0 +1,87 @@
package gr.thmmy.mthmmy.utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.util.AttributeSet;
import com.android.volley.toolbox.NetworkImageView;
public class CircularNetworkImageView extends NetworkImageView {
private static final int THUMBNAIL_SIZE = 100;
Context mContext;
public CircularNetworkImageView(Context context) {
super(context);
mContext = context;
}
public CircularNetworkImageView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
mContext = context;
}
public CircularNetworkImageView(Context context, AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);
mContext = context;
}
public static Bitmap scaleDown(Bitmap realImage, float maxImageSize,
boolean filter) {
float ratio = Math.min(
maxImageSize / realImage.getWidth(),
maxImageSize / realImage.getHeight());
int width = Math.round(ratio * realImage.getWidth());
int height = Math.round(ratio * realImage.getHeight());
return Bitmap.createScaledBitmap(realImage, width,
height, filter);
}
@Override
public void setImageBitmap(Bitmap bm) {
if(bm==null) return;
setImageDrawable(new BitmapDrawable(mContext.getResources(),
getCircularBitmap(bm)));
}
/**
* Creates a circular bitmap and uses whichever dimension is smaller to determine the width
* <br/>Also constrains the circle to the leftmost part of the image
*
* @param bitmap
* @return bitmap
*/
public Bitmap getCircularBitmap(Bitmap bitmap) {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
bitmap.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
int width = bitmap.getWidth();
if(bitmap.getWidth()>bitmap.getHeight())
width = bitmap.getHeight();
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, width, width);
final RectF rectF = new RectF(rect);
final float roundPx = width / 2;
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
output = scaleDown(output, THUMBNAIL_SIZE, true);
return output;
}
}

63
app/src/main/java/gr/thmmy/mthmmy/utils/ImageController.java

@ -0,0 +1,63 @@
package gr.thmmy.mthmmy.utils;
import android.app.Application;
import android.text.TextUtils;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
public class ImageController extends Application {
public static final String TAG = ImageController.class.getSimpleName();
private static ImageController mInstance;
private RequestQueue mRequestQueue;
private ImageLoader mImageLoader;
public static synchronized ImageController getInstance() {
return mInstance;
}
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
}
public RequestQueue getRequestQueue() {
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
}
return mRequestQueue;
}
public ImageLoader getImageLoader() {
getRequestQueue();
if (mImageLoader == null) {
mImageLoader = new ImageLoader(this.mRequestQueue,
new LruBitmapCache());
}
return this.mImageLoader;
}
public <T> void addToRequestQueue(Request<T> req, String tag) {
// set the default tag if tag is empty
req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
getRequestQueue().add(req);
}
public <T> void addToRequestQueue(Request<T> req) {
req.setTag(TAG);
getRequestQueue().add(req);
}
public void cancelPendingRequests(Object tag) {
if (mRequestQueue != null) {
mRequestQueue.cancelAll(tag);
}
}
}

41
app/src/main/java/gr/thmmy/mthmmy/utils/LruBitmapCache.java

@ -0,0 +1,41 @@
package gr.thmmy.mthmmy.utils;
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
import com.android.volley.toolbox.ImageLoader.ImageCache;
class LruBitmapCache extends LruCache<String, Bitmap> implements
ImageCache {
private static final int CACHE_SIZE_DIVIDER = 8;
LruBitmapCache() {
this(getDefaultLruCacheSize());
}
private LruBitmapCache(int sizeInKiloBytes) {
super(sizeInKiloBytes);
}
private static int getDefaultLruCacheSize() {
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
final int cacheSize = maxMemory / CACHE_SIZE_DIVIDER;
return cacheSize;
}
@Override
protected int sizeOf(String key, Bitmap value) {
return value.getRowBytes() * value.getHeight() / 1024;
}
@Override
public Bitmap getBitmap(String url) {
return get(url);
}
@Override
public void putBitmap(String url, Bitmap bitmap) {
put(url, bitmap);
}
}

8
app/src/main/res/anim/push_right_in.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="500"
android:fromXDelta="-100%p"
android:toXDelta="0" />
</set>

8
app/src/main/res/anim/push_right_out.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="500"
android:fromXDelta="0"
android:toXDelta="100%p" />
</set>

8
app/src/main/res/drawable/page_first.xml

@ -0,0 +1,8 @@
<!-- drawable/page_first.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path android:fillColor="#000" android:pathData="M18.41,16.59L13.82,12L18.41,7.41L17,6L11,12L17,18L18.41,16.59M6,6H8V18H6V6Z" />
</vector>

8
app/src/main/res/drawable/page_last.xml

@ -0,0 +1,8 @@
<!-- drawable/page_last.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path android:fillColor="#000" android:pathData="M5.59,7.41L10.18,12L5.59,16.59L7,18L13,12L7,6L5.59,7.41M16,6H18V18H16V6Z" />
</vector>

8
app/src/main/res/drawable/page_next.xml

@ -0,0 +1,8 @@
<!-- drawable/page_next.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path android:fillColor="#000" android:pathData="M16,18H18V6H16M6,18L14.5,12L6,6V18Z" />
</vector>

8
app/src/main/res/drawable/page_previous.xml

@ -0,0 +1,8 @@
<!-- drawable/page_previous.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path android:fillColor="#000" android:pathData="M6,18V6H8V18H6M9.5,12L18,6V18L9.5,12Z" />
</vector>

8
app/src/main/res/layout/activity_main.xml

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"
@ -21,14 +22,12 @@
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/popupTheme">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
@ -36,7 +35,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>

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

@ -1,34 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
tools:context="gr.thmmy.mthmmy.activities.TopicActivity">
<view
class="gr.thmmy.mthmmy.utils.CustomRecyclerView"
android:id="@+id/list"
android:id="@+id/posts_list"
android:name="gr.thmmy.mthmmy.activities.Topic"
class="gr.thmmy.mthmmy.utils.CustomRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:layout_alignParentTop="true"
android:clipToPadding="false"
android:background="@color/white"
android:paddingBottom="4dp"
android:paddingTop="4dp"
app:layoutManager="LinearLayoutManager"
tools:context="gr.thmmy.mthmmy.activities.TopicActivity"
tools:listitem="@layout/activity_topic_post_row"/>
<ProgressBar
android:visibility="invisible"
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
android:visibility="invisible"/>
</RelativeLayout>

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

@ -1,111 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
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"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp">
android:layout_gravity="center"
android:foreground="?android:attr/selectableItemBackground"
card_view:cardBackgroundColor="@color/white"
card_view:cardCornerRadius="0dp"
card_view:cardElevation="2dp"
card_view:cardPreventCornerOverlap="true"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<TextView
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/thumbnail_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="Author"
android:id="@+id/author" />
android:layout_centerVertical="true"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp">
<TextView
<gr.thmmy.mthmmy.utils.CircularNetworkImageView
android:id="@+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/author"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:text="DateTime"
android:id="@+id/dateTime" />
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/content"
android:layout_below="@+id/author"
android:layout_alignRight="@+id/dateTime"
android:layout_alignEnd="@+id/dateTime" />
</RelativeLayout>
<!--<?xml version="1.0" encoding="utf-8"?>-->
<!--<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_height="wrap_content"-->
<!--android:paddingEnd="4dp"-->
<!--android:paddingStart="4dp"-->
<!--android:orientation="vertical"-->
<!--android:background="@color/white">-->
<!--<android.support.v7.widget.CardView-->
<!--xmlns:card_view="http://schemas.android.com/apk/res-auto"-->
<!--android:id="@+id/card_view"-->
<!--android:layout_gravity="center"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:foreground="?android:attr/selectableItemBackground"-->
<!--card_view:cardCornerRadius="0dp"-->
<!--card_view:cardBackgroundColor="@color/white"-->
<!--card_view:cardElevation="2dp"-->
<!--card_view:cardPreventCornerOverlap="true"-->
<!--card_view:cardUseCompatPadding="true">-->
<!--<RelativeLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:paddingTop="6dp"-->
<!--android:paddingBottom="6dp"-->
<!--android:paddingLeft="10dp"-->
<!--android:paddingRight="10dp"-->
<!--android:layout_alignParentTop="true">-->
<!--<TextView-->
<!--android:id="@+id/username"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_alignParentTop="true"-->
<!--android:layout_alignParentLeft="true"-->
<!--android:layout_alignParentStart="true"-->
<!--android:textAppearance="?attr/textAppearanceListItem"-->
<!--android:textColor="@color/md_grey_500" />-->
<!--<Space-->
<!--android:id="@+id/spacer"-->
<!--android:layout_below="@+id/username"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="20dp"-->
<!--android:layout_alignParentBottom="@+id/username"-->
<!--android:layout_toRightOf="@+id/dateTime"-->
<!--android:layout_toEndOf="@+id/dateTime"/>-->
<!--<TextView-->
<!--android:id="@+id/content"-->
<!--android:layout_below="@+id/spacer"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:textAppearance="?attr/textAppearanceListItem"-->
<!--android:textColor="@color/md_grey_500" />-->
<!--<TextView-->
<!--android:id="@+id/dateTime"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_below="@+id/spacer"-->
<!--android:layout_alignParentLeft="true"-->
<!--android:layout_alignParentStart="true"-->
<!--android:textColor="@color/md_grey_500"/>-->
android:adjustViewBounds="false"
android:maxHeight="60dp"
android:maxWidth="60dp"
android:paddingEnd="2dp"
android:paddingLeft="2dp"
android:paddingRight="5dp"
android:paddingStart="2dp"/>
</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:layout_toRightOf="@+id/thumbnail_holder"
android:text="sometext"
android:textStyle="bold"/>
<!--</RelativeLayout>-->
<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:layout_toRightOf="@+id/thumbnail_holder"
android:text="sometext"/>
<!--</android.support.v7.widget.CardView>-->
</RelativeLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="9dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="3dp"
android:background="@color/divider"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--</LinearLayout>-->
<WebView
android:id="@+id/post"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="@color/white"
android:text="sometext"
/>
</FrameLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>

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

@ -3,8 +3,8 @@
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:layout_height="match_parent"
android:layout_width="match_parent">
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh"
@ -12,27 +12,26 @@
android:layout_height="match_parent">
<view
class="gr.thmmy.mthmmy.utils.CustomRecyclerView"
android:id="@+id/list"
android:name="gr.thmmy.mthmmy.sections.recent.RecentFragment"
class="gr.thmmy.mthmmy.utils.CustomRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:clipToPadding="false"
android:background="@color/white"
android:clipToPadding="false"
android:paddingBottom="4dp"
android:paddingTop="4dp"
app:layoutManager="LinearLayoutManager"
tools:context="gr.thmmy.mthmmy.sections.recent.RecentFragment"
tools:listitem="@layout/fragment_recent_row"/>
</android.support.v4.widget.SwipeRefreshLayout>
<ProgressBar
android:visibility="invisible"
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
android:visibility="invisible"/>
</RelativeLayout>

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

@ -1,21 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<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_height="wrap_content"
android:orientation="vertical"
android:paddingEnd="4dp"
android:paddingStart="4dp"
android:orientation="vertical">
android:paddingStart="4dp">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:foreground="?android:attr/selectableItemBackground"
card_view:cardCornerRadius="0dp"
card_view:cardBackgroundColor="@color/white"
card_view:cardElevation="2dp"
card_view:cardPreventCornerOverlap="true"
card_view:cardUseCompatPadding="true">
@ -23,55 +21,48 @@
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:layout_alignParentTop="true"
android:paddingBottom="6dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_alignParentTop="true">
android:paddingTop="6dp">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:textAppearance="?attr/textAppearanceListItem"
android:textColor="@color/md_grey_850"/>
<Space
android:id="@+id/spacer"
android:layout_below="@+id/title"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_alignParentBottom="@+id/title"
android:layout_toRightOf="@+id/dateTime"
android:layout_toEndOf="@+id/dateTime"/>
android:layout_below="@+id/title"
android:layout_toEndOf="@+id/dateTime"
android:layout_toRightOf="@+id/dateTime"/>
<TextView
android:id="@+id/dateTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/spacer"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textColor="@color/md_grey_500"/>
android:layout_below="@+id/spacer"/>
<TextView
android:id="@+id/lastUser"
android:textStyle="italic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/dateTime"
android:layout_alignBottom="@+id/dateTime"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:textColor="@color/md_grey_500"/>
android:layout_alignParentRight="true"
android:textStyle="italic"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>

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

@ -0,0 +1,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<EditText
android:id="@+id/select_page"
android:layout_width="50dp"
android:layout_height="match_parent"
android:imeOptions="actionGo"
android:inputType="number|textNoSuggestions"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="20sp"/>
</LinearLayout>

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

@ -1,30 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--Teal-Indigo-->
<!--<color name="primary">#009688</color>
<color name="primary_dark">#00796B</color>
<color name="primary_light">#B2DFDB</color>
<color name="accent">#536DFE</color>
<color name="primary_text">#E7E7E7</color>
<color name="secondary_text">#757575</color>-->
<!--Indigo-Teal-->
<!--Indigo-->
<color name="primary">#3F51B5</color>
<color name="primary_dark">#303F9F</color>
<color name="primary_light">#C5CAE9</color>
<color name="accent">#FFFFFF</color>
<color name="primary_text">#E7E7E7</color>
<color name="secondary_text">#757575</color>
<color name="card_background">#FFFFFF</color>
<color name="divider">#8B8B8B</color>
<color name="transparent">#00000000</color>
<color name="white">#ffffff</color>
<color name="iron">#CCCCCC</color>
<color name="background">#616161</color>
<color name="myColor1">#ffb74d</color>
<color name="myColor2">#1e88e5</color>
<color name="myColor3">#f57f17</color>
<color name="myColor4">#7e57c2</color>
<color name="myColor5">#388e3c</color>
<color name="myColor6">#d32f2f</color>
<color name="background">#D3D3D3</color>
</resources>

1
app/src/main/res/values/styles.xml

@ -9,6 +9,7 @@
<item name="android:textColorPrimary">@color/primary_text</item>
<item name="android:textColorSecondary">@color/secondary_text</item>
<item name="android:windowBackground">@color/primary</item>
<item name="cardBackgroundColor">@color/card_background</item>
<item name="colorControlNormal">@color/iron</item>
<item name="colorControlActivated">@color/white</item>

Loading…
Cancel
Save