Search in sources :

Example 1 with PairRecyclerViewAdapter

use of com.onesignal.sdktest.adapter.PairRecyclerViewAdapter in project OneSignal-Android-SDK by OneSignal.

the class MainActivityViewModel method setupTriggerRecyclerView.

private void setupTriggerRecyclerView() {
    recyclerViewBuilder.setupRecyclerView(triggersRecyclerView, 20, false, true);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
    triggersRecyclerView.setLayoutManager(linearLayoutManager);
    triggerPairRecyclerViewAdapter = new PairRecyclerViewAdapter(context, triggerArrayList, key -> {
        OneSignal.removeTriggerForKey(key);
        triggerSet.remove(key);
        refreshTriggerRecyclerView();
        toaster.makeCustomViewToast("Deleted trigger " + key, ToastType.SUCCESS);
    });
    triggersRecyclerView.setAdapter(triggerPairRecyclerViewAdapter);
}
Also used : LinearLayout(android.widget.LinearLayout) Switch(android.widget.Switch) PairItemActionCallback(com.onesignal.sdktest.callback.PairItemActionCallback) PairRecyclerViewAdapter(com.onesignal.sdktest.adapter.PairRecyclerViewAdapter) NestedScrollView(androidx.core.widget.NestedScrollView) UpdateAlertDialogCallback(com.onesignal.sdktest.callback.UpdateAlertDialogCallback) OSDeviceState(com.onesignal.OSDeviceState) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) Toaster(com.onesignal.sdktest.util.Toaster) AppBarLayout(com.google.android.material.appbar.AppBarLayout) OneSignal(com.onesignal.OneSignal) JSONException(org.json.JSONException) JSONObject(org.json.JSONObject) InAppMessageRecyclerViewAdapter(com.onesignal.sdktest.adapter.InAppMessageRecyclerViewAdapter) Map(java.util.Map) View(android.view.View) Button(android.widget.Button) RecyclerView(androidx.recyclerview.widget.RecyclerView) ProfileUtil(com.onesignal.sdktest.util.ProfileUtil) SharedPreferenceUtil(com.onesignal.sdktest.util.SharedPreferenceUtil) Notification(com.onesignal.sdktest.type.Notification) TextView(android.widget.TextView) RecyclerViewBuilder(com.onesignal.sdktest.ui.RecyclerViewBuilder) AddPairAlertDialogCallback(com.onesignal.sdktest.callback.AddPairAlertDialogCallback) Toolbar(androidx.appcompat.widget.Toolbar) RelativeLayout(android.widget.RelativeLayout) NotificationRecyclerViewAdapter(com.onesignal.sdktest.adapter.NotificationRecyclerViewAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) ToastType(com.onesignal.sdktest.type.ToastType) Context(android.content.Context) SecondaryActivity(com.onesignal.sdktest.activity.SecondaryActivity) GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) R(com.onesignal.sdktest.R) Pair(android.util.Pair) Dialog(com.onesignal.sdktest.util.Dialog) Intent(android.content.Intent) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) IntentTo(com.onesignal.sdktest.util.IntentTo) Animate(com.onesignal.sdktest.util.Animate) CurrentUser(com.onesignal.sdktest.user.CurrentUser) Font(com.onesignal.sdktest.util.Font) Iterator(java.util.Iterator) CompoundButton(android.widget.CompoundButton) InAppMessage(com.onesignal.sdktest.type.InAppMessage) OSPermissionStateChanges(com.onesignal.OSPermissionStateChanges) ViewTreeObserver(android.view.ViewTreeObserver) Text(com.onesignal.sdktest.constant.Text) Activity(android.app.Activity) OSEmailSubscriptionStateChanges(com.onesignal.OSEmailSubscriptionStateChanges) OSSubscriptionStateChanges(com.onesignal.OSSubscriptionStateChanges) PairRecyclerViewAdapter(com.onesignal.sdktest.adapter.PairRecyclerViewAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 2 with PairRecyclerViewAdapter

use of com.onesignal.sdktest.adapter.PairRecyclerViewAdapter in project OneSignal-Android-SDK by OneSignal.

the class MainActivityViewModel method setupTagRecyclerView.

private void setupTagRecyclerView() {
    recyclerViewBuilder.setupRecyclerView(tagsRecyclerView, 20, false, true);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
    tagsRecyclerView.setLayoutManager(linearLayoutManager);
    tagPairRecyclerViewAdapter = new PairRecyclerViewAdapter(context, tagArrayList, new PairItemActionCallback() {

        @Override
        public void onLongClick(String key) {
            OneSignal.deleteTag(key);
            tagSet.remove(key);
            refreshTagRecyclerView();
            toaster.makeCustomViewToast("Deleted tag " + key, ToastType.SUCCESS);
        }
    });
    tagsRecyclerView.setAdapter(tagPairRecyclerViewAdapter);
}
Also used : PairItemActionCallback(com.onesignal.sdktest.callback.PairItemActionCallback) PairRecyclerViewAdapter(com.onesignal.sdktest.adapter.PairRecyclerViewAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Aggregations

LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)2 PairRecyclerViewAdapter (com.onesignal.sdktest.adapter.PairRecyclerViewAdapter)2 PairItemActionCallback (com.onesignal.sdktest.callback.PairItemActionCallback)2 Activity (android.app.Activity)1 Context (android.content.Context)1 Intent (android.content.Intent)1 Pair (android.util.Pair)1 View (android.view.View)1 ViewTreeObserver (android.view.ViewTreeObserver)1 Button (android.widget.Button)1 CompoundButton (android.widget.CompoundButton)1 LinearLayout (android.widget.LinearLayout)1 RelativeLayout (android.widget.RelativeLayout)1 Switch (android.widget.Switch)1 TextView (android.widget.TextView)1 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)1 Toolbar (androidx.appcompat.widget.Toolbar)1 NestedScrollView (androidx.core.widget.NestedScrollView)1 GridLayoutManager (androidx.recyclerview.widget.GridLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1