rodzic
							
								
									6ac9be8a60
								
							
						
					
					
						commit
						0a857ef76f
					
				|  | @ -10,7 +10,7 @@ | ||||||
|   <component name="VisualizationToolProject"> |   <component name="VisualizationToolProject"> | ||||||
|     <option name="state"> |     <option name="state"> | ||||||
|       <ProjectState> |       <ProjectState> | ||||||
|         <option name="scale" value="0.22" /> |         <option name="scale" value="0.2" /> | ||||||
|       </ProjectState> |       </ProjectState> | ||||||
|     </option> |     </option> | ||||||
|   </component> |   </component> | ||||||
|  |  | ||||||
|  | @ -28,8 +28,23 @@ android { | ||||||
|             debuggable true |             debuggable true | ||||||
|             applicationIdSuffix ".debug" |             applicationIdSuffix ".debug" | ||||||
|             buildConfigField("String", "VERSION_SUFF", "\"[beta-DEBUG]\"") |             buildConfigField("String", "VERSION_SUFF", "\"[beta-DEBUG]\"") | ||||||
|  | 
 | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     flavorDimensions "channel" | ||||||
|  |     productFlavors { | ||||||
|  |         dist { | ||||||
|  |             dimension "channel" | ||||||
|  |             buildConfigField("boolean", "GPLAY", "false") | ||||||
|  |         } | ||||||
|  |         gplay { | ||||||
|  |             dimension "channel" | ||||||
|  |             buildConfigField("boolean", "GPLAY", "true") | ||||||
|  |             applicationIdSuffix ".paid" | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     compileOptions { |     compileOptions { | ||||||
|         sourceCompatibility JavaVersion.VERSION_1_8 |         sourceCompatibility JavaVersion.VERSION_1_8 | ||||||
|         targetCompatibility JavaVersion.VERSION_1_8 |         targetCompatibility JavaVersion.VERSION_1_8 | ||||||
|  |  | ||||||
|  | @ -3,9 +3,11 @@ package eu.piotro.sondechaser; | ||||||
| import android.Manifest; | import android.Manifest; | ||||||
| import android.app.AlertDialog; | import android.app.AlertDialog; | ||||||
| import android.content.pm.PackageManager; | import android.content.pm.PackageManager; | ||||||
|  | import android.content.res.Resources; | ||||||
| import android.os.Bundle; | import android.os.Bundle; | ||||||
| import android.view.View; | import android.view.View; | ||||||
| import android.view.Menu; | import android.view.Menu; | ||||||
|  | import android.widget.FrameLayout; | ||||||
| import android.widget.TextView; | import android.widget.TextView; | ||||||
| 
 | 
 | ||||||
| import com.google.android.material.snackbar.Snackbar; | import com.google.android.material.snackbar.Snackbar; | ||||||
|  | @ -38,7 +40,6 @@ public class MainActivity extends AppCompatActivity { | ||||||
|         // TODO: Main activity get destroyed on task-switch.
 |         // TODO: Main activity get destroyed on task-switch.
 | ||||||
|         //  It probably should be there (but where?), we need further separation of tasks and UI (could help loading times also)
 |         //  It probably should be there (but where?), we need further separation of tasks and UI (could help loading times also)
 | ||||||
|         //  It should be created in app constructor (notification about running in backgroud?) and non re-crated on UI crate!!!!
 |         //  It should be created in app constructor (notification about running in backgroud?) and non re-crated on UI crate!!!!
 | ||||||
| 
 |  | ||||||
|         // main activy is destroyed and then recreated - kill all other threads on destroy
 |         // main activy is destroyed and then recreated - kill all other threads on destroy
 | ||||||
|         dataCollector = new DataCollector(this); |         dataCollector = new DataCollector(this); | ||||||
| 
 | 
 | ||||||
|  | @ -61,8 +62,13 @@ public class MainActivity extends AppCompatActivity { | ||||||
|         NavigationUI.setupWithNavController(navigationView, navController); |         NavigationUI.setupWithNavController(navigationView, navController); | ||||||
| 
 | 
 | ||||||
|         View headerView = navigationView.getHeaderView(0); |         View headerView = navigationView.getHeaderView(0); | ||||||
|         TextView navUsername = (TextView) headerView.findViewById(R.id.nav_version); |         TextView navUsername =  headerView.findViewById(R.id.nav_version); | ||||||
|  |         FrameLayout nav_badge =  headerView.findViewById(R.id.nav_badge); | ||||||
|         navUsername.setText("v"+BuildConfig.VERSION_NAME + BuildConfig.VERSION_SUFF + " " + getString(R.string.nav_header_subtitle)); |         navUsername.setText("v"+BuildConfig.VERSION_NAME + BuildConfig.VERSION_SUFF + " " + getString(R.string.nav_header_subtitle)); | ||||||
|  |         if(BuildConfig.GPLAY) { | ||||||
|  |             nav_badge.setVisibility(View.VISIBLE); | ||||||
|  |             setTheme(R.style.Theme_SondeChaser_GPLAY); | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         // Map configurations
 |         // Map configurations
 | ||||||
|         Configuration.getInstance().setUserAgentValue(getApplicationContext().getPackageName()); |         Configuration.getInstance().setUserAgentValue(getApplicationContext().getPackageName()); | ||||||
|  | @ -80,6 +86,14 @@ public class MainActivity extends AppCompatActivity { | ||||||
|         dataCollectorThread.start(); |         dataCollectorThread.start(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     @Override | ||||||
|  |     public Resources.Theme getTheme() { | ||||||
|  |         Resources.Theme theme = super.getTheme(); | ||||||
|  |         if(BuildConfig.GPLAY) | ||||||
|  |             theme.applyStyle(R.style.Theme_SondeChaser_GPLAY, true); | ||||||
|  |         return theme; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     @Override |     @Override | ||||||
|     public boolean onCreateOptionsMenu(Menu menu) { |     public boolean onCreateOptionsMenu(Menu menu) { | ||||||
|         // Inflate the menu; this adds items to the action bar if it is present.
 |         // Inflate the menu; this adds items to the action bar if it is present.
 | ||||||
|  |  | ||||||
|  | @ -0,0 +1,7 @@ | ||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <shape xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|  |     android:shape="rectangle" android:padding="10dp"> | ||||||
|  |     <solid android:color="#236761"/> | ||||||
|  |     <corners android:radius="10dp"/> | ||||||
|  | </shape> | ||||||
|  | 
 | ||||||
|  | @ -31,5 +31,30 @@ | ||||||
|         android:id="@+id/nav_version" |         android:id="@+id/nav_version" | ||||||
|         android:layout_width="wrap_content" |         android:layout_width="wrap_content" | ||||||
|         android:layout_height="wrap_content" |         android:layout_height="wrap_content" | ||||||
|         android:text="@string/nav_header_subtitle" /> |         android:text="@string/nav_header_subtitle" | ||||||
|  |         android:textSize="12dp" /> | ||||||
|  | 
 | ||||||
|  |     <FrameLayout | ||||||
|  |         android:id="@+id/nav_badge" | ||||||
|  |         android:layout_width="match_parent" | ||||||
|  |         android:layout_height="23dp" | ||||||
|  |         android:layout_marginTop="5px" | ||||||
|  |         android:visibility="gone"> | ||||||
|  | 
 | ||||||
|  |         <ImageView | ||||||
|  |             android:id="@+id/imageView16" | ||||||
|  |             android:layout_width="match_parent" | ||||||
|  |             android:layout_height="match_parent" | ||||||
|  |             app:srcCompat="@drawable/badge_bg" /> | ||||||
|  | 
 | ||||||
|  |         <TextView | ||||||
|  |             android:id="@+id/nav_badge_text" | ||||||
|  |             android:layout_width="match_parent" | ||||||
|  |             android:layout_height="wrap_content" | ||||||
|  |             android:layout_gravity="center" | ||||||
|  |             android:gravity="center" | ||||||
|  |             android:text="❤️Google Play version. Thanks for support!" | ||||||
|  |             android:textSize="12dp" /> | ||||||
|  |     </FrameLayout> | ||||||
|  | 
 | ||||||
| </LinearLayout> | </LinearLayout> | ||||||
|  | @ -13,4 +13,20 @@ | ||||||
|         <item name="android:statusBarColor">?attr/colorPrimaryVariant</item> |         <item name="android:statusBarColor">?attr/colorPrimaryVariant</item> | ||||||
|         <!-- Customize your theme here. --> |         <!-- Customize your theme here. --> | ||||||
|     </style> |     </style> | ||||||
|  | 
 | ||||||
|  |     <style name="Theme.SondeChaser.GPLAY" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> | ||||||
|  |         <!-- Primary brand color. --> | ||||||
|  |         <item name="colorPrimary">@color/teal_200</item> | ||||||
|  |         <item name="colorPrimaryVariant">@color/teal_200</item> | ||||||
|  |         <item name="colorOnPrimary">@color/black</item> | ||||||
|  |         <!-- Secondary brand color. --> | ||||||
|  |         <item name="colorSecondary">@color/purple_200</item> | ||||||
|  |         <item name="colorSecondaryVariant">@color/purple_700</item> | ||||||
|  |         <item name="colorOnSecondary">@color/black</item> | ||||||
|  |         <!-- Status bar color. --> | ||||||
|  |         <item name="android:statusBarColor">?attr/colorPrimaryVariant</item> | ||||||
|  |         <!-- Customize your theme here. --> | ||||||
|  |         <item name="windowActionBar">false</item> | ||||||
|  |         <item name="windowNoTitle">true</item> | ||||||
|  |     </style> | ||||||
| </resources> | </resources> | ||||||
|  | @ -3,6 +3,6 @@ | ||||||
|     <dimen name="activity_horizontal_margin">16dp</dimen> |     <dimen name="activity_horizontal_margin">16dp</dimen> | ||||||
|     <dimen name="activity_vertical_margin">16dp</dimen> |     <dimen name="activity_vertical_margin">16dp</dimen> | ||||||
|     <dimen name="nav_header_vertical_spacing">8dp</dimen> |     <dimen name="nav_header_vertical_spacing">8dp</dimen> | ||||||
|     <dimen name="nav_header_height">176dp</dimen> |     <dimen name="nav_header_height">200dp</dimen> | ||||||
|     <dimen name="fab_margin">16dp</dimen> |     <dimen name="fab_margin">16dp</dimen> | ||||||
| </resources> | </resources> | ||||||
|  | @ -14,6 +14,22 @@ | ||||||
|         <!-- Customize your theme here. --> |         <!-- Customize your theme here. --> | ||||||
|     </style> |     </style> | ||||||
| 
 | 
 | ||||||
|  |     <style name="Theme.SondeChaser.GPLAY" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> | ||||||
|  |         <!-- Primary brand color. --> | ||||||
|  |         <item name="colorPrimary">@color/teal_200</item> | ||||||
|  |         <item name="colorPrimaryVariant">@color/teal_700</item> | ||||||
|  |         <item name="colorOnPrimary">@color/black</item> | ||||||
|  |         <!-- Secondary brand color. --> | ||||||
|  |         <item name="colorSecondary">@color/purple_500</item> | ||||||
|  |         <item name="colorSecondaryVariant">@color/purple_700</item> | ||||||
|  |         <item name="colorOnSecondary">@color/white</item> | ||||||
|  |         <!-- Status bar color. --> | ||||||
|  |         <item name="android:statusBarColor">?attr/colorPrimaryVariant</item> | ||||||
|  |         <!-- Customize your theme here. --> | ||||||
|  |         <item name="windowActionBar">false</item> | ||||||
|  |         <item name="windowNoTitle">true</item> | ||||||
|  |     </style> | ||||||
|  | 
 | ||||||
|     <style name="Theme.SondeChaser.NoActionBar"> |     <style name="Theme.SondeChaser.NoActionBar"> | ||||||
|         <item name="windowActionBar">false</item> |         <item name="windowActionBar">false</item> | ||||||
|         <item name="windowNoTitle">true</item> |         <item name="windowNoTitle">true</item> | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Piotro
						Piotro