forked from coder-pig/DrySister
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
693 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
app/src/main/java/com/coderpig/drysisters/ui/fragment/AboutFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.coderpig.drysisters.ui.fragment; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import com.coderpig.drysisters.R; | ||
import com.coderpig.drysisters.utils.PackageUtils; | ||
import com.coderpig.drysisters.utils.ResUtils; | ||
|
||
/** | ||
* 描述: 关于的Fragment | ||
* | ||
* @author CoderPig on 2018/02/28 14:33. | ||
*/ | ||
|
||
public class AboutFragment extends Fragment { | ||
|
||
private TextView tv_app_version; | ||
|
||
public static AboutFragment newInstance() { | ||
AboutFragment fragment = new AboutFragment(); | ||
return fragment; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
View view = inflater.inflate(R.layout.fragment_about, container, false); | ||
tv_app_version = view.findViewById(R.id.tv_app_version); | ||
return view; | ||
} | ||
|
||
@Override | ||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
String version = PackageUtils.packageName(); | ||
if(version != null) { | ||
String msg = String.format(ResUtils.getString(R.string.app_version), version); | ||
tv_app_version.setText(msg); | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
app/src/main/java/com/coderpig/drysisters/ui/fragment/SettingFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.coderpig.drysisters.ui.fragment; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import com.coderpig.drysisters.R; | ||
import com.coderpig.drysisters.utils.PackageUtils; | ||
import com.coderpig.drysisters.utils.ResUtils; | ||
|
||
/** | ||
* 描述: 应用设置的Fragment | ||
* | ||
* @author CoderPig on 2018/02/28 13:56. | ||
*/ | ||
|
||
public class SettingFragment extends Fragment { | ||
|
||
private TextView tv_app_version; | ||
|
||
public static SettingFragment newInstance() { | ||
SettingFragment fragment = new SettingFragment(); | ||
return fragment; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
View view = inflater.inflate(R.layout.fragment_setting, container, false); | ||
tv_app_version = view.findViewById(R.id.tv_app_version); | ||
return view; | ||
} | ||
|
||
@Override | ||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
String version = PackageUtils.packageName(); | ||
if(version != null) { | ||
String msg = String.format(ResUtils.getString(R.string.cur_version), version); | ||
tv_app_version.setText(msg); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
app/src/main/java/com/coderpig/drysisters/utils/PackageUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.coderpig.drysisters.utils; | ||
|
||
import android.content.pm.PackageInfo; | ||
import android.content.pm.PackageManager; | ||
|
||
import com.coderpig.drysisters.DrySisterApp; | ||
|
||
/** | ||
* 描述:应用包相关的工具类 | ||
* | ||
* @author CoderPig on 2018/02/28 18:01. | ||
*/ | ||
|
||
public class PackageUtils { | ||
|
||
public static int packageCode() { | ||
PackageManager manager = DrySisterApp.getContext().getPackageManager(); | ||
int code = 0; | ||
try { | ||
PackageInfo info = manager.getPackageInfo(DrySisterApp.getContext().getPackageName(), 0); | ||
code = info.versionCode; | ||
} catch (PackageManager.NameNotFoundException e) { | ||
e.printStackTrace(); | ||
} | ||
return code; | ||
} | ||
|
||
public static String packageName() { | ||
PackageManager manager = DrySisterApp.getContext().getPackageManager(); | ||
String name = null; | ||
try { | ||
PackageInfo info = manager.getPackageInfo(DrySisterApp.getContext().getPackageName(), 0); | ||
name = info.versionName; | ||
} catch (PackageManager.NameNotFoundException e) { | ||
e.printStackTrace(); | ||
} | ||
return name; | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<solid android:color="@color/colorPrimaryDark" /> | ||
<corners android:radius="5dp" /> | ||
<padding | ||
android:bottom="15dp" | ||
android:left="15dp" | ||
android:right="15dp" | ||
android:top="15dp" /> | ||
|
||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<solid android:color="@color/green" /> | ||
<corners android:radius="5dp" /> | ||
<padding | ||
android:bottom="15dp" | ||
android:left="15dp" | ||
android:right="15dp" | ||
android:top="15dp" /> | ||
|
||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<solid android:color="@color/purple" /> | ||
<corners android:radius="5dp" /> | ||
<padding | ||
android:bottom="15dp" | ||
android:left="15dp" | ||
android:right="15dp" | ||
android:top="15dp" /> | ||
|
||
</shape> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?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:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@color/white"> | ||
|
||
<android.support.design.widget.AppBarLayout | ||
android:id="@+id/ably_bar" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"> | ||
|
||
<android.support.v7.widget.Toolbar | ||
android:id="@+id/toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="?attr/actionBarSize" | ||
android:background="?attr/colorPrimary" | ||
android:theme="@style/ToolbarTheme" /> | ||
|
||
</android.support.design.widget.AppBarLayout> | ||
|
||
<android.support.constraint.ConstraintLayout | ||
android:id="@+id/cly_root" | ||
android:layout_width="0dp" | ||
android:layout_height="0dp" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/ably_bar" /> | ||
|
||
</android.support.constraint.ConstraintLayout> |
Oops, something went wrong.