This file contains hidden or 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
... | |
else: #if the request is to get, set, or delete | |
if self.leader: | |
self.current_operation = string_operation | |
key_value_store.write_to_log(string_operation, term_absent=True) | |
if self.current_operation.split(" ")[0] in ["set", "delete"]: | |
broadcast(self, with_return_address(self, "append_entries [" + self.current_operation + "]")) | |
send_pending = False |
This file contains hidden or 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
... | |
//to put a checkmark on the trailing side of the view | |
self.accessoryType = .checkmark | |
//to remove an accessory (such as a checkmark) from the trailing side of the view | |
self.accessoryType = .none | |
... |
This file contains hidden or 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
... | |
//to set the little flame icon, which is one of the iOS system icons (there are many you can use) | |
let flame = UIImageView(frame: CGRect(x: 0, y: 65, width: 25, height: 30)) | |
flame.image = UIImage(systemName: "flame.fill") | |
flame.tintColor = .systemRed | |
self.accessoryView = flame | |
//to remove an icon that you have set on the cell view | |
self.accessoryView = .none |
This file contains hidden or 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
... | |
<string name="greeting">Hello, %1$s!</string> | |
... |
This file contains hidden or 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
class MainActivity : AppCompatActivity(), Updatable { | |
... | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
//CHANGING THE TEXT OF THE TOP BAR | |
val toolbarTitle = findViewById<TextView>(R.id.title) | |
val preferences = PreferenceManager.getDefaultSharedPreferences(this) |
This file contains hidden or 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
class LoginActivity : AppCompatActivity() { | |
... | |
fun authenticate() { | |
... | |
if (session?.token != null) { | |
//HERE'S WHERE WE SAVE THE SESSION DAA | |
saveSessionData(session!!.name, session!!.token) | |
startActivity(Intent(this@LoginActivity, MainActivity::class.java)) |
This file contains hidden or 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
import androidx.preference.PreferenceManager | |
//SEE IMPORT ABOVE | |
class LoginActivity : AppCompatActivity() { | |
... | |
private fun saveSessionData(name: String?, token: String?) { | |
val preferences = | |
PreferenceManager.getDefaultSharedPreferences(this) |
This file contains hidden or 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
dependencies { | |
... | |
implementation "androidx.preference:preference-ktx:1.1.0" | |
} |
This file contains hidden or 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
package com.chelseatroy.canary | |
class LoginActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
... | |
signInButton.setOnClickListener { view -> | |
if (isNetworkConnected()) { | |
//HERE'S WHERE WE SHOW THE PROGRESS BAR | |
progressBar.visibility = View.VISIBLE |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
... | |
android:layout_height="match_parent"> | |
... | |
<ProgressBar | |
android:id="@+id/progressBar" | |
style="?android:attr/progressBarStyle" |