Browse Source

Fixes for settings, Add delete post

pull/27/head
Apostolos Fanakis 7 years ago
parent
commit
67ffb59c67
  1. 1
      app/src/main/AndroidManifest.xml
  2. 1
      app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarkActivity.java
  3. 5
      app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsActivity.java
  4. 44
      app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java
  5. 54
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  6. 54
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
  7. 24
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java
  8. 8
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  9. 20
      app/src/main/java/gr/thmmy/mthmmy/model/Post.java
  10. BIN
      app/src/main/res/drawable-hdpi/ic_more_vert.png
  11. BIN
      app/src/main/res/drawable-mdpi/ic_more_vert.png
  12. BIN
      app/src/main/res/drawable-xhdpi/ic_more_vert.png
  13. BIN
      app/src/main/res/drawable-xxhdpi/ic_more_vert.png
  14. BIN
      app/src/main/res/drawable-xxxhdpi/ic_more_vert.png
  15. 15
      app/src/main/res/layout-v21/activity_topic_post_row.xml
  16. 15
      app/src/main/res/layout/activity_topic_post_row.xml
  17. 19
      app/src/main/res/menu/post_menu.xml
  18. 1
      app/src/main/res/values-v21/styles.xml
  19. 7
      app/src/main/res/values/strings.xml
  20. 8
      app/src/main/res/values/styles.xml
  21. 5
      app/src/main/res/xml/app_preferences.xml

1
app/src/main/AndroidManifest.xml

@ -108,7 +108,6 @@
<activity
android:name=".activities.settings.SettingsActivity"
android:parentActivityName=".activities.main.MainActivity"
android:launchMode="singleInstance"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"

1
app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarkActivity.java

@ -1,7 +1,6 @@
package gr.thmmy.mthmmy.activities.bookmarks;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;

5
app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsActivity.java

@ -11,6 +11,8 @@ public class SettingsActivity extends BaseActivity {
public static final String NOTIFICATION_VIBRATION_KEY = "pref_notification_vibration_enable_key";
public static final String APP_SIGNATURE_ENABLE_KEY = "pref_posting_app_signature_enable_key";
private Fragment preferenceFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -29,7 +31,7 @@ public class SettingsActivity extends BaseActivity {
drawer.setSelection(SETTINGS_ID);
if (savedInstanceState == null) {
Fragment preferenceFragment = new SettingsFragment();
preferenceFragment = SettingsFragment.newInstance(sessionManager.isLoggedIn());
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.pref_container, preferenceFragment);
fragmentTransaction.commit();
@ -40,5 +42,6 @@ public class SettingsActivity extends BaseActivity {
protected void onResume() {
drawer.setSelection(SETTINGS_ID);
super.onResume();
((SettingsFragment) preferenceFragment).updateUserLoginState(sessionManager.isLoggedIn());
}
}

44
app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java

@ -8,27 +8,59 @@ import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceFragmentCompat;
import android.util.Log;
import android.view.View;
import gr.thmmy.mthmmy.R;
public class SettingsFragment extends PreferenceFragmentCompat {
public static final String ARG_IS_LOGGED_IN = "selectedRingtoneKey";
//Preferences xml keys
private static final String POSTING_CATEGORY = "pref_category_posting_key";
private static final String SELECTED_NOTIFICATIONS_SOUND = "pref_notifications_select_sound_key";
//SharedPreferences keys
private static final int REQUEST_CODE_ALERT_RINGTONE = 2;
public static final String SETTINGS_SHARED_PREFS = "settingsSharedPrefs";
public static final String SELECTED_RINGTONE = "selectedRingtoneKey";
private static final String SELECTED_NOTIFICATIONS_SOUND = "pref_notifications_select_sound_key";
private static final String SILENT_SELECTED = "STFU";
private SharedPreferences settingsFile;
private boolean isLoggedIn = false;
public static SettingsFragment newInstance(boolean isLoggedIn) {
SettingsFragment fragment = new SettingsFragment();
Bundle args = new Bundle();
args.putBoolean(ARG_IS_LOGGED_IN, isLoggedIn);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
if (args != null){
isLoggedIn = args.getBoolean(ARG_IS_LOGGED_IN,false);
}
}
@Override
public void onCreatePreferences(Bundle bundle, String s) {
public void onCreatePreferences(Bundle bundle, String rootKey) {
// Load the Preferences from the XML file
addPreferencesFromResource(R.xml.app_preferences);
}
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
findPreference(POSTING_CATEGORY).setVisible(isLoggedIn);
}
@Override
public boolean onPreferenceTreeClick(Preference preference) {
if (preference.getKey().equals(SELECTED_NOTIFICATIONS_SOUND)) {
@ -72,11 +104,15 @@ public class SettingsFragment extends PreferenceFragmentCompat {
if (ringtone != null) {
editor.putString(SELECTED_RINGTONE, ringtone.toString()).apply();
} else {
// "Silent" was selected
//"Silent" was selected
editor.putString(SELECTED_RINGTONE, SILENT_SELECTED).apply();
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
public void updateUserLoginState(boolean isLoggedIn) {
this.isLoggedIn = isLoggedIn;
}
}

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

@ -675,6 +675,7 @@ public class TopicActivity extends BaseActivity {
}
postsList.addAll(localPostsList);
topicAdapter.notifyItemRangeInserted(0, postsList.size());
topicAdapter.prepareForDelete(new DeleteTask());
progressBar.setVisibility(ProgressBar.INVISIBLE);
if (replyPageUrl == null) {
@ -981,4 +982,57 @@ public class TopicActivity extends BaseActivity {
}
}
}
class DeleteTask extends AsyncTask<String, Void, Boolean> {
@Override
protected void onPreExecute() {
progressBar.setVisibility(ProgressBar.VISIBLE);
paginationEnabled(false);
replyFAB.setEnabled(false);
}
@Override
protected Boolean doInBackground(String... args) {
Request delete = new Request.Builder()
.url(args[0])
.header("User-Agent",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36")
.build();
try {
client.newCall(delete).execute();
Response response = client.newCall(delete).execute();
//Response response = client.newCall(delete).execute();
switch (replyStatus(response)) {
case SUCCESSFUL:
return true;
default:
Timber.e("Something went wrong. Request string: %s", delete.toString());
return true;
}
} catch (IOException e) {
Timber.e(e, "Delete failed.");
return false;
}
}
@Override
protected void onPostExecute(Boolean result) {
progressBar.setVisibility(ProgressBar.GONE);
replyFAB.setVisibility(View.VISIBLE);
bottomNavBar.setVisibility(View.VISIBLE);
if (!result)
Toast.makeText(TopicActivity.this, "Post deleted!", Toast.LENGTH_SHORT).show();
paginationEnabled(true);
replyFAB.setEnabled(true);
if (result) {
topicTask = new TopicTask();
reloadingPage = true;
topicTask.execute(loadedPageUrl);
}
}
}
}

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

@ -11,12 +11,19 @@ import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.view.menu.MenuBuilder;
import android.support.v7.view.menu.MenuPopupHelper;
import android.support.v7.widget.AppCompatImageButton;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
@ -87,6 +94,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final int isQuoteButtonChecked = 1;
private TopicActivity.TopicTask topicTask;
private TopicActivity.ReplyTask replyTask;
private TopicActivity.DeleteTask deleteTask;
private final int VIEW_TYPE_POST = 0;
private final int VIEW_TYPE_QUICK_REPLY = 1;
@ -113,7 +121,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
this.topicTask = topicTask;
}
ArrayList<Integer> getToQuoteList(){
ArrayList<Integer> getToQuoteList() {
return toQuoteList;
}
@ -128,6 +136,10 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
this.buildedQuotes = buildedQuotes;
}
void prepareForDelete(TopicActivity.DeleteTask deleteTask) {
this.deleteTask = deleteTask;
}
@Override
public int getItemViewType(int position) {
return postsList.get(position) == null ? VIEW_TYPE_QUICK_REPLY : VIEW_TYPE_POST;
@ -409,13 +421,44 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
holder.userExtraInfo.setOnClickListener(null);
}
holder.sharePostButton.setOnClickListener(new View.OnClickListener() {
holder.overflowButton.setOnClickListener(new View.OnClickListener() {
@SuppressLint("RestrictedApi")
@Override
public void onClick(View view) {
//Inflates menu
PopupMenu popup = new PopupMenu(holder.overflowButton.getContext(), holder.overflowButton, Gravity.END);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.post_menu, popup.getMenu());
Menu popupMenu = popup.getMenu();
if(currentPost.getPostDeleteURL() == null || currentPost.getPostDeleteURL().equals("")){
popupMenu.findItem(R.id.delete_post).setEnabled(false);
popupMenu.findItem(R.id.delete_post).setVisible(false);
}
MenuPopupHelper optionsMenu = new MenuPopupHelper(holder.overflowButton.getContext()
, new MenuBuilder(holder.overflowButton.getContext()), holder.overflowButton);
optionsMenu.setForceShowIcon(true);
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.post_share_button:
Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(android.content.Intent.EXTRA_TEXT, currentPost.getPostURL());
context.startActivity(Intent.createChooser(sendIntent, "Share via"));
return true;
case R.id.delete_post:
deleteTask.execute(currentPost.getPostDeleteURL());
return true;
default:
}
return false;
}
});
popup.show();
}
});
@ -482,8 +525,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
holder.submitButton.setEnabled(true);
}
});
if(backPressHidden)
{
if (backPressHidden) {
holder.quickReply.requestFocus();
backPressHidden = false;
}
@ -514,7 +556,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
final TextView postDate, postNum, username, subject;
final ImageView thumbnail;
final public WebView post;
final ImageButton quoteToggle, sharePostButton;
final ImageButton quoteToggle, overflowButton;
final RelativeLayout header;
final LinearLayout userExtraInfo;
final View bodyFooterDivider;
@ -535,7 +577,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
post = view.findViewById(R.id.post);
post.setBackgroundColor(Color.argb(1, 255, 255, 255));
quoteToggle = view.findViewById(R.id.toggle_quote_button);
sharePostButton = view.findViewById(R.id.post_share_button);
overflowButton = view.findViewById(R.id.post_overflow_menu);
bodyFooterDivider = view.findViewById(R.id.body_footer_divider);
postFooter = view.findViewById(R.id.post_footer);

24
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java

@ -156,7 +156,8 @@ class TopicParser {
for (Element thisRow : postRows) {
//Variables for Post constructor
String p_userName, p_thumbnailURL, p_subject, p_post, p_postDate, p_profileURL, p_rank,
p_specialRank, p_gender, p_personalText, p_numberOfPosts, p_postLastEditDate, p_postURL;
p_specialRank, p_gender, p_personalText, p_numberOfPosts, p_postLastEditDate,
p_postURL, p_deletePostURL;
int p_postNum, p_postIndex, p_numberOfStars, p_userColor;
boolean p_isDeleted = false;
ArrayList<ThmmyFile> p_attachedFiles;
@ -172,6 +173,7 @@ class TopicParser {
p_userColor = USER_COLOR_YELLOW;
p_attachedFiles = new ArrayList<>();
p_postLastEditDate = null;
p_deletePostURL = null;
//Language independent parsing
//Finds thumbnail url
@ -232,6 +234,12 @@ class TopicParser {
p_profileURL = userName.attr("href");
}
//Finds post delete url
Element postDelete = thisRow.select("a:has(img[alt='Διαγραφή'])").first();
if (postDelete!=null){
p_deletePostURL = postDelete.attr("href");
}
//Finds post's submit date
Element postDate = thisRow.select("div.smalltext:matches(στις:)").first();
p_postDate = postDate.text();
@ -292,6 +300,12 @@ class TopicParser {
p_profileURL = userName.attr("href");
}
//Finds post delete url
Element postDelete = thisRow.select("a:has(img[alt='Remove message'])").first();
if (postDelete!=null){
p_deletePostURL = postDelete.attr("href");
}
//Finds post's submit date
Element postDate = thisRow.select("div.smalltext:matches(on:)").first();
p_postDate = postDate.text();
@ -412,16 +426,18 @@ class TopicParser {
p_personalText = p_personalText.replace("\n", "").replace("\r", "").trim();
}
}
//Add new post in postsList, extended information needed
parsedPostsList.add(new Post(p_thumbnailURL, p_userName, p_subject, p_post, p_postIndex
, p_postNum, p_postDate, p_profileURL, p_rank, p_specialRank, p_gender
, p_numberOfPosts, p_personalText, p_numberOfStars, p_userColor
, p_attachedFiles, p_postLastEditDate, p_postURL));
, p_attachedFiles, p_postLastEditDate, p_postURL, p_deletePostURL));
} else { //Deleted user
//Add new post in postsList, only standard information needed
parsedPostsList.add(new Post(p_thumbnailURL, p_userName, p_subject, p_post, p_postIndex
, p_postNum, p_postDate, p_userColor, p_attachedFiles, p_postLastEditDate, p_postURL));
parsedPostsList.add(new Post(p_thumbnailURL, p_userName, p_subject, p_post
, p_postIndex , p_postNum, p_postDate, p_userColor, p_attachedFiles
, p_postLastEditDate, p_postURL, p_deletePostURL));
}
}
return parsedPostsList;

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

@ -42,8 +42,8 @@ import java.util.ArrayList;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.activities.AboutActivity;
import gr.thmmy.mthmmy.activities.bookmarks.BookmarkActivity;
import gr.thmmy.mthmmy.activities.LoginActivity;
import gr.thmmy.mthmmy.activities.bookmarks.BookmarkActivity;
import gr.thmmy.mthmmy.activities.downloads.DownloadsActivity;
import gr.thmmy.mthmmy.activities.main.MainActivity;
import gr.thmmy.mthmmy.activities.profile.ProfileActivity;
@ -370,7 +370,7 @@ public abstract class BaseActivity extends AppCompatActivity {
if (sessionManager.isLoggedIn())
drawerBuilder.addDrawerItems(homeItem, bookmarksItem, downloadsItem, settingsItem, loginLogoutItem, aboutItem);
else
drawerBuilder.addDrawerItems(homeItem, bookmarksItem, loginLogoutItem, aboutItem);
drawerBuilder.addDrawerItems(homeItem, bookmarksItem, settingsItem, loginLogoutItem, aboutItem);
drawer = drawerBuilder.build();
@ -391,7 +391,6 @@ public abstract class BaseActivity extends AppCompatActivity {
if (!sessionManager.isLoggedIn()) //When logged out or if user is guest
{
drawer.removeItem(DOWNLOADS_ID);
drawer.removeItem(SETTINGS_ID);
loginLogoutItem.withName(R.string.login).withIcon(loginIcon); //Swap logout with login
profileDrawerItem.withName(sessionManager.getUsername());
setDefaultAvatar();
@ -399,9 +398,6 @@ public abstract class BaseActivity extends AppCompatActivity {
if (!drawer.getDrawerItems().contains(downloadsItem)){
drawer.addItemAtPosition(settingsItem, 2);
}
if (!drawer.getDrawerItems().contains(settingsItem)){
drawer.addItemAtPosition(settingsItem, 3);
}
loginLogoutItem.withName(R.string.logout).withIcon(logoutIcon); //Swap login with logout
profileDrawerItem.withName(sessionManager.getUsername());
if (sessionManager.hasAvatar())

20
app/src/main/java/gr/thmmy/mthmmy/model/Post.java

@ -29,6 +29,7 @@ public class Post {
private final ArrayList<ThmmyFile> attachedFiles;
private final String lastEdit;
private final String postURL;
private final String postDeleteURL;
//Extra info
private final String profileURL;
@ -61,6 +62,7 @@ public class Post {
attachedFiles = null;
lastEdit = null;
postURL = null;
postDeleteURL = null;
}
/**
@ -91,7 +93,8 @@ public class Post {
, int postIndex, int postNumber, String postDate, String profileURl, @Nullable String rank
, @Nullable String special_rank, @Nullable String gender, @Nullable String numberOfPosts
, @Nullable String personalText, int numberOfStars, int userColor
, @Nullable ArrayList<ThmmyFile> attachedFiles, @Nullable String lastEdit, String postURL) {
, @Nullable ArrayList<ThmmyFile> attachedFiles, @Nullable String lastEdit, String postURL
, @Nullable String postDeleteURL) {
if (Objects.equals(thumbnailUrl, "")) this.thumbnailUrl = null;
else this.thumbnailUrl = thumbnailUrl;
this.author = author;
@ -112,6 +115,7 @@ public class Post {
this.personalText = personalText;
this.numberOfStars = numberOfStars;
this.postURL = postURL;
this.postDeleteURL = postDeleteURL;
}
/**
@ -133,7 +137,8 @@ public class Post {
*/
public Post(@Nullable String thumbnailUrl, String author, String subject, String content
, int postIndex, int postNumber, String postDate, int userColor
, @Nullable ArrayList<ThmmyFile> attachedFiles, @Nullable String lastEdit, String postURL) {
, @Nullable ArrayList<ThmmyFile> attachedFiles, @Nullable String lastEdit, String postURL
, @Nullable String postDeleteURL) {
if (Objects.equals(thumbnailUrl, "")) this.thumbnailUrl = null;
else this.thumbnailUrl = thumbnailUrl;
this.author = author;
@ -154,6 +159,7 @@ public class Post {
personalText = "";
numberOfStars = 0;
this.postURL = postURL;
this.postDeleteURL = postDeleteURL;
}
//Getters
@ -342,4 +348,14 @@ public class Post {
public String getPostURL() {
return postURL;
}
/**
* Gets this post's delete url.
*
* @return post's delete url
*/
@Nullable
public String getPostDeleteURL() {
return postDeleteURL;
}
}

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

BIN
app/src/main/res/drawable-mdpi/ic_more_vert.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

BIN
app/src/main/res/drawable-xhdpi/ic_more_vert.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

BIN
app/src/main/res/drawable-xxhdpi/ic_more_vert.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

BIN
app/src/main/res/drawable-xxxhdpi/ic_more_vert.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

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

@ -95,7 +95,7 @@
android:contentDescription="@string/post_quote_button"
android:focusable="true"
android:src="@drawable/ic_format_quote_unchecked" />
<ImageButton
<!--<ImageButton
android:id="@+id/post_share_button"
android:layout_width="@dimen/post_image_button"
android:layout_height="@dimen/post_image_button"
@ -105,7 +105,18 @@
android:clickable="true"
android:contentDescription="@string/post_share_button"
android:focusable="true"
android:src="@drawable/ic_share" />
android:src="@drawable/ic_share" />-->
<ImageButton
android:id="@+id/post_overflow_menu"
android:layout_width="@dimen/post_image_button"
android:layout_height="@dimen/post_image_button"
android:layout_marginTop="9dp"
android:layout_marginEnd="9dp"
android:background="@color/card_background"
android:clickable="true"
android:contentDescription="@string/post_overflow_menu_button"
android:focusable="true"
android:src="@drawable/ic_more_vert" />
</LinearLayout>
<LinearLayout

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

@ -94,7 +94,7 @@
android:contentDescription="@string/post_quote_button"
android:focusable="true"
android:src="@drawable/ic_format_quote_unchecked" />
<ImageButton
<!--<ImageButton
android:id="@+id/post_share_button"
android:layout_width="@dimen/post_image_button"
android:layout_height="@dimen/post_image_button"
@ -104,7 +104,18 @@
android:clickable="true"
android:contentDescription="@string/post_share_button"
android:focusable="true"
android:src="@drawable/ic_share" />
android:src="@drawable/ic_share" />-->
<ImageButton
android:id="@+id/post_overflow_menu"
android:layout_width="@dimen/post_image_button"
android:layout_height="@dimen/post_image_button"
android:layout_marginTop="9dp"
android:layout_marginEnd="9dp"
android:background="@color/card_background"
android:clickable="true"
android:contentDescription="@string/post_overflow_menu_button"
android:focusable="true"
android:src="@drawable/ic_more_vert" />
</LinearLayout>
<LinearLayout

19
app/src/main/res/menu/post_menu.xml

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<menu 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"
tools:context=".activities.topic.TopicActivity">
<item
android:id="@+id/post_share_button"
android:icon="@drawable/ic_share"
android:title="@string/post_share_button"
app:showAsAction="never" />
<item
android:id="@+id/delete_post"
android:icon="@drawable/ic_delete"
android:title="@string/post_delete_button"
app:showAsAction="never" />
</menu>

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

@ -17,6 +17,7 @@
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>
<item name="android:windowContentTransitions">true</item>
<item name="popupMenuStyle">@style/PopupMenuStyle</item>
</style>
<style name="AppTheme.NoActionBar">

7
app/src/main/res/values/strings.xml

@ -38,7 +38,9 @@
<string name="post">Post</string>
<string name="post_thumbnail">Thumbnail</string>
<string name="post_quote_button">Quote button</string>
<string name="post_share_button">Share button</string>
<string name="post_overflow_menu_button">Overflow menu button</string>
<string name="post_share_button">Share</string>
<string name="post_delete_button">Delete</string>
<string name="user_number_of_posts">#%1$d</string>
<string name="button_first">first</string>
<string name="button_previous">previous</string>
@ -108,11 +110,10 @@
<!--<string name="pref_title_notifications_enable">New posts notification</string>
<string name="pref_summary_notifications_enable">Toggle notifications state</string>-->
<string name="pref_title_notification_vibration_enable">Vibration</string>
<string name="pref_summary_notification_vibration_enable">Summary</string>
<string name="pref_title_notifications_sound">Notifications sound</string>
<string name="pref_summary_notifications_sound">Select your preferred notification sound</string>
<string name="pref_category_posting">Posting</string>
<string name="pref_title_posting_app_signature_enable">App signature</string>
<string name="pref_summary_posting_app_signature_enable">If enabled, a \"Posted from mThmmy\" message will be inserted at the end of your posts</string>
<string name="pref_summary_posting_app_signature_enable">If enabled, a \"sent from mTHMMY\" message will be inserted at the end of your posts</string>
</resources>

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

@ -18,6 +18,8 @@
<item name="colorButtonNormal">@color/primary</item>
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>
<item name="popupMenuStyle">@style/PopupMenuStyle</item>
</style>
<style name="AppTheme.NoActionBar">
@ -26,6 +28,12 @@
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
</style>
<style name="PopupMenuStyle">
<item name="android:popupBackground">@color/primary</item>
<item name="android:textAppearanceLargePopupMenu">@color/accent</item>
<item name="android:textAppearanceSmallPopupMenu">@color/accent</item>
</style>
<style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Light">
<item name="android:textColorPrimary">@android:color/white</item>
<item name="android:colorBackground">@color/colorPrimary</item>

5
app/src/main/res/xml/app_preferences.xml

@ -12,7 +12,6 @@
<android.support.v7.preference.SwitchPreferenceCompat
android:defaultValue="true"
android:key="pref_notification_vibration_enable_key"
android:summary="@string/pref_summary_notification_vibration_enable"
android:title="@string/pref_title_notification_vibration_enable" />
<Preference
@ -22,7 +21,9 @@
</android.support.v7.preference.PreferenceCategory>
<android.support.v7.preference.PreferenceCategory android:title="@string/pref_category_posting">
<android.support.v7.preference.PreferenceCategory
android:key="pref_category_posting_key"
android:title="@string/pref_category_posting">
<android.support.v7.preference.SwitchPreferenceCompat
android:defaultValue="true"

Loading…
Cancel
Save