Verified Commit 3ae09964 authored by HashikD's avatar HashikD
Browse files

Changed MainActivityMVP to MainActivityMVP contract

parent 6c8056d2
......@@ -18,13 +18,13 @@ import org.torproject.snowflake.constants.FragmentConstants;
import org.torproject.snowflake.fragments.AppSettingsFragment;
import org.torproject.snowflake.fragments.MainFragment;
import org.torproject.snowflake.interfaces.MainFragmentCallback;
import org.torproject.snowflake.mvp.MainActivityMVP;
import org.torproject.snowflake.mvp.MainActivityMVPContract;
import org.torproject.snowflake.presenters.MainActivityPresenter;
/**
* MainActivity is the main UI of the application.
*/
public class MainActivity extends AppCompatActivity implements MainFragmentCallback, MainActivityMVP.View {
public class MainActivity extends AppCompatActivity implements MainFragmentCallback, MainActivityMVPContract.View {
private static final String TAG = "MainActivity";
int currentFragment;
MainActivityPresenter presenter;
......
......@@ -5,7 +5,7 @@ import android.util.Log;
import org.torproject.snowflake.GlobalApplication;
import org.torproject.snowflake.constants.AppPreferenceConstants;
import org.torproject.snowflake.mvp.MainActivityMVP;
import org.torproject.snowflake.mvp.MainActivityMVPContract;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -19,22 +19,22 @@ import io.reactivex.rxjava3.schedulers.Schedulers;
/**
* Model for MainActivity to handle network calls, Shared preferences.
*/
public class MainActivityModel implements MainActivityMVP.Model {
public class MainActivityModel implements MainActivityMVPContract.Model {
private static final String TAG = "MainActivityModel";
private static MainActivityModel instance = null;
private SharedPreferences sharedPreferences;
private MainActivityMVP.Presenter presenter;
private MainActivityMVPContract.Presenter presenter;
private int servedCount;
private SharedPreferences.OnSharedPreferenceChangeListener listener;
private MainActivityModel(MainActivityMVP.Presenter presenter) {
private MainActivityModel(MainActivityMVPContract.Presenter presenter) {
sharedPreferences = GlobalApplication.getAppPreferences();
this.presenter = presenter;
servedCount = 0;
}
public static MainActivityModel getInstance(MainActivityMVP.Presenter presenter) {
public static MainActivityModel getInstance(MainActivityMVPContract.Presenter presenter) {
if (instance == null) {
synchronized (MainActivityModel.class) {
instance = new MainActivityModel(presenter);
......
......@@ -3,7 +3,7 @@ package org.torproject.snowflake.mvp;
/**
* MVP contract Interface
*/
public interface MainActivityMVP {
public interface MainActivityMVPContract {
interface View {
void updateCountInFragment(int i);
}
......
......@@ -3,17 +3,17 @@ package org.torproject.snowflake.presenters;
import android.util.Log;
import org.torproject.snowflake.models.MainActivityModel;
import org.torproject.snowflake.mvp.MainActivityMVP;
import org.torproject.snowflake.mvp.MainActivityMVPContract;
/**
* Presenter for MainActivity.
*/
public class MainActivityPresenter implements MainActivityMVP.Presenter {
public class MainActivityPresenter implements MainActivityMVPContract.Presenter {
private static final String TAG = "MainActivityPresenter";
MainActivityMVP.View view;
MainActivityMVP.Model model;
MainActivityMVPContract.View view;
MainActivityMVPContract.Model model;
public MainActivityPresenter(MainActivityMVP.View view) {
public MainActivityPresenter(MainActivityMVPContract.View view) {
//Attaching
this.view = view;
model = MainActivityModel.getInstance(this);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment