Screen flow update messages basically working, dialog text color refactor

pull/14/head
Sam Bosley 13 years ago
parent 0f02eae5bc
commit 5842171d63

@ -168,7 +168,8 @@
<activity android:name="com.todoroo.astrid.activity.ShareActivity"/>
<activity android:name="com.todoroo.astrid.service.UpdateScreenFlow"
android:screenOrientation="portrait"/>
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Dialog"/>
<!-- Start of Crittercism.com Code -->
<activity android:name="com.crittercism.NewFeedbackSpringboardActivity" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"></activity>

@ -110,7 +110,7 @@ public class OrderedListFragmentHelper<LIST> {
"subtasks_horizontal.png",
getActivity().getString(R.string.subtasks_help_3));
String color = ThemeService.getDialogTextColor();
String color = ThemeService.getDialogTextColorString();
String html = String.format("<html><body style='text-align:center;color:%s'>%s</body></html>",
color, body);

@ -112,18 +112,25 @@ public class ThemeService {
return theme;
}
public static String getDialogTextColor() {
public static int getDialogTextColor() {
if (AndroidUtilities.getSdkVersion() >= 11) {
int theme = getTheme();
if (theme == R.style.Theme || theme == R.style.Theme_Transparent)
return "white";
return android.R.color.white;
else
return "black";
return android.R.color.black;
} else {
return "white";
return android.R.color.white;
}
}
public static String getDialogTextColorString() {
int color = getDialogTextColor();
if (color == android.R.color.white)
return "white";
return "black";
}
public static int getDrawable(int lightDrawable) {
return getDrawable(lightDrawable, 0);
}

@ -16,14 +16,17 @@ import org.weloveastrid.rmilk.MilkUtilities;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.text.Spannable;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager.BadTokenException;
import android.widget.TextView;
@ -37,9 +40,7 @@ import com.todoroo.andlib.service.RestClient;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.activity.EditPreferences;
import com.todoroo.astrid.dao.StoreObjectDao;
import com.todoroo.astrid.dao.StoreObjectDao.StoreObjectCriteria;
import com.todoroo.astrid.data.StoreObject;
@ -79,19 +80,20 @@ public class UpdateMessageService {
JSONArray updates = checkForUpdates();
System.err.println("UPDATES: " + updates);
try {
JSONObject test = new JSONObject();
test.put("date", "09/26/12");
test.put("message", "Screens!");
test.put("type", "screen");
JSONArray screenArray = new JSONArray();
screenArray.put(ActFmLoginActivity.class.getName());
screenArray.put(EditPreferences.class.getName());
test.put("screens", screenArray);
updates.put(test);
} catch (JSONException e) {
e.printStackTrace();
}
// try {
// JSONObject test = new JSONObject();
// test.put("date", "09/26/12");
// test.put("message", "Screens!");
// test.put("type", "screen");
// test.put("link", "Click me");
// JSONArray screenArray = new JSONArray();
// screenArray.put(ActFmLoginActivity.class.getName());
// screenArray.put(EditPreferences.class.getName());
// test.put("screens", screenArray);
// updates.put(test);
// } catch (JSONException e) {
// e.printStackTrace();
// }
if(updates == null || updates.length() == 0)
return;
@ -129,18 +131,29 @@ public class UpdateMessageService {
final DialogShower shower;
if (message instanceof Spannable) {
final TextView textView = new TextView(activity);
textView.setText(message);
textView.setTextSize(16);
textView.setTextColor(activity.getResources().getColor(ThemeService.getDialogTextColor()));
textView.setMovementMethod(LinkMovementMethod.getInstance());
shower = new DialogShower() {
@Override
public void showDialog(Activity a) {
new AlertDialog.Builder(a)
final Dialog d = new AlertDialog.Builder(a)
.setTitle(R.string.UpS_updates_title)
.setView(textView)
.setPositiveButton(R.string.DLG_ok, null)
.show();
.create();
textView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
d.dismiss();
}
});
d.show();
}
};
} else {
String color = ThemeService.getDialogTextColor();
String color = ThemeService.getDialogTextColorString();
final String html = "<html><body style='color: " + color + "'>" +
message + "</body></html>";
shower = new DialogShower() {

@ -540,7 +540,7 @@ public final class UpgradeService {
return;
changeLog.append("Enjoy!</body></html>");
String color = ThemeService.getDialogTextColor();
String color = ThemeService.getDialogTextColorString();
String changeLogHtml = "<html><body style='color: " + color +"'>" + changeLog;
DialogUtilities.htmlDialog(context, changeLogHtml,

@ -117,7 +117,7 @@ public class TaskListFragmentPager extends ViewPager {
"subtasks_horizontal.png",
activity.getString(R.string.swipe_lists_helper_subtitle));
String color = ThemeService.getDialogTextColor();
String color = ThemeService.getDialogTextColorString();
String html = String.format("<html><body style='text-align:center;color:%s'>%s</body></html>",
color, body);

Loading…
Cancel
Save