Skip to content

Commit 46756a7

Browse files
committed
Merge branch 'beta'
# Conflicts: # Awful.apk/src/main/AndroidManifest.xml
2 parents be48cc7 + a728839 commit 46756a7

34 files changed

+803
-190
lines changed

Awful.apk/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.11'
2+
ext.kotlin_version = '1.3.41'
33

44
repositories {
55
google()
66
jcenter()
77
maven { url 'https://maven.fabric.io/public' }
88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.2.1'
10+
classpath 'com.android.tools.build:gradle:3.4.2'
1111
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1212
classpath 'io.fabric.tools:gradle:1.+'
1313
}

Awful.apk/src/main/assets/css/amberpos.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ body {
3535
background-color: #1A4000;
3636
}
3737

38-
.postcontent {
39-
border-color: #eacf4c;
38+
.postseparator {
39+
background-color: #eacf4c;
4040
}
4141

4242
.postcontent .bbc-block {

Awful.apk/src/main/assets/css/classic.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ body {
3636
background-color: #5BA611;
3737
}
3838

39+
.postseparator {
40+
display: none;
41+
}
42+
3943
.postcontent {
4044
padding: 5px;
4145
margin: 5px 5px 0;

Awful.apk/src/main/assets/css/fyad.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ body {
4040
background-color: #ECFFD9;
4141
}
4242

43+
.postheader {
44+
padding-bottom: 0px;
45+
}
46+
47+
.postseparator {
48+
display: none;
49+
}
50+
4351
.postcontent {
4452
background-color: #FFFFFF;
4553
border: 3px solid #000000;

Awful.apk/src/main/assets/css/general.css

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,46 @@
2626
display: flex;
2727
border: 0;
2828
margin-left: 15px;
29-
padding-top: 15px;
29+
padding: 15px 0px 5px;
3030
}
3131

3232
.postmenu {
3333
font-weight: bolder;
3434
font-size: 1.7em;
35-
display: contents;
35+
width: 24px;
36+
height: 24px;
37+
margin-right: 5px;
38+
margin-top: -4px;
3639
}
3740

3841
.postmenu:after {
3942
font-family: 'icons' !important;
4043
content: "\e902";
4144
font-weight: normal;
4245
-webkit-font-smoothing: antialiased;
43-
display: inline-block;
4446
-webkit-user-select: none;
4547
user-select: none;
46-
margin-top: -10px;
47-
padding: 10px;
48-
height: 100%;
48+
padding: 4px;
49+
display:block;
50+
}
51+
52+
/*
53+
this is the dividing line between the header and the post content
54+
I've given it no vertical spacing, so the header and content can define their own padding etc
55+
(means that e.g. post content in previews looks right because it controls its spacing)
56+
*/
57+
.postseparator {
58+
display: block;
59+
height: 2px;
60+
padding: 0px;
61+
margin: 0px 15px;
62+
background-color: #eae9ea;
4963
}
5064

5165
.postcontent {
5266
word-wrap: break-word;
53-
padding: 10px 0;
54-
border-top: 2px solid #eae9ea;
55-
margin: 5px 15px;
67+
padding: 10px 0px;
68+
margin: 0px 15px;
5669
}
5770

5871
.playGif {

Awful.apk/src/main/assets/css/oled.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ body {
3636
}
3737

3838
.postcontent {
39-
border-top: none;
4039
margin: 5px 10px;
4140
}
4241

@@ -84,9 +83,14 @@ body {
8483
vertical-align: top;
8584
clear: left;
8685
border: 0;
87-
border-bottom: 1px solid #e7e7e7;
8886
border-top: 1px solid #e7e7e7;
8987
margin: 0;
9088
padding: 10px;
9189
padding-right: 0;
90+
}
91+
92+
.postseparator {
93+
height: 1px;
94+
background-color: #e7e7e7;
95+
margin: 0px;
9296
}

Awful.apk/src/main/assets/css/yospos.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ body {
4040
padding: 5px;
4141
}
4242

43-
.postcontent {
44-
border-color: #0F0;
43+
.postseparator {
44+
background-color: #0F0;
4545
}
4646

4747
.postcontent .bbc-block {

Awful.apk/src/main/assets/mustache/post.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
</div>
1414
<nav class="postmenu" username="{{username}}" userid="{{userID}}" lastreadurl="{{lastReadUrl}}" {{#editable}}editable{{/editable}} {{#mod}}isMod{{/mod}} {{#admin}}isAdmin{{/admin}} {{#plat}}isPlat{{/plat}} ></nav>
1515
</header>
16+
<div class="postseparator"></div>
1617
<section class="postcontent">
1718
{{{postcontent}}}
1819
</section >

Awful.apk/src/main/java/com/ferg/awfulapp/MessageDisplayActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void onCreate(Bundle savedInstanceState)
1515
{
1616
super.onCreate(savedInstanceState);
1717
setContentView(R.layout.private_message_activity);
18-
mToolbar = (Toolbar) findViewById(R.id.toolbar);
18+
mToolbar = findViewById(R.id.toolbar);
1919
setSupportActionBar(mToolbar);
2020
setUpActionBar();
2121
setActionbarTitle("Message");

Awful.apk/src/main/java/com/ferg/awfulapp/MessageFragment.java

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.ferg.awfulapp;
22

3+
import android.app.Activity;
34
import android.app.ProgressDialog;
45
import android.content.ContentResolver;
56
import android.content.ContentUris;
@@ -34,9 +35,13 @@
3435
import com.ferg.awfulapp.task.PMReplyRequest;
3536
import com.ferg.awfulapp.task.PMRequest;
3637
import com.ferg.awfulapp.task.SendPrivateMessageRequest;
38+
import com.ferg.awfulapp.thread.AwfulHtmlPage;
3739
import com.ferg.awfulapp.thread.AwfulMessage;
3840
import com.ferg.awfulapp.webview.AwfulWebView;
3941
import com.ferg.awfulapp.webview.WebViewJsInterface;
42+
import com.ferg.awfulapp.widget.ThreadIconPicker;
43+
44+
import timber.log.Timber;
4045

4146
import static android.view.View.GONE;
4247
import static android.view.View.VISIBLE;
@@ -57,6 +62,7 @@ public class MessageFragment extends AwfulFragment implements OnClickListener {
5762
private EditText mRecipient;
5863
private EditText mSubject;
5964
private View mBackground;
65+
private ThreadIconPicker threadIconPicker;
6066

6167
private AwfulPreferences mPrefs;
6268

@@ -106,20 +112,23 @@ public View onCreateView(LayoutInflater aInflater, ViewGroup aContainer, Bundle
106112

107113
View result = aInflater.inflate(R.layout.private_message_fragment, aContainer, false);
108114

109-
messageWebView = (AwfulWebView) result.findViewById(R.id.messagebody);
110-
mHideButton = (ImageButton) result.findViewById(R.id.hide_message);
115+
messageWebView = result.findViewById(R.id.messagebody);
116+
mHideButton = result.findViewById(R.id.hide_message);
111117
mHideButton.setOnClickListener(this);
112-
mRecipient = (EditText) result.findViewById(R.id.message_user);
113-
mSubject = (EditText) result.findViewById(R.id.message_subject);
114-
mUsername = (TextView) result.findViewById(R.id.username);
115-
mPostdate = (TextView) result.findViewById(R.id.post_date);
116-
mTitle = (TextView) result.findViewById(R.id.message_title);
118+
mRecipient = result.findViewById(R.id.message_user);
119+
mSubject = result.findViewById(R.id.message_subject);
120+
mUsername = result.findViewById(R.id.username);
121+
mPostdate = result.findViewById(R.id.post_date);
122+
mTitle = result.findViewById(R.id.message_title);
117123

118124
messageComposer = (MessageComposer) getChildFragmentManager().findFragmentById(R.id.message_composer_fragment);
125+
threadIconPicker = (ThreadIconPicker) getChildFragmentManager().findFragmentById(R.id.thread_icon_picker);
126+
threadIconPicker.usePrivateMessageIcons();
119127

120128
mBackground = result;
121129
updateColors(result, mPrefs);
122130
messageWebView.setJavascriptHandler(new WebViewJsInterface());
131+
messageWebView.setContent(AwfulHtmlPage.getContainerHtml(mPrefs, null, false));
123132

124133
if(pmId <=0){
125134
messageWebView.setVisibility(GONE);
@@ -174,11 +183,17 @@ public void onActivityCreated(Bundle savedState){
174183

175184

176185
private void syncPM() {
177-
queueRequest(new PMRequest(getActivity(), pmId).build(this, new AwfulRequest.AwfulResultCallback<Void>() {
186+
// TODO: rework this so we don't hold onto the activity - AwfulRequest wants to make a Toast so we can't just pass in the app context
187+
final Activity activity = getActivity();
188+
if (activity == null) {
189+
Timber.i("Activity unavailable - abandoning PM load");
190+
return;
191+
}
192+
queueRequest(new PMRequest(activity, pmId).build(this, new AwfulRequest.AwfulResultCallback<Void>() {
178193
@Override
179194
public void success(Void result) {
180195
restartLoader(pmId, null, mPMDataCallback);
181-
queueRequest(new PMReplyRequest(getActivity(), pmId).build(MessageFragment.this, new AwfulRequest.AwfulResultCallback<Void>() {
196+
queueRequest(new PMReplyRequest(activity, pmId).build(MessageFragment.this, new AwfulRequest.AwfulResultCallback<Void>() {
182197
@Override
183198
public void success(Void result) {
184199
restartLoader(pmId, null, mPMDataCallback);
@@ -262,6 +277,7 @@ public void saveReply(){
262277
values.put(AwfulMessage.TYPE, AwfulMessage.TYPE_PM);
263278
values.put(AwfulMessage.RECIPIENT, mRecipient.getText().toString());
264279
values.put(AwfulMessage.REPLY_CONTENT, messageComposer.getText());
280+
values.put(AwfulMessage.REPLY_ICON, threadIconPicker.getIcon().iconId);
265281
if(content.update(ContentUris.withAppendedId(AwfulMessage.CONTENT_URI_REPLY,pmId), values, null, null)<1){
266282
content.insert(AwfulMessage.CONTENT_URI_REPLY, values);
267283
}
@@ -311,7 +327,7 @@ private void newMessage(){
311327
mUsername.setText("");
312328
mRecipient.setText("");
313329
mPostdate.setText("");
314-
messageWebView.setContent(null);
330+
messageWebView.setBodyHtml(null);
315331
mTitle.setText("New Message");
316332
mSubject.setText("");
317333
}
@@ -361,11 +377,11 @@ public void onLoadFinished(Loader<Cursor> aLoader, Cursor aData) {
361377
if(aData != null && aData.moveToFirst()){
362378
Log.v(TAG,"PM load finished, populating: "+aData.getCount());
363379
if(messageWebView != null){
364-
messageWebView.setContent(null);
380+
messageWebView.setBodyHtml(null);
365381
}
366382
String title = aData.getString(aData.getColumnIndex(AwfulMessage.TITLE));
367383
mTitle.setText(title);
368-
messageWebView.setContent(AwfulMessage.getMessageHtml(aData.getString(aData.getColumnIndex(AwfulMessage.CONTENT)),mPrefs));
384+
messageWebView.setBodyHtml(AwfulMessage.getMessageHtml(aData.getString(aData.getColumnIndex(AwfulMessage.CONTENT))));
369385
mPostdate.setText(aData.getString(aData.getColumnIndex(AwfulMessage.DATE)));
370386
String replyTitle = aData.getString(aData.getColumnIndex(AwfulMessage.REPLY_TITLE));
371387
String replyContent = aData.getString(aData.getColumnIndex(AwfulMessage.REPLY_CONTENT));
@@ -424,8 +440,4 @@ protected boolean doScroll(boolean down) {
424440
}
425441

426442

427-
private String getBlankPage(){
428-
return "<html><head></head><body style='{background-color:#"+ ColorProvider.convertToRGB(ColorProvider.BACKGROUND.getColor()) +";'></body></html>";
429-
}
430-
431443
}

0 commit comments

Comments
 (0)