Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
echo-adr-Deprecated
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
echo
echo-adr-Deprecated
Commits
34974e57
Commit
34974e57
authored
Jul 21, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
主页
parent
9951b4cf
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
216 additions
and
11 deletions
+216
-11
LogFragment.java
app/src/main/java/com/virjar/echo/adr/ui/LogFragment.java
+11
-0
MainActivity.java
app/src/main/java/com/virjar/echo/adr/ui/MainActivity.java
+85
-1
MineFragment.java
app/src/main/java/com/virjar/echo/adr/ui/MineFragment.java
+6
-0
comment1.png
app/src/main/res/drawable-v24/comment1.png
+0
-0
comment2.png
app/src/main/res/drawable-v24/comment2.png
+0
-0
contrast.png
app/src/main/res/drawable-v24/contrast.png
+0
-0
contrast1.png
app/src/main/res/drawable-v24/contrast1.png
+0
-0
home3.png
app/src/main/res/drawable-v24/home3.png
+0
-0
home31.png
app/src/main/res/drawable-v24/home31.png
+0
-0
location4.png
app/src/main/res/drawable-v24/location4.png
+0
-0
location41.png
app/src/main/res/drawable-v24/location41.png
+0
-0
comment.xml
app/src/main/res/drawable/comment.xml
+5
-0
contrast_view.xml
app/src/main/res/drawable/contrast_view.xml
+5
-0
home.xml
app/src/main/res/drawable/home.xml
+5
-0
location_view.xml
app/src/main/res/drawable/location_view.xml
+5
-0
text_color_back.xml
app/src/main/res/drawable/text_color_back.xml
+5
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+89
-10
No files found.
app/src/main/java/com/virjar/echo/adr/ui/LogFragment.java
0 → 100644
View file @
34974e57
package
com
.
virjar
.
echo
.
adr
.
ui
;
import
androidx.fragment.app.Fragment
;
public
class
LogFragment
extends
Fragment
{
private
String
fragmentText
;
public
LogFragment
(
String
fragmentText
)
{
this
.
fragmentText
=
fragmentText
;
}
}
app/src/main/java/com/virjar/echo/adr/ui/MainActivity.java
View file @
34974e57
...
...
@@ -3,24 +3,108 @@ package com.virjar.echo.adr.ui;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.fragment.app.FragmentManager
;
import
androidx.fragment.app.FragmentTransaction
;
import
com.virjar.echo.adr.HttpProxyService
;
import
com.virjar.echo.adr.R
;
public
class
MainActivity
extends
AppCompatActivity
{
public
class
MainActivity
extends
AppCompatActivity
implements
View
.
OnClickListener
{
public
static
void
go
(
Context
context
)
{
context
.
startActivity
(
new
Intent
(
context
,
MainActivity
.
class
));
}
LinearLayout
logLinear
;
LinearLayout
settingLinear
;
LinearLayout
userLinear
;
private
FragmentManager
mfragmentManger
;
private
LogFragment
logFragment
;
private
SettingsActivity
.
SettingsFragment
settingsFragment
;
private
MineFragment
mineFragment
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
logLinear
=
findViewById
(
R
.
id
.
main_log
);
settingLinear
=
findViewById
(
R
.
id
.
main_setting
);
userLinear
=
findViewById
(
R
.
id
.
linear_user
);
mfragmentManger
=
getSupportFragmentManager
();
logLinear
.
performClick
();
startService
(
new
Intent
(
this
,
HttpProxyService
.
class
));
}
@Override
public
void
onClick
(
View
view
)
{
FragmentTransaction
fragmentTransaction
=
mfragmentManger
.
beginTransaction
();
//只能是局部变量,不能为全局变量,否则不能重复commit
//FragmentTransaction只能使用一次
hideAllFragment
(
fragmentTransaction
);
switch
(
view
.
getId
())
{
case
R
.
id
.
main_log
:
setAllFalse
();
logLinear
.
setSelected
(
true
);
if
(
logFragment
==
null
)
{
logFragment
=
new
LogFragment
(
"Log"
);
fragmentTransaction
.
add
(
R
.
id
.
fragment_frame
,
logFragment
);
}
else
{
fragmentTransaction
.
show
(
logFragment
);
}
break
;
case
R
.
id
.
main_setting
:
setAllFalse
();
settingLinear
.
setSelected
(
true
);
if
(
settingsFragment
==
null
)
{
settingsFragment
=
new
SettingsActivity
.
SettingsFragment
();
fragmentTransaction
.
add
(
R
.
id
.
fragment_frame
,
settingsFragment
);
}
else
{
fragmentTransaction
.
show
(
settingsFragment
);
}
break
;
case
R
.
id
.
linear_user
:
setAllFalse
();
userLinear
.
setSelected
(
true
);
if
(
mineFragment
==
null
)
{
mineFragment
=
new
MineFragment
();
fragmentTransaction
.
add
(
R
.
id
.
fragment_frame
,
mineFragment
);
}
else
{
fragmentTransaction
.
show
(
mineFragment
);
}
break
;
}
fragmentTransaction
.
commit
();
//记得必须要commit,否则没有效果
}
private
void
hideAllFragment
(
FragmentTransaction
fragmentTransaction
)
{
if
(
logFragment
!=
null
)
{
fragmentTransaction
.
hide
(
logFragment
);
}
if
(
settingsFragment
!=
null
)
{
fragmentTransaction
.
hide
(
settingsFragment
);
}
if
(
mineFragment
!=
null
)
{
fragmentTransaction
.
hide
(
mineFragment
);
}
}
private
void
setAllFalse
()
{
logLinear
.
setSelected
(
false
);
settingLinear
.
setSelected
(
false
);
userLinear
.
setSelected
(
false
);
}
}
app/src/main/java/com/virjar/echo/adr/ui/MineFragment.java
0 → 100644
View file @
34974e57
package
com
.
virjar
.
echo
.
adr
.
ui
;
import
androidx.fragment.app.Fragment
;
public
class
MineFragment
extends
Fragment
{
}
app/src/main/res/drawable-v24/comment1.png
0 → 100644
View file @
34974e57
5.86 KB
app/src/main/res/drawable-v24/comment2.png
0 → 100644
View file @
34974e57
5.61 KB
app/src/main/res/drawable-v24/contrast.png
0 → 100644
View file @
34974e57
7.14 KB
app/src/main/res/drawable-v24/contrast1.png
0 → 100644
View file @
34974e57
7.39 KB
app/src/main/res/drawable-v24/home3.png
0 → 100644
View file @
34974e57
3.67 KB
app/src/main/res/drawable-v24/home31.png
0 → 100644
View file @
34974e57
3.58 KB
app/src/main/res/drawable-v24/location4.png
0 → 100644
View file @
34974e57
2.7 KB
app/src/main/res/drawable-v24/location41.png
0 → 100644
View file @
34974e57
2.71 KB
app/src/main/res/drawable/comment.xml
0 → 100644
View file @
34974e57
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_selected=
"true"
android:drawable=
"@drawable/comment1"
/>
<item
android:drawable=
"@drawable/comment2"
/>
</selector>
\ No newline at end of file
app/src/main/res/drawable/contrast_view.xml
0 → 100644
View file @
34974e57
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_selected=
"true"
android:drawable=
"@drawable/contrast1"
/>
<item
android:drawable=
"@drawable/contrast"
/>
</selector>
\ No newline at end of file
app/src/main/res/drawable/home.xml
0 → 100644
View file @
34974e57
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_selected=
"true"
android:drawable=
"@drawable/home3"
/>
<item
android:drawable=
"@drawable/home31"
/>
</selector>
\ No newline at end of file
app/src/main/res/drawable/location_view.xml
0 → 100644
View file @
34974e57
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_selected=
"true"
android:drawable=
"@drawable/location41"
/>
<item
android:drawable=
"@drawable/location4"
/>
</selector>
\ No newline at end of file
app/src/main/res/drawable/text_color_back.xml
0 → 100644
View file @
34974e57
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_selected=
"true"
android:color=
"@color/colorAccent"
/>
<item
android:color=
"@android:color/white"
/>
</selector>
\ No newline at end of file
app/src/main/res/layout/activity_main.xml
View file @
34974e57
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".ui.MainActivity"
>
<TextView
android:layout_width=
"wrap_content"
<FrameLayout
android:id=
"@+id/fragment_frame"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_above=
"@+id/tab_linear"
>
</FrameLayout>
<LinearLayout
android:id=
"@+id/tab_linear"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Hello World!"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
android:layout_alignParentBottom=
"true"
android:background=
"@color/colorPrimary"
android:orientation=
"horizontal"
>
<LinearLayout
android:onClick=
"onClick"
android:id=
"@+id/main_log"
android:layout_width=
"0dp"
android:layout_height=
"60dp"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_gravity=
"center"
android:src=
"@drawable/home"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:text=
"日志"
android:textColor=
"@drawable/text_color_back"
/>
</LinearLayout>
<LinearLayout
android:onClick=
"onClick"
android:id=
"@+id/main_setting"
android:layout_width=
"0dp"
android:layout_height=
"60dp"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_gravity=
"center"
android:src=
"@drawable/location_view"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:text=
"设置"
android:textColor=
"@drawable/text_color_back"
/>
</LinearLayout>
<LinearLayout
android:onClick=
"onClick"
android:id=
"@+id/linear_user"
android:layout_width=
"0dp"
android:layout_height=
"60dp"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_gravity=
"center"
android:src=
"@drawable/contrast_view"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:text=
"我的"
android:textColor=
"@drawable/text_color_back"
/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
</RelativeLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment