Search in sources :

Example 96 with SuppressLint

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;
}
Also used : LayoutParams(android.widget.AbsListView.LayoutParams) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 97 with SuppressLint

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);
        }
    }
}
Also used : Calendar(java.util.Calendar) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 98 with SuppressLint

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);
}
Also used : GridLayout(android.widget.GridLayout) ActionBar(android.app.ActionBar) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 99 with SuppressLint

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));
}
Also used : MessageContent(com.waz.api.MessageContent) IConversationStore(com.waz.zclient.core.stores.conversation.IConversationStore) Instrumentation(android.app.Instrumentation) AssetForUpload(com.waz.api.AssetForUpload) IConversation(com.waz.api.IConversation) Intent(android.content.Intent) FragmentTest(com.waz.zclient.testutils.FragmentTest) Test(org.junit.Test) SuppressLint(android.annotation.SuppressLint)

Example 100 with SuppressLint

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());
}
Also used : ErrorsList(com.waz.api.ErrorsList) InvocationOnMock(org.mockito.invocation.InvocationOnMock) InAppNotificationStoreObserver(com.waz.zclient.core.stores.inappnotification.InAppNotificationStoreObserver) IInAppNotificationStore(com.waz.zclient.core.stores.inappnotification.IInAppNotificationStore) FragmentTest(com.waz.zclient.testutils.FragmentTest) Test(org.junit.Test) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1773 View (android.view.View)369 TextView (android.widget.TextView)243 Intent (android.content.Intent)232 ImageView (android.widget.ImageView)112 Paint (android.graphics.Paint)109 File (java.io.File)102 IOException (java.io.IOException)96 ArrayList (java.util.ArrayList)93 Context (android.content.Context)91 LayoutInflater (android.view.LayoutInflater)89 Uri (android.net.Uri)84 Bundle (android.os.Bundle)83 SharedPreferences (android.content.SharedPreferences)78 Bitmap (android.graphics.Bitmap)78 WebView (android.webkit.WebView)76 PendingIntent (android.app.PendingIntent)72 Method (java.lang.reflect.Method)72 SimpleDateFormat (java.text.SimpleDateFormat)69 ViewGroup (android.view.ViewGroup)66