- Update Gradle.

- Fix Search view.
- Change the application colors.
- Change the application's icon.
This commit is contained in:
Suhail Alkowaileet 2015-08-23 18:13:38 +03:00
parent 3d6e20c208
commit b8fa6bdb0f
24 changed files with 118 additions and 170 deletions

View File

@ -45,7 +45,7 @@
<application android:name="com.android.calendar.CalendarApplication"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher_calendar"
android:icon="@mipmap/ic_launcher"
android:label="@string/standalone_app_label"
android:taskAffinity="org.sufficientlysecure.standalonecalendar.task"
android:theme="@style/CalendarAppTheme">
@ -168,7 +168,7 @@
android:exported="true"
android:label="@string/search_title"
android:launchMode="singleTop"
android:theme="@style/CalendarTheme.WithoutActionBar"
android:theme="@style/CalendarTheme.WithActionBar"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.SEARCH"/>

View File

@ -4,7 +4,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.+'
classpath 'com.android.tools.build:gradle:1.3.0'
}
}

BIN
ic_launcher-web.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/search_results"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

View File

@ -30,11 +30,11 @@
app:showAsAction="never" />
<item
android:id="@+id/action_search"
android:actionViewClass="android.widget.SearchView"
android:alphabeticShortcut="f"
android:icon="@drawable/ic_menu_search"
android:imeOptions="actionSearch"
android:title="@string/search"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="never|collapseActionView" />
<item
android:id="@+id/action_hide_controls"

View File

@ -29,11 +29,11 @@
android:title="@string/calendar_refresh" />
<item
android:id="@+id/action_search"
android:actionViewClass="android.widget.SearchView"
android:alphabeticShortcut="f"
android:icon="@drawable/ic_menu_search"
android:imeOptions="actionSearch"
android:title="@string/search"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="collapseActionView" />
<item
android:id="@+id/action_hide_controls"

View File

@ -29,11 +29,11 @@
android:title="@string/calendar_refresh" />
<item
android:id="@+id/action_search"
android:actionViewClass="android.widget.SearchView"
android:alphabeticShortcut="f"
android:icon="@drawable/ic_menu_search"
android:imeOptions="actionSearch"
android:title="@string/search"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="collapseActionView" />
<item
android:id="@+id/action_hide_controls"

View File

@ -38,6 +38,6 @@
android:imeOptions="actionSearch"
android:orderInCategory="4"
android:title="@string/search"
app:actionViewClass="android.widget.SearchView"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="never|collapseActionView" />
</menu>

View File

@ -17,11 +17,11 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/action_search"
android:actionViewClass="android.widget.SearchView"
android:alphabeticShortcut="f"
android:icon="@drawable/ic_menu_search"
android:imeOptions="actionSearch"
android:title="@string/search"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="always|collapseActionView" />
<item
android:id="@+id/action_today"

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -19,8 +19,8 @@
-->
<resources>
<color name="colorPrimary">#9c27b0</color>
<color name="colorPrimaryDark">#7b1fa2</color>
<color name="colorPrimary">#41c3b1</color>
<color name="colorPrimaryDark">#388d7f</color>
<color name="colorAccent">#ff1744</color>
<color name="titleTextColor">@android:color/white</color>

View File

@ -13,8 +13,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="standalone_app_label">Standalone Calendar</string>
<resources>
<string name="standalone_app_label">Etar</string>
</resources>

View File

@ -48,8 +48,10 @@ import android.provider.CalendarContract.Calendars;
import android.provider.CalendarContract.Events;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.text.format.DateFormat;
@ -64,8 +66,6 @@ import android.view.accessibility.AccessibilityEvent;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.SearchView;
import android.widget.SearchView.OnSuggestionListener;
import android.widget.TextView;
import com.android.calendar.CalendarController.EventHandler;
@ -89,7 +89,7 @@ import static android.provider.CalendarContract.EXTRA_EVENT_BEGIN_TIME;
import static android.provider.CalendarContract.EXTRA_EVENT_END_TIME;
public class AllInOneActivity extends AbstractCalendarActivity implements EventHandler,
OnSharedPreferenceChangeListener, SearchView.OnQueryTextListener, OnSuggestionListener, NavigationView.OnNavigationItemSelectedListener {
OnSharedPreferenceChangeListener, SearchView.OnQueryTextListener, SearchView.OnSuggestionListener, NavigationView.OnNavigationItemSelectedListener {
private static final String TAG = "AllInOneActivity";
private static final boolean DEBUG = false;
private static final String EVENT_INFO_FRAGMENT_TAG = "EventInfoFragment";
@ -709,7 +709,7 @@ public class AllInOneActivity extends AbstractCalendarActivity implements EventH
}
mSearchMenu = menu.findItem(R.id.action_search);
mSearchView = (SearchView) mSearchMenu.getActionView();
mSearchView = (SearchView) MenuItemCompat.getActionView(mSearchMenu);
if (mSearchView != null) {
Utils.setUpSearchView(mSearchView, this);
mSearchView.setOnQueryTextListener(this);

View File

@ -15,13 +15,7 @@
*/
package com.android.calendar;
import org.sufficientlysecure.standalonecalendar.R;
import static android.provider.CalendarContract.EXTRA_EVENT_BEGIN_TIME;
import static android.provider.CalendarContract.EXTRA_EVENT_END_TIME;
import android.app.ActionBar;
import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.app.SearchManager;
@ -36,52 +30,38 @@ import android.os.Bundle;
import android.os.Handler;
import android.provider.CalendarContract.Events;
import android.provider.SearchRecentSuggestions;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.text.format.Time;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem.OnActionExpandListener;
import android.widget.SearchView;
import com.android.calendar.CalendarController.EventInfo;
import com.android.calendar.CalendarController.EventType;
import com.android.calendar.CalendarController.ViewType;
import com.android.calendar.agenda.AgendaFragment;
public class SearchActivity extends Activity implements CalendarController.EventHandler,
SearchView.OnQueryTextListener, OnActionExpandListener {
import org.sufficientlysecure.standalonecalendar.R;
private static final String TAG = SearchActivity.class.getSimpleName();
import static android.provider.CalendarContract.EXTRA_EVENT_BEGIN_TIME;
import static android.provider.CalendarContract.EXTRA_EVENT_END_TIME;
private static final boolean DEBUG = false;
public class SearchActivity extends AppCompatActivity implements CalendarController.EventHandler,
SearchView.OnQueryTextListener, MenuItemCompat.OnActionExpandListener {
private static final int HANDLER_KEY = 0;
protected static final String BUNDLE_KEY_RESTORE_TIME = "key_restore_time";
protected static final String BUNDLE_KEY_RESTORE_SEARCH_QUERY =
"key_restore_search_query";
// display event details to the side of the event list
private boolean mShowEventDetailsWithAgenda;
private static final String TAG = SearchActivity.class.getSimpleName();
private static final boolean DEBUG = false;
private static final int HANDLER_KEY = 0;
private static boolean mIsMultipane;
// display event details to the side of the event list
private boolean mShowEventDetailsWithAgenda;
private CalendarController mController;
private EventInfoFragment mEventInfoFragment;
private long mCurrentEventId = -1;
private String mQuery;
private SearchView mSearchView;
private DeleteEventHelper mDeleteEventHelper;
private Handler mHandler;
private BroadcastReceiver mTimeChangesReceiver;
private ContentResolver mContentResolver;
private final ContentObserver mObserver = new ContentObserver(new Handler()) {
@Override
public boolean deliverSelfNotifications() {
@ -93,7 +73,12 @@ public class SearchActivity extends Activity implements CalendarController.Event
eventsChanged();
}
};
private EventInfoFragment mEventInfoFragment;
private long mCurrentEventId = -1;
private String mQuery;
private SearchView mSearchView;
private DeleteEventHelper mDeleteEventHelper;
private Handler mHandler;
// runs when a timezone was changed and updates the today icon
private final Runnable mTimeChangesUpdater = new Runnable() {
@Override
@ -103,6 +88,8 @@ public class SearchActivity extends Activity implements CalendarController.Event
SearchActivity.this.invalidateOptionsMenu();
}
};
private BroadcastReceiver mTimeChangesReceiver;
private ContentResolver mContentResolver;
@Override
protected void onCreate(Bundle icicle) {
@ -122,10 +109,10 @@ public class SearchActivity extends Activity implements CalendarController.Event
mContentResolver = getContentResolver();
if (mIsMultipane) {
getActionBar().setDisplayOptions(
getSupportActionBar().setDisplayOptions(
ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
} else {
getActionBar().setDisplayOptions(0,
getSupportActionBar().setDisplayOptions(0,
ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME);
}
@ -264,9 +251,10 @@ public class SearchActivity extends Activity implements CalendarController.Event
}
MenuItem item = menu.findItem(R.id.action_search);
item.expandActionView();
item.setOnActionExpandListener(this);
mSearchView = (SearchView) item.getActionView();
MenuItemCompat.expandActionView(item);
MenuItemCompat.setOnActionExpandListener(item, this);
mSearchView = (SearchView) MenuItemCompat.getActionView(item);
Utils.setUpSearchView(mSearchView, this);
mSearchView.setQuery(mQuery, false);
mSearchView.clearFocus();

View File

@ -16,10 +16,6 @@
package com.android.calendar;
import org.sufficientlysecure.standalonecalendar.R;
import static android.provider.CalendarContract.EXTRA_EVENT_BEGIN_TIME;
import android.accounts.Account;
import android.app.Activity;
import android.app.SearchManager;
@ -41,6 +37,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.provider.CalendarContract.Calendars;
import android.support.v7.widget.SearchView;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
@ -51,12 +48,13 @@ import android.text.format.Time;
import android.text.style.URLSpan;
import android.text.util.Linkify;
import android.util.Log;
import android.widget.SearchView;
import com.android.calendar.CalendarController.ViewType;
import com.android.calendar.CalendarEventModel.ReminderEntry;
import com.android.calendar.CalendarUtils.TimeZoneUtils;
import org.sufficientlysecure.standalonecalendar.R;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@ -73,19 +71,16 @@ import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Utils {
private static final boolean DEBUG = false;
private static final String TAG = "CalUtils";
import static android.provider.CalendarContract.EXTRA_EVENT_BEGIN_TIME;
public class Utils {
// Set to 0 until we have UI to perform undo
public static final long UNDO_DELAY = 0;
// For recurring events which instances of the series are being modified
public static final int MODIFY_UNINITIALIZED = 0;
public static final int MODIFY_SELECTED = 1;
public static final int MODIFY_ALL_FOLLOWING = 2;
public static final int MODIFY_ALL = 3;
// When the edit event view finishes it passes back the appropriate exit
// code.
public static final int DONE_REVERT = 1 << 0;
@ -94,57 +89,35 @@ public class Utils {
// And should re run with DONE_EXIT if it should also leave the view, just
// exiting is identical to reverting
public static final int DONE_EXIT = 1 << 0;
public static final String OPEN_EMAIL_MARKER = " <";
public static final String CLOSE_EMAIL_MARKER = ">";
public static final String INTENT_KEY_DETAIL_VIEW = "DETAIL_VIEW";
public static final String INTENT_KEY_VIEW_TYPE = "VIEW";
public static final String INTENT_VALUE_VIEW_TYPE_DAY = "DAY";
public static final String INTENT_KEY_HOME = "KEY_HOME";
public static final int MONDAY_BEFORE_JULIAN_EPOCH = Time.EPOCH_JULIAN_DAY - 3;
public static final int DECLINED_EVENT_ALPHA = 0x66;
public static final int DECLINED_EVENT_TEXT_ALPHA = 0xC0;
private static final float SATURATION_ADJUST = 1.3f;
private static final float INTENSITY_ADJUST = 0.8f;
public static final int YEAR_MIN = 1970;
public static final int YEAR_MAX = 2036;
public static final String KEY_QUICK_RESPONSES = "preferences_quick_responses";
public static final String KEY_ALERTS_VIBRATE_WHEN = "preferences_alerts_vibrateWhen";
public static final String APPWIDGET_DATA_TYPE = "vnd.android.data/update";
// Defines used by the DNA generation code
static final int DAY_IN_MINUTES = 60 * 24;
static final int WEEK_IN_MINUTES = DAY_IN_MINUTES * 7;
// The work day is being counted as 6am to 8pm
static int WORK_DAY_MINUTES = 14 * 60;
static int WORK_DAY_START_MINUTES = 6 * 60;
static int WORK_DAY_END_MINUTES = 20 * 60;
static int WORK_DAY_END_LENGTH = (24 * 60) - WORK_DAY_END_MINUTES;
static int CONFLICT_COLOR = 0xFF000000;
static boolean mMinutesLoaded = false;
public static final int YEAR_MIN = 1970;
public static final int YEAR_MAX = 2036;
// The name of the shared preferences file. This name must be maintained for
// historical
// reasons, as it's what PreferenceManager assigned the first time the file
// was created.
static final String SHARED_PREFS_NAME = "com.android.calendar_preferences";
public static final String KEY_QUICK_RESPONSES = "preferences_quick_responses";
public static final String KEY_ALERTS_VIBRATE_WHEN = "preferences_alerts_vibrateWhen";
public static final String APPWIDGET_DATA_TYPE = "vnd.android.data/update";
static final String MACHINE_GENERATED_ADDRESS = "calendar.google.com";
private static final boolean DEBUG = false;
private static final String TAG = "CalUtils";
private static final float SATURATION_ADJUST = 1.3f;
private static final float INTENSITY_ADJUST = 0.8f;
private static final TimeZoneUtils mTZUtils = new TimeZoneUtils(SHARED_PREFS_NAME);
private static boolean mAllowWeekForDetailView = false;
private static long mTardis = 0;
private static String sVersion = null;
private static final Pattern mWildcardPattern = Pattern.compile("^.*$");
/**
* A coordinate must be of the following form for Google Maps to correctly use it:
* Latitude, Longitude
@ -196,11 +169,23 @@ public class Utils {
+ COORD_DECIMAL_LONGITUDE;
private static final Pattern COORD_PATTERN =
Pattern.compile(COORD_DEGREES_PATTERN + "|" + COORD_DECIMAL_PATTERN);
private static final String NANP_ALLOWED_SYMBOLS = "()+-*#.";
private static final int NANP_MIN_DIGITS = 7;
private static final int NANP_MAX_DIGITS = 11;
// Using int constants as a return value instead of an enum to minimize resources.
private static final int TODAY = 1;
private static final int TOMORROW = 2;
private static final int NONE = 0;
// The work day is being counted as 6am to 8pm
static int WORK_DAY_MINUTES = 14 * 60;
static int WORK_DAY_START_MINUTES = 6 * 60;
static int WORK_DAY_END_MINUTES = 20 * 60;
static int WORK_DAY_END_LENGTH = (24 * 60) - WORK_DAY_END_MINUTES;
static int CONFLICT_COLOR = 0xFF000000;
static boolean mMinutesLoaded = false;
private static boolean mAllowWeekForDetailView = false;
private static long mTardis = 0;
private static String sVersion = null;
/**
* Returns whether the SDK is the Jellybean release or later.
@ -816,14 +801,14 @@ public class Utils {
return o1 == null ? o2 == null : o1.equals(o2);
}
public static void setAllowWeekForDetailView(boolean allowWeekView) {
mAllowWeekForDetailView = allowWeekView;
}
public static boolean getAllowWeekForDetailView() {
return mAllowWeekForDetailView;
}
public static void setAllowWeekForDetailView(boolean allowWeekView) {
mAllowWeekForDetailView = allowWeekView;
}
public static boolean getConfigBool(Context c, int key) {
return c.getResources().getBoolean(key);
}
@ -858,27 +843,6 @@ public class Utils {
return (0xff000000) | ((r | g | b) >> 8);
}
// A single strand represents one color of events. Events are divided up by
// color to make them convenient to draw. The black strand is special in
// that it holds conflicting events as well as color settings for allday on
// each day.
public static class DNAStrand {
public float[] points;
public int[] allDays; // color for the allday, 0 means no event
int position;
public int color;
int count;
}
// A segment is a single continuous length of time occupied by a single
// color. Segments should never span multiple days.
private static class DNASegment {
int startMinute; // in minutes since the start of the week
int endMinute;
int color; // Calendar color or black for conflicts
int day; // quick reference to the day this segment is on
}
/**
* Converts a list of events to a list of segments to draw. Assumes list is
* ordered by start time of the events. The function processes events for a
@ -1494,11 +1458,6 @@ public class Utils {
return startDay == endDay;
}
// Using int constants as a return value instead of an enum to minimize resources.
private static final int TODAY = 1;
private static final int TOMORROW = 2;
private static final int NONE = 0;
/**
* Returns TODAY or TOMORROW if applicable. Otherwise returns NONE.
*/
@ -1650,27 +1609,6 @@ public class Utils {
icon.setDrawableByLayerId(R.id.today_icon_day, today);
}
private static class CalendarBroadcastReceiver extends BroadcastReceiver {
Runnable mCallBack;
public CalendarBroadcastReceiver(Runnable callback) {
super();
mCallBack = callback;
}
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_DATE_CHANGED) ||
intent.getAction().equals(Intent.ACTION_TIME_CHANGED) ||
intent.getAction().equals(Intent.ACTION_LOCALE_CHANGED) ||
intent.getAction().equals(Intent.ACTION_TIMEZONE_CHANGED)) {
if (mCallBack != null) {
mCallBack.run();
}
}
}
}
public static BroadcastReceiver setTimeChangesReceiver(Context c, Runnable callback) {
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_TIME_CHANGED);
@ -2110,4 +2048,47 @@ public class Utils {
return reminders;
}
// A single strand represents one color of events. Events are divided up by
// color to make them convenient to draw. The black strand is special in
// that it holds conflicting events as well as color settings for allday on
// each day.
public static class DNAStrand {
public float[] points;
public int[] allDays; // color for the allday, 0 means no event
public int color;
int position;
int count;
}
// A segment is a single continuous length of time occupied by a single
// color. Segments should never span multiple days.
private static class DNASegment {
int startMinute; // in minutes since the start of the week
int endMinute;
int color; // Calendar color or black for conflicts
int day; // quick reference to the day this segment is on
}
private static class CalendarBroadcastReceiver extends BroadcastReceiver {
Runnable mCallBack;
public CalendarBroadcastReceiver(Runnable callback) {
super();
mCallBack = callback;
}
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_DATE_CHANGED) ||
intent.getAction().equals(Intent.ACTION_TIME_CHANGED) ||
intent.getAction().equals(Intent.ACTION_LOCALE_CHANGED) ||
intent.getAction().equals(Intent.ACTION_TIMEZONE_CHANGED)) {
if (mCallBack != null) {
mCallBack.run();
}
}
}
}
}