Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fastdevelop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高超
fastdevelop
Commits
3bc7daa0
Commit
3bc7daa0
authored
Jan 04, 2019
by
gao.chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loadingDialog
parent
a85d15d4
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
204 additions
and
20 deletions
+204
-20
app/build.gradle
+1
-0
app/src/main/AndroidManifest.xml
+3
-0
app/src/main/java/com/mayi/demo/ItemBean.java
+30
-0
app/src/main/java/com/mayi/demo/MainActivity.java
+50
-2
app/src/main/java/com/mayi/demo/TsetActviity.java
+33
-0
app/src/main/res/layout/activity_main.xml
+3
-14
app/src/main/res/layout/test_layout.xml
+14
-0
fastDevelop/build.gradle
+3
-3
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseActivity.java
+59
-1
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseFragment.java
+8
-0
No files found.
app/build.gradle
View file @
3bc7daa0
...
...
@@ -25,4 +25,5 @@ dependencies {
testImplementation
'junit:junit:4.12'
androidTestImplementation
'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
api
project
(
':fastDevelop'
)
}
app/src/main/AndroidManifest.xml
View file @
3bc7daa0
...
...
@@ -16,6 +16,8 @@
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
".TsetActviity"
/>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/com/mayi/demo/ItemBean.java
0 → 100644
View file @
3bc7daa0
package
com
.
mayi
.
demo
;
import
android.view.View
;
public
class
ItemBean
{
private
String
text
;
private
View
.
OnClickListener
clickListener
;
public
ItemBean
(
String
text
,
View
.
OnClickListener
clickListener
)
{
this
.
text
=
text
;
this
.
clickListener
=
clickListener
;
}
public
String
getText
()
{
return
text
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
public
View
.
OnClickListener
getClickListener
()
{
return
clickListener
;
}
public
void
setClickListener
(
View
.
OnClickListener
clickListener
)
{
this
.
clickListener
=
clickListener
;
}
}
app/src/main/java/com/mayi/demo/MainActivity.java
View file @
3bc7daa0
...
...
@@ -2,13 +2,61 @@ package com.mayi.demo;
import
android.os.Bundle
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.annotation.NonNull
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.Button
;
public
class
MainActivity
extends
AppCompatActivity
{
import
com.mayi.fastdevelop.base.BaseActivity
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
MainActivity
extends
BaseActivity
{
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
RecyclerView
listView
=
findViewById
(
R
.
id
.
list
);
listView
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
final
List
<
ItemBean
>
list
=
new
ArrayList
<>();
list
.
add
(
new
ItemBean
(
"BaseActivity"
,
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
gotoActivity
(
TsetActviity
.
class
);
}
}));
listView
.
setAdapter
(
new
RecyclerView
.
Adapter
<
MyViewHolder
>()
{
@NonNull
@Override
public
MyViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
viewGroup
,
int
i
)
{
return
new
MyViewHolder
(
new
Button
(
viewGroup
.
getContext
()));
}
@Override
public
void
onBindViewHolder
(
@NonNull
MyViewHolder
viewHolder
,
int
i
)
{
viewHolder
.
tv
.
setOnClickListener
(
list
.
get
(
i
).
getClickListener
());
viewHolder
.
tv
.
setText
(
list
.
get
(
i
).
getText
());
}
@Override
public
int
getItemCount
()
{
return
list
.
size
();
}
});
}
class
MyViewHolder
extends
RecyclerView
.
ViewHolder
{
Button
tv
;
public
MyViewHolder
(
@NonNull
View
itemView
)
{
super
(
itemView
);
tv
=
(
Button
)
itemView
;
}
}
}
app/src/main/java/com/mayi/demo/TsetActviity.java
0 → 100644
View file @
3bc7daa0
package
com
.
mayi
.
demo
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.support.annotation.Nullable
;
import
android.view.View
;
import
com.mayi.fastdevelop.base.BaseActivity
;
public
class
TsetActviity
extends
BaseActivity
{
private
Handler
handler
;
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
test_layout
);
handler
=
new
Handler
();
findViewById
(
R
.
id
.
showLoading
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
showLoadingDialog
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
dismssLoadingDialog
();
}
},
4000
);
}
});
}
}
app/src/main/res/layout/activity_main.xml
View file @
3bc7daa0
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
<android.support.v7.widget.RecyclerView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/list"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".MainActivity"
>
tools:context=
".MainActivity"
/
>
<TextView
android:layout_width=
"wrap_content"
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.support.constraint.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/test_layout.xml
0 → 100644
View file @
3bc7daa0
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<Button
android:id=
"@+id/showLoading"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"显示对话框"
/>
</LinearLayout>
\ No newline at end of file
fastDevelop/build.gradle
View file @
3bc7daa0
...
...
@@ -25,9 +25,9 @@ android {
}
dependencies
{
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
implementation
'com.android.support:appcompat-v7:28.0.0'
api
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
api
'com.android.support:recyclerview-v7:28.0.0'
api
'com.android.support:appcompat-v7:28.0.0'
testImplementation
'junit:junit:4.12'
androidTestImplementation
'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseActivity.java
View file @
3bc7daa0
package
com
.
mayi
.
fastdevelop
.
base
;
import
android.app.Dialog
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v7.app.AppCompatActivity
;
import
com.mayi.fastdevelop.view.LoadingDialog
;
public
abstract
class
BaseActivity
extends
AppCompatActivity
{
private
Dialog
dialog
;
public
void
showLoadingDialog
()
{
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
}
public
void
showLoadingDialog
()
{
if
(
dialog
==
null
)
{
dialog
=
LoadingDialog
.
init
(
this
).
show
();
}
else
{
dialog
.
show
();
}
}
public
void
dismssLoadingDialog
()
{
if
(
dialog
!=
null
)
{
dialog
.
dismiss
();
}
}
/**
* 跳转页面并结束当前页面
* @param activity
*/
public
void
gotoActivityAndFinish
(
Class
activity
)
{
Intent
intent
=
new
Intent
(
this
,
activity
);
startActivity
(
intent
);
finish
();
}
/**
* 跳转页面
* @param activity
*/
public
void
gotoActivity
(
Class
activity
)
{
Intent
intent
=
new
Intent
(
this
,
activity
);
startActivity
(
intent
);
}
/**
* 跳转页面并结束当前页面
* @param activity
*/
public
void
gotoActivityAndFinish
(
Class
activity
,
Bundle
bundle
)
{
Intent
intent
=
new
Intent
(
this
,
activity
);
intent
.
putExtras
(
bundle
);
startActivity
(
intent
);
finish
();
}
/**
* 跳转页面
* @param activity
*/
public
void
gotoActivity
(
Class
activity
,
Bundle
bundle
)
{
Intent
intent
=
new
Intent
(
this
,
activity
);
intent
.
putExtras
(
bundle
);
startActivity
(
intent
);
}
@Override
protected
void
onDestroy
()
{
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseFragment.java
View file @
3bc7daa0
package
com
.
mayi
.
fastdevelop
.
base
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v4.app.Fragment
;
public
abstract
class
BaseFragment
extends
Fragment
{
@Override
public
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
getActivity
().
finish
();
}
}
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