diff --git a/android/.idea/assetWizardSettings.xml b/android/.idea/assetWizardSettings.xml new file mode 100644 index 0000000..2eb36a1 --- /dev/null +++ b/android/.idea/assetWizardSettings.xml @@ -0,0 +1,32 @@ + + + + + + \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 44ac0f4..eafab24 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -4,7 +4,7 @@ android { compileSdkVersion 27 defaultConfig { applicationId "com.blackforestbytes.simplecloudnotifier" - minSdkVersion 15 + minSdkVersion 21 targetSdkVersion 27 versionCode 2 versionName "0.2" @@ -24,9 +24,11 @@ dependencies { implementation 'com.android.support:cardview-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support:recyclerview-v7:27.1.1' + implementation 'com.android.support:design:27.1.1' implementation 'com.google.firebase:firebase-core:16.0.3' implementation 'com.google.firebase:firebase-messaging:17.3.2' + implementation 'com.android.support:support-v4:27.1.1' } apply plugin: 'com.google.gms.google-services' diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index ce0f728..aa93a3c 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -10,7 +10,7 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + @@ -20,7 +20,7 @@ - + diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/MainActivity.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/MainActivity.java deleted file mode 100644 index 4328c58..0000000 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/MainActivity.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.blackforestbytes.simplecloudnotifier; - -import android.support.v7.app.AppCompatActivity; -import android.os.Bundle; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.util.Log; -import android.view.View; - -import com.google.android.gms.tasks.OnSuccessListener; -import com.google.firebase.iid.FirebaseInstanceId; -import com.google.firebase.iid.InstanceIdResult; - -public class MainActivity extends AppCompatActivity -{ - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - RecyclerView rvMessages = findViewById(R.id.rvMessages); - rvMessages.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, true)); - rvMessages.setAdapter(new MessageAdapter()); - - SCNApp.register(this); - } - - @Override - protected void onStop() - { - super.onStop(); - - CMessageList.inst().fullSave(); - } -} diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java index de4c214..102f8eb 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java @@ -4,6 +4,8 @@ import android.app.Application; import android.content.Context; import android.widget.Toast; +import com.blackforestbytes.simplecloudnotifier.view.MainActivity; + import java.lang.ref.WeakReference; public class SCNApp extends Application diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/CMessage.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/CMessage.java similarity index 93% rename from android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/CMessage.java rename to android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/CMessage.java index 929550c..7b703f7 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/CMessage.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/CMessage.java @@ -1,4 +1,4 @@ -package com.blackforestbytes.simplecloudnotifier; +package com.blackforestbytes.simplecloudnotifier.model; import android.annotation.SuppressLint; diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/CMessageList.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/CMessageList.java similarity index 95% rename from android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/CMessageList.java rename to android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/CMessageList.java index 4df30d7..693a86a 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/CMessageList.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/CMessageList.java @@ -1,9 +1,11 @@ -package com.blackforestbytes.simplecloudnotifier; +package com.blackforestbytes.simplecloudnotifier.model; -import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; +import com.blackforestbytes.simplecloudnotifier.view.MessageAdapter; +import com.blackforestbytes.simplecloudnotifier.SCNApp; + import java.lang.ref.WeakReference; import java.util.ArrayList; diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/FBMService.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/service/FBMService.java similarity index 88% rename from android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/FBMService.java rename to android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/service/FBMService.java index f3405a3..2a78c79 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/FBMService.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/service/FBMService.java @@ -1,8 +1,10 @@ -package com.blackforestbytes.simplecloudnotifier; +package com.blackforestbytes.simplecloudnotifier.service; import android.util.Log; import android.widget.Toast; +import com.blackforestbytes.simplecloudnotifier.SCNApp; +import com.blackforestbytes.simplecloudnotifier.model.CMessageList; import com.google.firebase.messaging.FirebaseMessagingService; import com.google.firebase.messaging.RemoteMessage; diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/AccountFragment.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/AccountFragment.java new file mode 100644 index 0000000..4051949 --- /dev/null +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/AccountFragment.java @@ -0,0 +1,25 @@ +package com.blackforestbytes.simplecloudnotifier.view; + +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.blackforestbytes.simplecloudnotifier.R; + +public class AccountFragment extends Fragment +{ + public AccountFragment() + { + // Required empty public constructor + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + return inflater.inflate(R.layout.fragment_account, container, false); + } + +} diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/MainActivity.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/MainActivity.java new file mode 100644 index 0000000..50e4eee --- /dev/null +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/MainActivity.java @@ -0,0 +1,48 @@ +package com.blackforestbytes.simplecloudnotifier.view; + +import android.support.design.widget.TabLayout; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.Toolbar; +import android.view.Menu; +import android.view.MenuItem; + +import com.blackforestbytes.simplecloudnotifier.R; +import com.blackforestbytes.simplecloudnotifier.SCNApp; +import com.blackforestbytes.simplecloudnotifier.model.CMessageList; + +public class MainActivity extends AppCompatActivity +{ + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + Toolbar toolbar = findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + TabLayout tabLayout = findViewById(R.id.tab_layout); + tabLayout.addTab(tabLayout.newTab().setText("Notifications")); + tabLayout.addTab(tabLayout.newTab().setText("Account")); + tabLayout.addTab(tabLayout.newTab().setText("Settings")); + tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); + + final ViewPager viewPager = findViewById(R.id.pager); + final PagerAdapter adapter = new TabAdapter(getSupportFragmentManager()); + viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + + SCNApp.register(this); + } + + @Override + protected void onStop() + { + super.onStop(); + + CMessageList.inst().fullSave(); + } +} diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/MessageAdapter.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/MessageAdapter.java similarity index 87% rename from android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/MessageAdapter.java rename to android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/MessageAdapter.java index 9da1a26..401d3ab 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/MessageAdapter.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/MessageAdapter.java @@ -1,4 +1,4 @@ -package com.blackforestbytes.simplecloudnotifier; +package com.blackforestbytes.simplecloudnotifier.view; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; @@ -8,6 +8,11 @@ import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; +import com.blackforestbytes.simplecloudnotifier.R; +import com.blackforestbytes.simplecloudnotifier.SCNApp; +import com.blackforestbytes.simplecloudnotifier.model.CMessage; +import com.blackforestbytes.simplecloudnotifier.model.CMessageList; + public class MessageAdapter extends RecyclerView.Adapter { public MessageAdapter() diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/NotificationsFragment.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/NotificationsFragment.java new file mode 100644 index 0000000..70eb627 --- /dev/null +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/NotificationsFragment.java @@ -0,0 +1,34 @@ +package com.blackforestbytes.simplecloudnotifier.view; + +import android.content.Context; +import android.net.Uri; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v4.app.Fragment; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.blackforestbytes.simplecloudnotifier.R; + +public class NotificationsFragment extends Fragment +{ + public NotificationsFragment() + { + // Required empty public constructor + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + View v = inflater.inflate(R.layout.fragment_notifications, container, false); + + RecyclerView rvMessages = v.findViewById(R.id.rvMessages); + rvMessages.setLayoutManager(new LinearLayoutManager(this.getContext(), RecyclerView.VERTICAL, true)); + rvMessages.setAdapter(new MessageAdapter()); + + return v; + } +} diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/SettingsFragment.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/SettingsFragment.java new file mode 100644 index 0000000..4dba427 --- /dev/null +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/SettingsFragment.java @@ -0,0 +1,30 @@ +package com.blackforestbytes.simplecloudnotifier.view; + + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.blackforestbytes.simplecloudnotifier.R; + +/** + * A simple {@link Fragment} subclass. + */ +public class SettingsFragment extends Fragment { + + + public SettingsFragment() { + // Required empty public constructor + } + + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_settings, container, false); + } + +} diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/TabAdapter.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/TabAdapter.java new file mode 100644 index 0000000..6d69993 --- /dev/null +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/TabAdapter.java @@ -0,0 +1,33 @@ +package com.blackforestbytes.simplecloudnotifier.view; + +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentManager; +import android.support.v4.app.FragmentStatePagerAdapter; + +public class TabAdapter extends FragmentStatePagerAdapter { + + public TabAdapter(FragmentManager fm) + { + super(fm); + } + + @Override + public Fragment getItem(int position) { + + switch (position) { + case 0: + return new NotificationsFragment(); + case 1: + return new AccountFragment(); + case 2: + return new SettingsFragment(); + default: + return null; + } + } + + @Override + public int getCount() { + return 3; + } +} \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_bfb.xml b/android/app/src/main/res/drawable/ic_bfb.xml new file mode 100644 index 0000000..e1e1774 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_bfb.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/android/app/src/main/res/drawable/ic_copy.xml b/android/app/src/main/res/drawable/ic_copy.xml new file mode 100644 index 0000000..50192eb --- /dev/null +++ b/android/app/src/main/res/drawable/ic_copy.xml @@ -0,0 +1,6 @@ + + + diff --git a/android/app/src/main/res/drawable/ic_fuel.xml b/android/app/src/main/res/drawable/ic_fuel.xml new file mode 100644 index 0000000..dc17631 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_fuel.xml @@ -0,0 +1,7 @@ + + + diff --git a/android/app/src/main/res/drawable/ic_key.xml b/android/app/src/main/res/drawable/ic_key.xml new file mode 100644 index 0000000..85ec964 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_key.xml @@ -0,0 +1,4 @@ + + + diff --git a/android/app/src/main/res/drawable/ic_user.xml b/android/app/src/main/res/drawable/ic_user.xml new file mode 100644 index 0000000..7288ae8 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_user.xml @@ -0,0 +1,12 @@ + + + + diff --git a/android/app/src/main/res/drawable/qr_default.xml b/android/app/src/main/res/drawable/qr_default.xml new file mode 100644 index 0000000..d47e01b --- /dev/null +++ b/android/app/src/main/res/drawable/qr_default.xml @@ -0,0 +1,422 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/res/layout/activity_main.xml b/android/app/src/main/res/layout/activity_main.xml index 231161d..050c331 100644 --- a/android/app/src/main/res/layout/activity_main.xml +++ b/android/app/src/main/res/layout/activity_main.xml @@ -5,11 +5,30 @@ android:layout_height="match_parent" tools:showIn="@layout/activity_main"> - + android:layout_alignParentTop="true" + android:background="?attr/colorPrimary" + android:elevation="6dp" + android:minHeight="?attr/actionBarSize" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> + + + + \ No newline at end of file diff --git a/android/app/src/main/res/layout/fragment_account.xml b/android/app/src/main/res/layout/fragment_account.xml new file mode 100644 index 0000000..16fcef8 --- /dev/null +++ b/android/app/src/main/res/layout/fragment_account.xml @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +