Browse Source

firt init

Dola TENG 1 year ago
parent
commit
93d0cf3940

+ 0 - 1
.idea/gradle.xml

@@ -11,7 +11,6 @@
           <set>
           <set>
             <option value="$PROJECT_DIR$" />
             <option value="$PROJECT_DIR$" />
             <option value="$PROJECT_DIR$/app" />
             <option value="$PROJECT_DIR$/app" />
-            <option value="$PROJECT_DIR$/printooth" />
           </set>
           </set>
         </option>
         </option>
       </GradleProjectSettings>
       </GradleProjectSettings>

+ 0 - 1
app/build.gradle

@@ -141,7 +141,6 @@ dependencies {
     implementation 'com.google.code.gson:gson:2.8.6'
     implementation 'com.google.code.gson:gson:2.8.6'
 
 
     //Lib
     //Lib
-    implementation project(path: ':printooth')
     implementation 'com.squareup.picasso:picasso:2.71828'
     implementation 'com.squareup.picasso:picasso:2.71828'
 
 
     testImplementation 'junit:junit:4.13.2'
     testImplementation 'junit:junit:4.13.2'

+ 0 - 2
app/src/main/java/com/sambath/sbc/app/App.kt

@@ -4,7 +4,6 @@ import android.app.Application
 import android.content.Context
 import android.content.Context
 import android.util.Log
 import android.util.Log
 import com.itkacher.okhttpprofiler.OkHttpProfilerInterceptor
 import com.itkacher.okhttpprofiler.OkHttpProfilerInterceptor
-import com.mazenrashed.printooth.Printooth
 import com.sambath.sbc.config.Config
 import com.sambath.sbc.config.Config
 import com.sambath.sbc.BuildConfig
 import com.sambath.sbc.BuildConfig
 import com.sambath.sbc.remote.service.ApiService
 import com.sambath.sbc.remote.service.ApiService
@@ -49,7 +48,6 @@ class App : Application() {
     override fun onCreate() {
     override fun onCreate() {
         super.onCreate()
         super.onCreate()
         ModelPreferencesManager.with(this)
         ModelPreferencesManager.with(this)
-        Printooth.init(this)
         picasso = Picasso.Builder(this).loggingEnabled(true).build()
         picasso = Picasso.Builder(this).loggingEnabled(true).build()
         // FirebaseApp.initializeApp(this)
         // FirebaseApp.initializeApp(this)
         Picasso.setSingletonInstance(picasso)
         Picasso.setSingletonInstance(picasso)

+ 4 - 620
app/src/main/java/com/sambath/sbc/base/BaseFragment.kt

@@ -10,14 +10,6 @@ import android.widget.TextView
 import android.widget.Toast
 import android.widget.Toast
 import androidx.annotation.LayoutRes
 import androidx.annotation.LayoutRes
 import androidx.fragment.app.Fragment
 import androidx.fragment.app.Fragment
-import com.cocking.fight.screen.dialogfragment.StatementDialogViewModel
-import com.mazenrashed.printooth.Printooth
-import com.mazenrashed.printooth.data.printable.Printable
-import com.mazenrashed.printooth.data.printable.TextPrintable
-import com.mazenrashed.printooth.data.printer.DefaultPrinter
-import com.mazenrashed.printooth.utilities.Printing
-import com.sambath.sbc.app.App
-import com.sambath.sbc.app.ShareActivity
 import com.sambath.sbc.remote.LottoSet
 import com.sambath.sbc.remote.LottoSet
 import com.sambath.sbc.remote.ReportOne
 import com.sambath.sbc.remote.ReportOne
 import com.sambath.sbc.remote.User
 import com.sambath.sbc.remote.User
@@ -31,21 +23,21 @@ abstract class BaseFragment(
     @LayoutRes private val layoutRes: Int
     @LayoutRes private val layoutRes: Int
 ) : Fragment() {
 ) : Fragment() {
     private lateinit var user: User
     private lateinit var user: User
-    private var printing: Printing? = null
     override fun onCreate(savedInstanceState: Bundle?) {
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         super.onCreate(savedInstanceState)
-        if (Printooth.hasPairedPrinter()) printing = Printooth.printer()
         user = ModelPreferencesManager.get<User>(Const.USER_KEY)!!
         user = ModelPreferencesManager.get<User>(Const.USER_KEY)!!
     }
     }
 
 
-    fun currencyType() : String{
+    fun currencyType(): String {
         when (user.currencyType) {
         when (user.currencyType) {
             1 -> {//dollar
             1 -> {//dollar
                 return "$"
                 return "$"
             }
             }
+
             2 -> {//riel
             2 -> {//riel
                 return "៛"
                 return "៛"
             }
             }
+
             3 -> {//baht
             3 -> {//baht
                 return "฿"
                 return "฿"
             }
             }
@@ -54,9 +46,7 @@ abstract class BaseFragment(
     }
     }
 
 
     override fun onCreateView(
     override fun onCreateView(
-        inflater: LayoutInflater,
-        container: ViewGroup?,
-        savedInstanceState: Bundle?
+        inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
     ): View? {
     ): View? {
         return inflater.inflate(layoutRes, container, false)
         return inflater.inflate(layoutRes, container, false)
     }
     }
@@ -99,431 +89,6 @@ abstract class BaseFragment(
 
 
     }
     }
 
 
-    fun printSomePrintable(
-        userName: String,
-        ticketID: String,
-        gameID: String,
-        betDate: String,
-        betType: String,
-        betCast: String,
-        winLose: String
-    ) {
-        if (Printooth.hasPairedPrinter() && printing == null) printing = Printooth.printer()
-        if (printing == null) {
-            Toast.makeText(requireContext(), "No printing paired", Toast.LENGTH_SHORT).show()
-        } else {
-            val printables =
-                getSomePrintables(userName, ticketID, gameID, betDate, betType, betCast, winLose)
-            printing?.print(printables)
-        }
-    }
-
-
-    private fun getSomePrintables(
-        userName: String,
-        ticketID: String,
-        gameID: String,
-        betDate: String,
-        betType: String,
-        betCast: String,
-        winLose: String
-    ) = ArrayList<Printable>().apply {
-        add(
-            TextPrintable.Builder()
-                .setText(userName)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setAlignment(DefaultPrinter.ALIGNMENT_CENTER)
-                .setLineSpacing(DefaultPrinter.LINE_SPACING_30)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .build()
-        )
-
-        add(
-            TextPrintable.Builder()
-                .setText("----------------")
-                .setLineSpacing(DefaultPrinter.LINE_SPACING_30)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC1252)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Ticket ID:   $ticketID")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Game ID  :   $gameID")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Date     :   $betDate")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Bet Type :   $betType")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Bet Point:   $betCast")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Win/Lose :   $winLose")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("----------------")
-                .setLineSpacing(DefaultPrinter.LINE_SPACING_30)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("www.wa855.net")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setAlignment(DefaultPrinter.ALIGNMENT_CENTER)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC437)
-                .setNewLinesAfter(1)
-                .build()
-        )
-    }
-
-    fun printCfPrintable(
-        userName: String,
-        fightNo: String,
-        betDate: String,
-        betType: String,
-        amount: String,
-        payout: String
-    ) {
-        if (Printooth.hasPairedPrinter() && printing == null) printing = Printooth.printer()
-        if (printing == null) {
-            Toast.makeText(requireContext(), "No printing paired", Toast.LENGTH_SHORT).show()
-        } else {
-            printing?.print(getCfPrintables(userName, fightNo, betDate, betType, amount, payout))
-        }
-    }
-
-    fun printCfPrintable(
-        user: User,
-        fightNo: String,
-        betDate: String,
-        betType: String,
-        amount: String,
-        payoutRate: String,
-        payout: String,
-        id: String,
-        channelId: Int
-    ) {
-        if (Printooth.hasPairedPrinter() && printing == null) printing = Printooth.printer()
-        if (printing == null) {
-            Toast.makeText(requireContext(), "No printing paired", Toast.LENGTH_SHORT).show()
-        } else {
-            var currencyType: String = ""
-            when (user.currencyType) {
-                1 -> {
-                    currencyType = "Dollar"
-                }
-                2 -> {
-                    currencyType = "Riel"
-                }
-                3 -> {
-                    currencyType = "Baht"
-                }
-            }
-            printing?.print(
-                getCfPrintables(
-                    user.userName,
-                    currencyType,
-                    fightNo,
-                    betDate,
-                    betType,
-                    amount,
-                    payoutRate,
-                    payout,
-                    id,
-                    channelId
-                )
-            )
-        }
-    }
-
-    private fun getCfPrintables(
-        userName: String,
-        currencyType: String,
-        fightNo: String,
-        betDate: String,
-        betType: String,
-        amount: String,
-        payoutRate: String,
-        payout: String,
-        id: String,
-        channelId: Int
-    ) = ArrayList<Printable>().apply {
-        add(
-            TextPrintable.Builder()
-                .setText("SBC2888")
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setAlignment(DefaultPrinter.ALIGNMENT_CENTER)
-                .setLineSpacing(DefaultPrinter.LINE_SPACING_30)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Channel : $channelId")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Bet ID : ${id}")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("----------------")
-                .setLineSpacing(DefaultPrinter.LINE_SPACING_30)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC1252)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Fight No  : $fightNo")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Account:")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText(userName)
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setAlignment(DefaultPrinter.ALIGNMENT_CENTER)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Bet Type : $betType")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Date : $betDate")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-//        add(
-//            TextPrintable.Builder()
-//                .setText("Bet Point")
-//                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-//                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-//                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-//                .setNewLinesAfter(1)
-//                .build()
-//        )
-//        add(
-//            TextPrintable.Builder()
-//                .setText("$amount x $payoutRate")
-//                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-//                .setAlignment(DefaultPrinter.ALIGNMENT_CENTER)
-//                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-//                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-//                .setNewLinesAfter(1)
-//                .build()
-//        )
-        add(
-            TextPrintable.Builder()
-                .setText("Currency Type : $currencyType")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Bet point : $payout")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("----------------")
-                .setLineSpacing(DefaultPrinter.LINE_SPACING_30)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("www.wa855.net")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setAlignment(DefaultPrinter.ALIGNMENT_CENTER)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC437)
-                .setNewLinesAfter(1)
-                .build()
-        )
-    }
-
-    private fun getCfPrintables(
-        userName: String,
-        fightNo: String,
-        betDate: String,
-        betType: String,
-        amount: String,
-        payout: String
-    ) = ArrayList<Printable>().apply {
-        add(
-            TextPrintable.Builder()
-                .setText("SBC2888")
-                .setUnderlined(DefaultPrinter.UNDERLINED_MODE_ON)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setAlignment(DefaultPrinter.ALIGNMENT_CENTER)
-                .setLineSpacing(DefaultPrinter.LINE_SPACING_30)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("----------------")
-                .setLineSpacing(DefaultPrinter.LINE_SPACING_10)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC1252)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Round  : $fightNo")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Date   : $betDate")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Account: $userName")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Type   : $betType")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Bet x Odds:")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("$amount x $payout")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setAlignment(DefaultPrinter.ALIGNMENT_CENTER)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Payout : $amount")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("----------------")
-                .setLineSpacing(DefaultPrinter.LINE_SPACING_10)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("www.wa855.net")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setAlignment(DefaultPrinter.ALIGNMENT_CENTER)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC437)
-                .setNewLinesAfter(1)
-                .build()
-        )
-    }
-
     private fun getLastFourChars(str: String, n: Int): String {
     private fun getLastFourChars(str: String, n: Int): String {
         var lastChars = str
         var lastChars = str
         if (lastChars.length > n) {
         if (lastChars.length > n) {
@@ -531,185 +96,4 @@ abstract class BaseFragment(
         }
         }
         return lastChars
         return lastChars
     }
     }
-
-    fun printSBCPrintable(reportOne: ReportOne, currencyType: Int, channelId: Int) {
-        if (Printooth.hasPairedPrinter() && printing == null) printing = Printooth.printer()
-        if (printing == null) {
-            Toast.makeText(requireContext(), "No printing paired", Toast.LENGTH_SHORT).show()
-        } else {
-            var winOrLose: String = ""
-            var sign: String = ""
-            winOrLose = if (reportOne.is_win == true) {
-                "WIN"
-            } else {
-                "LOSE"
-            }
-            when (currencyType) {
-                1 -> {
-                    sign = "Dollar"
-                }
-                2 -> {
-                    sign = "Riel"
-                }
-                3 -> {
-                    sign = "Baht"
-                }
-            }
-            printing?.print(getSBCPrintables(reportOne, getLastFourChars(reportOne._id, 4), winOrLose, sign, channelId))
-        }
-    }
-
-    private fun getSBCPrintables(
-        reportOne: ReportOne,
-        betId: String,
-        winLose: String,
-        currencyType: String,
-        channelId: Int
-    ) = ArrayList<Printable>().apply {
-        add(
-            TextPrintable.Builder()
-                .setText("SBC2888")
-                .setUnderlined(DefaultPrinter.UNDERLINED_MODE_ON)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setAlignment(DefaultPrinter.ALIGNMENT_CENTER)
-                .setLineSpacing(DefaultPrinter.LINE_SPACING_30)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Channel : $channelId")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Bet ID : $betId")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("----------------")
-                .setLineSpacing(DefaultPrinter.LINE_SPACING_10)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC1252)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Fight No : ${reportOne.fightNo}")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Bet Type : ${reportOne.betName}")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Date : ${reportOne.date}")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Amount : ${reportOne.amount}")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Payout : ${reportOne.payout}")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Cast : ${reportOne.cast}")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Amount Win : ${reportOne.amountWin}")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-
-        add(
-            TextPrintable.Builder()
-                .setText("Currency Type : $currencyType")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Result : ${reportOne.resultName}")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("Win/Lose : $winLose")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setFontSize(DefaultPrinter.FONT_SIZE_SMALL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC850)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("----------------")
-                .setLineSpacing(DefaultPrinter.LINE_SPACING_10)
-                .setNewLinesAfter(1)
-                .build()
-        )
-        add(
-            TextPrintable.Builder()
-                .setText("www.wa855.net")
-                .setEmphasizedMode(DefaultPrinter.EMPHASIZED_MODE_NORMAL)
-                .setAlignment(DefaultPrinter.ALIGNMENT_CENTER)
-                .setFontSize(DefaultPrinter.FONT_SIZE_NORMAL)
-                .setCharacterCode(DefaultPrinter.CHARCODE_PC437)
-                .setNewLinesAfter(1)
-                .build()
-        )
-    }
 }
 }

+ 1 - 26
app/src/main/java/com/sambath/sbc/screen/main/cflive/Betting/CfBetFragment.kt

@@ -359,30 +359,8 @@ class CfBetFragment : BaseFragment(R.layout.fragment_cf_betting) {
                     tv_amount.text = it.data.balance
                     tv_amount.text = it.data.balance
                 }
                 }
                 betAmount = 0
                 betAmount = 0
-//            if (it.channel != null) {
-//                fightNo = it.channel.fightNo
-//                betDate = it.channel.date
-//                val obj = JSONObject()
-//                obj.put(K.ChannelId, it.channel.id)
-//                obj.put(K.TemId, it.channel.temId)
-//                obj.put(K.AmountRed, it.channel.amountRed)
-//                obj.put(K.PayoutRed, it.channel.payoutRed)
-//                obj.put(K.PayoutBlue, it.channel.payoutBlue)
-//                obj.put(K.AmountBlue, it.channel.amountBlue)
-//                shareViewModel.emitCfCreateBetting(obj)
-//            }
                 if (prefHelper.getIsAutoPrint()) {
                 if (prefHelper.getIsAutoPrint()) {
-                    printCfPrintable(
-                        userShare,
-                        it.data.fightNo.toString(),
-                        it.data.time,
-                        it.data.betting,
-                        it.data.amount,
-                        it.data.amount,
-                        it.data.amount,
-                        getLastFourChars(it.data._id, 4),
-                        sharePref.getChannelType()
-                    )
+
                 }
                 }
                 txtMsgAmount.text = ""
                 txtMsgAmount.text = ""
                 edtBettingAmount.setText("")
                 edtBettingAmount.setText("")
@@ -391,14 +369,12 @@ class CfBetFragment : BaseFragment(R.layout.fragment_cf_betting) {
                 btnBetWala.isEnabled = true
                 btnBetWala.isEnabled = true
                 it.isSuccess = false
                 it.isSuccess = false
             }
             }
-//            shareViewModel.setUpdateFlagMain(true)
         } else {
         } else {
             if (it.error != null) {
             if (it.error != null) {
                 txtMsgAmount.text = it.error
                 txtMsgAmount.text = it.error
                 btnBetMeron.isEnabled = true
                 btnBetMeron.isEnabled = true
                 btnBetWala.isEnabled = true
                 btnBetWala.isEnabled = true
             }
             }
-//            Log.d("CfCreateBetting", "api fail : " + it.accountBalance)
         }
         }
     }
     }
 
 
@@ -410,7 +386,6 @@ class CfBetFragment : BaseFragment(R.layout.fragment_cf_betting) {
             btnBetMeron.isEnabled = false
             btnBetMeron.isEnabled = false
             btnBetWala.isEnabled = false
             btnBetWala.isEnabled = false
             confirmBet(betType, moneyBet.toInt(), chickenId)
             confirmBet(betType, moneyBet.toInt(), chickenId)
-//            cfBetViewModel.createBetting(CreateBetting(moneyBet.toInt(), chickenId))
         } else {
         } else {
             txtMsgAmount.text = "Please enter amount!"
             txtMsgAmount.text = "Please enter amount!"
         }
         }

+ 0 - 14
app/src/main/java/com/sambath/sbc/screen/main/cflive/currentbets/CurrentBetsFragment.kt

@@ -52,28 +52,14 @@ class CurrentBetsFragment : BaseFragment(R.layout.fragment_current_bets) {
         rv_current_bet.itemAnimator = DefaultItemAnimator()
         rv_current_bet.itemAnimator = DefaultItemAnimator()
         rv_current_bet.adapter = adapter
         rv_current_bet.adapter = adapter
         adapter.printButtonListener = { fightNo, betDate, betType, amount, payout, payoutPrint, id ->
         adapter.printButtonListener = { fightNo, betDate, betType, amount, payout, payoutPrint, id ->
-            //val item = adapter.currentList[index] as ListItem
-            printCfPrintable(
-                user,
-                fightNo,
-                betDate,
-                betType,
-                amount,
-                payout,
-                payoutPrint,
-                id,
-                sharePref.getChannelType()
-            )
         }
         }
         label_amount.text = "Amount ($currency)"
         label_amount.text = "Amount ($currency)"
         currentBetsViewModel.getCurrentBetsData()
         currentBetsViewModel.getCurrentBetsData()
         currentBetsViewModel.state.observe(viewLifecycleOwner, androidx.lifecycle.Observer {
         currentBetsViewModel.state.observe(viewLifecycleOwner, androidx.lifecycle.Observer {
-//            Log.d("dataxzsd", "data live")
             getCurrentBets(it)
             getCurrentBets(it)
         })
         })
         shareViewModel.getUpdateFlagMain.observe(viewLifecycleOwner, Observer {
         shareViewModel.getUpdateFlagMain.observe(viewLifecycleOwner, Observer {
             if (it) {
             if (it) {
-//                Log.d("dataxzsdup", "update data live")
                 currentBetsViewModel.getCurrentBetsData()
                 currentBetsViewModel.getCurrentBetsData()
                 shareViewModel.setUpdateFlagMain(false)
                 shareViewModel.setUpdateFlagMain(false)
             }
             }

+ 0 - 1
app/src/main/java/com/sambath/sbc/screen/report/StatementFragment.kt

@@ -384,7 +384,6 @@ class StatementFragment : BaseFragment(R.layout.fragment_statement) {
         rvTab1.layoutManager = layoutManager1
         rvTab1.layoutManager = layoutManager1
         rvTab1.adapter = adapterTb1
         rvTab1.adapter = adapterTb1
         adapterTb1.printButtonListener = { reportOne: ReportOne ->
         adapterTb1.printButtonListener = { reportOne: ReportOne ->
-            printSBCPrintable(reportOne, user.currencyType, sharePref.getChannelType())
         }
         }
 
 
         adapterTb2 = ReportAdapter(Type.WIN_LOST)
         adapterTb2 = ReportAdapter(Type.WIN_LOST)

+ 24 - 26
app/src/main/java/com/sambath/sbc/screen/setting/SettingFragment.kt

@@ -8,8 +8,6 @@ import androidx.core.view.isVisible
 import androidx.fragment.app.Fragment
 import androidx.fragment.app.Fragment
 import com.google.android.material.button.MaterialButton
 import com.google.android.material.button.MaterialButton
 import com.google.android.material.textfield.TextInputLayout
 import com.google.android.material.textfield.TextInputLayout
-import com.mazenrashed.printooth.Printooth
-import com.mazenrashed.printooth.ui.ScanningActivity
 import com.sambath.sbc.R
 import com.sambath.sbc.R
 import com.sambath.sbc.app.App
 import com.sambath.sbc.app.App
 import com.sambath.sbc.app.ShareActivity
 import com.sambath.sbc.app.ShareActivity
@@ -62,12 +60,12 @@ class SettingFragment : BaseFragment(R.layout.fragment_setting) {
         val tilCurrentPwd = view.findViewById<TextInputLayout>(R.id.til_new_pwd)
         val tilCurrentPwd = view.findViewById<TextInputLayout>(R.id.til_new_pwd)
         val tilNewPwd = view.findViewById<TextInputLayout>(R.id.til_confirm_pwd)
         val tilNewPwd = view.findViewById<TextInputLayout>(R.id.til_confirm_pwd)
         sw_print.isChecked = sharePref.getIsAutoPrint()
         sw_print.isChecked = sharePref.getIsAutoPrint()
-        val hasPair = Printooth.hasPairedPrinter()
-        if (hasPair) {
-            v_print.setImageViewIcon(R.drawable.blue_text_dc)
-            val pair = Printooth.getPairedPrinter()
-            text_connect.text = pair?.name
-        }
+//        val hasPair = Printooth.hasPairedPrinter()
+//        if (hasPair) {
+//            v_print.setImageViewIcon(R.drawable.blue_text_dc)
+////            val pair = Printooth.getPairedPrinter()
+////            text_connect.text = pair?.name
+//        }
         v_save.setOnClickListener {
         v_save.setOnClickListener {
 //            if (!sharePref.getIsMute()) betTouch.start()
 //            if (!sharePref.getIsMute()) betTouch.start()
             it.btnClick().subscribe {
             it.btnClick().subscribe {
@@ -112,17 +110,17 @@ class SettingFragment : BaseFragment(R.layout.fragment_setting) {
         v_print.setOnClickListener {
         v_print.setOnClickListener {
 //            if (!sharePref.getIsMute()) betTouch.start()
 //            if (!sharePref.getIsMute()) betTouch.start()
             it.btnClick().subscribe {
             it.btnClick().subscribe {
-                if (hasPair) {
-                    Printooth.removeCurrentPrinter()
-                    v_print.setImageViewIcon(R.drawable.blue_text_connect)
-                    text_connect.text = ""
-
-                } else startActivityForResult(
-                    Intent(
-                        requireActivity(),
-                        ScanningActivity::class.java
-                    ), ScanningActivity.SCANNING_FOR_PRINTER
-                )
+//                if (hasPair) {
+//                    Printooth.removeCurrentPrinter()
+//                    v_print.setImageViewIcon(R.drawable.blue_text_connect)
+//                    text_connect.text = ""
+//
+//                } else startActivityForResult(
+//                    Intent(
+//                        requireActivity(),
+//                        ScanningActivity::class.java
+//                    ), ScanningActivity.SCANNING_FOR_PRINTER
+//                )
 
 
             }
             }
         }
         }
@@ -155,13 +153,13 @@ class SettingFragment : BaseFragment(R.layout.fragment_setting) {
 
 
     override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
     override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
         super.onActivityResult(requestCode, resultCode, data)
         super.onActivityResult(requestCode, resultCode, data)
-        if (requestCode == ScanningActivity.SCANNING_FOR_PRINTER && resultCode == Activity.RESULT_OK) {
-            val pair = Printooth.getPairedPrinter()
-            v_print.setImageViewIcon(R.drawable.blue_text_dc)
-            text_connect.text = pair?.name
-            //Printooth.removeCurrentPrinter()
-//https://github.com/mazenrashed/Printooth
-        }
+//        if (requestCode == ScanningActivity.SCANNING_FOR_PRINTER && resultCode == Activity.RESULT_OK) {
+//            val pair = Printooth.getPairedPrinter()
+//            v_print.setImageViewIcon(R.drawable.blue_text_dc)
+//            text_connect.text = pair?.name
+//            //Printooth.removeCurrentPrinter()
+////https://github.com/mazenrashed/Printooth
+//        }
         //Printer is ready now
         //Printer is ready now
     }
     }
 }
 }

+ 1 - 1
app/src/main/res/layout/activity_login.xml

@@ -4,7 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_height="match_parent"
-    android:background="@color/text_black"
+    android:background="@color/color_black"
     android:orientation="vertical"
     android:orientation="vertical"
     tools:context=".screen.login.LoginActivity">
     tools:context=".screen.login.LoginActivity">
 
 

+ 1 - 1
app/src/main/res/layout/activity_main2.xml

@@ -17,7 +17,7 @@
         android:layout_height="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginStart="0dp"
         android:layout_marginStart="0dp"
         android:layout_marginEnd="0dp"
         android:layout_marginEnd="0dp"
-        android:background="@color/text_black"
+        android:background="@color/color_black"
         app:labelVisibilityMode="labeled"
         app:labelVisibilityMode="labeled"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"

+ 1 - 1
app/src/main/res/layout/activity_register.xml

@@ -4,7 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_height="match_parent"
-    android:background="@color/text_black"
+    android:background="@color/color_black"
     android:orientation="vertical"
     android:orientation="vertical"
     tools:context=".screen.register.RegisterActivity">
     tools:context=".screen.register.RegisterActivity">
 
 

+ 1 - 1
app/src/main/res/layout/app_bar_boxing.xml

@@ -12,7 +12,7 @@
         android:layout_width="match_parent"
         android:layout_width="match_parent"
         android:layout_height="?attr/actionBarSize"
         android:layout_height="?attr/actionBarSize"
         android:layout_gravity="center_vertical"
         android:layout_gravity="center_vertical"
-        android:background="@color/text_black"
+        android:background="@color/color_black"
         app:popupTheme="@style/PopupOverlay">
         app:popupTheme="@style/PopupOverlay">
 
 
         <androidx.constraintlayout.widget.ConstraintLayout
         <androidx.constraintlayout.widget.ConstraintLayout

+ 2 - 2
app/src/main/res/layout/fragment_fighter.xml

@@ -4,7 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_height="match_parent"
-    android:background="@color/text_black"
+    android:background="@color/color_black"
     android:orientation="vertical"
     android:orientation="vertical"
     tools:context=".screen.fighter.FighterFragment">
     tools:context=".screen.fighter.FighterFragment">
 
 
@@ -12,7 +12,7 @@
         android:id="@+id/tabLayout"
         android:id="@+id/tabLayout"
         android:layout_width="match_parent"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_height="wrap_content"
-        android:background="@color/text_black"
+        android:background="@color/color_black"
         app:tabGravity="fill"
         app:tabGravity="fill"
         app:tabMode="scrollable"
         app:tabMode="scrollable"
         app:tabTextColor="@color/color_white" />
         app:tabTextColor="@color/color_white" />

+ 0 - 1
settings.gradle

@@ -1,3 +1,2 @@
-include ':printooth'
 rootProject.name='SampleApp'
 rootProject.name='SampleApp'
 include ':app'
 include ':app'