This commit is contained in:
gwyneth-zgf 2022-10-29 19:53:42 +08:00
commit 8fe14e5914
95 changed files with 2533 additions and 0 deletions

15
.gitignore vendored Normal file
View File

@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

6
.idea/compiler.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\hp\.android\avd\Pixel_2_API_30_2.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2021-12-14T08:08:11.486210900Z" />
</component>
</project>

20
.idea/gradle.xml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

35
.idea/jarRepositories.xml Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://developer.huawei.com/repo/" />
</remote-repository>
</component>
</project>

46
.idea/misc.xml Normal file
View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/drawable/Login_input.xml" value="0.14583333333333334" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/drawable/Login_input_box.xml" value="0.14583333333333334" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/drawable/login_input_box.xml" value="0.15833333333333333" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/drawable/login_inputbox.xml" value="0.17962962962962964" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/layout/activity_detail.xml" value="0.3425925925925926" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/layout/activity_login.xml" value="0.2" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/layout/activity_main.xml" value="0.144" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/layout/activity_surface.xml" value="0.12" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/layout/bottom.xml" value="0.2" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/layout/home_fragment.xml" value="0.3425925925925926" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/layout/map_fragment.xml" value="0.136" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/layout/me_fragment.xml" value="0.264" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/layout/my_menu.xml" value="0.4" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/layout/post_activity.xml" value="0.1296875" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/layout/post_fragment.xml" value="0.2" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/layout/post_success_activity.xml" value="0.1296875" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/layout/top.xml" value="0.136" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.26979166666666665" />
<entry key="..\:/Codefield/CODE_JAVA/ShaheBar/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.26979166666666665" />
<entry key="..\:/Users/hp/AndroidStudioProjects/ShaheBar/app/src/main/res/drawable/selector.xml" value="0.16018518518518518" />
<entry key="..\:/Users/hp/AndroidStudioProjects/ShaheBar/app/src/main/res/drawable/tab_forum.xml" value="0.13703703703703704" />
<entry key="..\:/Users/hp/AndroidStudioProjects/ShaheBar/app/src/main/res/drawable/tab_map.xml" value="0.13703703703703704" />
<entry key="..\:/Users/hp/AndroidStudioProjects/ShaheBar/app/src/main/res/drawable/tab_profile.xml" value="0.13703703703703704" />
<entry key="..\:/Users/hp/AndroidStudioProjects/ShaheBar/app/src/main/res/layout/activity_detail.xml" value="0.1" />
<entry key="..\:/Users/hp/AndroidStudioProjects/ShaheBar/app/src/main/res/layout/activity_login.xml" value="0.25" />
<entry key="..\:/Users/hp/AndroidStudioProjects/ShaheBar/app/src/main/res/layout/activity_main.xml" value="0.10326086956521739" />
<entry key="..\:/Users/hp/AndroidStudioProjects/ShaheBar/app/src/main/res/layout/activity_surface.xml" value="0.17916666666666667" />
<entry key="..\:/Users/hp/AndroidStudioProjects/ShaheBar/app/src/main/res/layout/activity_surface2.xml" value="0.1" />
<entry key="..\:/Users/hp/AndroidStudioProjects/ShaheBar/app/src/main/res/layout/bottom.xml" value="0.25" />
<entry key="..\:/Users/hp/AndroidStudioProjects/ShaheBar/app/src/main/res/layout/home_fragment.xml" value="0.17916666666666667" />
<entry key="..\:/Users/hp/AndroidStudioProjects/ShaheBar/app/src/main/res/layout/me_fragment.xml" value="0.17916666666666667" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

View File

@ -0,0 +1,47 @@
{
"agcgw_all":{
"CN":"connect-drcn.dbankcloud.cn",
"CN_back":"connect-drcn.hispace.hicloud.com",
"DE":"connect-dre.dbankcloud.cn",
"DE_back":"connect-dre.hispace.hicloud.com",
"RU":"connect-drru.dbankcloud.cn",
"RU_back":"connect-drru.hispace.hicloud.com",
"SG":"connect-dra.dbankcloud.cn",
"SG_back":"connect-dra.hispace.hicloud.com"
},
"client":{
"cp_id":"2850086000388930396",
"product_id":"737518067794074853",
"client_id":"799921662886689600",
"client_secret":"A27F8DEEDDF90579293E9265C1A2455755ADEFE6ADF513C63A6A6609AE82EB64",
"project_id":"737518067794074853",
"app_id":"105307573",
"api_key":"DAEDAGx5DM0BWArj+gXm2m4jr9aIg+T/mCYc68/weMRVgNrCp5K6OVd1GlYduBU43Tba/9VE4dDbAPkHT3WE4hPr0cDKFqRVCahtdQ==",
"package_name":"com.example.shahebar"
},
"oauth_client":{
"client_id":"105307573",
"client_type":1
},
"app_info":{
"app_id":"105307573",
"package_name":"com.example.shahebar"
},
"configuration_version":"3.0",
"appInfos":[
{
"package_name":"com.example.shahebar",
"client":{
"app_id":"105307573"
},
"app_info":{
"package_name":"com.example.shahebar",
"app_id":"105307573"
},
"oauth_client":{
"client_type":1,
"client_id":"105307573"
}
}
]
}

42
app/build.gradle Normal file
View File

@ -0,0 +1,42 @@
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion '30.0.3'
defaultConfig {
applicationId "com.example.shahebar"
minSdkVersion 22
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.huawei.hms:image-render-fallback:1.0.3.302'
implementation 'com.huawei.hms:image-render:1.0.3.303'
}
apply plugin: 'com.huawei.agconnect'

30
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,30 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}

View File

@ -0,0 +1,26 @@
package com.example.shahebar;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.shahebar", appContext.getPackageName());
}
}

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.shahebar">
<!--获取照片权限-->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:requestLegacyExternalStorage="true"
android:allowBackup="true" android:fullBackupOnly="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.ShaheBar" android:appComponentFactory="xxxxx" tools:replace="android:appComponentFactory" >
<!-- 为调用相机拍照设置内容提供者 -->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.example.mydemo.fileprovider"
android:exported="false"
android:grantUriPermissions="true"
tools:ignore="WrongManifestParent">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<activity android:name=".SurfaceActivity" android:exported="false" />
<activity android:name=".MainActivity" android:exported="false" />
<activity android:name=".PostActivity" />
<activity android:name=".DetailActivity" />
<activity android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.huawei.hms.client.channel.androidMarket" android:value="false" />
</application>
<queries>
<intent>
<action android:name="com.huawei.hms.core.aidlservice" />
</intent>
</queries>
</manifest>

View File

@ -0,0 +1,32 @@
package com.example.shahebar;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
/**
* 用于数据库处理的帮助类
*/
public class DBOpenHelper extends SQLiteOpenHelper {
final String CREATE_TABLE_USERS="create table users ( uid integer primary key autoincrement,uname text not null,upwd text not null)";
final String CREATE_TABLE_POSTS="create table posts ( pid integer primary key autoincrement,title text not null,content text not null,author text not null)";
public DBOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, null, version);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_USERS);
db.execSQL(CREATE_TABLE_POSTS);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.i("ShaheBar","--版本更新"+oldVersion+"-->"+newVersion);
}
}

View File

@ -0,0 +1,35 @@
package com.example.shahebar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.Nullable;
public class DetailActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
//获取数据
String title = bundle.getString("title");
Integer image = bundle.getInt("image");
String author = bundle.getString("author");
String content = bundle.getString("content");
//获取布局文件中的view
TextView tv_title = (TextView)findViewById(R.id.detail_title);
ImageView iv_image = (ImageView)findViewById(R.id.detail_image);
TextView tv_author = (TextView)findViewById(R.id.detail_author);
TextView tv_content = (TextView)findViewById(R.id.detail_content);
tv_title.setText(title);
iv_image.setImageResource(image);
tv_author.setText(author);
tv_content.setText(content);
}
}

View File

@ -0,0 +1,96 @@
package com.example.shahebar;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 主页界面主要功能是用ListView实现帖子浏览
*/
public class Home_Fragment extends Fragment implements AdapterView.OnItemClickListener{
ListView listView;
String [] title={"建设乡宝藏日料店——烧鸟居酒屋","Bigbud热狗绝绝子","甜品店——青桔和木鱼","印象城负一楼一家好吃的冒菜","安利一家便宜超市"};
int [] image={R.drawable.post_0,R.drawable.post_1,R.drawable.post_2,R.drawable.post_3,
R.drawable.post_4};
String [] author={"PaccBet","yhann","Indulgence","路人作者1","路人作者2"};
String [] content={"餐厅交通便利,特色日式装修,店内宽敞整洁,氛围满满的日式风情,用餐环境舒适,服务态度很不错。牛鳗双宝丼鳗鱼肉质细腻,牛肉鲜嫩可口,酱汁配米饭,味道超棒!炸鸡块外酥里嫩,咖喱鸡肉饭外观精致,份量超足,大家快去试试!",
"大芽芝士瀑布热狗面包中间切开在铁板上黄油两面煎至微微焦黄松软的面包芯又带着焦脆外壳一股子奶香味意式肉酱热狗肠、马苏里拉、意式肉酱然后是各种酱料喷射biubiubiu不可能不好吃而且价格也不贵同学们可冲",
"青桔家的雪媚娘绝绝子,芋泥奥利奥可口超好吃,印着小熊猫的奶冻又好吃又好看,哪个精致的猪猪女孩不喜欢吃?",
"冒菜是一道以肉类、豆制品、青菜、海鲜、菌菇类作为主要食材制作而成的菜品,起源于成都,具有四川特色的传统小吃。\n冒菜最为讲究的吃法为干碟即在小碟中放置干的辣椒粉加上盐味精等的调料将锅里烫好的菜在干碟里轻轻一蘸然后就可以送进嘴里味道又香又辣甚为可口。",
"超市一般是指商品开放陈列、顾客自我选购、排队收银结算以经营生鲜食品水果、日杂用品为主的商店。一种消费者自助选购、统一收银结算的零售企业。在中国超级市场被引入于1978年当时称作自选商场。\n超级市场一般经销食品和日用品为主其特点主要是①薄利多销基本上不设售货员经营中低档商品②商品采用小包装、标明分量、规格和价格;③备有小车或货筐、顾客自选商品;④出门一次结算付款。"};
SimpleAdapter simpleAdapter;
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.home_fragment,container,false);
listView = view.findViewById(R.id.list);
simpleAdapter = new SimpleAdapter(getActivity(),getData(),R.layout.my_menu,new String[]{"title","image","author","content"},new int[]{R.id.myMenu_title,R.id.myMenu_image,R.id.myMenu_author,R.id.myMenu_content});
listView.setAdapter(simpleAdapter);
//listView.setOnItemClickListener(this);
//为每一个item设置点击事件
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(getActivity(),DetailActivity.class);
Bundle bundle = new Bundle();
bundle.putString("title",title[position]);
bundle.putInt("image",image[position]);
bundle.putString("author",author[position]);
bundle.putString("content",content[position]);
intent.putExtras(bundle);
//Log.i("message", title[position]+"这是一段日志");
startActivity(intent);
}
});
return view;
}
private List<Map<String,Object>> getData() {
List<Map<String,Object>> list= new ArrayList<>();
for(int i=0;i<5;i++){
Map map = new HashMap();
map.put("title",title[i]);
map.put("image",image[i]);
map.put("author",author[i]);
map.put("content",content[i]);
list.add(map);
}
return list;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String text = listView.getAdapter().getItem(position).toString();
}
}

View File

@ -0,0 +1,93 @@
package com.example.shahebar;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Toast;
import java.util.Map;
/**
* 登陆界面
*/
//登录函数没有加判断需要数据库支持
public class LoginActivity extends AppCompatActivity {
private CheckBox mCheckBox;
private Button mRegisterButton;//注册按钮
private Button mLoginButton;//登录按钮
private EditText mUser;
private EditText mKey;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
mUser=(EditText)findViewById(R.id.input_user_text);
mKey=(EditText)findViewById(R.id.input_key_text);
mRegisterButton=(Button)findViewById(R.id.register_button);
mLoginButton=(Button)findViewById(R.id.login_button);
mCheckBox=(CheckBox)findViewById(R.id.checkbox_text);
//检查是否有账号密码如果有需要回显.这个用文件就好了捏捏别管他
Map<String, String> map=SafePath.Show(this);
if(map!=null){
mUser.setText(map.get("user"));
mKey.setText(map.get("key"));
}
mLoginButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) //给登录按钮设置监听器
{
String username = mUser.getText().toString();
String userpassword = mKey.getText().toString();
//判断提示为空
if(TextUtils.isEmpty(username)|| TextUtils.isEmpty(userpassword)){
Toast.makeText(LoginActivity.this, R.string.message1,
Toast.LENGTH_SHORT).show();
}
//回显的功能
if(mCheckBox.isChecked()){
boolean result=SafePath.Save(LoginActivity.this,username,userpassword);
if(result){
Toast.makeText(LoginActivity.this, R.string.message2,
Toast.LENGTH_SHORT).show();
}
}
Toast.makeText(LoginActivity.this, R.string.press_login_button1,
Toast.LENGTH_SHORT).show();//事件触发,显示欢迎信息
//下面跳转论坛界面
Intent intent = new Intent();
intent.setClass(LoginActivity.this, MainActivity.class);
startActivity(intent);
LoginActivity.this.finish();
}
});
mRegisterButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v)
{
Intent intent = new Intent();
intent.setClass(LoginActivity.this, SurfaceActivity.class);
startActivity(intent);//跳转注册界面
LoginActivity.this.finish();
}
});
}
}

View File

@ -0,0 +1,186 @@
package com.example.shahebar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
/**
* 主要功能是实现顶部栏底部导航栏中部Fragment切换
*/
public class MainActivity extends FragmentActivity implements View.OnClickListener{
//声明三个Tab的布局文件
private LinearLayout tabHome;
private LinearLayout tabMap;
private LinearLayout tabMe;
//声明三个Tab的ImageButton
private ImageButton igHome;
private ImageButton igMap;
private ImageButton igMe;
//声明三个Tab分别对应的Fragment
private Fragment fragHome;
private Fragment fragMap;
private Fragment fragMe;
//数据库
//private DBOpenHelper dbOpenHelper;
//获取数据
//Cursor cursor_user = dbOpenHelper.getReadableDatabase().query("users",null,"uid=?",new String[]{"1"},null,null,null);//数据表指定的列查询条件占位符的值
//Cursor cursor_post = dbOpenHelper.getReadableDatabase().query("posts",null,null,null,null,null,null);//数据表指定的列查询条件占位符的值
//int number = cursor_post.getCount();//posts表的行数
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
//初始化数据库
//dbOpenHelper = new DBOpenHelper(MainActivity.this,"db_bar",null,1);//实例化db_bar为数据库名称
initViews();//初始化控件
initEvents();//初始化事件
selectTab(0);//默认选中第一个Tab
Button button = (Button) findViewById(R.id.post);
button.setOnClickListener(new View.OnClickListener(){
public void onClick(View vw){
Intent intent = new Intent(MainActivity.this,PostActivity.class);
startActivity(intent);
}
});
/**想弄数据库但是失败了
Bundle bundle = new Bundle();
while(cursor_user.moveToNext()){
bundle.putInt("uid",cursor_user.getInt(0));
bundle.putString("uname",cursor_user.getString(1));//第一列是uname索引从零开始
bundle.putString("upwd",cursor_user.getString(2));//第二列是upwd
}
while(cursor_post.moveToNext()){
bundle.putInt("pid",cursor_post.getInt(0));
bundle.putString("title",cursor_post.getString(1));
bundle.putString("content",cursor_post.getString(2));
bundle.putString("author",cursor_post.getString(3));
}
fragMe.setArguments(bundle);
**/
}
private void initEvents() {
//初始化三个Tab的点击事件
tabHome.setOnClickListener(this);
tabMap.setOnClickListener(this);
tabMe.setOnClickListener(this);
}
private void initViews() {
//初始化三个Tab的布局文件
tabHome = (LinearLayout) findViewById(R.id.tab1);
tabMap = (LinearLayout) findViewById(R.id.tab2);
tabMe = (LinearLayout) findViewById(R.id.tab3);
//初始化三个ImageButton
igHome = (ImageButton) findViewById(R.id.tab1_img);
igMap = (ImageButton) findViewById(R.id.tab2_img);
igMe = (ImageButton) findViewById(R.id.tab3_img);
}
//处理Tab的点击事件
@Override
public void onClick(View v) {
resetImgs(); //先将三个ImageButton置为灰色
switch (v.getId()) {
case R.id.tab1:
selectTab(0);
break;
case R.id.tab2:
selectTab(1);
break;
case R.id.tab3:
selectTab(2);
break;
}
}
//进行选中Tab的处理
private void selectTab(int i) {
//获取FragmentManager对象
FragmentManager manager = getSupportFragmentManager();
//获取FragmentTransaction对象
FragmentTransaction transaction = manager.beginTransaction();
//先隐藏所有的Fragment
hideFragments(transaction);
switch (i) {
//当选中点击的是第一页的Tab时
case 0:
//设置第一页的ImageButton为绿色
igHome.setImageResource(R.mipmap.home2);
//如果第一页对应的Fragment没有实例化则进行实例化并显示出来
if (fragHome == null) {
fragHome = new Home_Fragment();
transaction.add(R.id.id_content, fragHome);
} else {
//如果第一页对应的Fragment已经实例化则直接显示出来
transaction.show(fragHome);
}
break;
case 1:
igMap.setImageResource(R.mipmap.location2);
if (fragMap == null) {
fragMap = new Map_Fragment();
transaction.add(R.id.id_content, fragMap);
} else {
transaction.show(fragMap);
}
break;
case 2:
igMe.setImageResource(R.mipmap.user2);
if (fragMe == null) {
fragMe = new Me_Fragment();
transaction.add(R.id.id_content, fragMe);
} else {
transaction.show(fragMe);
}
break;
}
//不要忘记提交事务
transaction.commit();
}
//将三个的Fragment隐藏
private void hideFragments(FragmentTransaction transaction) {
if (fragHome != null) {
transaction.hide(fragHome);
}
if (fragMap != null) {
transaction.hide(fragMap);
}
if (fragMe != null) {
transaction.hide(fragMe);
}
}
//将三个ImageButton置为灰色
private void resetImgs() {
igHome.setImageResource(R.mipmap.home1);
igMap.setImageResource(R.mipmap.location1);
igMe.setImageResource(R.mipmap.user1);
}
}

View File

@ -0,0 +1,20 @@
package com.example.shahebar;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
/**
* 校园地图界面
*/
public class Map_Fragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.map_fragment,container,false);
return view;
}
}

View File

@ -0,0 +1,50 @@
package com.example.shahebar;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.app.FragmentTransaction;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
/**
* 个人主页
*/
public class Me_Fragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.me_fragment,container,false);
/*
Button button = (Button) getActivity().findViewById(R.id.exit);
button.setOnClickListener(new View.OnClickListener(){
public void onClick(View vw){
Intent intent = new Intent(getActivity(),LoginActivity.class);
startActivity(intent);
}
});*/
return view;
}
/**
@Override
public void onStart() {
super.onStart();
if(isAdded()){
String uid = getArguments().getString("uid");
String uname = getArguments().getString("uname");
String upwd = getArguments().getString("upwd");
}
}**/
}

View File

@ -0,0 +1,172 @@
package com.example.shahebar;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ContentResolver;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.PixelFormat;
import android.hardware.Camera;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
* 发帖界面难点和亮点是实现照片上传/拍照
*/
public class PostActivity extends AppCompatActivity {
public static final int TAKE_PHOTO = 1;//声明一个请求码用于识别返回的结果
private ImageView picture;
private Uri imageUri;
private final String filePath = Environment.getExternalStorageDirectory() + File.separator + "output_image.jpg";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.post_activity);
///////////////////
//点击事件进行拍照
Button takephoto = findViewById(R.id.take_photo);
picture = findViewById(R.id.picture);
takephoto.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
//动态请求相机权限
requestPermission(); //在其中若用户给予权限则请求相机拍照
}
});
//设置默认图片
setDefualtImage();
///////////////////
Button button = (Button) findViewById(R.id.submit);
button.setOnClickListener(new View.OnClickListener(){
public void onClick(View vw){
Toast.makeText(PostActivity.this, "提交成功!",
Toast.LENGTH_SHORT).show();//事件触发,显示欢迎信息
Intent intent = new Intent(PostActivity.this,MainActivity.class);
startActivity(intent);
}
});
}
//动态请求权限
private void requestPermission() {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
//请求权限
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA}, 1);
} else {
//调用
requestCamera();
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (grantResults != null && grantResults.length != 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
switch (requestCode) {
case 1: {
requestCamera();
}
break;
}
}
}
private void requestCamera() {
File outputImage = new File(filePath);
/*
创建一个File文件对象用于存放摄像头拍下的图片我们把这个图片命名为output_image.jpg
并把它存放在应用关联缓存目录下调用getExternalCacheDir()可以得到这个目录为什么要
用关联缓存目录呢由于android6.0开始读写sd卡列为了危险权限使用的时候必须要有权限
应用关联目录则可以跳过这一步
*/
try//判断图片是否存在存在则删除在创建不存在则直接创建
{
if (!outputImage.getParentFile().exists()) {
outputImage.getParentFile().mkdirs();
}
if (outputImage.exists()) {
outputImage.delete();
}
outputImage.createNewFile();
if (Build.VERSION.SDK_INT >= 24) {
imageUri = FileProvider.getUriForFile(this,
"com.example.mydemo.fileprovider", outputImage);
} else {
imageUri = Uri.fromFile(outputImage);
}
//使用隐示的Intent系统会找到与它对应的活动即调用摄像头并把它存储
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, TAKE_PHOTO);
//调用会返回结果的开启方式返回成功的话则把它显示出来
} catch (IOException e) {
e.printStackTrace();
}
}
//处理返回结果的函数下面是隐示Intent的返回结果的处理方式具体见以前我所发的intent讲解
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case TAKE_PHOTO:
if (resultCode == RESULT_OK) {
try {
Bitmap bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(imageUri));
picture.setImageBitmap(bitmap);
//将图片解析成Bitmap对象并把它显现出来
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
break;
default:
break;
}
}
//设置保存拍照图片>再次关闭app重新打开显示为上次拍照照片
private void setDefualtImage() {
File outputImage = new File(filePath);
if (!outputImage.exists()) {
return;
}
picture.setImageBitmap(BitmapFactory.decodeFile(filePath));
}
}

View File

@ -0,0 +1,52 @@
package com.example.shahebar;
import android.content.Context;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
//只留下保存信息回显一个功能
public class SafePath {
public static boolean Save(Context context, String user, String key){
try {
File f= new File(context.getFilesDir(),"info.txt");
FileOutputStream fs=new FileOutputStream(f);
fs.write((user+"#####"+key+"\n").getBytes());
fs.close();
return true;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
}
public static Map<String,String> Show(Context context){
File f= new File(context.getFilesDir(),"info.txt");
try {
BufferedReader br= new BufferedReader(new InputStreamReader(new FileInputStream(f)));
String s = br.readLine();
String[] info = s.split("#####");
Map<String, String> map = new HashMap<String, String>();
map.put("user", info[0]);
map.put("key", info[1]);
return map;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
}

View File

@ -0,0 +1,66 @@
package com.example.shahebar;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
//注册界面
public class SurfaceActivity extends AppCompatActivity {
private EditText identity;
private EditText password;
private EditText again;
private Button register_button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_surface);
identity = (EditText) findViewById(R.id.input_identity_text);
password = (EditText) findViewById(R.id.input_password_text);
again = (EditText) findViewById(R.id.input_again_text);
register_button= (Button)findViewById(R.id.surface_register_button);
//下面的点击事件全交给数据库,留了一个返回登录界面功能
register_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
/*String username = identity.getText().toString();
String pswd = password.getText().toString();
String againpw = again.getText().toString();
if (TextUtils.isEmpty(username) || TextUtils.isEmpty(pswd)) {
Toast.makeText(SurfaceActivity.this, R.string.message1,
Toast.LENGTH_SHORT).show();
}
if (!SafePath.Check(SurfaceActivity.this, username)) {
Toast.makeText(SurfaceActivity.this, "用户名重复",
Toast.LENGTH_SHORT).show();
}
if (!againpw.equals(pswd)) {
Toast.makeText(SurfaceActivity.this, "密码不一致",
Toast.LENGTH_SHORT).show();
} else {
boolean result = SafePath.Save(SurfaceActivity.this, username, pswd);
if (result) {
}
}*/
Toast.makeText(SurfaceActivity.this, "注册成功",
Toast.LENGTH_SHORT).show();
Intent intent = new Intent();
intent.setClass(SurfaceActivity.this, LoginActivity.class);
startActivity(intent);//跳转登录界面
finish();
}
});
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/black" />
<stroke android:width="3dp" android:color="@color/purple_500" />
<corners android:radius="0dp" />
<padding android:left="0dp" android:top="0dp"
android:right="0dp" android:bottom="0dp" />
</shape>

View File

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="1dp"
android:color="#A6A6A6"/>
<corners
android:radius="10dp"/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/detail_title"
android:layout_margin="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="标题:"
android:textSize="25sp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="作者:"></TextView>
<TextView
android:id="@+id/detail_author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="作者" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:gravity="right"
android:text="2021.12.12"></TextView>
</LinearLayout>
<TextView
android:id="@+id/detail_content"
android:layout_margin="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="18dp"
android:text="内容:"/>
<ImageView
android:id="@+id/detail_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
/>
</LinearLayout>

View File

@ -0,0 +1,121 @@
<?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:background="@color/white"
android:orientation="vertical"
>
<ImageView
android:layout_width="130dp"
android:layout_height="130dp"
android:padding="5dp"
android:layout_gravity="center"
android:layout_marginTop="60dp"
android:background="@drawable/bg_border"
android:src="@drawable/head" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="30dp">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="50dp"
android:src="@mipmap/login1" />
<EditText
android:id="@+id/input_user_text"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:paddingLeft="5dp"
android:hint="用户名"
android:maxLines="1"
android:textSize="15dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="50dp"
android:src="@mipmap/password1" />
<EditText
android:layout_width="250dp"
android:layout_height="50dp"
android:id="@+id/input_key_text"
android:layout_marginLeft="5dp"
android:paddingLeft="5dp"
android:maxLines="1"
android:textSize="15dp"
android:hint="密码"
android:inputType="textPassword"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/checkbox_text"
android:orientation="vertical"
android:layout_marginLeft="45dp"
android:checked="true"
android:textSize="12dp"
android:text="@string/checkbox_text"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<Button
android:id="@+id/register_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:background="@drawable/login_inputbox"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/register_button"
android:textSize="18dp" />
<Button
android:id="@+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:background="@drawable/login_inputbox"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/login_button"
android:textSize="18dp" />
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/thirdpart">
</ImageView>
</LinearLayout>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
layout="@layout/top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top" />
<FrameLayout
android:id="@+id/id_content"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_weight="1">
</FrameLayout>
<include
layout="@layout/bottom"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_width="match_parent" />
</LinearLayout>

View File

@ -0,0 +1,116 @@
<?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"
android:background="@color/white">
<ImageView
android:background="@drawable/bg_border"
android:padding="5dp"
android:layout_width="130dp"
android:layout_height="130dp"
android:layout_gravity="center"
android:layout_marginTop="50dp"
android:src="@drawable/head" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="50dp"
android:src="@mipmap/login1"/>
<EditText
android:id="@+id/input_identity_text"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:textSize="15dp"
android:maxLines="1"
android:hint="用户名"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="50dp"
android:src="@mipmap/password1"/>
<EditText
android:id="@+id/input_password_text"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:textSize="15dp"
android:maxLines="1"
android:hint="密码"
android:inputType="textPassword"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="50dp"
android:src="@mipmap/password1"/>
<EditText
android:id="@+id/input_again_text"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:textSize="15dp"
android:maxLines="1"
android:hint="密码(重复)"
android:inputType="textPassword"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="50dp"
android:src="@mipmap/email"/>
<EditText
android:id="@+id/input_mailbox_text"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:textSize="15dp"
android:maxLines="1"
android:hint="邮箱"/>
</LinearLayout>
<Button
android:id="@+id/surface_register_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_gravity="center"
android:background="@drawable/login_inputbox"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/register_button"
android:textSize="18dp" />
</LinearLayout>

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/tab1"
android:gravity="center"
android:orientation="vertical">
<ImageButton
android:id="@+id/tab1_img"
android:clickable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/home1"
android:background="#00000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#515151"
android:text="主页"/>
</LinearLayout>
<LinearLayout
android:id="@+id/tab2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageButton
android:id="@+id/tab2_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:clickable="false"
android:src="@mipmap/location1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#515151"
android:text="地图"/>
</LinearLayout>
<LinearLayout
android:id="@+id/tab3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageButton
android:id="@+id/tab3_img"
android:clickable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/user1"
android:background="#00000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#515151"
android:text="个人主页"
android:maxLines="1"/>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,16 @@
<?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">
<!--用来显示主页-->
<!--数据库整出来后,应该用适配器-->
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--用来显示地图-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="地图模块"
android:layout_margin="5dp"
android:textSize="25dp"
android:gravity="center" />
<ImageView
android:layout_width="match_parent"
android:layout_height="1200dp"
android:src="@drawable/map">
</ImageView>
</RelativeLayout>

View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical">
<!--用来显示个人主页-->
<TextView
android:id="@+id/me"
android:textSize="25sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_gravity="center_horizontal"
android:text="个人主页"
android:textColor="#515151"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/head"
android:layout_margin="20dp"
android:padding="5dp"
android:background="@drawable/bg_border"/>
<LinearLayout
android:layout_width="200dp"
android:layout_height="80dp"
android:orientation="vertical"
android:layout_margin="20dp">
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="用户名:曾桂芳" />
<TextView
android:id="@+id/number"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="学号2020090914003" />
<TextView
android:id="@+id/phone"
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="电话188xxxx6647"
android:layout_weight="1"/>
</LinearLayout>
<Button
android:id="@+id/edit"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@mipmap/change"
android:layout_gravity="center"/>
</LinearLayout>
<Button
android:id="@+id/my_posts"
android:layout_margin="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:text="我的帖子"
android:textColor="@color/black"/>
<Button
android:id="@+id/setup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@color/white"
android:textColor="@color/black"
android:text="设置" />
<Button
android:id="@+id/about"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@color/white"
android:textColor="@color/black"
android:text="关于" />
<Button
android:id="@+id/exit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@color/white"
android:textColor="@color/black"
android:text="退出" />
</LinearLayout>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/myMenu_image"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_margin="20dp"
android:layout_gravity="top"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="20dp"
android:layout_marginRight="5dp"
android:orientation="vertical"
android:requiresFadingEdge="vertical"
android:fadingEdgeLength="20dp"
android:fadingEdge="vertical">
<TextView
android:id="@+id/myMenu_title"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="3"
android:text="title"
android:textColor="@color/black"
android:textSize="15sp" />
<TextView
android:id="@+id/myMenu_author"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_weight="1.3"
android:text="author"
android:textColor="#515151"
android:textSize="12sp" />
<TextView
android:id="@+id/myMenu_content"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_weight="1.5"
android:text="content"
android:textColor="#515151"
android:textSize="12sp"
/>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,86 @@
<?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"
android:padding="16dp">
<!--用来显示提交帖子页面-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="15"
android:layout_margin="5dp"
android:textColor="#515151"
android:text="发布帖子"
android:textSize="25sp" />
<Button
android:id="@+id/submit"
android:layout_width="80dp"
android:layout_height="40dp"
android:layout_gravity="right"
android:text="提交"
android:background="#6200EE"
android:textColor="@color/white"
android:textSize="15dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="标题:"
android:textSize="18sp">
</TextView>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content">
</EditText>
</LinearLayout>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="说点什么吧~"
android:gravity="top"
android:lines="15"
android:background="#FFFFF0"
android:padding="5dp"
android:layout_marginBottom="10dp"
android:inputType="textMultiLine"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请添加照片:"
android:textSize="18sp">
</TextView>
<Button
android:id="@+id/take_photo"
android:text="打开相机"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/picture"
android:layout_width="100dp"
android:layout_height="100dp" />
</LinearLayout>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="提交成功"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="50dp">
<ImageView
android:layout_width="4dp"
android:layout_height="45dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:src="@mipmap/user3"
android:layout_weight="1"/>
<EditText
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:background="@drawable/login_inputbox"
android:hint=" 搜索"
android:maxLines="1"
android:layout_weight="7"/>
<Button
android:id="@+id/post"
android:layout_width="04dp"
android:layout_height="45dp"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:background="@mipmap/add"
android:layout_weight="1"/>
</LinearLayout>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 904 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
app/src/main/res/post_5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.ShaheBar" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="posts_name">
<item>帖子1</item>
<item>帖子2</item>
<item>帖子3</item>
<item>帖子4</item>
</string-array>
</resources>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="gray">#E0E0E0</color>
<color name="light_blue_600">#FF039BE5</color>
<color name="light_blue_900">#FF01579B</color>
<color name="light_blue_A200">#FF40C4FF</color>
<color name="light_blue_A400">#FF00B0FF</color>
<color name="black_overlay">#66000000</color>
<color name="ivory">#FFFFF0</color> <!--象牙色 -->
</resources>

View File

@ -0,0 +1,33 @@
<resources>
<string name="app_name">沙河拾金</string>
<string name="login_text">用户登录</string>
<string name="checkbox_text">记住密码</string>
<string name="username_text">用 户:</string>
<string name="input_user_text">******</string>
<string name="key_text">密 码:</string>
<string name="input_key_text">******</string>
<string name="register_button">注册</string>
<string name="login_button">登录</string>
<string name="message1">账号或者密码不能为空</string>
<string name="message2">保存成功</string>
<string name="press_login_button1">欢迎登录!</string>
<string name="press_login_button2">登录失败!</string>
<string name="press_register_button">欢迎注册!</string>
<string name="register_surface">用户注册</string>
<string name="identity_text">账 号:</string>
<string name="input_identity_text">******</string>
<string name="password_text">密 码:</string>
<string name="input_password_text"></string>
<string name="mailbox_text">邮 箱:</string>
<string name="input_mailbox_text"></string>
<string name="phonenumber_text">电 话:</string>
<string name="input_phonenumber_text"></string>
<string name="surface2_register_button">注册</string>
<string name="register_message">注册成功!</string>
<string name="surface2_message">不能为空!</string>
<string name="again_text">重 复:</string>
</resources>

View File

@ -0,0 +1,19 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.ShaheBar" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<!--取消标题栏-->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path
name="my_images"
path="."/>
</paths>

View File

@ -0,0 +1,17 @@
package com.example.shahebar;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

33
build.gradle Normal file
View File

@ -0,0 +1,33 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven {
url 'https://developer.huawei.com/repo/'
}
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.2"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.huawei.agconnect:agcp:1.4.2.300'
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven {
url 'https://developer.huawei.com/repo/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

18
gradle.properties Normal file
View File

@ -0,0 +1,18 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
android.enableJetifier=true

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Wed Dec 08 21:53:46 CST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

172
gradlew vendored Normal file
View File

@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
gradlew.bat vendored Normal file
View File

@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

2
settings.gradle Normal file
View File

@ -0,0 +1,2 @@
rootProject.name = "ShaheBar"
include ':app'