|
|
@ -27,6 +27,7 @@ import android.content.SharedPreferences;
|
|
|
|
import android.graphics.Color;
|
|
|
|
import android.graphics.Color;
|
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.AdapterView;
|
|
|
|
import android.widget.AdapterView;
|
|
|
@ -34,6 +35,7 @@ import android.widget.ArrayAdapter;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.CheckBox;
|
|
|
|
import android.widget.CheckBox;
|
|
|
|
import android.widget.CompoundButton;
|
|
|
|
import android.widget.CompoundButton;
|
|
|
|
|
|
|
|
import android.widget.EditText;
|
|
|
|
import android.widget.Spinner;
|
|
|
|
import android.widget.Spinner;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
|
|
|
@ -73,6 +75,7 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|
|
|
private CheckBox cbAvatars;
|
|
|
|
private CheckBox cbAvatars;
|
|
|
|
private CheckBox cbAccountName;
|
|
|
|
private CheckBox cbAccountName;
|
|
|
|
private CheckBox cbCaption;
|
|
|
|
private CheckBox cbCaption;
|
|
|
|
|
|
|
|
private EditText etName;
|
|
|
|
private CheckBox cbRefresh;
|
|
|
|
private CheckBox cbRefresh;
|
|
|
|
private CheckBox cbCompose;
|
|
|
|
private CheckBox cbCompose;
|
|
|
|
private Button btnSave;
|
|
|
|
private Button btnSave;
|
|
|
@ -116,6 +119,7 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|
|
|
boolean avatars = prefs.getBoolean("widget." + appWidgetId + ".avatars", false);
|
|
|
|
boolean avatars = prefs.getBoolean("widget." + appWidgetId + ".avatars", false);
|
|
|
|
boolean account_name = prefs.getBoolean("widget." + appWidgetId + ".account_name", true);
|
|
|
|
boolean account_name = prefs.getBoolean("widget." + appWidgetId + ".account_name", true);
|
|
|
|
boolean caption = prefs.getBoolean("widget." + appWidgetId + ".caption", true);
|
|
|
|
boolean caption = prefs.getBoolean("widget." + appWidgetId + ".caption", true);
|
|
|
|
|
|
|
|
String name = prefs.getString("widget." + appWidgetId + ".name", null);
|
|
|
|
boolean refresh = prefs.getBoolean("widget." + appWidgetId + ".refresh", false);
|
|
|
|
boolean refresh = prefs.getBoolean("widget." + appWidgetId + ".refresh", false);
|
|
|
|
boolean compose = prefs.getBoolean("widget." + appWidgetId + ".compose", false);
|
|
|
|
boolean compose = prefs.getBoolean("widget." + appWidgetId + ".compose", false);
|
|
|
|
|
|
|
|
|
|
|
@ -142,6 +146,7 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|
|
|
cbAvatars = findViewById(R.id.cbAvatars);
|
|
|
|
cbAvatars = findViewById(R.id.cbAvatars);
|
|
|
|
cbAccountName = findViewById(R.id.cbAccountName);
|
|
|
|
cbAccountName = findViewById(R.id.cbAccountName);
|
|
|
|
cbCaption = findViewById(R.id.cbCaption);
|
|
|
|
cbCaption = findViewById(R.id.cbCaption);
|
|
|
|
|
|
|
|
etName = findViewById(R.id.etName);
|
|
|
|
cbRefresh = findViewById(R.id.cbRefresh);
|
|
|
|
cbRefresh = findViewById(R.id.cbRefresh);
|
|
|
|
cbCompose = findViewById(R.id.cbCompose);
|
|
|
|
cbCompose = findViewById(R.id.cbCompose);
|
|
|
|
btnSave = findViewById(R.id.btnSave);
|
|
|
|
btnSave = findViewById(R.id.btnSave);
|
|
|
@ -249,6 +254,13 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbCaption.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
|
|
|
|
|
etName.setEnabled(isChecked);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
btnSave.setOnClickListener(new View.OnClickListener() {
|
|
|
|
btnSave.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
|
|
|
public void onClick(View view) {
|
|
|
@ -258,12 +270,16 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ActivityWidgetUnified.this);
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ActivityWidgetUnified.this);
|
|
|
|
SharedPreferences.Editor editor = prefs.edit();
|
|
|
|
SharedPreferences.Editor editor = prefs.edit();
|
|
|
|
|
|
|
|
|
|
|
|
if (account != null && account.id > 0)
|
|
|
|
if (account != null && account.id > 0) {
|
|
|
|
|
|
|
|
String name = etName.getText().toString();
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(name))
|
|
|
|
if (folder != null && folder.id > 0)
|
|
|
|
if (folder != null && folder.id > 0)
|
|
|
|
editor.putString("widget." + appWidgetId + ".name", folder.getDisplayName(ActivityWidgetUnified.this));
|
|
|
|
editor.putString("widget." + appWidgetId + ".name", folder.getDisplayName(ActivityWidgetUnified.this));
|
|
|
|
else
|
|
|
|
else
|
|
|
|
editor.putString("widget." + appWidgetId + ".name", account.name);
|
|
|
|
editor.putString("widget." + appWidgetId + ".name", account.name);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
editor.putString("widget." + appWidgetId + ".name", name);
|
|
|
|
|
|
|
|
} else
|
|
|
|
editor.remove("widget." + appWidgetId + ".name");
|
|
|
|
editor.remove("widget." + appWidgetId + ".name");
|
|
|
|
|
|
|
|
|
|
|
|
int font = spFontSize.getSelectedItemPosition();
|
|
|
|
int font = spFontSize.getSelectedItemPosition();
|
|
|
@ -421,6 +437,8 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|
|
|
spSubjectLines.setSelection(subject_lines - 1);
|
|
|
|
spSubjectLines.setSelection(subject_lines - 1);
|
|
|
|
tvSubjectLinesHint.setText(getString(R.string.title_advanced_preview_lines_hint, NF.format(HtmlHelper.PREVIEW_SIZE)));
|
|
|
|
tvSubjectLinesHint.setText(getString(R.string.title_advanced_preview_lines_hint, NF.format(HtmlHelper.PREVIEW_SIZE)));
|
|
|
|
cbCaption.setChecked(caption);
|
|
|
|
cbCaption.setChecked(caption);
|
|
|
|
|
|
|
|
etName.setText(name);
|
|
|
|
|
|
|
|
etName.setEnabled(caption);
|
|
|
|
cbRefresh.setChecked(refresh);
|
|
|
|
cbRefresh.setChecked(refresh);
|
|
|
|
cbCompose.setChecked(compose);
|
|
|
|
cbCompose.setChecked(compose);
|
|
|
|
|
|
|
|
|
|
|
|