#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim sql1 As SQL
Dim cur As Cursor
Dim timer1 As Timer
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private mn3 As Button
Private ex As Button
Private lv As ListView
Dim PanelWithSidebar As SlidingSidebar
Dim lv1 As ListView
Dim it As Boolean
Dim sec As Int
Dim ch As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Activity.LoadLayout("menu")
'menu>>--------------------
Dim gd(2) As Int
gd(0) = Colors.White
gd(1) = Colors.LightGray
Dim gdContent As GradientDrawable
gdContent.Initialize("RIGHT_LEFT", gd)
Activity.Color = gd(0)
PanelWithSidebar.Initialize(Activity, 200dip, 1, 1, 200, 200)
PanelWithSidebar.ContentPanel.Background = gdContent
PanelWithSidebar.Sidebar.Background = PanelWithSidebar.LoadDrawable("jog_tab_bar_left_end_normal")
PanelWithSidebar.SetOnChangeListeners(Me, "Sidebar_onFullyOpen", "Sidebar_onFullyClosed", "Sidebar_onMove")
PanelWithSidebar.ContentPanel.LoadLayout("menu")
Dim r As Reflector
r.Target = PanelWithSidebar.Sidebar
r.RunMethod4("setPadding", Array As Object(0, 0, 0, 0), Array As String("java.lang.int", "java.lang.int", "java.lang.int", "java.lang.int"))
lv1.Initialize("lvMenu")
lv1.AddTwoLinesAndBitmap("صفحه اسلی","",LoadBitmap(File.DirAssets,"home.png"))
lv1.AddTwoLinesAndBitmap("فهرست","",LoadBitmap(File.DirAssets,"to.png"))
lv1.AddTwoLinesAndBitmap("علاقه مندی ها","",LoadBitmap(File.DirAssets,"f.png"))
lv1.AddTwoLinesAndBitmap("ارتباط با ما","",LoadBitmap(File.DirAssets,"co.png"))
lv1.AddTwoLinesAndBitmap("درباره ی ما","",LoadBitmap(File.DirAssets,"abo.png"))
lv1.AddTwoLinesAndBitmap("خروج","",LoadBitmap(File.DirAssets,"ex.png"))
lv1.Color = Colors.RGB(189, 139, 203)
lv1.ScrollingBackgroundColor = Colors.Transparent
'----------------------
Dim lbltxtsidebar As Label
lbltxtsidebar = lv1.TwoLinesAndBitmap.Label
lbltxtsidebar.left = lbltxtsidebar.Left - 90dip
lbltxtsidebar.Top=lbltxtsidebar.Top+15dip
lbltxtsidebar.TextColor=Colors.RGB(13, 10, 62)
lbltxtsidebar.TextSize = 15
myview(lbltxtsidebar,20,"yekan")
PanelWithSidebar.Sidebar.AddView(lv1, 2dip, 0, PanelWithSidebar.Sidebar.Width , PanelWithSidebar.Sidebar.Height - 40dip)
Dim bg1(2) As Int
bg1(0) = Colors.RGB(21, 42, 96)
bg1(1) = Colors.RGB(27, 54, 124)
PanelWithSidebar.Sidebar.Color=Colors.RGB(189, 139, 203)
'------------------------------------------------------------'
PanelWithSidebar.EnableSwipeGesture(True, 40dip, 1)
lv.AddTwoLinesAndBitmap2("فهرست","فهرست",LoadBitmap(File.DirAssets,"to.png"),1)
lv.AddTwoLinesAndBitmap2("جستجو","جستجو",LoadBitmap(File.DirAssets,"ser.png"),2)
lv.AddTwoLinesAndBitmap2("علاقه مندی ","علاقه مندی",LoadBitmap(File.DirAssets,"f.png"),3)
lv.AddTwoLinesAndBitmap2("تنظیمات","تنظیمات",LoadBitmap(File.DirAssets,"set.png"),4)
lv.AddTwoLinesAndBitmap2("درباره ما","درباره ما",LoadBitmap(File.DirAssets,"abo.png"),5)
lv.TwoLinesAndBitmap.Label.Gravity = Gravity.CENTER
lv.TwoLinesAndBitmap.Label.TextColor = Colors.black
'data base>>-----------------
If File.Exists(File.DirInternal,"e1.db")=False Then
File.Copy(File.DirAssets,"e1.db",File.DirInternal,"e1.db")
End If
If sql1.IsInitialized=False Then
sql1.Initialize(File.DirInternal,"e1.db",False)
cur = sql1.ExecQuery("SELECT * FROM tbl1")
End If
ch.Text="1"
timer1.Initialize("timer1",3000)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub myview(which As Label,fontsize As Int,fontname As String)
which.Typeface=Typeface.LoadFromAssets(fontname&".ttf")
which.TextColor=Colors.White
which.TextSize=fontsize
which.Gravity= Gravity.RIGHT
which.TextColor=Colors.White
End Sub
Sub lvMenu_ItemClick (Position As Int, Value As Object)
Log(Value)
Select Case Value
Case "صفحه اصلی"
StartActivity("menu")
Case "فهرست"
Case "علاقه مندی ها"
Case "ارتباط با ما"
Case "درباره ی ما"
Case "خروج"
Exit
End Select
PanelWithSidebar.CloseSidebar
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
If ch.Text="3" Then
Activity.removeallviews
Activity.LoadLayout("menu")
ch.Text="1"
Return True
End If
If ch.Text="2" Then
Activity.removeallviews
Activity.LoadLayout("menu")
ch.Text="1"
Return True
End If
If ch.Text="22" Then
Activity.removeallviews
Activity.LoadLayout("menu")
ch.Text="1"
Return True
End If
If ch.Text="222" Then
Activity.removeallviews
Activity.LoadLayout("menu")
ch.Text="1"
Return True
End If
If ch.Text="14" Then
Activity.removeallviews
Activity.LoadLayout("menu")
ch.Text="1"
Return True
End If
If ch.Text="1" Then
If it = False Then
timer1.Enabled = True
ToastMessageShow("برای خروج دوباره کلید بازگشت رو بزن",False)
it = True
Return True
Else
Return False
End If
End If
End If
End Sub
Sub timer1_tick
If sec <= 3 Then
sec = sec+1
Else
it = False
timer1.Enabled = False
End If
End Sub
سوال
mr-edris 186
سلام به همه ببخشید ببینید کد من ایرادی داره
بالا نمیاد
لینک ارسال
به اشتراک گذاری در سایت های دیگر
3 پاسخ به این سوال تاکنون داده شده است
ارسالهای توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.