use of android.annotation.SuppressLint in project MaterialDateTimePicker by wdullaer.
the class MonthAdapter method getView.
@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MonthView v;
HashMap<String, Integer> drawingParams = null;
if (convertView != null) {
v = (MonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
drawingParams = (HashMap<String, Integer>) v.getTag();
} else {
v = createMonthView(mContext);
// Set up the new view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(params);
v.setClickable(true);
v.setOnDayClickListener(this);
}
if (drawingParams == null) {
drawingParams = new HashMap<>();
}
drawingParams.clear();
final int month = (position + mController.getStartDate().get(Calendar.MONTH)) % MONTHS_IN_YEAR;
final int year = (position + mController.getStartDate().get(Calendar.MONTH)) / MONTHS_IN_YEAR + mController.getMinYear();
int selectedDay = -1;
if (isSelectedDayInMonth(year, month)) {
selectedDay = mSelectedDay.day;
}
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
v.reuse();
drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
v.setMonthParams(drawingParams);
v.invalidate();
return v;
}
use of android.annotation.SuppressLint in project SublimePicker by vikramkakkar.
the class SublimeDatePicker method onRestoreInstanceState.
@SuppressLint("NewApi")
@Override
public void onRestoreInstanceState(Parcelable state) {
BaseSavedState bss = (BaseSavedState) state;
super.onRestoreInstanceState(bss.getSuperState());
SavedState ss = (SavedState) bss;
Calendar startDate = Calendar.getInstance(mCurrentLocale);
Calendar endDate = Calendar.getInstance(mCurrentLocale);
startDate.set(ss.getSelectedYearStart(), ss.getSelectedMonthStart(), ss.getSelectedDayStart());
endDate.set(ss.getSelectedYearEnd(), ss.getSelectedMonthEnd(), ss.getSelectedDayEnd());
mCurrentDate.setFirstDate(startDate);
mCurrentDate.setSecondDate(endDate);
int currentView = ss.getCurrentView();
mMinDate.setTimeInMillis(ss.getMinDate());
mMaxDate.setTimeInMillis(ss.getMaxDate());
mCurrentlyActivatedRangeItem = ss.getCurrentlyActivatedRangeItem();
onCurrentDateChanged(false);
setCurrentView(currentView);
final int listPosition = ss.getListPosition();
if (listPosition != -1) {
if (currentView == VIEW_MONTH_DAY) {
mDayPickerView.setPosition(listPosition);
} else if (currentView == VIEW_YEAR) {
final int listPositionOffset = ss.getListPositionOffset();
mYearPickerView.setSelectionFromTop(listPosition, listPositionOffset);
}
}
}
use of android.annotation.SuppressLint in project android by JetBrains.
the class MyActivity method testSuppressed.
@SuppressLint("NewApi")
public void testSuppressed() {
ActionBar actionBar = getActionBar();
GridLayout gridLayout = new GridLayout(null);
int x = View.DRAWING_CACHE_QUALITY_AUTO;
int y = View.MEASURED_HEIGHT_STATE_SHIFT;
int alignmentMode = gridLayout.getAlignmentMode();
gridLayout.setRowOrderPreserved(true);
}
use of android.annotation.SuppressLint in project wire-android by wireapp.
the class FileUploadTest method assertFileUploadIntentInOneToOneConversation.
@Test
@SuppressLint("NewApi")
public void assertFileUploadIntentInOneToOneConversation() throws InterruptedException {
// Mock conversation
IConversation mockConversation = mock(IConversation.class);
when(mockConversation.getType()).thenReturn(IConversation.Type.ONE_TO_ONE);
when(mockConversation.isMemberOfConversation()).thenReturn(true);
when(mockConversation.isActive()).thenReturn(true);
MockHelper.setupConversationMocks(mockConversation, activity);
IConversationStore mockConversationStore = activity.getStoreFactory().getConversationStore();
// Mock intent result
String action;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
action = Intent.ACTION_OPEN_DOCUMENT;
} else {
action = Intent.ACTION_GET_CONTENT;
}
Matcher<Intent> expectedIntent = allOf(hasAction(action), hasType("*/*"));
Intent intent = new Intent();
intent.setData(Uri.parse("file:///tmp/whatever.txt"));
Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, intent);
intending(expectedIntent).respondWith(result);
// attach fragment
attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
// verify stuff
Thread.sleep(500);
onView(withId(R.id.cursor_menu_item_more)).perform(click());
Thread.sleep(500);
onView(withId(R.id.cursor_menu_item_file)).perform(click());
Thread.sleep(200);
verify(mockConversationStore).sendMessage(any(AssetForUpload.class), any(MessageContent.Asset.ErrorHandler.class));
}
use of android.annotation.SuppressLint in project wire-android by wireapp.
the class FileUploadTest method assertFileTooBigWarningShowed.
@Test
@SuppressLint("NewApi")
public void assertFileTooBigWarningShowed() throws InterruptedException {
final ErrorsList.ErrorDescription mockErrorDescription = mock(ErrorsList.ErrorDescription.class);
when(mockErrorDescription.getType()).thenReturn(ErrorType.CANNOT_SEND_ASSET_TOO_LARGE);
IInAppNotificationStore mockInAppNotificationStore = activity.getStoreFactory().getInAppNotificationStore();
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
InAppNotificationStoreObserver u = (InAppNotificationStoreObserver) args[0];
u.onSyncError(mockErrorDescription);
return null;
}
}).when(mockInAppNotificationStore).addInAppNotificationObserver(any(InAppNotificationStoreObserver.class));
// attach fragment
attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
onView(withText(activity.getString(R.string.asset_upload_error__file_too_large__title))).check(isVisible());
}
Aggregations