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
1882698c
Commit
1882698c
authored
Jan 31, 2019
by
gao.chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
activity与Fragment交互
parent
cd862ad3
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
680 additions
and
26 deletions
+680
-26
app/src/main/AndroidManifest.xml
+2
-0
app/src/main/java/com/mayi/demo/FragmentInteractiveActivity.java
+60
-0
app/src/main/java/com/mayi/demo/FragmentInteractiveActivity2.java
+76
-0
app/src/main/java/com/mayi/demo/FunctionActivity.java
+12
-0
app/src/main/java/com/mayi/demo/MyFragment.java
+89
-0
app/src/main/res/layout/activity_fragment_interactive.xml
+20
-0
app/src/main/res/layout/activity_fragment_interactive_2.xml
+46
-0
app/src/main/res/layout/activity_function.xml
+12
-0
app/src/main/res/layout/fragment_my.xml
+39
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseActivity.java
+0
-6
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseFragment.java
+116
-1
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseFragmentActivity.java
+183
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/UpdateDownLoadAPKActvity.java
+2
-2
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/AppCallback.java
+7
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/Constant.java
+7
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/Key.java
+1
-1
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/RequestCode.java
+1
-1
fastDevelop/src/main/java/com/mayi/fastdevelop/util/DownLoadUtil.java
+1
-1
fastDevelop/src/main/java/com/mayi/fastdevelop/util/ToastUtil.java
+5
-2
fastDevelop/src/main/java/com/mayi/fastdevelop/view/installapk/AppUpgradeManager.java
+1
-12
keyStore.jks
+0
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
1882698c
...
...
@@ -43,6 +43,8 @@
<activity
android:name=
".QRActivity"
/>
<activity
android:name=
".TitleActivity"
/>
<activity
android:name=
".DownLoadAPKActivity"
/>
<activity
android:name=
".FragmentInteractiveActivity"
/>
<activity
android:name=
".FragmentInteractiveActivity2"
/>
</application>
<!-- 配置APP ID -->
...
...
app/src/main/java/com/mayi/demo/FragmentInteractiveActivity.java
0 → 100644
View file @
1882698c
package
com
.
mayi
.
demo
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.support.annotation.Nullable
;
import
android.support.v4.view.ViewPager
;
import
android.widget.TextView
;
import
com.mayi.fastdevelop.base.BaseFragment
;
import
com.mayi.fastdevelop.base.BaseFragmentActivity
;
import
com.mayi.fastdevelop.comnon.AppCallback
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
FragmentInteractiveActivity
extends
BaseFragmentActivity
{
private
TextView
tv
;
private
ViewPager
viewPager
;
private
List
<
BaseFragment
>
list
=
new
ArrayList
<>();
private
Handler
handler
;
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_fragment_interactive
);
handler
=
new
Handler
(
Looper
.
getMainLooper
());
tv
=
findViewById
(
R
.
id
.
tv
);
viewPager
=
findViewById
(
R
.
id
.
viewpager
);
list
.
add
(
getFragment
(
"0"
));
list
.
add
(
getFragment
(
"1"
));
list
.
add
(
getFragment
(
"2"
));
list
.
add
(
getFragment
(
"3"
));
viewPagerLoadFragments
(
list
,
viewPager
);
}
@Override
public
void
handleInfo
(
final
String
data
,
final
AppCallback
<
String
>
callback
)
{
tv
.
setText
(
data
);
showToast
(
data
);
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
callback
!=
null
)
{
callback
.
callBack
(
getClass
().
getName
()
+
":已处理数据-->"
+
data
);
}
}
},
1000
);
}
public
BaseFragment
getFragment
(
String
tag
)
{
MyFragment
fragment
=
new
MyFragment
();
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
"tag"
,
tag
);
fragment
.
setArguments
(
bundle
);
return
fragment
;
}
}
app/src/main/java/com/mayi/demo/FragmentInteractiveActivity2.java
0 → 100644
View file @
1882698c
package
com
.
mayi
.
demo
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.support.annotation.Nullable
;
import
android.view.View
;
import
android.widget.TextView
;
import
com.mayi.fastdevelop.base.BaseFragment
;
import
com.mayi.fastdevelop.base.BaseFragmentActivity
;
import
com.mayi.fastdevelop.comnon.AppCallback
;
import
com.mayi.fastdevelop.view.OnMultiClickListener
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
FragmentInteractiveActivity2
extends
BaseFragmentActivity
{
private
TextView
tv
;
private
List
<
BaseFragment
>
list
=
new
ArrayList
<>();
private
Handler
handler
;
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_fragment_interactive_2
);
findViewById
(
R
.
id
.
b1
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
showFragment
(
0
);
}
});
findViewById
(
R
.
id
.
b2
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
showFragment
(
1
);
}
});
findViewById
(
R
.
id
.
b3
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
showFragment
(
21
);
}
});
handler
=
new
Handler
(
Looper
.
getMainLooper
());
tv
=
findViewById
(
R
.
id
.
tv
);
list
.
add
(
getFragment
(
"0"
));
list
.
add
(
getFragment
(
"1"
));
list
.
add
(
getFragment
(
"2"
));
addFragmentsAndShowFragment
(
list
,
R
.
id
.
layout
);
}
@Override
public
void
handleInfo
(
final
String
data
,
final
AppCallback
<
String
>
callback
)
{
tv
.
setText
(
data
);
showToast
(
data
);
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
callback
!=
null
)
{
callback
.
callBack
(
getClass
().
getName
()
+
":已处理数据-->"
+
data
);
}
}
},
1000
);
}
public
BaseFragment
getFragment
(
String
tag
)
{
MyFragment
fragment
=
new
MyFragment
();
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
"tag"
,
tag
);
fragment
.
setArguments
(
bundle
);
return
fragment
;
}
}
app/src/main/java/com/mayi/demo/FunctionActivity.java
View file @
1882698c
...
...
@@ -31,6 +31,18 @@ public class FunctionActivity extends BaseActivity{
gotoActivity
(
DownLoadAPKActivity
.
class
);
}
});
findViewById
(
R
.
id
.
b4
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
gotoActivity
(
FragmentInteractiveActivity
.
class
);
}
});
findViewById
(
R
.
id
.
b5
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
gotoActivity
(
FragmentInteractiveActivity2
.
class
);
}
});
}
...
...
app/src/main/java/com/mayi/demo/MyFragment.java
0 → 100644
View file @
1882698c
package
com
.
mayi
.
demo
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
import
com.mayi.fastdevelop.base.BaseFragment
;
import
com.mayi.fastdevelop.comnon.AppCallback
;
import
com.mayi.fastdevelop.comnon.Constant
;
import
com.mayi.fastdevelop.view.OnMultiClickListener
;
public
class
MyFragment
extends
BaseFragment
{
private
String
fragmentTag
;
private
Handler
handler
;
@Override
public
String
getFragmentTag
()
{
return
fragmentTag
;
}
@Override
public
void
receiveAndHandleInfo
(
final
String
data
,
final
AppCallback
<
String
>
callback
)
{
showToast
(
"我是"
+
getFragmentTag
()
+
"接收到-->"
+
data
);
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
callback
!=
null
)
{
callback
.
callBack
(
getClass
().
getName
()
+
":已处理数据-->"
+
data
);
}
}
},
1000
);
}
@Override
public
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
handler
=
new
Handler
();
fragmentTag
=
getArguments
().
getString
(
"tag"
);
}
@Nullable
@Override
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_my
,
container
,
false
);
TextView
tv
=
view
.
findViewById
(
R
.
id
.
tv
);
tv
.
setText
(
"我是"
+
getFragmentTag
());
view
.
findViewById
(
R
.
id
.
b1
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
sendInfo
(
"0"
,
"发送给第一个Fragment"
,
new
AppCallback
<
String
>()
{
@Override
public
void
callBack
(
String
s
)
{
showToast
(
getFragmentTag
()
+
"接收到处理的数据:"
+
s
);
}
});
}
});
view
.
findViewById
(
R
.
id
.
b2
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
sendInfo
(
"1"
,
"发送给第2个Fragment,不需要返回数据"
,
null
);
}
});
view
.
findViewById
(
R
.
id
.
b3
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
sendInfo
(
Constant
.
ACTIVITY_TAG
,
"发送给Activity,需要返回数据"
,
new
AppCallback
<
String
>()
{
@Override
public
void
callBack
(
String
s
)
{
showToast
(
getFragmentTag
()
+
"接收到处理的数据:"
+
s
);
}
});
}
});
view
.
findViewById
(
R
.
id
.
b4
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
sendInfo
(
Constant
.
ACTIVITY_TAG
,
"发送给Activity,不需要返回数据"
,
null
);
}
});
return
view
;
}
}
app/src/main/res/layout/activity_fragment_interactive.xml
0 → 100644
View file @
1882698c
<?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"
>
<TextView
android:id=
"@+id/tv"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/im_dp_40"
/>
<android.support.v4.view.ViewPager
android:id=
"@+id/viewpager"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/activity_fragment_interactive_2.xml
0 → 100644
View file @
1882698c
<?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"
>
<TextView
android:id=
"@+id/tv"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/im_dp_40"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/b1"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"第1个fragment"
/>
<Button
android:id=
"@+id/b2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"第2个fragment"
/>
<Button
android:id=
"@+id/b3"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"第3个fragment"
/>
</LinearLayout>
<FrameLayout
android:id=
"@+id/layout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/activity_function.xml
View file @
1882698c
...
...
@@ -26,6 +26,18 @@
android:layout_height=
"wrap_content"
android:text=
"下载安装APP"
/>
<Button
android:id=
"@+id/b4"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Activity与Fragment之间交互\n可以左右滑动"
/>
<Button
android:id=
"@+id/b5"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Activity与Fragment之间交互\n不可以左右滑动"
/>
</LinearLayout>
...
...
app/src/main/res/layout/fragment_my.xml
0 → 100644
View file @
1882698c
<?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"
>
<TextView
android:id=
"@+id/tv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/im_dp_20"
/>
<Button
android:id=
"@+id/b1"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"发送给第一个Fragment,需要回调"
/>
<Button
android:id=
"@+id/b2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"发送给第一个Fragment,,不需要回调"
/>
<Button
android:id=
"@+id/b3"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"发送给Activity,,需要回调"
/>
<Button
android:id=
"@+id/b4"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"发送给Activity,,不需要回调"
/>
</LinearLayout>
\ No newline at end of file
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseActivity.java
View file @
1882698c
...
...
@@ -13,12 +13,6 @@ public abstract class BaseActivity extends AppCompatActivity {
private
Dialog
dialog
;
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
}
public
void
showLoadingDialog
()
{
if
(
dialog
==
null
)
{
dialog
=
LoadingDialog
.
init
(
this
).
show
();
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseFragment.java
View file @
1882698c
package
com
.
mayi
.
fastdevelop
.
base
;
import
android.app.Activity
;
import
android.app.Dialog
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.FragmentActivity
;
public
abstract
class
BaseFragment
extends
Fragment
{
import
com.mayi.fastdevelop.comnon.AppCallback
;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.view.LoadingDialog
;
public
abstract
class
BaseFragment
extends
Fragment
{
private
Dialog
dialog
;
/**
* Fragment加载到Acrtivity中的Tag
*
* @return
*/
public
abstract
String
getFragmentTag
();
/**
* 接收并处理数据
*
* @param data
* @param callback
*/
public
abstract
void
receiveAndHandleInfo
(
String
data
,
AppCallback
<
String
>
callback
);
/**
* 发送消息给Acticity/Fragment
*
* @param tag 发送的目的地
* @param data 发送的数据
*/
public
void
sendInfo
(
String
tag
,
String
data
,
AppCallback
<
String
>
callback
)
{
FragmentActivity
activity
=
getActivity
();
if
(
activity
instanceof
BaseFragmentActivity
)
{
BaseFragmentActivity
fragmentActivity
=
(
BaseFragmentActivity
)
activity
;
fragmentActivity
.
receiveInfo
(
tag
,
data
,
callback
);
}
else
{
throw
new
RuntimeException
(
"Activity必须继承BaseFragmentActivity"
);
}
}
public
void
showLoadingDialog
()
{
if
(
dialog
==
null
)
{
dialog
=
LoadingDialog
.
init
(
getContext
()).
show
();
}
else
{
dialog
.
show
();
}
}
public
void
dismssLoadingDialog
()
{
if
(
dialog
!=
null
)
{
dialog
.
dismiss
();
}
}
/**
* 跳转页面并结束当前页面
*
* @param activity
*/
public
void
gotoActivityAndFinish
(
Class
activity
)
{
Intent
intent
=
new
Intent
(
getContext
(),
activity
);
startActivity
(
intent
);
Activity
a
=
getActivity
();
if
(
a
!=
null
)
{
a
.
finish
();
}
}
/**
* 跳转页面
*
* @param activity
*/
public
void
gotoActivity
(
Class
activity
)
{
Intent
intent
=
new
Intent
(
getContext
(),
activity
);
startActivity
(
intent
);
}
/**
* 跳转页面并结束当前页面
*
* @param activity
*/
public
void
gotoActivityAndFinish
(
Class
activity
,
Bundle
bundle
)
{
Intent
intent
=
new
Intent
(
getContext
(),
activity
);
intent
.
putExtras
(
bundle
);
startActivity
(
intent
);
Activity
a
=
getActivity
();
if
(
a
!=
null
)
{
a
.
finish
();
}
}
/**
* 跳转页面
*
* @param activity
*/
public
void
gotoActivity
(
Class
activity
,
Bundle
bundle
)
{
Intent
intent
=
new
Intent
(
getContext
(),
activity
);
intent
.
putExtras
(
bundle
);
startActivity
(
intent
);
}
public
void
showToast
(
String
msg
)
{
ToastUtil
.
show
(
getContext
(),
msg
);
}
@Override
public
void
onDestroyView
()
{
dismssLoadingDialog
();
super
.
onDestroyView
();
}
}
fastDevelop/src/main/java/com/mayi/fastdevelop/base/BaseFragmentActivity.java
0 → 100644
View file @
1882698c
package
com
.
mayi
.
fastdevelop
.
base
;
import
android.app.Dialog
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.FragmentActivity
;
import
android.support.v4.app.FragmentPagerAdapter
;
import
android.support.v4.app.FragmentTransaction
;
import
android.support.v4.view.ViewPager
;
import
android.text.TextUtils
;
import
com.mayi.fastdevelop.comnon.AppCallback
;
import
com.mayi.fastdevelop.comnon.Constant
;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.view.LoadingDialog
;
import
java.util.List
;
public
abstract
class
BaseFragmentActivity
extends
FragmentActivity
{
private
List
<
BaseFragment
>
list
;
//list不能为null,否则无法传递数据,传递数据是通过list找到Fragment的
/**
* 数量Fragment发送过来的数据
*
* @param data
* @param callback
*/
public
abstract
void
handleInfo
(
String
data
,
AppCallback
<
String
>
callback
);
public
void
setList
(
List
<
BaseFragment
>
list
)
{
this
.
list
=
list
;
}
public
void
viewPagerLoadFragments
(
final
List
<
BaseFragment
>
list
,
ViewPager
viewPager
)
{
this
.
list
=
list
;
viewPager
.
setAdapter
(
new
FragmentPagerAdapter
(
getSupportFragmentManager
())
{
@Override
public
Fragment
getItem
(
int
i
)
{
return
list
.
get
(
i
);
}
@Override
public
int
getCount
()
{
return
list
.
size
();
}
});
}
/**
* 把Fragment添加到页面中并显示第一个Fragment
*
* @param list
*/
public
void
addFragmentsAndShowFragment
(
List
<
BaseFragment
>
list
,
int
viewId
)
{
this
.
list
=
list
;
FragmentTransaction
transaction
=
getSupportFragmentManager
().
beginTransaction
();
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
BaseFragment
fragment
=
list
.
get
(
i
);
transaction
.
add
(
viewId
,
fragment
).
hide
(
fragment
);
}
transaction
.
show
(
list
.
get
(
0
));
transaction
.
commit
();
}
}
/**
* 显示选中的Fragment
*
* @param index
*/
public
void
showFragment
(
int
index
)
{
if
(
list
!=
null
&&
list
.
size
()
>
0
&&
index
<
list
.
size
())
{
BaseFragment
baseFragment
=
list
.
get
(
index
);
if
(!
baseFragment
.
isHidden
()
&&
baseFragment
.
isVisible
())
{
return
;
}
FragmentTransaction
transaction
=
getSupportFragmentManager
().
beginTransaction
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
BaseFragment
fragment
=
list
.
get
(
i
);
transaction
.
hide
(
fragment
);
}
transaction
.
show
(
baseFragment
).
commit
();
}
}
/**
* 接收Fragment发送过来的数据,如果tag=Activity,在Activity中处理数据
*
* @param tag
* @param data
* @param callback
*/
public
void
receiveInfo
(
String
tag
,
String
data
,
AppCallback
<
String
>
callback
)
{
if
(
TextUtils
.
equals
(
Constant
.
ACTIVITY_TAG
,
tag
))
{
handleInfo
(
data
,
callback
);
}
else
{
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
BaseFragment
fragment
=
list
.
get
(
i
);
if
(
TextUtils
.
equals
(
tag
,
fragment
.
getFragmentTag
()))
{
fragment
.
receiveAndHandleInfo
(
data
,
callback
);
}
}
}
}
}
private
Dialog
dialog
;
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
);
}
public
void
showToast
(
String
msg
)
{
ToastUtil
.
show
(
this
,
msg
);
}
@Override
protected
void
onDestroy
()
{
dismssLoadingDialog
();
super
.
onDestroy
();
}
}
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/UpdateDownLoadAPKActvity.java
View file @
1882698c
...
...
@@ -13,8 +13,8 @@ import android.support.annotation.Nullable;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.bean.AppConfig
;
import
com.mayi.fastdevelop.co
nstant
.Key
;
import
com.mayi.fastdevelop.co
nstant
.RequestCode
;
import
com.mayi.fastdevelop.co
mnon
.Key
;
import
com.mayi.fastdevelop.co
mnon
.RequestCode
;
import
com.mayi.fastdevelop.util.DownLoadUtil
;
import
com.mayi.fastdevelop.util.PermissionUtil
;
import
com.mayi.fastdevelop.util.SpUtil
;
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/AppCallback.java
0 → 100644
View file @
1882698c
package
com
.
mayi
.
fastdevelop
.
comnon
;
public
interface
AppCallback
<
T
>
{
public
void
callBack
(
T
t
);
}
fastDevelop/src/main/java/com/mayi/fastdevelop/comnon/Constant.java
0 → 100644
View file @
1882698c
package
com
.
mayi
.
fastdevelop
.
comnon
;
public
class
Constant
{
public
static
final
String
ACTIVITY_TAG
=
"Activity"
;
}
fastDevelop/src/main/java/com/mayi/fastdevelop/co
nstant
/Key.java
→
fastDevelop/src/main/java/com/mayi/fastdevelop/co
mnon
/Key.java
View file @
1882698c
package
com
.
mayi
.
fastdevelop
.
co
nstant
;
package
com
.
mayi
.
fastdevelop
.
co
mnon
;
public
class
Key
{
public
static
final
String
ANT_DOWNLOAD_ID
=
"ant_download_id"
;
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/co
nstant
/RequestCode.java
→
fastDevelop/src/main/java/com/mayi/fastdevelop/co
mnon
/RequestCode.java
View file @
1882698c
package
com
.
mayi
.
fastdevelop
.
co
nstant
;
package
com
.
mayi
.
fastdevelop
.
co
mnon
;
public
class
RequestCode
{
public
static
final
int
REQUEST_CODE_APP_INSTALL
=
0x00
;
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/util/DownLoadUtil.java
View file @
1882698c
...
...
@@ -9,7 +9,7 @@ import android.os.Environment;
import
android.provider.MediaStore
;
import
android.webkit.MimeTypeMap
;
import
com.mayi.fastdevelop.co
nstant
.Key
;
import
com.mayi.fastdevelop.co
mnon
.Key
;
/**
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/util/ToastUtil.java
View file @
1882698c
...
...
@@ -27,8 +27,11 @@ public class ToastUtil {
if
(
sToast
==
null
)
{
sToast
=
Toast
.
makeText
(
context
,
msg
,
duration
);
}
else
{
sToast
.
setDuration
(
duration
);
sToast
.
setText
(
msg
);
/**
*适配8.0及以上版本,8.0不会更新Toast中的文字,要创建一个新的Toast
*/
sToast
.
cancel
();
sToast
=
Toast
.
makeText
(
context
,
msg
,
duration
);
}
sToast
.
show
();
return
sToast
;
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/view/installapk/AppUpgradeManager.java
View file @
1882698c
...
...
@@ -3,25 +3,16 @@ package com.mayi.fastdevelop.view.installapk;
import
android.Manifest
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.graphics.Canvas
;
import
android.graphics.Color
;
import
android.graphics.ColorFilter
;
import
android.graphics.drawable.ColorDrawable
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.GradientDrawable
;
import
android.graphics.drawable.StateListDrawable
;
import
android.net.Uri
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
android.view.View
;
import
android.widget.ProgressBar
;
import
android.widget.TextView
;
import
com.mayi.fastdevelop.R
;
import
com.mayi.fastdevelop.bean.AppConfig
;
import
com.mayi.fastdevelop.co
nstant
.Key
;
import
com.mayi.fastdevelop.co
mnon
.Key
;
import
com.mayi.fastdevelop.util.ActivitysManager
;
import
com.mayi.fastdevelop.util.DownLoadUtil
;
import
com.mayi.fastdevelop.util.PermissionUtil
;
...
...
@@ -29,8 +20,6 @@ import com.mayi.fastdevelop.util.SpUtil;
import
com.mayi.fastdevelop.util.ToastUtil
;
import
com.mayi.fastdevelop.view.dialog.BaseDialog
;
import
com.mayi.fastdevelop.view.dialog.DialogViewHolder
;
import
com.yanzhenjie.permission.AndPermission
;
import
com.yanzhenjie.permission.Rationale
;
import
java.util.List
;
...
...
keyStore.jks
0 → 100644
View file @
1882698c
File added
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