Popup for tag settings activity

pull/14/head
Sam Bosley 13 years ago
parent 7d06f46fc4
commit b281f48aef

@ -26,6 +26,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
@ -736,4 +737,14 @@ public class AndroidUtilities {
} }
} }
/**
* Returns true if the screen is large or xtra large
* @param context
* @return
*/
public static boolean isTabletSized(Context context) {
int screenSize = context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
return (screenSize >= Configuration.SCREENLAYOUT_SIZE_LARGE);
}
} }

@ -325,7 +325,8 @@
<activity android:name="com.todoroo.astrid.actfm.TagCreateActivity" <activity android:name="com.todoroo.astrid.actfm.TagCreateActivity"
android:theme="@android:style/Theme.Dialog"/> android:theme="@android:style/Theme.Dialog"/>
<activity android:name="com.todoroo.astrid.actfm.TagSettingsActivity" <activity android:name="com.todoroo.astrid.actfm.TagSettingsActivity"
android:windowSoftInputMode="stateHidden"/> android:windowSoftInputMode="stateHidden"
android:theme="@style/Theme_Dialog"/>
<activity android:name="com.todoroo.astrid.actfm.TagUpdatesActivity" <activity android:name="com.todoroo.astrid.actfm.TagUpdatesActivity"
android:windowSoftInputMode="stateHidden"/> android:windowSoftInputMode="stateHidden"/>
<!-- <receiver android:name="com.todoroo.astrid.actfm.EditPeopleExposer"> <!-- <receiver android:name="com.todoroo.astrid.actfm.EditPeopleExposer">

@ -116,7 +116,7 @@ public class EditPeopleControlSet extends PopupControlSet {
sharedWithRow = LayoutInflater.from(activity).inflate(R.layout.control_set_collaborators_display, null); sharedWithRow = LayoutInflater.from(activity).inflate(R.layout.control_set_collaborators_display, null);
sharedWithView = LayoutInflater.from(activity).inflate(R.layout.control_set_collaborators, null); sharedWithView = LayoutInflater.from(activity).inflate(R.layout.control_set_collaborators, null);
sharedWithDialog = new Dialog(activity, ThemeService.getDialogTheme()); sharedWithDialog = new Dialog(activity, ThemeService.getEditDialogTheme());
sharedWithDialog.setTitle(R.string.actfm_EPA_collaborators_header); sharedWithDialog.setTitle(R.string.actfm_EPA_collaborators_header);
View v = getSharedWithView(); View v = getSharedWithView();
DisplayMetrics metrics = new DisplayMetrics(); DisplayMetrics metrics = new DisplayMetrics();

@ -73,7 +73,8 @@ public class TagSettingsActivity extends FragmentActivity {
private CheckBox isSilent; private CheckBox isSilent;
private Bitmap setBitmap; private Bitmap setBitmap;
boolean isNewTag = false; private boolean isNewTag = false;
private boolean isDialog;
public TagSettingsActivity() { public TagSettingsActivity() {
DependencyInjectionService.getInstance().inject(this); DependencyInjectionService.getInstance().inject(this);
@ -81,7 +82,7 @@ public class TagSettingsActivity extends FragmentActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
ThemeService.applyTheme(this); setupForDialogOrFullscreen();
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.tag_settings_activity); setContentView(R.layout.tag_settings_activity);
tagData = getIntent().getParcelableExtra(TagViewActivity.EXTRA_TAG_DATA); tagData = getIntent().getParcelableExtra(TagViewActivity.EXTRA_TAG_DATA);
@ -91,9 +92,11 @@ public class TagSettingsActivity extends FragmentActivity {
} }
ActionBar actionBar = getSupportActionBar(); ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.setCustomView(R.layout.header_title_view); actionBar.setCustomView(R.layout.header_title_view);
}
setUpSettingsPage(); setUpSettingsPage();
@ -116,6 +119,14 @@ public class TagSettingsActivity extends FragmentActivity {
} }
private void setupForDialogOrFullscreen() {
isDialog = AndroidUtilities.isTabletSized(this);
if (isDialog)
setTheme(ThemeService.getDialogTheme());
else
ThemeService.applyTheme(this);
}
private void showCollaboratorsPopover() { private void showCollaboratorsPopover() {
if (!Preferences.getBoolean(R.string.p_showed_collaborators_help, false)) { if (!Preferences.getBoolean(R.string.p_showed_collaborators_help, false)) {
View members = findViewById(R.id.members_container); View members = findViewById(R.id.members_container);
@ -125,6 +136,22 @@ public class TagSettingsActivity extends FragmentActivity {
} }
protected void setUpSettingsPage() { protected void setUpSettingsPage() {
if (isDialog) {
findViewById(R.id.save_and_cancel).setVisibility(View.VISIBLE);
findViewById(R.id.cancel).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
findViewById(R.id.save).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
saveSettings();
}
});
}
tagMembers = (PeopleContainer) findViewById(R.id.members_container); tagMembers = (PeopleContainer) findViewById(R.id.members_container);
tagName = (EditText) findViewById(R.id.tag_name); tagName = (EditText) findViewById(R.id.tag_name);
tagDescription = (EditText) findViewById(R.id.tag_description); tagDescription = (EditText) findViewById(R.id.tag_description);
@ -245,15 +272,13 @@ public class TagSettingsActivity extends FragmentActivity {
@Override @Override
public void finish() { public void finish() {
finishWithAnimation(true); finishWithAnimation(!isDialog);
} }
private void finishWithAnimation(boolean backAnimation) { private void finishWithAnimation(boolean backAnimation) {
super.finish(); super.finish();
if (backAnimation) { if (backAnimation) {
AndroidUtilities.callOverridePendingTransition(this, R.anim.slide_right_in, R.anim.slide_right_out); AndroidUtilities.callOverridePendingTransition(this, R.anim.slide_right_in, R.anim.slide_right_out);
} else {
AndroidUtilities.callOverridePendingTransition(this, R.anim.slide_left_in, R.anim.slide_left_out);
} }
} }
@ -261,15 +286,22 @@ public class TagSettingsActivity extends FragmentActivity {
private void refreshSettingsPage() { private void refreshSettingsPage() {
tagName.setText(tagData.getValue(TagData.NAME)); tagName.setText(tagData.getValue(TagData.NAME));
ActionBar ab = getSupportActionBar(); ActionBar ab = getSupportActionBar();
if (ab != null) {
View customView = ab.getCustomView(); View customView = ab.getCustomView();
TextView titleView = (TextView) customView.findViewById(R.id.title); TextView titleView = (TextView) customView.findViewById(R.id.title);
if (isNewTag) { if (isNewTag) {
titleView.setText(getString(R.string.tag_new_list)); titleView.setText(getString(R.string.tag_new_list));
} else { } else {
titleView.setText(this.getString(R.string.tag_settings_title, tagData.getValue(TagData.NAME))); titleView.setText(getString(R.string.tag_settings_title, tagData.getValue(TagData.NAME)));
}
} else {
if (isNewTag) {
setTitle(getString(R.string.tag_new_list));
} else {
setTitle(getString(R.string.tag_settings_title, tagData.getValue(TagData.NAME)));
}
} }
picture.setUrl(tagData.getValue(TagData.PICTURE)); picture.setUrl(tagData.getValue(TagData.PICTURE));
setTitle(tagData.getValue(TagData.NAME));
TextView ownerLabel = (TextView) findViewById(R.id.tag_owner); TextView ownerLabel = (TextView) findViewById(R.id.tag_owner);
try { try {

@ -34,7 +34,6 @@ import com.todoroo.andlib.service.NotificationManager;
import com.todoroo.andlib.service.NotificationManager.AndroidNotificationManager; import com.todoroo.andlib.service.NotificationManager.AndroidNotificationManager;
import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
@ -138,7 +137,6 @@ public class TagViewActivity extends TaskListActivity {
Intent intent = new Intent(getActivity(), TagSettingsActivity.class); Intent intent = new Intent(getActivity(), TagSettingsActivity.class);
intent.putExtra(EXTRA_TAG_DATA, tagData); intent.putExtra(EXTRA_TAG_DATA, tagData);
startActivityForResult(intent, REQUEST_CODE_SETTINGS); startActivityForResult(intent, REQUEST_CODE_SETTINGS);
AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_left_in, R.anim.slide_left_out);
} }
}; };

@ -9,6 +9,7 @@
android:layout_height="fill_parent" android:layout_height="fill_parent"
style="@style/Content"> style="@style/Content">
<ScrollView <ScrollView
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -33,6 +34,31 @@
android:layout_marginTop="10dip" android:layout_marginTop="10dip"
style="@style/TextAppearance.GEN_EditLabel" style="@style/TextAppearance.GEN_EditLabel"
android:text="@string/actfm_TVA_tag_label" /> android:text="@string/actfm_TVA_tag_label" />
<LinearLayout
android:id="@+id/save_and_cancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/tag_label"
android:layout_alignParentRight="true"
android:orientation="horizontal"
android:gravity="right"
android:visibility="gone">
<ImageButton
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dip"
android:background="@android:color/transparent"
android:src="@android:drawable/ic_menu_close_clear_cancel"/>
<ImageButton
android:id="@+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dip"
android:background="@android:color/transparent"
android:src="@android:drawable/ic_menu_save"/>
</LinearLayout>
<EditText <EditText
android:id="@+id/tag_name" android:id="@+id/tag_name"

@ -111,6 +111,23 @@
<item name="android:colorBackgroundCacheHint">@null</item> <item name="android:colorBackgroundCacheHint">@null</item>
</style> </style>
<style name="Theme_Dialog.White">
<item name="asContentBackground">@drawable/background_white</item>
<item name="asHeaderBackground">@drawable/header_background_white</item>
<item name="asHeaderButtonBackground">@drawable/header_button_white</item>
<item name="asTextColor">#ff000000</item>
<item name="asDetailsColor">#ff6666aa</item>
<item name="asDueDateColor">#878787</item>
<item name="asFilterHeaderColor">#ffffff</item>
<item name="asFilterHeaderBackground">@drawable/edit_titlebar_white</item>
<item name="asMembersHeaderBackground">@drawable/ios_fabric_480</item>
<!-- actionbar-styling -->
<item name="abBackground">@android:color/white</item>
<item name="abDisplayOptions">useLogo|showHome|showTitle</item>
<item name="abLogo">@drawable/icon_48</item>
<item name="asAbTextColor">@color/red_text_color</item>
</style>
<!--================================================== General == --> <!--================================================== General == -->
<style name="Content"> <style name="Content">

@ -176,6 +176,7 @@ public class FilterListActivity extends ListFragment {
public void onClick(View v) { public void onClick(View v) {
Intent intent = TagsPlugin.newTagDialog(getActivity()); Intent intent = TagsPlugin.newTagDialog(getActivity());
getActivity().startActivityForResult(intent, REQUEST_NEW_LIST); getActivity().startActivityForResult(intent, REQUEST_NEW_LIST);
if (!AndroidUtilities.isTabletSized(getActivity()))
AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_left_in, R.anim.slide_left_out); AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_left_in, R.anim.slide_left_out);
} }
}); });

@ -478,7 +478,7 @@ public final class TaskEditActivity extends Fragment {
} }
private void constructWhenDialog(View whenDialogView) { private void constructWhenDialog(View whenDialogView) {
int theme = ThemeService.getDialogTheme(); int theme = ThemeService.getEditDialogTheme();
whenDialog = new Dialog(getActivity(), theme); whenDialog = new Dialog(getActivity(), theme);
Button dismissDialogButton = (Button) whenDialogView.findViewById(R.id.when_dismiss); Button dismissDialogButton = (Button) whenDialogView.findViewById(R.id.when_dismiss);

@ -29,7 +29,7 @@ public class ThemeService {
return R.style.Theme_White; return R.style.Theme_White;
} }
public static int getDialogTheme() { public static int getEditDialogTheme() {
int themeSetting = ThemeService.getTheme(); int themeSetting = ThemeService.getTheme();
int theme; int theme;
if (themeSetting == R.style.Theme || themeSetting == R.style.Theme_Transparent) { if (themeSetting == R.style.Theme || themeSetting == R.style.Theme_Transparent) {
@ -40,4 +40,14 @@ public class ThemeService {
return theme; return theme;
} }
public static int getDialogTheme() {
int themeSetting = ThemeService.getTheme();
int theme;
if (themeSetting == R.style.Theme || themeSetting == R.style.Theme_Transparent) {
theme = R.style.Theme_Dialog;
} else {
theme = R.style.Theme_Dialog_White;
}
return theme;
}
} }

@ -26,7 +26,7 @@ public class DateAndTimeDialog extends Dialog {
private DateAndTimeDialogListener listener; private DateAndTimeDialogListener listener;
public DateAndTimeDialog(Context context, long startDate) { public DateAndTimeDialog(Context context, long startDate) {
super(context, ThemeService.getDialogTheme()); super(context, ThemeService.getEditDialogTheme());
/** 'Window.FEATURE_NO_TITLE' - Used to hide the title */ /** 'Window.FEATURE_NO_TITLE' - Used to hide the title */
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);

@ -62,7 +62,7 @@ public abstract class PopupControlSet extends TaskEditControlSet {
} }
protected Dialog buildDialog(int title, final DialogInterface.OnClickListener okListener, DialogInterface.OnCancelListener cancelListener) { protected Dialog buildDialog(int title, final DialogInterface.OnClickListener okListener, DialogInterface.OnCancelListener cancelListener) {
int theme = ThemeService.getDialogTheme(); int theme = ThemeService.getEditDialogTheme();
final Dialog d = new Dialog(activity, theme); final Dialog d = new Dialog(activity, theme);
if (title == 0) if (title == 0)
d.requestWindowFeature(Window.FEATURE_NO_TITLE); d.requestWindowFeature(Window.FEATURE_NO_TITLE);

Loading…
Cancel
Save