]> git.ktnx.net Git - mobile-ledger.git/commitdiff
avoid deprecated usage of viewModelProviders
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 22 Dec 2019 07:05:37 +0000 (09:05 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 22 Dec 2019 07:05:37 +0000 (09:05 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionFragment.java

index d506ac35ab994f65397c3317779bd2a8e481ff9a..24f7f8955c04fcd878486426c47aecfee24f1b30 100644 (file)
@@ -24,7 +24,7 @@ import android.view.MenuItem;
 import android.view.View;
 
 import androidx.appcompat.widget.Toolbar;
-import androidx.lifecycle.ViewModelProviders;
+import androidx.lifecycle.ViewModelProvider;
 import androidx.navigation.NavController;
 import androidx.navigation.Navigation;
 
@@ -65,8 +65,7 @@ public class NewTransactionActivity extends ProfileThemedActivity implements Tas
         Objects.requireNonNull(getSupportActionBar())
                .setDisplayHomeAsUpEnabled(true);
 
-        model = ViewModelProviders.of(this)
-                                  .get(NewTransactionModel.class);
+        model = new ViewModelProvider(this).get(NewTransactionModel.class);
     }
     @Override
     protected void initProfile() {
index 10f246d74af8d285de14f357308378c3cedcb0d4..5cbbab71f5cb86c71ec23073437d2723e191972d 100644 (file)
@@ -30,7 +30,7 @@ import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentActivity;
-import androidx.lifecycle.ViewModelProviders;
+import androidx.lifecycle.ViewModelProvider;
 import androidx.recyclerview.widget.ItemTouchHelper;
 import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.recyclerview.widget.RecyclerView;
@@ -93,8 +93,7 @@ public class NewTransactionFragment extends Fragment {
                     "getActivity() returned null within onActivityCreated()");
 
         list = activity.findViewById(R.id.new_transaction_accounts);
-        viewModel = ViewModelProviders.of(activity)
-                                      .get(NewTransactionModel.class);
+        viewModel = new ViewModelProvider(activity).get(NewTransactionModel.class);
         mProfile = Data.profile.getValue();
         listAdapter = new NewTransactionItemsAdapter(viewModel, mProfile);
         list.setAdapter(listAdapter);