├── .gitignore ├── .idea ├── .gitignore ├── compiler.xml ├── gradle.xml ├── jarRepositories.xml ├── misc.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro ├── release │ └── output-metadata.json └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── uaudith │ │ └── memesterland │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── uaudith │ │ │ └── memesterland │ │ │ ├── HttpClient.kt │ │ │ ├── MainActivity.kt │ │ │ ├── MainViewModel.kt │ │ │ ├── RvImageAdapter.kt │ │ │ ├── SettingsActivity.kt │ │ │ ├── ViewPagerAdapter.kt │ │ │ ├── entities │ │ │ ├── RedditResponse.kt │ │ │ └── ViewPagerItemData.kt │ │ │ ├── factory │ │ │ └── LinksFactory.kt │ │ │ ├── feedItemOptions │ │ │ └── Share.kt │ │ │ ├── helpers │ │ │ └── popupToNewActivity.kt │ │ │ └── memeSources │ │ │ ├── MemeSource.kt │ │ │ └── Reddit.kt │ └── res │ │ ├── anim │ │ └── enlarge.xml │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── ic_darkmode.xml │ │ ├── ic_display.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_logo.xml │ │ ├── ic_love.xml │ │ ├── ic_love_pressed.xml │ │ ├── ic_refresh.xml │ │ ├── ic_send.xml │ │ ├── ic_send_pressed.xml │ │ ├── ic_settings.xml │ │ ├── lovebtn_selector.xml │ │ ├── send_selector.xml │ │ ├── splash_gradient.xml │ │ └── splash_screen.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── item_feed.xml │ │ ├── item_view_pager.xml │ │ ├── popup_layout.xml │ │ └── settings_activity.xml │ │ ├── menu │ │ └── options_menu.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-night │ │ └── themes.xml │ │ ├── values │ │ ├── arrays.xml │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ │ └── xml │ │ ├── filepaths.xml │ │ └── root_preferences.xml │ └── test │ └── java │ └── com │ └── uaudith │ └── memesterland │ └── ExampleUnitTest.kt ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | keystore.properties 17 | .apk 18 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MemesterLand 2 | 3 | ## Screenshots 4 | 5 | ![image](https://user-images.githubusercontent.com/53704054/122667908-03faba00-d1d3-11eb-9c8d-54e03fd16ea3.png) 6 | ![screener_1624289383370](https://user-images.githubusercontent.com/53704054/122788287-cc276b80-d2d3-11eb-89f2-5eb6308d3b57.png) 7 | 8 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | } 5 | 6 | def keystorePropertiesFile = rootProject.file("keystore.properties") 7 | // Initialize a new Properties() object called keystoreProperties. 8 | def keystoreProperties = new Properties() 9 | // Load your keystore.properties file into the keystoreProperties object. 10 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 11 | 12 | android { 13 | signingConfigs { 14 | meme { 15 | keyAlias keystoreProperties['keyAlias'] 16 | keyPassword keystoreProperties['keyPassword'] 17 | storeFile file(keystoreProperties['storeFile']) 18 | storePassword keystoreProperties['storePassword'] 19 | } 20 | 21 | } 22 | compileSdkVersion 30 23 | buildToolsVersion "30.0.2" 24 | 25 | defaultConfig { 26 | applicationId "com.uaudith.memesterland" 27 | minSdkVersion 24 28 | targetSdkVersion 30 29 | versionCode 2 30 | versionName "1.0.1" 31 | 32 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 33 | signingConfig signingConfigs.meme 34 | } 35 | 36 | buildTypes { 37 | release { 38 | minifyEnabled = true 39 | shrinkResources = true 40 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 41 | } 42 | } 43 | compileOptions { 44 | sourceCompatibility JavaVersion.VERSION_1_8 45 | targetCompatibility JavaVersion.VERSION_1_8 46 | } 47 | kotlinOptions { 48 | jvmTarget = '1.8' 49 | } 50 | } 51 | 52 | ext { 53 | ktor_version = '1.6.0' 54 | } 55 | 56 | dependencies { 57 | 58 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 59 | implementation 'androidx.core:core-ktx:1.5.0' 60 | implementation 'androidx.appcompat:appcompat:1.3.0' 61 | implementation 'com.google.android.material:material:1.3.0' 62 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 63 | implementation("io.ktor:ktor-client-core:$ktor_version") 64 | implementation "io.ktor:ktor-client-android:$ktor_version" 65 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0' 66 | implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3") 67 | implementation "io.ktor:ktor-client-gson:$ktor_version" 68 | // implementation "io.ktor:ktor-client-serialization:$ktor_version" 69 | implementation ("com.github.bumptech.glide:glide:4.11.0") { 70 | exclude group: "com.android.support" 71 | } 72 | implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' 73 | 74 | def appcompat_version = "1.3.0" 75 | implementation "androidx.appcompat:appcompat:$appcompat_version" 76 | 77 | 78 | implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1" 79 | implementation "androidx.activity:activity-ktx:1.2.3" 80 | 81 | // settings 82 | def preference_version = "1.1.1" 83 | implementation "androidx.preference:preference-ktx:$preference_version" 84 | 85 | 86 | api "io.ktor:ktor-client-logging:$ktor_version" 87 | testImplementation 'junit:junit:4.13.2' 88 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 89 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 90 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/release/output-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "artifactType": { 4 | "type": "APK", 5 | "kind": "Directory" 6 | }, 7 | "applicationId": "com.uaudith.memesterland", 8 | "variantName": "processReleaseResources", 9 | "elements": [ 10 | { 11 | "type": "SINGLE", 12 | "filters": [], 13 | "versionCode": 2, 14 | "versionName": "1.0.1", 15 | "outputFile": "app-release.apk" 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /app/src/androidTest/java/com/uaudith/memesterland/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.uaudith.memesterland", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 14 | 17 | 18 | 19 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/uaudith/memesterland/HttpClient.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland 2 | import io.ktor.client.* 3 | import io.ktor.client.engine.android.* 4 | import io.ktor.client.features.json.* 5 | import io.ktor.client.features.logging.* 6 | 7 | class HttpClient { 8 | companion object { 9 | val client = HttpClient(Android) { 10 | install(JsonFeature) 11 | install(Logging) { 12 | logger = Logger.DEFAULT 13 | } 14 | engine { 15 | // this: AndroidEngineConfig 16 | connectTimeout = 500_000 17 | socketTimeout = 500_000 18 | // proxy = Proxy(Proxy.Type.HTTP, InetSocketAddress("10.0.2.2", 8080)) 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /app/src/main/java/com/uaudith/memesterland/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland 2 | import android.content.Intent 3 | import android.os.Bundle 4 | import android.util.Log 5 | import android.view.Menu 6 | import android.view.MenuItem 7 | import androidx.activity.viewModels 8 | import androidx.appcompat.app.AppCompatActivity 9 | import androidx.appcompat.app.AppCompatDelegate 10 | import androidx.appcompat.widget.Toolbar 11 | import androidx.preference.PreferenceManager 12 | import androidx.viewpager2.widget.ViewPager2 13 | import com.google.android.material.tabs.TabLayout 14 | import com.google.android.material.tabs.TabLayoutMediator 15 | import com.uaudith.memesterland.entities.ViewPagerItemData 16 | 17 | 18 | const val TAG = "MainActivity" 19 | class MainActivity : AppCompatActivity() { 20 | 21 | private lateinit var viewPager2: ViewPager2 22 | private lateinit var toolbar: Toolbar 23 | private lateinit var tabLayout: TabLayout 24 | 25 | 26 | override fun onCreate(savedInstanceState: Bundle?) { 27 | super.onCreate(savedInstanceState) 28 | setTheme(R.style.Theme_MemesterLand) 29 | setContentView(R.layout.activity_main) 30 | 31 | val model: MainViewModel by viewModels() 32 | 33 | 34 | toolbar = findViewById(R.id.toolbar) 35 | viewPager2 = findViewById(R.id.viewPager) 36 | tabLayout = findViewById(R.id.tabLayout) 37 | setSupportActionBar(toolbar) 38 | 39 | val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this) 40 | if(sharedPreferences.getBoolean("darkMode", true)) 41 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) 42 | else 43 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) 44 | 45 | val linksFactory = model.lfMain 46 | val feedAdapter = RvImageAdapter(linksFactory) 47 | linksFactory.setCbOnFetch { startPos, size -> 48 | feedAdapter.notifyItemRangeInserted(startPos, size) 49 | } 50 | 51 | val pageData = listOf( 52 | ViewPagerItemData(feedAdapter, "dank"), 53 | ViewPagerItemData(RvImageAdapter(model.lfFav), "green") 54 | ) 55 | 56 | viewPager2.adapter = ViewPagerAdapter(pageData) 57 | 58 | TabLayoutMediator(tabLayout, viewPager2) { tab, position -> 59 | tab.text = pageData[position].tabName 60 | }.attach() 61 | } 62 | 63 | override fun onCreateOptionsMenu(menu: Menu?): Boolean { 64 | // Inflate the menu; this adds items to the action bar if it is present. 65 | menuInflater.inflate(R.menu.options_menu, menu) 66 | return true 67 | } 68 | 69 | override fun onOptionsItemSelected(item: MenuItem): Boolean { 70 | return when(item.itemId){ 71 | R.id.settingsFrame -> { 72 | Log.i(TAG,"clicked settings") 73 | startActivity(Intent(this,SettingsActivity::class.java)) 74 | true 75 | } 76 | else -> super.onOptionsItemSelected(item) 77 | } 78 | 79 | } 80 | } -------------------------------------------------------------------------------- /app/src/main/java/com/uaudith/memesterland/MainViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland 2 | 3 | import androidx.lifecycle.ViewModel 4 | import androidx.lifecycle.viewModelScope 5 | import com.uaudith.memesterland.factory.LinksFactory 6 | import com.uaudith.memesterland.memeSources.Reddit 7 | 8 | class MainViewModel: ViewModel() { 9 | val lfMain = LinksFactory() 10 | val lfFav = LinksFactory() 11 | init { 12 | lfMain.setScope(viewModelScope) 13 | lfMain.addSource( 14 | Reddit("dankmemes") 15 | ) 16 | 17 | lfFav.setScope(viewModelScope) 18 | lfFav.addSource( 19 | Reddit("greentext") 20 | ) 21 | } 22 | } -------------------------------------------------------------------------------- /app/src/main/java/com/uaudith/memesterland/RvImageAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland 2 | 3 | import android.graphics.drawable.Drawable 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import android.view.animation.AnimationUtils 8 | import android.widget.ImageButton 9 | import android.widget.ImageView 10 | import android.widget.ProgressBar 11 | import androidx.recyclerview.widget.RecyclerView 12 | import com.bumptech.glide.Glide 13 | import com.bumptech.glide.load.DataSource 14 | import com.bumptech.glide.load.engine.GlideException 15 | import com.bumptech.glide.request.RequestListener 16 | import com.bumptech.glide.request.target.Target 17 | import com.uaudith.memesterland.factory.LinksFactory 18 | import com.uaudith.memesterland.feedItemOptions.Share 19 | import com.uaudith.memesterland.helpers.popupImage 20 | 21 | class RvImageAdapter(private val dataSet: LinksFactory) : 22 | RecyclerView.Adapter() { 23 | inner class FeedViewHolder(val view: View) : RecyclerView.ViewHolder(view) { 24 | val imgView: ImageView = view.findViewById(R.id.feedItem_imageView) 25 | val progBar: ProgressBar = view.findViewById(R.id.progressBar) 26 | val likeBtn: ImageButton = view.findViewById(R.id.likeBtn) 27 | val shareBtn: ImageButton = view.findViewById(R.id.shareBtn) 28 | // val cardView : CardView = view.findViewById(R.id.cardView) 29 | } 30 | 31 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FeedViewHolder { 32 | val view = LayoutInflater.from(parent.context) 33 | .inflate(R.layout.item_feed, parent, false) 34 | return FeedViewHolder(view) 35 | 36 | } 37 | 38 | override fun onBindViewHolder(holder: FeedViewHolder, position: Int) { 39 | holder.progBar.visibility = View.VISIBLE 40 | Glide.with(holder.view) 41 | .load(dataSet.getUrlAt(position)) 42 | .placeholder(R.drawable.ic_refresh) 43 | // .override(holder.cardView.width,1) 44 | .listener(glideListener(holder,position)) 45 | .into(holder.imgView) 46 | holder.likeBtn.setOnClickListener { 47 | it.startAnimation(AnimationUtils.loadAnimation(holder.view.context, R.anim.enlarge)) 48 | } 49 | holder.shareBtn.setOnClickListener { 50 | it.startAnimation(AnimationUtils.loadAnimation(holder.view.context, R.anim.enlarge)) 51 | } 52 | holder.shareBtn.setOnClickListener{ 53 | Share(dataSet.getUrlAt(position), holder.view.context) 54 | } 55 | holder.imgView.setOnClickListener { 56 | popupImage(holder.view.context,dataSet.getUrlAt(position)) 57 | } 58 | 59 | } 60 | 61 | override fun getItemCount(): Int { 62 | return dataSet.getTotalCount() 63 | } 64 | private fun glideListener(holder: FeedViewHolder, position: Int): RequestListener { 65 | return object :RequestListener{ 66 | override fun onLoadFailed( 67 | e: GlideException?, 68 | model: Any?, 69 | target: Target?, 70 | isFirstResource: Boolean 71 | ): Boolean { 72 | holder.progBar.visibility = View.GONE 73 | dataSet.removeItem(position) 74 | notifyItemRemoved(position) 75 | return true 76 | } 77 | 78 | override fun onResourceReady( 79 | resource: Drawable?, 80 | model: Any?, 81 | target: Target?, 82 | dataSource: DataSource?, 83 | isFirstResource: Boolean 84 | ): Boolean { 85 | holder.progBar.visibility = View.GONE 86 | // holder.imgView.layoutParams.height = ConstraintLayout.LayoutParams.WRAP_CONTENT 87 | // holder.imgView.requestLayout() 88 | return false 89 | } 90 | 91 | } 92 | } 93 | fun shuffleData(){ 94 | dataSet.shuffleItems() 95 | } 96 | } -------------------------------------------------------------------------------- /app/src/main/java/com/uaudith/memesterland/SettingsActivity.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland 2 | 3 | import android.os.Bundle 4 | import android.util.Log 5 | import android.view.MenuItem 6 | import androidx.appcompat.widget.Toolbar 7 | import androidx.appcompat.app.AppCompatActivity 8 | import androidx.appcompat.app.AppCompatDelegate 9 | import androidx.preference.Preference 10 | import androidx.preference.PreferenceFragmentCompat 11 | import androidx.preference.SwitchPreferenceCompat 12 | 13 | 14 | class SettingsActivity : AppCompatActivity() { 15 | private lateinit var toolbar: Toolbar 16 | override fun onCreate(savedInstanceState: Bundle?) { 17 | super.onCreate(savedInstanceState) 18 | setTheme(R.style.Theme_MemesterLand) 19 | setContentView(R.layout.settings_activity) 20 | if (savedInstanceState == null) { 21 | supportFragmentManager 22 | .beginTransaction() 23 | .replace(R.id.settingsFrame, SettingsFragment()) 24 | .commit() 25 | } 26 | toolbar = findViewById(R.id.settingsToolBar) 27 | setSupportActionBar(toolbar) 28 | supportActionBar?.setDisplayHomeAsUpEnabled(true) 29 | 30 | } 31 | 32 | override fun onOptionsItemSelected(item: MenuItem): Boolean { 33 | return when(item.itemId){ 34 | android.R.id.home -> { 35 | onBackPressed() 36 | true 37 | } 38 | else -> super.onOptionsItemSelected(item) 39 | } 40 | } 41 | 42 | class SettingsFragment : PreferenceFragmentCompat() { 43 | private val tagMsg = "SettingsActivity" 44 | private val darkModeListener = Preference.OnPreferenceChangeListener { _, newValue -> 45 | Log.i(tagMsg,"new value for darkmode $newValue and ${newValue::class}") 46 | 47 | when (newValue as Boolean){ 48 | true -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) 49 | false -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) 50 | } 51 | true 52 | } 53 | 54 | override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { 55 | setPreferencesFromResource(R.xml.root_preferences, rootKey) 56 | 57 | val infoPref: Preference? = findPreference("info") 58 | val darkMode : SwitchPreferenceCompat? = findPreference("darkMode") 59 | 60 | infoPref?.summary = BuildConfig.APPLICATION_ID+" "+BuildConfig.VERSION_NAME 61 | darkMode?.onPreferenceChangeListener = darkModeListener 62 | 63 | 64 | } 65 | 66 | } 67 | } -------------------------------------------------------------------------------- /app/src/main/java/com/uaudith/memesterland/ViewPagerAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland 2 | 3 | import android.content.Context 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.recyclerview.widget.LinearLayoutManager 8 | import androidx.recyclerview.widget.RecyclerView 9 | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout 10 | import com.uaudith.memesterland.entities.ViewPagerItemData 11 | 12 | class ViewPagerAdapter(private val dataList: List) 13 | : RecyclerView.Adapter() { 14 | inner class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView){ 15 | val rv: RecyclerView = itemView.findViewById(R.id.rvFeed) 16 | val swipeRefresh = itemView.findViewById(R.id.refresh) 17 | val context: Context = itemView.context 18 | } 19 | 20 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder { 21 | val view = LayoutInflater.from(parent.context).inflate(R.layout.item_view_pager,parent,false) 22 | return MyViewHolder(view) 23 | } 24 | 25 | override fun onBindViewHolder(holder: MyViewHolder, position: Int) { 26 | val adapter = dataList[position].adapter 27 | holder.rv.adapter = adapter 28 | holder.rv.layoutManager = LinearLayoutManager(holder.context) 29 | val doRefresh = dataList[position].adapter::shuffleData 30 | 31 | holder.swipeRefresh.setOnRefreshListener { 32 | doRefresh() 33 | adapter.notifyDataSetChanged() 34 | holder.swipeRefresh.isRefreshing = false 35 | } 36 | } 37 | 38 | override fun getItemCount(): Int { 39 | return dataList.size 40 | } 41 | } -------------------------------------------------------------------------------- /app/src/main/java/com/uaudith/memesterland/entities/RedditResponse.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland.entities 2 | 3 | import androidx.annotation.Keep 4 | 5 | // Used to serialize the json response from reddit 6 | 7 | @Keep 8 | data class RedditResponse( 9 | val kind: String, 10 | val data: Data 11 | ) 12 | @Keep 13 | data class Data( 14 | val after: String, 15 | val children: List 16 | 17 | ) 18 | @Keep 19 | data class Child( 20 | val kind: String, 21 | val data: ChildData 22 | ) 23 | @Keep 24 | data class ChildData( 25 | val url: String, 26 | val name: String 27 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/uaudith/memesterland/entities/ViewPagerItemData.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland.entities 2 | 3 | 4 | import com.uaudith.memesterland.RvImageAdapter 5 | 6 | data class ViewPagerItemData( 7 | val adapter: RvImageAdapter, 8 | val tabName: String 9 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/uaudith/memesterland/factory/LinksFactory.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland.factory 2 | 3 | import android.util.Log 4 | import com.uaudith.memesterland.HttpClient 5 | import com.uaudith.memesterland.memeSources.MemeSource 6 | import kotlinx.coroutines.CoroutineScope 7 | import kotlinx.coroutines.Dispatchers 8 | import kotlinx.coroutines.launch 9 | import kotlinx.coroutines.sync.Mutex 10 | import kotlinx.coroutines.sync.withLock 11 | import kotlinx.coroutines.withContext 12 | 13 | const val TAG = "LinksFactory" 14 | class LinksFactory { 15 | private val sources = mutableSetOf() 16 | private val imgLinks = mutableListOf() 17 | private lateinit var scope : CoroutineScope 18 | private var cbAfterFetch: (Int, Int) -> Unit = { _: Int, _: Int -> } 19 | private val imgLinksLock = Mutex() 20 | 21 | fun addSource(source: MemeSource){ 22 | sources.add(source) 23 | fetch(source) 24 | } 25 | fun addSource(vararg sources: MemeSource){ 26 | sources.forEach { 27 | addSource(it) 28 | } 29 | } 30 | 31 | private fun fetch(source: MemeSource)= scope.launch { 32 | 33 | var startPos: Int 34 | Log.i(TAG,"fetching addresses from internet") 35 | source.fetch(HttpClient.client) 36 | val size = source.getTotalCount() 37 | imgLinksLock.withLock { 38 | startPos = imgLinks.size 39 | // Log.i(TAG,"start=$startPos and size=$size") 40 | imgLinks.addAll(source.getAll()) 41 | withContext(Dispatchers.Main){ 42 | cbAfterFetch(startPos, size) 43 | } 44 | } 45 | 46 | } 47 | 48 | fun setCbOnFetch(block: (Int, Int)->Unit){ 49 | cbAfterFetch = block 50 | } 51 | 52 | fun getTotalCount(): Int { 53 | return imgLinks.size 54 | } 55 | 56 | fun getUrlAt(position: Int): String { 57 | return imgLinks[position] 58 | } 59 | 60 | fun removeItem(position: Int){ 61 | imgLinks.removeAt(position) 62 | } 63 | 64 | fun shuffleItems() { 65 | imgLinks.shuffle() 66 | } 67 | fun setScope(scope: CoroutineScope){ 68 | this.scope = scope 69 | } 70 | } -------------------------------------------------------------------------------- /app/src/main/java/com/uaudith/memesterland/feedItemOptions/Share.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland.feedItemOptions 2 | 3 | import android.content.Context 4 | import android.content.Intent 5 | import android.graphics.Bitmap 6 | import android.graphics.drawable.BitmapDrawable 7 | import android.graphics.drawable.Drawable 8 | import android.os.Parcelable 9 | import androidx.core.content.ContextCompat.startActivity 10 | import androidx.core.content.FileProvider 11 | import com.bumptech.glide.Glide 12 | import com.bumptech.glide.load.resource.gif.GifDrawable 13 | import com.bumptech.glide.request.target.CustomTarget 14 | import com.bumptech.glide.request.transition.Transition 15 | import java.io.File 16 | import java.io.FileOutputStream 17 | import java.nio.ByteBuffer 18 | 19 | 20 | class Share(urlAt: String, private val context: Context) { 21 | 22 | init { 23 | Glide.with(context) 24 | .load(urlAt) 25 | .into(object :CustomTarget() { 26 | override fun onResourceReady(resource: Drawable, transition: Transition?) { 27 | lateinit var imageFile: File 28 | if(resource is BitmapDrawable){ 29 | imageFile = getTempFile(".png") 30 | val fos = FileOutputStream(imageFile) 31 | resource.bitmap.compress( 32 | Bitmap.CompressFormat.PNG, 100, fos) 33 | fos.close() 34 | }else if (resource is GifDrawable){ 35 | imageFile = getTempFile(".gif") 36 | val byteBuffer = resource.buffer 37 | 38 | val output = FileOutputStream(imageFile) 39 | val bytes = ByteArray(byteBuffer.capacity()) 40 | (byteBuffer.duplicate().clear() as ByteBuffer).get(bytes) 41 | output.write(bytes, 0 ,bytes.size) 42 | output.close() 43 | 44 | } 45 | val uriToShare = FileProvider.getUriForFile(context,"com.uaudith.memesterland.fileprovider", 46 | imageFile) 47 | val shareIntent = Intent() 48 | shareIntent.action = Intent.ACTION_SEND 49 | shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) // temp permission for receiving app to read this file 50 | shareIntent.setDataAndType(uriToShare, context.contentResolver.getType(uriToShare)) 51 | shareIntent.putExtra(Intent.EXTRA_STREAM, uriToShare as Parcelable?) 52 | startActivity(context,Intent.createChooser(shareIntent, "Choose an app"),null) 53 | } 54 | 55 | override fun onLoadCleared(placeholder: Drawable?) {} 56 | 57 | }) 58 | 59 | } 60 | 61 | private fun getTempFile(type: String): File { 62 | val outputDir: File = context.cacheDir // context being the Activity pointer 63 | return File.createTempFile("tmpImage", type, outputDir) 64 | } 65 | } -------------------------------------------------------------------------------- /app/src/main/java/com/uaudith/memesterland/helpers/popupToNewActivity.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland.helpers 2 | 3 | 4 | import android.app.Dialog 5 | import android.content.Context 6 | import android.graphics.Color 7 | import android.graphics.drawable.ColorDrawable 8 | import android.view.* 9 | import android.widget.ImageView 10 | import com.bumptech.glide.Glide 11 | import com.uaudith.memesterland.R 12 | 13 | 14 | fun popupImage(context: Context, urlAt: String) { 15 | val myPopup = Dialog(context,R.style.ThemeOverlay_MaterialComponents_Dialog_Alert ) 16 | myPopup.setContentView(R.layout.popup_layout) 17 | val popupImgView = myPopup.findViewById(R.id.popupImgV) 18 | myPopup.show() 19 | Glide.with(context) 20 | .load(urlAt) 21 | .into(popupImgView) 22 | myPopup.apply { 23 | window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/uaudith/memesterland/memeSources/MemeSource.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland.memeSources 2 | 3 | import io.ktor.client.* 4 | 5 | interface MemeSource { 6 | fun getTotalCount():Int 7 | fun getAll(): Set 8 | suspend fun fetch(client: HttpClient) 9 | } -------------------------------------------------------------------------------- /app/src/main/java/com/uaudith/memesterland/memeSources/Reddit.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland.memeSources 2 | 3 | import android.util.Log 4 | import com.uaudith.memesterland.entities.RedditResponse 5 | import io.ktor.client.* 6 | import io.ktor.client.request.* 7 | import io.ktor.http.* 8 | 9 | const val TAG = "Reddit" 10 | class Reddit(subredditName: String): MemeSource { 11 | private val uri = "https://www.reddit.com/r/$subredditName/.json?limit=50" 12 | private val memeList = mutableSetOf() 13 | override fun getTotalCount(): Int { 14 | return memeList.size 15 | } 16 | 17 | override fun getAll(): Set { 18 | return memeList 19 | } 20 | 21 | override suspend fun fetch(client: HttpClient) { 22 | try { 23 | val response = client.request(uri) { 24 | // Configure request parameters exposed by HttpRequestBuilder 25 | method = HttpMethod.Get 26 | } 27 | response.data.children.forEach { 28 | memeList.add(it.data.url) 29 | } 30 | }catch (e: Exception){ 31 | Log.w(TAG,e.message?:"Something Wrong") 32 | } 33 | 34 | } 35 | } -------------------------------------------------------------------------------- /app/src/main/res/anim/enlarge.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 9 | 10 | 16 | 19 | 22 | 23 | 24 | 25 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_darkmode.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_display.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_love.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_love_pressed.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_refresh.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_send.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_send_pressed.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_settings.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/lovebtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/send_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/splash_gradient.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/splash_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 16 | 21 | 22 | 23 | 24 | 32 | 33 | 34 | 35 | 36 | 37 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_feed.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | 20 | 25 | 28 | 29 | 37 | 45 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_view_pager.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 13 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/popup_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/settings_activity.xml: -------------------------------------------------------------------------------- 1 | 6 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/menu/options_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uaudith/MemesterLand/3571aff07338c2d7e4e3356204fc25111af2cf87/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uaudith/MemesterLand/3571aff07338c2d7e4e3356204fc25111af2cf87/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uaudith/MemesterLand/3571aff07338c2d7e4e3356204fc25111af2cf87/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uaudith/MemesterLand/3571aff07338c2d7e4e3356204fc25111af2cf87/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uaudith/MemesterLand/3571aff07338c2d7e4e3356204fc25111af2cf87/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uaudith/MemesterLand/3571aff07338c2d7e4e3356204fc25111af2cf87/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uaudith/MemesterLand/3571aff07338c2d7e4e3356204fc25111af2cf87/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uaudith/MemesterLand/3571aff07338c2d7e4e3356204fc25111af2cf87/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uaudith/MemesterLand/3571aff07338c2d7e4e3356204fc25111af2cf87/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uaudith/MemesterLand/3571aff07338c2d7e4e3356204fc25111af2cf87/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Reply 5 | Reply to all 6 | 7 | 8 | 9 | reply 10 | reply_all 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | 11 | #C7EAFF 12 | #82B8D9 13 | #42708C 14 | #F2C7AE 15 | #D9AB73 16 | 17 | 18 | #171717 19 | #2E2E2E 20 | #525252 21 | #6B6B6B 22 | #8C8C8C 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MemesterLand 3 | SettingsActivity 4 | 5 | 6 | Messages 7 | Information 8 | Display 9 | DarkMode 10 | Settings 11 | 12 | 13 | Your signature 14 | Default reply action 15 | 16 | 17 | Sync email periodically 18 | Download incoming attachments 19 | Automatically download attachments for incoming emails 20 | Only download attachments when manually requested 21 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/xml/filepaths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/xml/root_preferences.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 7 | 8 | 13 | 14 | 15 | 16 | 18 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/test/java/com/uaudith/memesterland/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.uaudith.memesterland 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | ext.kotlin_version = "1.5.10" 4 | repositories { 5 | google() 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath "com.android.tools.build:gradle:4.1.3" 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | } 23 | 24 | task clean(type: Delete) { 25 | delete rootProject.buildDir 26 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official 22 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uaudith/MemesterLand/3571aff07338c2d7e4e3356204fc25111af2cf87/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 04 14:47:43 IST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name = "MemesterLand" --------------------------------------------------------------------------------