|
|
@ -1472,10 +1472,12 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onReceiveHeaderInfo(ParserUtils.HeaderInfo headerInfo) { |
|
|
|
public void onReceiveHeaderInfo(ParserUtils.HeaderInfo headerInfo) { |
|
|
|
if (!TextUtils.isEmpty(headerInfo.title)) { |
|
|
|
if (!TextUtils.isEmpty(headerInfo.title)) { |
|
|
|
cleanBaseUrl(headerInfo); |
|
|
|
Editable text = textEditor.getText(); |
|
|
|
textEditor.append(headerInfo.title); |
|
|
|
int index = text.toString().indexOf(headerInfo.baseUrl); |
|
|
|
textEditor.append(StringUtils.carriageReturn); |
|
|
|
if (index < 0) { |
|
|
|
textEditor.append(headerInfo.baseUrl); |
|
|
|
index = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
text.insert(index, headerInfo.title + StringUtils.carriageReturn); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!TextUtils.isEmpty(headerInfo.image)) { |
|
|
|
if (!TextUtils.isEmpty(headerInfo.image)) { |
|
|
|
Picasso.Builder builder = new Picasso.Builder(getApplicationContext()); |
|
|
|
Picasso.Builder builder = new Picasso.Builder(getApplicationContext()); |
|
|
@ -1505,16 +1507,6 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// remove the precedent paste from the edit text
|
|
|
|
|
|
|
|
private void cleanBaseUrl(ParserUtils.HeaderInfo headerInfo) { |
|
|
|
|
|
|
|
int lengthBaseUrl = headerInfo.baseUrl.length(); |
|
|
|
|
|
|
|
int total = textEditor.getText().length(); |
|
|
|
|
|
|
|
int indexSubString = total - lengthBaseUrl; |
|
|
|
|
|
|
|
String text = textEditor.getText().toString(); |
|
|
|
|
|
|
|
text = text.substring(0, indexSubString); |
|
|
|
|
|
|
|
textEditor.setText(text); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onErrorHeaderInfo() { |
|
|
|
public void onErrorHeaderInfo() { |
|
|
|
displayTransientError(R.string.error_generic); |
|
|
|
displayTransientError(R.string.error_generic); |
|
|
|