add arrows to the day screen too

This commit is contained in:
tibbi 2016-07-05 15:34:56 +02:00
parent c9a86bb347
commit a49e883bbc
8 changed files with 84 additions and 66 deletions

View File

@ -94,9 +94,9 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calendar {
}
private void setupButtons() {
setupIntent(PREV, R.id.left_arrow);
setupIntent(NEXT, R.id.right_arrow);
setupAppOpenIntent(R.id.table_month);
setupIntent(PREV, R.id.top_left_arrow);
setupIntent(NEXT, R.id.top_right_arrow);
setupAppOpenIntent(R.id.top_text);
}
private SharedPreferences initPrefs(Context context) {
@ -152,17 +152,17 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calendar {
}
private void updateTopViews() {
mRemoteViews.setInt(R.id.table_month, "setTextColor", mTextColor);
mRemoteViews.setInt(R.id.top_text, "setTextColor", mTextColor);
Bitmap bmp = getColoredIcon(mContext, mTextColor, R.mipmap.arrow_left);
mRemoteViews.setImageViewBitmap(R.id.left_arrow, bmp);
mRemoteViews.setImageViewBitmap(R.id.top_left_arrow, bmp);
bmp = getColoredIcon(mContext, mTextColor, R.mipmap.arrow_right);
mRemoteViews.setImageViewBitmap(R.id.right_arrow, bmp);
mRemoteViews.setImageViewBitmap(R.id.top_right_arrow, bmp);
}
public void updateMonth(String month) {
mRemoteViews.setTextViewText(R.id.table_month, month);
mRemoteViews.setTextViewText(R.id.top_text, month);
}
@Override

View File

@ -3,6 +3,7 @@ package com.simplemobiletools.calendar.activities;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
@ -15,6 +16,7 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@ -23,6 +25,7 @@ import com.simplemobiletools.calendar.DBHelper;
import com.simplemobiletools.calendar.EventsAdapter;
import com.simplemobiletools.calendar.Formatter;
import com.simplemobiletools.calendar.R;
import com.simplemobiletools.calendar.Utils;
import com.simplemobiletools.calendar.models.Event;
import java.util.ArrayList;
@ -34,9 +37,11 @@ import butterknife.OnClick;
public class DayActivity extends AppCompatActivity
implements DBHelper.DBOperationsListener, AdapterView.OnItemClickListener, AbsListView.MultiChoiceModeListener {
@BindView(R.id.day_date) TextView mDateTV;
@BindView(R.id.top_text) TextView mDateTV;
@BindView(R.id.day_events) ListView mEventsList;
@BindView(R.id.day_coordinator) CoordinatorLayout mCoordinatorLayout;
@BindView(R.id.top_left_arrow) ImageView mLeftArrow;
@BindView(R.id.top_right_arrow) ImageView mRightArrow;
private static final int EDIT_EVENT = 1;
public static final String DELETED_ID = "deleted_id";
@ -64,6 +69,10 @@ public class DayActivity extends AppCompatActivity
final String date = Formatter.getEventDate(mDayCode);
mDateTV.setText(date);
mToBeDeleted = new ArrayList<>();
final int textColor = Utils.adjustAlpha(Color.BLACK, Constants.HIGH_ALPHA);
mLeftArrow.getDrawable().mutate().setColorFilter(textColor, PorterDuff.Mode.SRC_ATOP);
mRightArrow.getDrawable().mutate().setColorFilter(textColor, PorterDuff.Mode.SRC_ATOP);
}
@Override
@ -85,6 +94,16 @@ public class DayActivity extends AppCompatActivity
startActivity(intent);
}
@OnClick(R.id.top_left_arrow)
public void leftArrowClicked() {
}
@OnClick(R.id.top_right_arrow)
public void rightArrowClicked() {
}
private void editEvent(Event event) {
final Intent intent = new Intent(getApplicationContext(), EventActivity.class);
intent.putExtra(Constants.EVENT, event);

View File

@ -38,9 +38,9 @@ import butterknife.ButterKnife;
import butterknife.OnClick;
public class MainActivity extends AppCompatActivity implements Calendar {
@BindView(R.id.left_arrow) ImageView mLeftArrow;
@BindView(R.id.right_arrow) ImageView mRightArrow;
@BindView(R.id.table_month) TextView mMonthTV;
@BindView(R.id.top_left_arrow) ImageView mLeftArrow;
@BindView(R.id.top_right_arrow) ImageView mRightArrow;
@BindView(R.id.top_text) TextView mMonthTV;
@BindView(R.id.calendar_holder) View mCalendarHolder;
@BindDimen(R.dimen.day_text_size) float mDayTextSize;
@ -162,17 +162,17 @@ public class MainActivity extends AppCompatActivity implements Calendar {
startActivity(intent);
}
@OnClick(R.id.left_arrow)
@OnClick(R.id.top_left_arrow)
public void leftArrowClicked() {
mCalendar.getPrevMonth();
}
@OnClick(R.id.right_arrow)
@OnClick(R.id.top_right_arrow)
public void rightArrowClicked() {
mCalendar.getNextMonth();
}
@OnClick(R.id.table_month)
@OnClick(R.id.top_text)
public void pickMonth() {
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(this, R.style.MyAlertDialog);
final View view = getLayoutInflater().inflate(R.layout.date_picker, null);

View File

@ -34,9 +34,9 @@ import butterknife.OnClick;
import yuku.ambilwarna.AmbilWarnaDialog;
public class WidgetConfigureActivity extends AppCompatActivity implements Calendar {
@BindView(R.id.left_arrow) ImageView mLeftArrow;
@BindView(R.id.right_arrow) ImageView mRightArrow;
@BindView(R.id.table_month) TextView mMonthTV;
@BindView(R.id.top_left_arrow) ImageView mLeftArrow;
@BindView(R.id.top_right_arrow) ImageView mRightArrow;
@BindView(R.id.top_text) TextView mMonthTV;
@BindView(R.id.config_bg_color) View mBgColorPicker;
@BindView(R.id.config_bg_seekbar) SeekBar mBgSeekBar;
@BindView(R.id.config_text_color) View mTextColorPicker;
@ -227,12 +227,12 @@ public class WidgetConfigureActivity extends AppCompatActivity implements Calend
}
};
@OnClick(R.id.left_arrow)
@OnClick(R.id.top_left_arrow)
public void leftArrowClicked() {
mCalendar.getPrevMonth();
}
@OnClick(R.id.right_arrow)
@OnClick(R.id.top_right_arrow)
public void rightArrowClicked() {
mCalendar.getNextMonth();
}

View File

@ -4,28 +4,20 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/activity_margin">
android:padding="@dimen/activity_margin">
<RelativeLayout
android:id="@+id/day_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/day_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_margin"
android:gravity="center_horizontal"
android:paddingTop="@dimen/top_padding"
android:text="January 1 1970"
android:textSize="@dimen/month_text_size"/>
<include layout="@layout/top_navigation"/>
<ListView
android:id="@+id/day_events"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/day_date"
android:layout_below="@+id/top_text"
android:choiceMode="multipleChoiceModal"/>
</RelativeLayout>

View File

@ -5,44 +5,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/left_arrow"
style="@style/ArrowStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/table_month"
android:layout_alignTop="@+id/table_month"
android:padding="@dimen/activity_margin"
android:src="@mipmap/arrow_left"/>
<TextView
android:id="@+id/table_month"
style="@style/MonthStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/right_arrow"
android:layout_toRightOf="@+id/left_arrow"
android:gravity="center_horizontal"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/top_padding"
android:textSize="@dimen/month_text_size"/>
<ImageView
android:id="@+id/right_arrow"
style="@style/ArrowStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/table_month"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/table_month"
android:padding="@dimen/activity_margin"
android:src="@mipmap/arrow_right"/>
<include layout="@layout/top_navigation"/>
<LinearLayout
android:id="@+id/table_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/table_month"
android:layout_below="@+id/top_text"
android:gravity="center"
android:orientation="vertical">
@ -388,4 +357,4 @@
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>

View File

@ -6,8 +6,6 @@
android:layout_height="wrap_content"
android:background="@drawable/event_item_background"
android:paddingBottom="@dimen/event_padding"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/event_padding">
<TextView

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<merge
android:id="@+id/calendar_holder"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:id="@+id/top_left_arrow"
style="@style/ArrowStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/top_text"
android:layout_alignTop="@+id/top_text"
android:padding="@dimen/activity_margin"
android:src="@mipmap/arrow_left"/>
<TextView
android:id="@+id/top_text"
style="@style/MonthStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/top_right_arrow"
android:layout_toRightOf="@+id/top_left_arrow"
android:gravity="center_horizontal"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/top_padding"
android:text="January"
android:textSize="@dimen/month_text_size"/>
<ImageView
android:id="@+id/top_right_arrow"
style="@style/ArrowStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/top_text"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/top_text"
android:padding="@dimen/activity_margin"
android:src="@mipmap/arrow_right"/>
</merge>