Skip to content

Commit 9a594c4

Browse files
authored
Merge pull request #46 from JLindemann42/development
Development
2 parents dbd3ae3 + 8240e51 commit 9a594c4

File tree

21 files changed

+414
-83
lines changed

21 files changed

+414
-83
lines changed

.idea/deploymentTargetSelector.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ android {
2121
applicationId "com.jlindemann.science"
2222
minSdkVersion 23
2323
targetSdkVersion 34
24-
versionCode 78
25-
versionName "2.2.0"
24+
versionCode 81
25+
versionName "2.2.2"
2626
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2727
}
2828
buildTypes {

app/release/app-release.apk

-8.67 MB
Binary file not shown.
744 Bytes
Binary file not shown.
678 Bytes
Binary file not shown.

app/release/output-metadata.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,27 @@
1111
"type": "SINGLE",
1212
"filters": [],
1313
"attributes": [],
14-
"versionCode": 66,
15-
"versionName": "2.2.0",
14+
"versionCode": 81,
15+
"versionName": "2.2.2",
1616
"outputFile": "app-release.apk"
1717
}
1818
],
1919
"elementType": "File",
20+
"baselineProfiles": [
21+
{
22+
"minApi": 28,
23+
"maxApi": 30,
24+
"baselineProfiles": [
25+
"baselineProfiles/1/app-release.dm"
26+
]
27+
},
28+
{
29+
"minApi": 31,
30+
"maxApi": 2147483647,
31+
"baselineProfiles": [
32+
"baselineProfiles/0/app-release.dm"
33+
]
34+
}
35+
],
2036
"minSdkVersionForDexing": 23
2137
}

app/src/main/AndroidManifest.xml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
android:name=".activities.ElementInfoActivity"
4747
android:label="ELEMENTINFOACTIVITY"
4848
android:exported="true"
49-
android:screenOrientation="portrait"
49+
5050
android:theme="@style/AppTheme">
5151
<intent-filter>
5252
<action android:name="package.OtherActivity" />
@@ -56,7 +56,7 @@
5656
android:name=".activities.SettingsActivity"
5757
android:label="SETTINGS"
5858
android:exported="true"
59-
android:screenOrientation="portrait"
59+
6060
android:theme="@style/AppTheme">
6161
<intent-filter>
6262
<action android:name="package.OtherActivity" />
@@ -66,7 +66,7 @@
6666
android:name=".activities.settings.FavoritePageActivity"
6767
android:label="FAVORITEPAGE"
6868
android:exported="true"
69-
android:screenOrientation="portrait"
69+
7070
android:theme="@style/AppTheme">
7171
<intent-filter>
7272
<action android:name="package.OtherActivity" />
@@ -76,7 +76,7 @@
7676
android:name=".activities.settings.OrderActivity"
7777
android:label="ORDERPAGE"
7878
android:exported="true"
79-
android:screenOrientation="portrait"
79+
8080
android:theme="@style/AppTheme">
8181
<intent-filter>
8282
<action android:name="package.OtherActivity" />
@@ -86,7 +86,7 @@
8686
android:name=".activities.tables.IonActivity"
8787
android:label="IONPAGE"
8888
android:exported="true"
89-
android:screenOrientation="portrait"
89+
9090
android:theme="@style/AppTheme">
9191
<intent-filter>
9292
<action android:name="package.OtherActivity" />
@@ -96,7 +96,7 @@
9696
android:name=".settings.ExperimentalActivity"
9797
android:label="EXPERIMENTAL_PAGE"
9898
android:exported="true"
99-
android:screenOrientation="portrait"
99+
100100
android:theme="@style/AppTheme">
101101
<intent-filter>
102102
<action android:name="package.OtherActivity" />
@@ -106,7 +106,7 @@
106106
android:name=".activities.SolubilityActivity"
107107
android:label="SOLUBILITYPAGE"
108108
android:exported="true"
109-
android:screenOrientation="portrait">
109+
>
110110
<intent-filter>
111111
<action android:name="package.OtherActivity" />
112112
</intent-filter>
@@ -115,7 +115,7 @@
115115
android:name=".activities.CalculatorActivity"
116116
android:label="CALCULATORPAGE"
117117
android:exported="true"
118-
android:screenOrientation="portrait"
118+
119119
android:theme="@style/AppTheme">
120120
<intent-filter>
121121
<action android:name="package.OtherActivity" />
@@ -125,7 +125,7 @@
125125
android:name=".activities.tables.DictionaryActivity"
126126
android:label="DICTIONARYPAGE"
127127
android:exported="true"
128-
android:screenOrientation="portrait"
128+
129129
android:theme="@style/AppTheme">
130130
<intent-filter>
131131
<action android:name="package.OtherActivity" />
@@ -135,7 +135,7 @@
135135
android:name=".activities.IsotopesActivityExperimental"
136136
android:label="ISOTPOESPAGEEXP"
137137
android:exported="true"
138-
android:screenOrientation="portrait"
138+
139139
android:theme="@style/AppTheme">
140140
<intent-filter>
141141
<action android:name="package.OtherActivity" />
@@ -145,7 +145,7 @@
145145
android:name=".activities.settings.AboutActivity"
146146
android:label="ABOUTPAGE"
147147
android:exported="true"
148-
android:screenOrientation="portrait"
148+
149149
android:theme="@style/AppTheme">
150150
<intent-filter>
151151
<action android:name="package.OtherActivity" />
@@ -155,7 +155,7 @@
155155
android:name=".activities.TableActivity"
156156
android:label="TABLEPAGE"
157157
android:exported="true"
158-
android:screenOrientation="portrait"
158+
159159
android:theme="@style/AppTheme">
160160
<intent-filter>
161161
<action android:name="package.OtherActivity" />
@@ -165,7 +165,7 @@
165165
android:name=".activities.tables.ElectrodeActivity"
166166
android:label="ELECTRODEPAGE"
167167
android:exported="true"
168-
android:screenOrientation="portrait"
168+
169169
android:theme="@style/AppTheme">
170170
<intent-filter>
171171
<action android:name="package.OtherActivity" />
@@ -175,7 +175,7 @@
175175
android:name=".activities.settings.SubmitActivity"
176176
android:label="SUBMITPAGE"
177177
android:exported="true"
178-
android:screenOrientation="portrait"
178+
179179
android:theme="@style/AppTheme"
180180
android:windowSoftInputMode="adjustNothing">
181181
<intent-filter>
@@ -186,7 +186,7 @@
186186
android:name=".activities.settings.ProActivity"
187187
android:label="SUBMITPAGE"
188188
android:exported="true"
189-
android:screenOrientation="portrait"
189+
190190
android:theme="@style/AppTheme"
191191
android:windowSoftInputMode="adjustNothing">
192192
<intent-filter>
@@ -197,7 +197,7 @@
197197
android:name=".activities.settings.LicensesActivity"
198198
android:label="LICENSESPAGE"
199199
android:exported="true"
200-
android:screenOrientation="portrait"
200+
201201
android:theme="@style/AppTheme"
202202
android:windowSoftInputMode="adjustNothing">
203203
<intent-filter>
@@ -208,7 +208,7 @@
208208
android:name=".activities.tables.EquationsActivity"
209209
android:label="EQUATIONSACTIVITY"
210210
android:exported="true"
211-
android:screenOrientation="portrait"
211+
212212
android:theme="@style/AppTheme"
213213
android:windowSoftInputMode="adjustNothing">
214214
<intent-filter>
@@ -219,7 +219,7 @@
219219
android:name=".activities.tables.phActivity"
220220
android:label="PHACTIVITY"
221221
android:exported="true"
222-
android:screenOrientation="portrait"
222+
223223
android:theme="@style/AppTheme"
224224
android:windowSoftInputMode="adjustNothing">
225225
<intent-filter>
@@ -230,7 +230,7 @@
230230
android:name=".activities.tables.PoissonActivity"
231231
android:label="POISSONACTIVITY"
232232
android:exported="true"
233-
android:screenOrientation="portrait"
233+
234234
android:theme="@style/AppTheme"
235235
android:windowSoftInputMode="adjustNothing">
236236
<intent-filter>
@@ -241,7 +241,7 @@
241241
android:name=".activities.settings.UnitActivity"
242242
android:label="activity_unit"
243243
android:exported="true"
244-
android:screenOrientation="portrait"
244+
245245
android:theme="@style/AppTheme"
246246
android:windowSoftInputMode="adjustNothing">
247247
<intent-filter>
@@ -252,7 +252,7 @@
252252
android:name=".activities.tables.NuclideActivity"
253253
android:label="activity_nuclide"
254254
android:exported="true"
255-
android:screenOrientation="portrait"
255+
256256
android:theme="@style/AppTheme"
257257
android:windowSoftInputMode="adjustNothing">
258258
<intent-filter>

app/src/main/java/com/jlindemann/science/activities/MainActivity.kt

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@ import com.jlindemann.science.animations.Anim
2929
import com.jlindemann.science.extensions.TableExtension
3030
import com.jlindemann.science.model.Element
3131
import com.jlindemann.science.model.ElementModel
32+
import com.jlindemann.science.model.HoverFilterMenu
33+
import com.jlindemann.science.model.HoverFilterMenuList
3234
import com.jlindemann.science.preferences.ElectronegativityPreference
3335
import com.jlindemann.science.preferences.ElementSendAndLoad
36+
import com.jlindemann.science.preferences.ProVersion
3437
import com.jlindemann.science.preferences.SearchPreferences
3538
import com.jlindemann.science.preferences.ThemePreference
39+
import com.jlindemann.science.preferences.hideNavPreference
3640
import com.jlindemann.science.utils.TabUtil
3741
import com.jlindemann.science.utils.Utils
3842
import com.sothree.slidinguppanel.SlidingUpPanelLayout
@@ -85,19 +89,20 @@ class MainActivity : TableExtension(), ElementAdapter.OnElementClickListener2 {
8589
findViewById<SlidingUpPanelLayout>(R.id.sliding_layout).panelState = PanelState.COLLAPSED
8690
searchFilter(elements, recyclerView)
8791
mediaListeners()
88-
hoverListeners(elements)
8992
initName(elements)
9093
findViewById<FloatingActionButton>(R.id.more_btn).setOnClickListener { openHover() }
9194
findViewById<TextView>(R.id.hover_background).setOnClickListener { closeHover() }
9295
findViewById<Button>(R.id.random_btn).setOnClickListener { getRandomItem() }
9396
findViewById<ConstraintLayout>(R.id.view_main).systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
9497

9598
//Check if PRO version and if make changes:
96-
val proPref = ElectronegativityPreference(this)
99+
val proPref = ProVersion(this)
97100
var proPrefValue = proPref.getValue()
98101
if (proPrefValue==100) {
99102
proChanges()
100103
}
104+
hoverListeners(elements, proPrefValue)
105+
101106

102107
val handler = android.os.Handler()
103108
handler.postDelayed({
@@ -113,8 +118,8 @@ class MainActivity : TableExtension(), ElementAdapter.OnElementClickListener2 {
113118
mScale += scale
114119
if (mScale < 1f)
115120
mScale = 1f
116-
if (mScale > 12.5f)
117-
mScale = 12.5f
121+
if (mScale > 1f) //temp disabled, 12.5 default
122+
mScale = 1f
118123
val scaleAnimation = ScaleAnimation(
119124
1f / pScale,
120125
1f / mScale,
@@ -140,19 +145,28 @@ class MainActivity : TableExtension(), ElementAdapter.OnElementClickListener2 {
140145
return true
141146
}
142147
})
148+
val hideNavPref = hideNavPreference(this)
143149

144150
findViewById<TwoWayNestedScrollView>(R.id.scrollView).getViewTreeObserver()
145151
.addOnScrollChangedListener(object : OnScrollChangedListener {
146152
var y = 0f
147153
override fun onScrollChanged() {
148-
if (findViewById<TwoWayNestedScrollView>(R.id.scrollView).getScrollY() > y) {
149-
Utils.fadeOutAnim(findViewById<FrameLayout>(R.id.nav_bar_main), 150)
150-
Utils.fadeOutAnim(findViewById<FloatingActionButton>(R.id.more_btn), 150)
151-
} else {
152-
Utils.fadeInAnim(findViewById<FrameLayout>(R.id.nav_bar_main), 150)
153-
Utils.fadeInAnim(findViewById<FloatingActionButton>(R.id.more_btn), 150)
154+
val hideNavPrefValue = hideNavPref.getValue()
155+
156+
if (hideNavPrefValue == 1) {
157+
if (findViewById<TwoWayNestedScrollView>(R.id.scrollView).getScrollY() > y) {
158+
Utils.fadeOutAnim(findViewById<FrameLayout>(R.id.nav_bar_main), 150)
159+
Utils.fadeOutAnim(
160+
findViewById<FloatingActionButton>(R.id.more_btn),
161+
150
162+
)
163+
} else {
164+
Utils.fadeInAnim(findViewById<FrameLayout>(R.id.nav_bar_main), 150)
165+
Utils.fadeInAnim(findViewById<FloatingActionButton>(R.id.more_btn), 150)
166+
}
167+
y = findViewById<TwoWayNestedScrollView>(R.id.scrollView).getScrollY()
168+
.toFloat()
154169
}
155-
y = findViewById<TwoWayNestedScrollView>(R.id.scrollView).getScrollY().toFloat()
156170
}
157171
})
158172

@@ -364,7 +378,7 @@ class MainActivity : TableExtension(), ElementAdapter.OnElementClickListener2 {
364378
}
365379
}
366380

367-
private fun hoverListeners(elements: ArrayList<Element>) {
381+
private fun hoverListeners(elements: ArrayList<Element>, proValue: Int) {
368382
findViewById<TextView>(R.id.h_name_btn).setOnClickListener { initName(elements) }
369383
findViewById<TextView>(R.id.h_group_btn).setOnClickListener { initGroups(elements) }
370384
findViewById<TextView>(R.id.h_electronegativity_btn).setOnClickListener { initElectro(elements) }
@@ -376,6 +390,33 @@ class MainActivity : TableExtension(), ElementAdapter.OnElementClickListener2 {
376390
findViewById<TextView>(R.id.h_fusion_btn).setOnClickListener { initHeat(elements) }
377391
findViewById<TextView>(R.id.h_specific_btn).setOnClickListener { initSpecific(elements) }
378392
findViewById<TextView>(R.id.h_vaporizaton_btn).setOnClickListener { initVape(elements) }
393+
findViewById<TextView>(R.id.h_electrical_type_btn).setOnClickListener { initTableChange(elements, "electrical_type") }
394+
395+
//Check if user has PRO version on not and give additional features if.
396+
findViewById<TextView>(R.id.h_poisson_ratio_btn).setOnClickListener {
397+
if (proValue == 1) {
398+
val intent = Intent(this, ProActivity::class.java)
399+
startActivity(intent) }
400+
if (proValue == 100) { initTableChange(elements, "poisson_ratio") }
401+
}
402+
findViewById<TextView>(R.id.h_young_modulus_btn).setOnClickListener {
403+
if (proValue == 1) {
404+
val intent = Intent(this, ProActivity::class.java)
405+
startActivity(intent) }
406+
if (proValue == 100) { initTableChange(elements, "young_modulus") }
407+
}
408+
findViewById<TextView>(R.id.h_bulk_modulus_btn).setOnClickListener {
409+
if (proValue == 1) {
410+
val intent = Intent(this, ProActivity::class.java)
411+
startActivity(intent) }
412+
if (proValue == 100) { initTableChange(elements, "bulk_modulus") }
413+
}
414+
findViewById<TextView>(R.id.h_shear_modulus_btn).setOnClickListener {
415+
if (proValue == 1) {
416+
val intent = Intent(this, ProActivity::class.java)
417+
startActivity(intent) }
418+
if (proValue == 100) { initTableChange(elements, "shear_modulus") }
419+
}
379420
}
380421

381422
private fun setupNavListeners() {

0 commit comments

Comments
 (0)