Skip to content

Commit

Permalink
Update v1.8-beta
Browse files Browse the repository at this point in the history
Added
  - Various Clock options including skins, motion type and other customizations
  - Dark Mode both manual and auto based on system theme
  - Settings screen
  - 7-inches tablet support
  - Bottom navigation panel for quickly switching panels

Changes
  - Navigation panel removed for causing issues with various Android navigation methods
  - Major UI changes
     - Bottom Navigation replaced Sliding Navigation Panel
     - UI overhaul, more minimalism and less clutter
     - More smooth animations everywhere

Fixes
  - Many bugs fixes and improvements
  • Loading branch information
Hamza417 committed Oct 31, 2020
1 parent 21cf268 commit dd9a44f
Show file tree
Hide file tree
Showing 165 changed files with 10,870 additions and 3,071 deletions.
31 changes: 23 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,34 @@ android {
applicationId "app.simple.positional"
minSdkVersion 21
targetSdkVersion 29
versionCode 6
versionName "v1.7-beta"
versionCode 7
versionName "v1.8-beta"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

flavorDimensions "version"
productFlavors {
lite {
dimension "version"
applicationIdSuffix ".lite"
versionNameSuffix "-lite"
}
full {
dimension "version"
versionNameSuffix "-full"
}
}

buildTypes {
release {
minifyEnabled true
shrinkResources true
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}

debug {
applicationIdSuffix ".debug"
}
}

compileOptions {
Expand Down Expand Up @@ -66,12 +83,10 @@ dependencies {

implementation 'org.shredzone.commons:commons-suncalc:3.4'

implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:4.1.2'

implementation 'nl.psdcompany:duo-navigation-drawer:3.0.0'
implementation "androidx.navigation:navigation-ui-ktx:2.3.1"

// debugImplementation because LeakCanary should only run in debug builds.
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.5'
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.5'
}

repositories {
Expand Down
Binary file added app/src/debug/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
5 changes: 5 additions & 0 deletions app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file added app/src/debug/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/debug/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/debug/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/debug/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/src/debug/res/values/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#F6F6F6</color>
</resources>
Binary file added app/src/full/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/src/full/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
5 changes: 5 additions & 0 deletions app/src/full/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file added app/src/full/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/full/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/full/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/full/res/mipmap-xxhdpi/ic_launcher.png
4 changes: 4 additions & 0 deletions app/src/full/res/values/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#F2F2F2</color>
</resources>
Binary file added app/src/lite/ic_launcher-playstore.png
5 changes: 5 additions & 0 deletions app/src/lite/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
5 changes: 5 additions & 0 deletions app/src/lite/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file added app/src/lite/res/mipmap-hdpi/ic_launcher.png
Binary file added app/src/lite/res/mipmap-mdpi/ic_launcher.png
Binary file added app/src/lite/res/mipmap-xhdpi/ic_launcher.png
Binary file added app/src/lite/res/mipmap-xxhdpi/ic_launcher.png
Binary file added app/src/lite/res/mipmap-xxxhdpi/ic_launcher.png
4 changes: 4 additions & 0 deletions app/src/lite/res/values/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#F6F6F6</color>
</resources>
File renamed without changes.
File renamed without changes.
File renamed without changes.
143 changes: 38 additions & 105 deletions app/src/main/java/app/simple/positional/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,94 +5,61 @@ import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.content.res.Configuration
import android.graphics.PixelFormat
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.PowerManager
import android.provider.Settings
import android.view.MenuItem
import android.view.WindowManager
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import app.simple.positional.adapters.MenuAdapter
import app.simple.positional.callbacks.BottomSheetSlide
import app.simple.positional.callbacks.PermissionCallbacks
import app.simple.positional.dialogs.PermissionDialog
import app.simple.positional.preference.ViewPagerPreference
import app.simple.positional.preference.FragmentPreferences
import app.simple.positional.preference.MainPreferences
import app.simple.positional.services.CompassService
import app.simple.positional.services.LocationService
import app.simple.positional.smoothbottombar.SmoothBottomBar
import app.simple.positional.ui.AppSettings
import app.simple.positional.ui.Clock
import app.simple.positional.ui.Compass
import app.simple.positional.ui.GPS
import com.google.android.material.appbar.MaterialToolbar
import nl.psdcompany.duonavigationdrawer.views.DuoDrawerLayout
import nl.psdcompany.duonavigationdrawer.views.DuoMenuView
import nl.psdcompany.duonavigationdrawer.widgets.DuoDrawerToggle


class MainActivity : AppCompatActivity(), PermissionCallbacks, DuoMenuView.OnMenuClickListener {
class MainActivity : AppCompatActivity(), PermissionCallbacks, BottomSheetSlide {

private var locationIntent: Intent? = null
private var compassIntent: Intent? = null

private lateinit var drawer: DuoDrawerLayout
private lateinit var toggle: DuoDrawerToggle
private lateinit var navMenu: DuoMenuView
private lateinit var toolbar: MaterialToolbar

private lateinit var menuAdapter: MenuAdapter
private lateinit var bottomBar: SmoothBottomBar

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
window.setFormat(PixelFormat.RGBA_8888)

val mTitles = resources.getStringArray(R.array.menuOptions).toList()
// This will keep the screen on during test
if (BuildConfig.DEBUG) {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}

val title: ArrayList<String> = ArrayList()
app.simple.positional.theme.setTheme(MainPreferences().getCurrentTheme(baseContext))

for (i in mTitles.indices) {
title.add(mTitles[i])
println(mTitles[i])
}
setContentView(R.layout.activity_main)

window.setFormat(PixelFormat.RGBA_8888)

bottomBar = findViewById(R.id.bottom_bar)
locationIntent = Intent(applicationContext, LocationService::class.java)
compassIntent = Intent(applicationContext, CompassService::class.java)

toolbar = findViewById(R.id.toolbar)
//setSupportActionBar(toolbar)
//toolbar.overflowIcon = ContextCompat.getDrawable(this, R.drawable.ic_drag_handle)
toolbar.inflateMenu(R.menu.toolbar_items)

drawer = findViewById(R.id.drawer)
navMenu = drawer.menuView as DuoMenuView
menuAdapter = MenuAdapter(title)
navMenu.adapter = menuAdapter
navMenu.setOnMenuClickListener(this)
toggle = DuoDrawerToggle(this, drawer, toolbar, R.string.nav_open, R.string.nav_close)
drawer.setDrawerListener(toggle)
toggle.syncState()
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setHomeButtonEnabled(true)
//checkBattery()

runApp()
checkRunTimePermission()

navMenu.setOnClickListener {
if (drawer.isDrawerOpen) {
drawer.closeDrawer()
}
}

toolbar.setOnMenuItemClickListener { item ->
if (item.itemId == R.id.menu_main_setting) {
if (ViewPagerPreference().getCurrentPage(baseContext) == 1) {
(supportFragmentManager.findFragmentByTag("compass") as Compass?)?.openCompassMenu(findViewById(R.id.menu_main_setting))
}
}
true
bottomBar.setOnItemSelectedListener {
setFragment(it)
FragmentPreferences().setCurrentPage(baseContext, it)
}
}

Expand All @@ -106,32 +73,6 @@ class MainActivity : AppCompatActivity(), PermissionCallbacks, DuoMenuView.OnMen
stopService()
}

override fun onBackPressed() {
if (drawer.isDrawerOpen) {
drawer.closeDrawer()
} else {
return super.onBackPressed()
}
}

override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)
toggle.syncState()
}

override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
toggle.onConfigurationChanged(newConfig)
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
return if (toggle.onOptionsItemSelected(item)) {
true
} else {
super.onOptionsItemSelected(item)
}
}

private fun checkRunTimePermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ActivityCompat.checkSelfPermission(applicationContext, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
Expand All @@ -158,7 +99,8 @@ class MainActivity : AppCompatActivity(), PermissionCallbacks, DuoMenuView.OnMen
}

private fun runApp() {
setFragment(ViewPagerPreference().getCurrentPage(this))
setFragment(FragmentPreferences().getCurrentPage(this))
bottomBar.itemActiveIndex = FragmentPreferences().getCurrentPage(this)
}

private fun runService() {
Expand Down Expand Up @@ -200,26 +142,7 @@ class MainActivity : AppCompatActivity(), PermissionCallbacks, DuoMenuView.OnMen
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION), DEFAULT_PERMISSION_REQUEST_CODE)
}

override fun onFooterClicked() {
finish()
println("callled")
}

override fun onHeaderClicked() {

}

override fun onOptionClicked(position: Int, objectClicked: Any?) {
Handler().postDelayed({
setFragment(position)
}, 200)

drawer.closeDrawer()
ViewPagerPreference().setCurrentPage(this, position)
}

private fun setFragment(position: Int) {
menuAdapter.setViewSelected(position, true)
when (position) {
0 -> {
val clock = supportFragmentManager.findFragmentByTag("clock") as Clock?
Expand All @@ -235,8 +158,6 @@ class MainActivity : AppCompatActivity(), PermissionCallbacks, DuoMenuView.OnMen
.replace(R.id.containers, clock, "clock")
.commit()
}
toolbar.setLogo(R.drawable.ic_clock)
toolbar.title = " Clock"
}
1 -> {
val compass = supportFragmentManager.findFragmentByTag("compass") as Compass?
Expand All @@ -252,8 +173,6 @@ class MainActivity : AppCompatActivity(), PermissionCallbacks, DuoMenuView.OnMen
.replace(R.id.containers, compass, "compass")
.commit()
}
toolbar.setLogo(R.drawable.ic_compass)
toolbar.title = " Compass"
}
2 -> {
val gps = supportFragmentManager.findFragmentByTag("gps") as GPS?
Expand All @@ -269,15 +188,29 @@ class MainActivity : AppCompatActivity(), PermissionCallbacks, DuoMenuView.OnMen
.replace(R.id.containers, gps, "gps")
.commit()
}
toolbar.setLogo(R.drawable.ic_calibration)
toolbar.title = " GPS"
}
3 -> {
val settings = supportFragmentManager.findFragmentByTag("settings") as AppSettings?

if (settings == null) {
supportFragmentManager.beginTransaction()
.setCustomAnimations(R.anim.dialog_in, R.anim.dialog_out)
.replace(R.id.containers, AppSettings(), "settings")
.commit()
} else {
supportFragmentManager.beginTransaction()
.setCustomAnimations(R.anim.dialog_in, R.anim.dialog_out)
.replace(R.id.containers, settings, "settings")
.commit()
}
}
4 -> {

}
}
}

override fun onBottomSheetSliding(slideOffset: Float) {
bottomBar.translationY = (bottomBar.height * slideOffset)
}
}
Loading

0 comments on commit dd9a44f

Please sign in to comment.