Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加灾害预警功能 #3

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
添加功能
  • Loading branch information
牛冲 committed Apr 16, 2019
commit bb01ce82f9bea5a3f06d9c1dd258a2533520e683
29 changes: 28 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'walle'

android {
compileSdkVersion 28
Expand All @@ -10,15 +11,24 @@ android {
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

signingConfigs {
he {
keyAlias "heweather"
keyPassword "He123qwe."
storeFile rootProject.file("he.jks")
storePassword "He123qwe."
}
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.he
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.he
}
}
allprojects {
Expand All @@ -44,6 +54,23 @@ android {
release.setRoot('build-types/release')
}
}
buildscript {
repositories {
jcenter()
}
}
//生成渠道包 ./gradlew clean assembleReleaseChannels
//支持 productFlavors ./gradlew clean assembleMeituanReleaseChannels
//生成单个渠道包 ./gradlew clean assembleReleaseChannels -PchannelList=google
//生成多个渠道包 ./gradlew clean assembleReleaseChannels -PchannelList=google,dianping
walle {
// 指定渠道包的输出路径
apkOutputFolder = new File("${project.buildDir}/channels")
// 定制渠道包的APK的文件名称
apkFileNameFormat = '${appName}-${channel}-${buildType}-v${versionName}-${versionCode}-${buildTime}.apk'
// 渠道配置文件
channelFile = new File("${project.getProjectDir()}/channel")
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<!-- 设置key -->
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="高德的key" />
android:value="9656fca1e4cef43a19082b4f37b600bb" />

<service android:name="com.amap.api.location.APSService" />
<service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.heweather.owp.view.activity;

import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.heweather.owp.R;

Expand All @@ -17,5 +20,26 @@ public void onClick(View view) {
onBackPressed();
}
});

TextView tvVersion = findViewById(R.id.tv_version_num);
tvVersion.setText(getVersionName(this));
}

/**
* 获取versionName
*
* @param context 上下文
* @return 版本号
*/
private static String getVersionName(Context context) {
String versionName = "";
try {
versionName = context.getPackageManager().
getPackageInfo(context.getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return "v" + versionName;
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.heweather.owp.view.fragment;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
Expand Down Expand Up @@ -298,6 +300,13 @@ private void initView(View view) {
textViewList.add(tvLineMin);
tvLineMax = view.findViewById(R.id.tv_line_max_tmp);
textViewList.add(tvLineMax);
TextView tvFrom = view.findViewById(R.id.tv_from);
tvFrom.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startUri();
}
});

tvSunTitle = view.findViewById(R.id.tv_sun_title);
textViewList.add(tvSunTitle);
Expand Down Expand Up @@ -826,4 +835,10 @@ public void setUserVisibleHint(boolean isVisibleToUser) {
hasAni = true;
}
}

private void startUri(){
Uri uri = Uri.parse("https://www.heweather.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
}
1 change: 1 addition & 0 deletions app/src/main/res/layout/layout_today_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@
</LinearLayout>

<TextView
android:id="@+id/tv_from"
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="@color/back_white"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,6 @@
<string name="Cape_Town">Cape Town</string>
<string name="Bangkok">Bangkok</string>
<string name="Madrid">Madrid</string>
<string name="powered">Powered By heweather.com</string>

</resources>