-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DST offset config
- Loading branch information
Showing
8 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
salah/app/src/main/java/com/tazzix/wear/salah/ConfigDSTActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.tazzix.wear.salah | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.util.Log | ||
import androidx.fragment.app.FragmentActivity | ||
|
||
import androidx.wear.widget.WearableLinearLayoutManager | ||
import androidx.wear.widget.WearableRecyclerView | ||
|
||
|
||
class ConfigDSTActivity : FragmentActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_config) | ||
|
||
val recyclerView: WearableRecyclerView = findViewById(R.id.config_menu_view) | ||
recyclerView.setHasFixedSize(true) | ||
recyclerView.isEdgeItemsCenteringEnabled = true | ||
recyclerView.layoutManager = WearableLinearLayoutManager(this) | ||
|
||
val menuItems: ArrayList<MenuItem> = ArrayList() | ||
val methods = resources.getStringArray(R.array.array_dst_offsets) | ||
|
||
for (method in methods) { | ||
menuItems.add(MenuItem(android.R.drawable.ic_menu_info_details, "", method)) | ||
} | ||
|
||
recyclerView.adapter = MenuAdapter(this, R.layout.notitle_item, menuItems, object: MenuAdapter.AdapterCallback { | ||
override fun onItemClicked(menuPosition: Int?) { | ||
val sharedPreferences = getSharedPreferences("SALAH_LOCATION", Context.MODE_PRIVATE) | ||
sharedPreferences.edit().putInt("DST_OFFSET", menuPosition!!).apply() | ||
finish() | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters