forked from BeyondDimension/SteamTools
-
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
133 changed files
with
667 additions
and
206 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
using System; | ||
|
||
using Android.App; | ||
using Android.Views; | ||
|
||
namespace Xamarin.Android.Design | ||
{ | ||
public delegate Java.Lang.Object OnLayoutItemNotFoundHandler(int resourceId, Type expectedViewType); | ||
|
||
abstract class LayoutBinding | ||
{ | ||
Activity boundActivity; | ||
View boundView; | ||
OnLayoutItemNotFoundHandler onLayoutItemNotFound; | ||
|
||
protected LayoutBinding(Activity activity, OnLayoutItemNotFoundHandler onLayoutItemNotFound = null) | ||
{ | ||
boundActivity = activity ?? throw new ArgumentNullException(nameof(activity)); | ||
this.onLayoutItemNotFound = onLayoutItemNotFound; | ||
} | ||
|
||
protected LayoutBinding(View view, OnLayoutItemNotFoundHandler onLayoutItemNotFound = null) | ||
{ | ||
boundView = view ?? throw new ArgumentNullException(nameof(view)); | ||
this.onLayoutItemNotFound = onLayoutItemNotFound; | ||
} | ||
|
||
protected T FindView<T>(int resourceId, ref T cachedField) where T : View | ||
{ | ||
if (cachedField != null) | ||
return cachedField; | ||
|
||
T ret; | ||
if (boundActivity != null) | ||
ret = boundActivity.FindViewById<T>(resourceId); | ||
else | ||
ret = boundView.FindViewById<T>(resourceId); | ||
|
||
if (ret == null && onLayoutItemNotFound != null) | ||
ret = (T)onLayoutItemNotFound(resourceId, typeof(T)); | ||
|
||
if (ret == null) | ||
throw new global::System.InvalidOperationException($"View not found (Resource ID: {resourceId})"); | ||
|
||
cachedField = ret; | ||
return ret; | ||
} | ||
|
||
Activity EnsureActivity() | ||
{ | ||
if (boundActivity != null) | ||
return boundActivity; | ||
|
||
var ret = boundView?.Context as Activity; | ||
if (ret != null) | ||
return ret; | ||
|
||
throw new InvalidOperationException("Finding fragments is supported only for Activity instances"); | ||
} | ||
|
||
T __FindFragment<T>(int resourceId, Func<Activity, T> finder, ref T cachedField) where T : Java.Lang.Object | ||
{ | ||
if (cachedField != null) | ||
return cachedField; | ||
|
||
var ret = finder(EnsureActivity()); | ||
if (ret == null && onLayoutItemNotFound != null) | ||
ret = (T)onLayoutItemNotFound(resourceId, typeof(T)); | ||
|
||
if (ret == null) | ||
throw new InvalidOperationException($"Fragment not found (ID: {resourceId}; Type: {typeof(T)})"); | ||
|
||
cachedField = ret; | ||
return ret; | ||
} | ||
#if __ANDROID_11__ | ||
//protected T FindFragment<T>(int resourceId, global::Android.App.Fragment __ignoreMe, ref T cachedField) where T : global::Android.App.Fragment | ||
//{ | ||
// return __FindFragment<T>(resourceId, (activity) => activity.FragmentManager.FindFragmentById<T>(resourceId), ref cachedField); | ||
//} | ||
#endif // __ANDROID_11__ | ||
|
||
#if __HAVE_SUPPORT__ | ||
protected T FindFragment <T> (int resourceId, global::Android.Support.V4.App.Fragment __ignoreMe, ref T cachedField) where T: global::Android.Support.V4.App.Fragment | ||
{ | ||
return __FindFragment<T> (resourceId, (activity) => activity.FragmentManager.FindFragmentById<T> (resourceId), ref cachedField); | ||
} | ||
#endif // __HAVE_SUPPORT__ | ||
|
||
#if __HAVE_ANDROIDX__ | ||
protected T FindFragment<T>(int resourceId, global::AndroidX.Fragment.App.Fragment __ignoreMe, ref T cachedField) where T : global::AndroidX.Fragment.App.Fragment | ||
{ | ||
return __FindFragment(resourceId, (activity) => | ||
{ | ||
if (activity is AndroidX.AppCompat.App.AppCompatActivity activity_) | ||
{ | ||
return global::Android.Runtime.Extensions.JavaCast<T>(activity_.SupportFragmentManager.FindFragmentById(resourceId)); | ||
} | ||
else | ||
{ | ||
throw new InvalidCastException(activity.GetType().ToString()); | ||
} | ||
}, ref cachedField); | ||
} | ||
#endif // __HAVE_ANDROIDX__ | ||
} | ||
} |
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
Binary file modified
BIN
+194 Bytes
(100%)
src/ST.Client.Mobile.Droid.Design/app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
9 changes: 1 addition & 8 deletions
9
src/ST.Client.Mobile.Droid.Design/app/src/main/res/values/strings.xml
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 |
---|---|---|
@@ -1,10 +1,3 @@ | ||
<resources> | ||
<string name="local_auth">本地令牌</string> | ||
<string name="my">我的</string> | ||
<string name="community_fix">社区加速</string> | ||
<string name="game_list">库存游戏</string> | ||
<string name="under_construction">该功能正在开发中,敬请期待</string> | ||
<string name="login_and_register">登录 / 注册</string> | ||
<string name="settings">设置</string> | ||
<string name="edit_profile">编辑资料</string> | ||
<string name="app_name">Steam++(Design)</string> | ||
</resources> |
3 changes: 0 additions & 3 deletions
3
src/ST.Client.Mobile.Droid.Design/app/src/main/res/values/strings__dont_link.xml
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
rootProject.name = "Steam++" | ||
include ':app' | ||
include ':ui' | ||
include ':ui' |
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 @@ | ||
/build |
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,50 @@ | ||
plugins { | ||
id 'com.android.library' | ||
} | ||
|
||
android { | ||
compileSdkVersion 30 | ||
|
||
defaultConfig { | ||
minSdkVersion 21 | ||
targetSdkVersion 30 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles "consumer-rules.pro" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
buildFeatures { | ||
viewBinding true | ||
} | ||
lintOptions { | ||
abortOnError false | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'de.hdodenhof:circleimageview:3.1.0' | ||
implementation 'androidx.appcompat:appcompat:1.3.0' | ||
implementation 'com.google.android.material:material:1.3.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | ||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1' | ||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1' | ||
implementation 'androidx.navigation:navigation-fragment:2.3.5' | ||
implementation 'androidx.navigation:navigation-ui:2.3.5' | ||
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha05' | ||
implementation 'androidx.viewpager2:viewpager2:1.0.0' | ||
testImplementation 'junit:junit:4.+' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.2' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' | ||
} |
Empty file.
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,21 @@ | ||
# 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 |
26 changes: 26 additions & 0 deletions
26
...bile.Droid.Design/ui/src/androidTest/java/net/steampp/app/ui/ExampleInstrumentedTest.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,26 @@ | ||
package net.steampp.app.ui; | ||
|
||
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("net.steampp.app.ui.test", appContext.getPackageName()); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/ST.Client.Mobile.Droid.Design/ui/src/main/AndroidManifest.xml
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,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="net.steampp.app.ui"> | ||
|
||
</manifest> |
Binary file added
BIN
+28.4 KB
src/ST.Client.Mobile.Droid.Design/ui/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.