diff --git a/app/build.gradle b/app/build.gradle index 77b9bc03..880bb490 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,7 +13,6 @@ android { useLibrary 'org.apache.http.legacy' versionCode 121 versionName "1.7.6" - multiDexEnabled true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -58,20 +57,12 @@ android { checkReleaseBuilds false } namespace 'com.jens.automation2' - buildFeatures { - viewBinding true - } } dependencies { implementation 'org.jetbrains:annotations:15.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1' googlePlayFlavorImplementation 'com.google.firebase:firebase-appindexing:20.0.0' googlePlayFlavorImplementation 'com.google.android.gms:play-services-location:18.0.0' - implementation 'com.android.support:multidex:1.0.3' - implementation 'androidx.preference:preference:1.2.0' apkFlavorImplementation 'com.google.firebase:firebase-appindexing:20.0.0' apkFlavorImplementation 'com.google.android.gms:play-services-location:18.0.0' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6ab4797a..a5918e68 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,12 +1,4 @@ - - - - \ No newline at end of file diff --git a/app/src/main/java/com/jens/automation2/MainActivityTabs.java b/app/src/main/java/com/jens/automation2/MainActivityTabs.java deleted file mode 100644 index 78c00511..00000000 --- a/app/src/main/java/com/jens/automation2/MainActivityTabs.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.jens.automation2; - -import android.os.Bundle; - -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.google.android.material.snackbar.Snackbar; -import com.google.android.material.tabs.TabLayout; - -import androidx.viewpager.widget.ViewPager; -import androidx.appcompat.app.AppCompatActivity; - -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; - -import com.jens.automation2.ui.main.SectionsPagerAdapter; -import com.jens.automation2.databinding.ActivityMainTabsBinding; - -public class MainActivityTabs extends AppCompatActivity -{ - - private ActivityMainTabsBinding binding; - - @Override - protected void onCreate(Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - - binding = ActivityMainTabsBinding.inflate(getLayoutInflater()); - setContentView(binding.getRoot()); - - SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(this, getSupportFragmentManager()); - ViewPager viewPager = binding.viewPager; - viewPager.setAdapter(sectionsPagerAdapter); - TabLayout tabs = binding.tabs; - tabs.setupWithViewPager(viewPager); - FloatingActionButton fab = binding.fab; - - fab.setOnClickListener(new View.OnClickListener() - { - @Override - public void onClick(View view) - { - Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) - .setAction("Action", null).show(); - } - }); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/jens/automation2/ui/main/PageViewModel.java b/app/src/main/java/com/jens/automation2/ui/main/PageViewModel.java deleted file mode 100644 index 0173efb0..00000000 --- a/app/src/main/java/com/jens/automation2/ui/main/PageViewModel.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.jens.automation2.ui.main; - -import androidx.arch.core.util.Function; -import androidx.lifecycle.LiveData; -import androidx.lifecycle.MutableLiveData; -import androidx.lifecycle.Transformations; -import androidx.lifecycle.ViewModel; - -public class PageViewModel extends ViewModel -{ - - private MutableLiveData mIndex = new MutableLiveData<>(); - private LiveData mText = Transformations.map(mIndex, new Function() - { - @Override - public String apply(Integer input) - { - return "Hello world from section: " + input; - } - }); - - public void setIndex(int index) - { - mIndex.setValue(index); - } - - public LiveData getText() - { - return mText; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/jens/automation2/ui/main/PlaceholderFragment.java b/app/src/main/java/com/jens/automation2/ui/main/PlaceholderFragment.java deleted file mode 100644 index b80b7ce0..00000000 --- a/app/src/main/java/com/jens/automation2/ui/main/PlaceholderFragment.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.jens.automation2.ui.main; - -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProvider; - -import com.jens.automation2.R; -import com.jens.automation2.databinding.FragmentMainActivityTabsBinding; - -/** - * A placeholder fragment containing a simple view. - */ -public class PlaceholderFragment extends Fragment -{ - - private static final String ARG_SECTION_NUMBER = "section_number"; - - private PageViewModel pageViewModel; - private FragmentMainActivityTabsBinding binding; - - public static PlaceholderFragment newInstance(int index) - { - PlaceholderFragment fragment = new PlaceholderFragment(); - Bundle bundle = new Bundle(); - bundle.putInt(ARG_SECTION_NUMBER, index); - fragment.setArguments(bundle); - return fragment; - } - - @Override - public void onCreate(Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - pageViewModel = new ViewModelProvider(this).get(PageViewModel.class); - int index = 1; - if (getArguments() != null) - { - index = getArguments().getInt(ARG_SECTION_NUMBER); - } - pageViewModel.setIndex(index); - } - - @Override - public View onCreateView( - @NonNull LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) - { - - binding = FragmentMainActivityTabsBinding.inflate(inflater, container, false); - View root = binding.getRoot(); - - final TextView textView = binding.sectionLabel; - pageViewModel.getText().observe(getViewLifecycleOwner(), new Observer() - { - @Override - public void onChanged(@Nullable String s) - { - textView.setText(s); - } - }); - return root; - } - - @Override - public void onDestroyView() - { - super.onDestroyView(); - binding = null; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/jens/automation2/ui/main/SectionsPagerAdapter.java b/app/src/main/java/com/jens/automation2/ui/main/SectionsPagerAdapter.java deleted file mode 100644 index 46a3d229..00000000 --- a/app/src/main/java/com/jens/automation2/ui/main/SectionsPagerAdapter.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.jens.automation2.ui.main; - -import android.content.Context; - -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; -import androidx.fragment.app.FragmentPagerAdapter; - -import com.jens.automation2.R; - -/** - * A [FragmentPagerAdapter] that returns a fragment corresponding to - * one of the sections/tabs/pages. - */ -public class SectionsPagerAdapter extends FragmentPagerAdapter -{ - - @StringRes - private static final int[] TAB_TITLES = new int[]{R.string.tab_text_1, R.string.tab_text_2}; - private final Context mContext; - - public SectionsPagerAdapter(Context context, FragmentManager fm) - { - super(fm); - mContext = context; - } - - @Override - public Fragment getItem(int position) - { - // getItem is called to instantiate the fragment for the given page. - // Return a PlaceholderFragment (defined as a static inner class below). - return PlaceholderFragment.newInstance(position + 1); - } - - @Nullable - @Override - public CharSequence getPageTitle(int position) - { - return mContext.getResources().getString(TAB_TITLES[position]); - } - - @Override - public int getCount() - { - // Show 2 total pages. - return 2; - } -} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main_tabs.xml b/app/src/main/res/layout/activity_main_tabs.xml deleted file mode 100644 index 83455994..00000000 --- a/app/src/main/res/layout/activity_main_tabs.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_main_activity_tabs.xml b/app/src/main/res/layout/fragment_main_activity_tabs.xml deleted file mode 100644 index 0a90c04c..00000000 --- a/app/src/main/res/layout/fragment_main_activity_tabs.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/build.gradle b/build.gradle index dad47d93..77782480 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:7.2.2' + classpath 'com.android.tools.build:gradle:7.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files