Browse Source

Fix for bookmark functionality and letters getting chopped in TextViews.

pull/24/head
Apostolos Fanakis 8 years ago
parent
commit
0398ac249f
  1. 5
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java
  2. 14
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  3. 138
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  4. 57
      app/src/main/java/gr/thmmy/mthmmy/model/Bookmark.java
  5. 69
      app/src/main/java/gr/thmmy/mthmmy/utils/ObjectSerializer.java
  6. 3
      app/src/main/res/layout/activity_board_sub_board.xml
  7. 127
      app/src/main/res/layout/activity_board_topic.xml
  8. 2
      app/src/main/res/layout/activity_downloads_row.xml

5
app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java

@ -91,8 +91,9 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true);
} }
setBoardBookmark((ImageButton) findViewById(R.id.bookmark), thisPageBookmark = new Bookmark(boardTitle, boardUrl);
new Bookmark(boardTitle, boardUrl)); thisPageBookmarkButton = (ImageButton) findViewById(R.id.bookmark);
setBoardBookmark();
createDrawer(); createDrawer();
progressBar = (MaterialProgressBar) findViewById(R.id.progressBar); progressBar = (MaterialProgressBar) findViewById(R.id.progressBar);

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

@ -9,6 +9,7 @@ import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
@ -118,8 +119,9 @@ public class TopicActivity extends BaseActivity {
getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true);
} }
setTopicBookmark((ImageButton) findViewById(R.id.bookmark), thisPageBookmark = new Bookmark(topicTitle, ThmmyPage.getTopicId(topicPageUrl));
new Bookmark(topicTitle, ThmmyPage.getTopicId(topicPageUrl))); thisPageBookmarkButton = (ImageButton) findViewById(R.id.bookmark);
setTopicBookmark();
createDrawer(); createDrawer();
progressBar = (MaterialProgressBar) findViewById(R.id.progressBar); progressBar = (MaterialProgressBar) findViewById(R.id.progressBar);
@ -450,7 +452,7 @@ public class TopicActivity extends BaseActivity {
} }
if (Integer.parseInt(newPageUrl.substring(base_url.length() + 1)) / 15 + 1 == thisPage) if (Integer.parseInt(newPageUrl.substring(base_url.length() + 1)) / 15 + 1 == thisPage)
return SAME_PAGE; return SAME_PAGE;
} else topicTitle = null; } else if (!Objects.equals(loadedPageUrl, "")) topicTitle = null;
loadedPageUrl = newPageUrl; loadedPageUrl = newPageUrl;
Request request = new Request.Builder() Request request = new Request.Builder()
@ -481,8 +483,10 @@ public class TopicActivity extends BaseActivity {
switch (parseResult) { switch (parseResult) {
case SUCCESS: case SUCCESS:
setTopicBookmark((ImageButton) findViewById(R.id.bookmark), if (topicTitle == null || Objects.equals(topicTitle, "")) {
new Bookmark(parsedTitle, ThmmyPage.getTopicId(loadedPageUrl))); thisPageBookmark = new Bookmark(parsedTitle, ThmmyPage.getTopicId(loadedPageUrl));
setTopicBookmark();
}
progressBar.setVisibility(ProgressBar.INVISIBLE); progressBar.setVisibility(ProgressBar.INVISIBLE);
topicAdapter.customNotifyDataSetChanged(new TopicTask()); topicAdapter.customNotifyDataSetChanged(new TopicTask());

138
app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

@ -29,9 +29,7 @@ import com.mikepenz.materialdrawer.model.ProfileDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IProfile; import com.mikepenz.materialdrawer.model.interfaces.IProfile;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects;
import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.activities.AboutActivity; import gr.thmmy.mthmmy.activities.AboutActivity;
@ -44,7 +42,6 @@ import gr.thmmy.mthmmy.model.Bookmark;
import gr.thmmy.mthmmy.services.DownloadService; import gr.thmmy.mthmmy.services.DownloadService;
import gr.thmmy.mthmmy.session.SessionManager; import gr.thmmy.mthmmy.session.SessionManager;
import gr.thmmy.mthmmy.utils.FileManager.ThmmyFile; import gr.thmmy.mthmmy.utils.FileManager.ThmmyFile;
import gr.thmmy.mthmmy.utils.ObjectSerializer;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
@ -67,9 +64,11 @@ public abstract class BaseActivity extends AppCompatActivity {
private static final String BOOKMARKS_SHARED_PREFS = "bookmarksSharedPrefs"; private static final String BOOKMARKS_SHARED_PREFS = "bookmarksSharedPrefs";
private static final String BOOKMARKED_TOPICS_KEY = "bookmarkedTopicsKey"; private static final String BOOKMARKED_TOPICS_KEY = "bookmarkedTopicsKey";
private static final String BOOKMARKED_BOARDS_KEY = "bookmarkedBoardsKey"; private static final String BOOKMARKED_BOARDS_KEY = "bookmarkedBoardsKey";
protected static SharedPreferences bookmarksFile; protected Bookmark thisPageBookmark;
protected static ArrayList<Bookmark> topicsBookmarked; protected ImageButton thisPageBookmarkButton;
protected static ArrayList<Bookmark> boardsBookmarked; protected SharedPreferences bookmarksFile;
protected ArrayList<Bookmark> topicsBookmarked;
protected ArrayList<Bookmark> boardsBookmarked;
protected static Drawable bookmarked; protected static Drawable bookmarked;
protected static Drawable notBookmarked; protected static Drawable notBookmarked;
@ -409,46 +408,45 @@ public abstract class BaseActivity extends AppCompatActivity {
return topicsBookmarked; return topicsBookmarked;
} }
protected void setTopicBookmark(ImageButton bookmarkView, final Bookmark bookmark) { protected void setTopicBookmark() {
if (matchExists(bookmark, topicsBookmarked)) { if (thisPageBookmark.matchExists(topicsBookmarked)) {
bookmarkView.setImageDrawable(bookmarked); thisPageBookmarkButton.setImageDrawable(bookmarked);
} else { } else {
bookmarkView.setImageDrawable(notBookmarked); thisPageBookmarkButton.setImageDrawable(notBookmarked);
} }
bookmarkView.setOnClickListener(new View.OnClickListener() { thisPageBookmarkButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (matchExists(bookmark, topicsBookmarked)) { if (thisPageBookmark.matchExists(topicsBookmarked)) {
((ImageButton) view).setImageDrawable(notBookmarked); thisPageBookmarkButton.setImageDrawable(notBookmarked);
toggleTopicToBookmarks(bookmark); toggleTopicToBookmarks(thisPageBookmark);
Toast.makeText(BaseActivity.this, "Bookmark removed", Toast.LENGTH_SHORT).show(); Toast.makeText(BaseActivity.this, "Bookmark removed", Toast.LENGTH_SHORT).show();
} else { } else {
((ImageButton) view).setImageDrawable(bookmarked); thisPageBookmarkButton.setImageDrawable(bookmarked);
toggleTopicToBookmarks(bookmark); toggleTopicToBookmarks(thisPageBookmark);
Toast.makeText(BaseActivity.this, "Bookmark added", Toast.LENGTH_SHORT).show(); Toast.makeText(BaseActivity.this, "Bookmark added", Toast.LENGTH_SHORT).show();
} }
} }
}); });
} }
protected void setBoardBookmark(ImageButton bookmarkView, final Bookmark bookmark) { protected void setBoardBookmark() {
if (matchExists(bookmark, boardsBookmarked)) { if (thisPageBookmark.matchExists(boardsBookmarked)) {
bookmarkView.setImageDrawable(bookmarked); thisPageBookmarkButton.setImageDrawable(bookmarked);
} else { } else {
bookmarkView.setImageDrawable(notBookmarked); thisPageBookmarkButton.setImageDrawable(notBookmarked);
} }
bookmarkView.setOnClickListener(new View.OnClickListener() { thisPageBookmarkButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (matchExists(bookmark, boardsBookmarked)) { if (thisPageBookmark.matchExists(boardsBookmarked)) {
((ImageButton) view).setImageDrawable(notBookmarked); thisPageBookmarkButton.setImageDrawable(notBookmarked);
toggleBoardToBookmarks(bookmark);
Toast.makeText(BaseActivity.this, "Bookmark removed", Toast.LENGTH_SHORT).show(); Toast.makeText(BaseActivity.this, "Bookmark removed", Toast.LENGTH_SHORT).show();
} else { } else {
((ImageButton) view).setImageDrawable(bookmarked); thisPageBookmarkButton.setImageDrawable(bookmarked);
toggleBoardToBookmarks(bookmark);
Toast.makeText(BaseActivity.this, "Bookmark added", Toast.LENGTH_SHORT).show(); Toast.makeText(BaseActivity.this, "Bookmark added", Toast.LENGTH_SHORT).show();
} }
toggleBoardToBookmarks(thisPageBookmark);
} }
}); });
} }
@ -456,95 +454,50 @@ public abstract class BaseActivity extends AppCompatActivity {
private void loadSavedBookmarks() { private void loadSavedBookmarks() {
String tmpString = bookmarksFile.getString(BOOKMARKED_TOPICS_KEY, null); String tmpString = bookmarksFile.getString(BOOKMARKED_TOPICS_KEY, null);
if (tmpString != null) if (tmpString != null)
try { topicsBookmarked = Bookmark.arrayFromString(tmpString);
topicsBookmarked = (ArrayList<Bookmark>) ObjectSerializer.deserialize(tmpString);
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
}
else { else {
topicsBookmarked = new ArrayList<>(); topicsBookmarked = new ArrayList<>();
topicsBookmarked.add(null);
} }
tmpString = bookmarksFile.getString(BOOKMARKED_BOARDS_KEY, null); tmpString = bookmarksFile.getString(BOOKMARKED_BOARDS_KEY, null);
if (tmpString != null) if (tmpString != null)
try { boardsBookmarked = Bookmark.arrayFromString(tmpString);
boardsBookmarked = (ArrayList<Bookmark>) ObjectSerializer.deserialize(tmpString);
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
}
else { else {
boardsBookmarked = new ArrayList<>(); boardsBookmarked = new ArrayList<>();
boardsBookmarked.add(null);
} }
} }
private void toggleBoardToBookmarks(Bookmark bookmark) { private void toggleBoardToBookmarks(Bookmark bookmark) {
if (boardsBookmarked == null) return; if (boardsBookmarked == null) return;
if (matchExists(bookmark, boardsBookmarked)) { if (bookmark.matchExists(boardsBookmarked)) {
if (boardsBookmarked.size() == 1) boardsBookmarked.set(0, null); boardsBookmarked.remove(bookmark.findIndex(boardsBookmarked));
else boardsBookmarked.remove(findIndex(bookmark, boardsBookmarked)); } else boardsBookmarked.add(new Bookmark(bookmark.getTitle(), bookmark.getId()));
} else boardsBookmarked.add(bookmark);
updateBoardBookmarks(); updateBoardBookmarks();
} }
private void toggleTopicToBookmarks(Bookmark bookmark) { private void toggleTopicToBookmarks(Bookmark bookmark) {
if (topicsBookmarked == null) return; if (topicsBookmarked == null) return;
if (matchExists(bookmark, topicsBookmarked)) if (bookmark.matchExists(topicsBookmarked)) {
topicsBookmarked.remove(findIndex(bookmark, topicsBookmarked)); topicsBookmarked.remove(bookmark.findIndex(topicsBookmarked));
else topicsBookmarked.add(bookmark); } else {
topicsBookmarked.add(new Bookmark(bookmark.getTitle(), bookmark.getId()));
}
updateTopicBookmarks(); updateTopicBookmarks();
} }
private void updateBoardBookmarks() { private void updateBoardBookmarks() {
String tmpString = null; String tmpString;
if (!(boardsBookmarked.size() == 1 && boardsBookmarked.get(0) == null)) { tmpString = Bookmark.arrayToString(boardsBookmarked);
try {
tmpString = ObjectSerializer.serialize(boardsBookmarked);
} catch (IOException e) {
e.printStackTrace();
}
}
SharedPreferences.Editor editor = bookmarksFile.edit(); SharedPreferences.Editor editor = bookmarksFile.edit();
editor.putString(BOOKMARKED_BOARDS_KEY, tmpString).apply(); editor.putString(BOOKMARKED_BOARDS_KEY, tmpString).apply();
} }
private void updateTopicBookmarks() { private void updateTopicBookmarks() {
String tmpString = null; String tmpString;
if (!(topicsBookmarked.size() == 1 && topicsBookmarked.get(0) == null)) { tmpString = Bookmark.arrayToString(topicsBookmarked);
try {
tmpString = ObjectSerializer.serialize(topicsBookmarked);
} catch (IOException e) {
e.printStackTrace();
}
}
SharedPreferences.Editor editor = bookmarksFile.edit(); SharedPreferences.Editor editor = bookmarksFile.edit();
editor.putString(BOOKMARKED_TOPICS_KEY, tmpString).apply(); editor.putString(BOOKMARKED_TOPICS_KEY, tmpString).apply();
} }
private boolean matchExists(Bookmark bookmark, ArrayList<Bookmark> array) {
if (array != null && !array.isEmpty()) {
for (Bookmark b : array) {
if (b != null) {
return Objects.equals(b.getId(), bookmark.getId())
&& Objects.equals(b.getTitle(), bookmark.getTitle());
}
}
}
return false;
}
private int findIndex(Bookmark bookmark, ArrayList<Bookmark> array) {
if (array.size() == 1 && array.get(0) == null) return -1;
if (!array.isEmpty()) {
for (int i = 0; i < array.size(); ++i) {
if (array.get(i) != null && Objects.equals(array.get(i).getId(), bookmark.getId())
&& Objects.equals(array.get(i).getTitle(), bookmark.getTitle()))
return i;
}
}
return -1;
}
//-------------------------------------------BOOKMARKS END------------------------------------------ //-------------------------------------------BOOKMARKS END------------------------------------------
//-------PERMS--------- //-------PERMS---------
@ -570,8 +523,8 @@ public abstract class BaseActivity extends AppCompatActivity {
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE}; Manifest.permission.WRITE_EXTERNAL_STORAGE};
requestPermissions(PERMISSIONS_STORAGE, PERMISSIONS_REQUEST_CODE); requestPermissions(PERMISSIONS_STORAGE, PERMISSIONS_REQUEST_CODE);
} }
} }
@ -588,16 +541,14 @@ public abstract class BaseActivity extends AppCompatActivity {
//----------------------------------DOWNLOAD------------------ //----------------------------------DOWNLOAD------------------
private ThmmyFile tempThmmyFile; private ThmmyFile tempThmmyFile;
public void launchDownloadService(ThmmyFile thmmyFile) { public void launchDownloadService(ThmmyFile thmmyFile) {
if(checkPerms()) if (checkPerms()) {
{
Intent i = new Intent(this, DownloadService.class); Intent i = new Intent(this, DownloadService.class);
i.setAction(ACTION_DOWNLOAD); i.setAction(ACTION_DOWNLOAD);
i.putExtra(EXTRA_DOWNLOAD_URL, thmmyFile.getFileUrl().toString()); i.putExtra(EXTRA_DOWNLOAD_URL, thmmyFile.getFileUrl().toString());
startService(i); startService(i);
} } else {
else
{
tempThmmyFile = thmmyFile; tempThmmyFile = thmmyFile;
requestPerms(); requestPerms();
} }
@ -605,8 +556,7 @@ public abstract class BaseActivity extends AppCompatActivity {
//Uses temp file - called after permission grant //Uses temp file - called after permission grant
public void launchDownloadService() { public void launchDownloadService() {
if(checkPerms()) if (checkPerms()) {
{
Intent i = new Intent(this, DownloadService.class); Intent i = new Intent(this, DownloadService.class);
i.setAction(ACTION_DOWNLOAD); i.setAction(ACTION_DOWNLOAD);
i.putExtra(EXTRA_DOWNLOAD_URL, tempThmmyFile.getFileUrl().toString()); i.putExtra(EXTRA_DOWNLOAD_URL, tempThmmyFile.getFileUrl().toString());

57
app/src/main/java/gr/thmmy/mthmmy/model/Bookmark.java

@ -1,6 +1,12 @@
package gr.thmmy.mthmmy.model; package gr.thmmy.mthmmy.model;
public class Bookmark { import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.util.ArrayList;
import java.util.Objects;
public class Bookmark implements java.io.Serializable {
private final String title, id; private final String title, id;
public Bookmark(String title, String id) { public Bookmark(String title, String id) {
@ -15,4 +21,53 @@ public class Bookmark {
public String getId() { public String getId() {
return id; return id;
} }
public boolean matchExists(ArrayList<Bookmark> array) {
if (array != null && !array.isEmpty()) {
for (Bookmark bookmark : array) {
if (bookmark != null) {
if (Objects.equals(bookmark.getId(), this.id)
&& Objects.equals(bookmark.getTitle(), this.title))
return true;
}
}
}
return false;
}
public int findIndex(ArrayList<Bookmark> array) {
if (array != null && !array.isEmpty()) {
for (int i = 0; i < array.size(); ++i) {
if (array.get(i) != null && Objects.equals(array.get(i).getId(), this.id)
&& Objects.equals(array.get(i).getTitle(), this.title))
return i;
}
}
return -1;
}
@Nullable
public static String arrayToString(@NonNull ArrayList<Bookmark> arrayList) {
String returnString = "";
for (Bookmark bookmark : arrayList) {
if (bookmark != null) {
returnString += (bookmark.getId() + "\t");
returnString += (bookmark.getTitle() + "\n");
}
}
if (!Objects.equals(returnString, "")) return returnString;
else return null;
}
public static ArrayList<Bookmark> arrayFromString(@NonNull String string) {
ArrayList<Bookmark> returnArray = new ArrayList<>();
String[] lines = string.split("\n");
for (String line : lines) {
if (line == null || line.isEmpty() || Objects.equals(line, "")) break;
String[] parameters = line.split("\t");
if (parameters.length != 2) break;
returnArray.add(new Bookmark(parameters[1], parameters[0]));
}
return returnArray;
}
} }

69
app/src/main/java/gr/thmmy/mthmmy/utils/ObjectSerializer.java

@ -1,69 +0,0 @@
package gr.thmmy.mthmmy.utils;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//copied from http://github.com/apache/pig/blob/89c2e8e76c68d0d0abe6a36b4e08ddc56979796f/src/org/apache/pig/impl/util/ObjectSerializer.java
//package org.apache.pig.impl.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
public class ObjectSerializer {
public static String serialize(Serializable obj) throws IOException {
if (obj == null) return "";
ByteArrayOutputStream serialObj = new ByteArrayOutputStream();
ObjectOutputStream objStream = new ObjectOutputStream(serialObj);
objStream.writeObject(obj);
objStream.close();
return encodeBytes(serialObj.toByteArray());
}
public static Object deserialize(String str) throws IOException, ClassNotFoundException {
if (str == null || str.length() == 0) return null;
ByteArrayInputStream serialObj = new ByteArrayInputStream(decodeBytes(str));
ObjectInputStream objStream = new ObjectInputStream(serialObj);
return objStream.readObject();
}
public static String encodeBytes(byte[] bytes) {
StringBuffer strBuf = new StringBuffer();
for (int i = 0; i < bytes.length; i++) {
strBuf.append((char) (((bytes[i] >> 4) & 0xF) + ((int) 'a')));
strBuf.append((char) (((bytes[i]) & 0xF) + ((int) 'a')));
}
return strBuf.toString();
}
public static byte[] decodeBytes(String str) {
byte[] bytes = new byte[str.length() / 2];
for (int i = 0; i < str.length(); i += 2) {
char c = str.charAt(i);
bytes[i / 2] = (byte) ((c - 'a') << 4);
c = str.charAt(i + 1);
bytes[i / 2] += (c - 'a');
}
return bytes;
}
}

3
app/src/main/res/layout/activity_board_sub_board.xml

@ -28,8 +28,9 @@
android:id="@+id/child_board_title" android:id="@+id/child_board_title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_vertical" android:paddingBottom="2dp"
android:text="@string/child_board_title" android:text="@string/child_board_title"
android:textColor="@color/accent" android:textColor="@color/accent"
android:textSize="22sp"/> android:textSize="22sp"/>

127
app/src/main/res/layout/activity_board_topic.xml

@ -1,85 +1,80 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/topic_row_linear"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<LinearLayout <LinearLayout
android:id="@+id/topic_row_linear"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:layout_marginBottom="5dp"
android:clickable="true" android:layout_marginTop="5dp"
android:focusable="true" android:orientation="horizontal">
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<LinearLayout <TextView
android:layout_width="match_parent" android:id="@+id/topic_subject"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="5dp" android:layout_gravity="center_vertical"
android:layout_marginTop="5dp" android:layout_weight="1"
android:orientation="horizontal"> android:paddingBottom="2dp"
android:text="@string/topic_subject"
android:textColor="@color/primary_text"
android:textSize="18sp"/>
<TextView <ImageButton
android:id="@+id/topic_subject" android:id="@+id/topic_expand_collapse_button"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:background="@null"
android:gravity="center_vertical" android:contentDescription="@string/child_board_button"
android:text="@string/topic_subject" android:src="@drawable/ic_arrow_drop_down"/>
android:textColor="@color/primary_text" </LinearLayout>
android:textSize="18sp"/>
<ImageButton <LinearLayout
android:id="@+id/topic_expand_collapse_button" android:id="@+id/topic_expandable"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@null" android:layout_marginBottom="5dp"
android:contentDescription="@string/child_board_button" android:orientation="vertical"
android:src="@drawable/ic_arrow_drop_down"/> android:visibility="gone">
</LinearLayout>
<LinearLayout <TextView
android:id="@+id/topic_expandable" android:id="@+id/topic_started_by"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="5dp" android:layout_marginBottom="1dp"
android:orientation="vertical" android:layout_marginTop="1dp"
android:visibility="gone"> android:text="@string/topic_started_by"
android:textColor="@color/secondary_text"
<TextView android:textSize="12sp"/>
android:id="@+id/topic_started_by"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:text="@string/topic_started_by"
android:textColor="@color/secondary_text"
android:textSize="12sp"/>
<TextView <TextView
android:id="@+id/topic_stats" android:id="@+id/topic_stats"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="1dp" android:layout_marginBottom="1dp"
android:layout_marginTop="1dp" android:layout_marginTop="1dp"
android:text="@string/topic_stats" android:text="@string/topic_stats"
android:textColor="@color/secondary_text" android:textColor="@color/secondary_text"
android:textSize="12sp"/> android:textSize="12sp"/>
<TextView <TextView
android:id="@+id/topic_last_post" android:id="@+id/topic_last_post"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="1dp" android:layout_marginBottom="1dp"
android:layout_marginTop="1dp" android:layout_marginTop="1dp"
android:clickable="true" android:clickable="true"
android:text="@string/topic_last_post" android:text="@string/topic_last_post"
android:textColor="@color/primary_text" android:textColor="@color/primary_text"
android:textSize="12sp"/> android:textSize="12sp"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

2
app/src/main/res/layout/activity_downloads_row.xml

@ -29,9 +29,11 @@
android:id="@+id/download_title" android:id="@+id/download_title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="2dp" android:layout_marginBottom="2dp"
android:layout_marginTop="2dp" android:layout_marginTop="2dp"
android:layout_weight="1" android:layout_weight="1"
android:paddingBottom="2dp"
android:textColor="@color/accent" android:textColor="@color/accent"
android:textSize="18sp"/> android:textSize="18sp"/>

Loading…
Cancel
Save