ก๊วนซอฟท์แวร์ </softganz> SoftGang (Gang Software)

Web &amp; Software Developer Gang.

603 items|« First « Prev 3 4 (5/61) 6 7 Next » Last »|
โดย Little Bear on 30 ก.ย. 63 11:18

ตอนที่เริ่มสร้าง App ใหม่ โดยใช้ Template Buttom Navigator Activity นั้นจะไม่มีปุ่มเมนูบนด้านขวาของ Action Bar หากเราต้องการใช้ ก็จำเป็นต้องสร้างขึ้นมาเอง

เริ่มด้วยการสร้าง resource file ของ options menu ก่อน

Menu -> New -> Resource File File name : options_menu Resource type : Menu

options_menu.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
    android:id="@+id/searchFragment"
    android:icon="@drawable/ic_baseline_search_24"
    android:title="@string/action_search"
    app:showAsAction="always" />
<item
    android:id="@+id/settingsFragment"
    android:icon="@drawable/ic_baseline_settings_24"
    android:title="@string/action_settings"
    app:iconTint="@color/yourcolor"
    app:showAsAction="ifRoom" />
<item
    android:id="@+id/aboutUsFragment"
    android:icon="@drawable/ic_baseline_info_24"
    android:title="@string/action_aboutus" />
</menu>

MainActivity.kt

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
    val inflater = menuInflater
    inflater.inflate(R.menu.options_menu, menu)
    if (menu is MenuBuilder) {
        menu.setOptionalIconsVisible(true)
    }
    return super.onCreateOptionsMenu(menu)
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
    when (item.itemId) {
        R.id.aboutUsFragment -> {
            toast("About Us")
        }
    }
    return super.onOptionsItemSelected(item)
}

เพิ่มรายการในเมนู

menu?.apply {
// ----------------- add a new item to menu ----------------
// add new item to menu
val newItem:MenuItem = menu.add(
    Menu.NONE, // group id
    2, // item id
    1, // order
    "New Item" // title
)

// set new item's icon
newItem.setIcon(R.drawable.ic_check_circle)

// set new item show as action flags
newItem.setShowAsActionFlags(
    MenuItem.SHOW_AS_ACTION_ALWAYS or
    MenuItem.SHOW_AS_ACTION_WITH_TEXT
)

// menu new item click listener
newItem.setOnMenuItemClickListener {
    Toast.makeText(this@MainActivity, "New Item Clicked", Toast.LENGTH_SHORT).show()
    true
}

// ----------------- remove an item from menu ----------------
menu.removeItem(R.id.cancel)

// ----------------- update an item in menu ----------------
menu.findItem(R.id.settings).apply {
    title = "Updated Title"
}

ตรวจสอบว่า menu ได้สร้างหรือยัง?

::actionMenu.isInitialized

ตรวจสอบว่า key ของ Array มีหรือไม่?

options.has("menu")

การเข้าถึง R -> Resource

android.R.attr.actionBarSize

ที่มา

โดย Little Bear on 23 ก.ย. 63 17:29

ช่วงนี้กำลังพัฒนา Green Smile App เวอร์ชั่นใหม่ โดยเปลี่ยนแปลงรูปแบบมาใช้ Fragment แทน

หลังจากทำไปพักหนึ่ง ก็มีปัญหาในการสื่อสาร/เข้าถึงข้อมูลระหว่า Activity กับ Fragment

ขอบคุณบทความดี ๆ จาก Akexorcist เรื่อง Let’s Fragment — วิธีการรับส่งข้อมูลของ Fragment แถมในบทความยังมีบทความในซีรีย์เดียวกันอีกหลายเรื่อง เช่น

  • มารู้จักกับ Fragment กันเถอะ~
  • เริ่มต้นง่ายๆกับ Fragment แบบพื้นฐาน
  • ว่าด้วยเรื่องการสร้าง Fragment จาก Constructor ที่ถูกต้อง
  • รู้จักกับ FragmentTransaction สำหรับการแสดง Fragment [ตอนที่ 1]
  • รู้จักกับ FragmentTransaction สำหรับการแสดง Fragment [ตอนที่ 2]
  • Lifecycle ของ Fragment (Fragment Lifecycle)
  • วิธีการรับส่งข้อมูลของ Fragment
  • มาทำ View Pager กันเถิดพี่น้อง~ [ตอนที่ 1]
  • มาทำ View Pager กันเถิดพี่น้อง~ [ตอนที่ 2]
  • เพิ่มลูกเล่นให้กับ View Pager ด้วย Page Transformer

ลองตามไปอ่านกันดูนะครับ

โดย Little Bear on 20 ก.ย. 63 18:12

fun evaluateJsFromNative(command: String,
    webView: WebView, function: (value : Boolean) -> Unit ) {
    webView.evaluateJavascript("(function() { return $command; })();") {
        s -> function(s.toBoolean())
    }
}
override fun onBackPressed() {
    var boxCheck = "document.getElementsByClassName('box-page')[0].tagName == 'DIV';"
    evaluateJsFromNative(boxCheck, myWebView) {
        if (it) {
            evaluateJsFromNative("$.colorbox.close()", myWebView){}
        } else {
            super.onBackPressed()
        }
    }
}

โดย Little Bear on 10 ส.ค. 63 09:39
[Intro]
C Cmaj7 Cadd9 C Asus2 Asus4 Am Asus2
Cadd9 C Cmaj7 Cadd9 Am Asus2 Asus4 Am

  C    G/B  Am    G        Dm7          Am I close my eyes only for a moment and a moment´s gone. C  G/B  Am    G            Dm7          Am All my dreams pass before my eyes a curiosity.
D  G        Am    D            G          Am Dust in the wind, all we are is dust in the wind.
C  G/B  Am    G            Dm7            Am Same old song, just a drop of water in the endless sea. C  G/B  Am  G                Dm7              Am All we do, crumbles to the ground though we refuse to see.
D  G        Am    D            G          Am Dust in the wind, all we are is dust in the wind.
C      G/B  Am  G                Dm7          Am Don't hang on, nothing last´s forever but the earth and sky. C  G5      Am  G                  Dm7        Am It slips away all your money won´t another minute buy.
D  G        Am    D            G          Am Dust in the wind, all we are is dust in the wind D  G        Am    D            G          Am Dust in the wind, everything is dust in the wind.

Ultimate Guitar

โดย Little Bear on 9 ก.ค. 63 11:01

Application Green Smile ที่เราสร้างขึ้นมาเพื่อให้เป็นเครื่องมือหนึ่งของแพลตฟอร์ม ที่จะช่วยให้เกษตรกรสามารถเชื่อมโยงผลผลิตไปสู่ผู้บริโภคนะครับ


เครื่องมือนี้ทำอะไรได้บ้าง?

  • จะเป็นตัวช่วยให้กลุ่มเกษตรกรหรือเกษตรกรสามารถบริหารจัดการแปลงที่ดินที่มีอยู่ โดยการบันทึกผลผลิตในแต่ละรุ่นทั้งประเภท จำนวน วันเก็บเกี่ยว รวมถึงการให้ผู้บริโภคสามารถจองผลผลิตดังกล่าวได้ ผู้บริโภคสามารถติดตามกิจกรรมของการผลิตในแต่ละแปลงได้

นอกจากนี้เรายังมีระบบซื้อขายสินค้าเพื่อให้เกษตรกรสามารถต่อยอดขายสินค้าออนไลน์ได้ด้วย


Application Green Smile สามารถนำไปประยุกต์ให้งานกับเกษตรกรกลุ่มไหนได้บ้าง?

  • สามารถนำไปใช้กับสวนยางได้ ในระบบการขนส่งน้ำยางจากแปลงยางได้ทันเวลาได้น้ำยางที่มีคุณภาพ การเก็บข้อมูลพืชร่วมยาง รวมทั้งธนาคารต้นไม้

  • เราสามารถนำไปใช้งานในการบริหารจัดการเกษตรได้หลากหลายรูปแบบ เช่น เกษตรสวนยางพารา(FSC), เกษตรกรอินทรีย์(PGS,GAP), ธนาคารต้นไม้

  • ผลผลิต รายวัน,รายสัปดาห์,รายเดือน,รายปี,ระยะยาว(หลังเกษียณ)

ดูรายละเอียด Application Green Smile

โดย Little Bear on 22 มิ.ย. 63 23:29

umount -l /dev/sda1
e2fsck -cfpv /dev/sda1 > chresult.txt&

โดย Little Bear on 10 ธ.ค. 62 09:26

เลือกเมนู New Value Resource

กำหนดค่า

Local

th

ตั้งชื่อ strings_th.xml

โดย Little Bear on 5 ธ.ค. 62 09:22

cd /usr/local/directadmin/data/admin
echo -n "" > tickets.list

โดย Little Bear on 17 พ.ย. 62 11:41

What is Google Data Studio?

Google Data Studio is a FREE data visualization tool that allows you to import data from multiple sources and visualize them on a report that is easy to read and share. You can import data from any source using Google Sheets or Data Connectors to create the report you want.

What is Google Colaboratory?

Colaboratory is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud. With Colaboratory you can write and execute code, save and share your analyses, and access powerful computing resources, all for free from your browser.


Resource

โดย Little Bear on 9 พ.ย. 62 15:38




603 items|« First « Prev 3 4 (5/61) 6 7 Next » Last »|