more graphql queries
This commit is contained in:
		| @@ -12,7 +12,8 @@ | |||||||
|         <activity |         <activity | ||||||
|             android:name=".MainActivity" |             android:name=".MainActivity" | ||||||
|             android:label="@string/app_name" |             android:label="@string/app_name" | ||||||
|             android:theme="@style/Theme.Noise.NoActionBar"> |             android:theme="@style/Theme.Noise.NoActionBar" | ||||||
|  |             android:exported="true"> | ||||||
|             <intent-filter> |             <intent-filter> | ||||||
|                 <action android:name="android.intent.action.MAIN" /> |                 <action android:name="android.intent.action.MAIN" /> | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								app/src/main/graphql/org/ddnss/sfs/getUsers.graphql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								app/src/main/graphql/org/ddnss/sfs/getUsers.graphql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | query getUsers { | ||||||
|  |     users { | ||||||
|  |         id | ||||||
|  |         userName | ||||||
|  |         displayName | ||||||
|  |         activated | ||||||
|  |         created | ||||||
|  |         lastOnline | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										10
									
								
								app/src/main/java/org/dnss/sfs/git/wdg/noise/Apollo.kt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								app/src/main/java/org/dnss/sfs/git/wdg/noise/Apollo.kt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | package org.dnss.sfs.git.wdg.noise | ||||||
|  | import com.apollographql.apollo3.ApolloClient | ||||||
|  |  | ||||||
|  | class Apollo { | ||||||
|  |  | ||||||
|  |     val apolloClient = ApolloClient.Builder() | ||||||
|  |         .serverUrl("https://noise.sfs.ddnss.org/graphql") | ||||||
|  |         .build() | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -45,11 +45,6 @@ class MainActivity : AppCompatActivity() { | |||||||
|         ) |         ) | ||||||
|         setupActionBarWithNavController(navController, appBarConfiguration) |         setupActionBarWithNavController(navController, appBarConfiguration) | ||||||
|         navView.setupWithNavController(navController) |         navView.setupWithNavController(navController) | ||||||
|  |  | ||||||
|         addButton( "a", 0xff0000) |  | ||||||
|         addButton( "b", 0xff0000) |  | ||||||
|         addButton( "c", 0xff0000) |  | ||||||
|         addButton( "d", 0xff0000) |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     override fun onCreateOptionsMenu(menu: Menu): Boolean { |     override fun onCreateOptionsMenu(menu: Menu): Boolean { | ||||||
| @@ -63,19 +58,4 @@ class MainActivity : AppCompatActivity() { | |||||||
|         return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() |         return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     fun addButton(userName: String, color: Int) { |  | ||||||
|         val contactScrollField = findViewById<LinearLayout>(R.id.linear_layout) |  | ||||||
|                             // = findViewById(R.id.linear_layout) as LinearLayout |  | ||||||
|  |  | ||||||
|         val dynamicButton = Button(this) |  | ||||||
|         /*dynamicButton.layoutParams = LinearLayout.LayoutParams( |  | ||||||
|             LinearLayout.LayoutParams.WRAP_CONTENT, |  | ||||||
|             LinearLayout.LayoutParams.WRAP_CONTENT |  | ||||||
|         )*/ |  | ||||||
|         dynamicButton.text = userName |  | ||||||
|         dynamicButton.setBackgroundColor(Color.GREEN) |  | ||||||
|  |  | ||||||
|         contactScrollField.addView(dynamicButton) |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } | } | ||||||
| @@ -1,14 +1,14 @@ | |||||||
| package org.dnss.sfs.git.wdg.noise.ui.gallery | package org.dnss.sfs.git.wdg.noise.ui.gallery | ||||||
|  |  | ||||||
| import android.os.Bundle | import android.os.Bundle | ||||||
|  | import android.util.Log | ||||||
| import android.view.LayoutInflater | import android.view.LayoutInflater | ||||||
| import android.view.View | import android.view.View | ||||||
| import android.view.ViewGroup | import android.view.ViewGroup | ||||||
| import android.widget.TextView |  | ||||||
| import androidx.fragment.app.Fragment | import androidx.fragment.app.Fragment | ||||||
| import androidx.lifecycle.Observer |  | ||||||
| import androidx.lifecycle.ViewModelProvider | import androidx.lifecycle.ViewModelProvider | ||||||
| import org.dnss.sfs.git.wdg.noise.R | import androidx.lifecycle.lifecycleScope | ||||||
|  | import org.dnss.sfs.git.wdg.noise.Apollo | ||||||
| import org.dnss.sfs.git.wdg.noise.databinding.FragmentGalleryBinding | import org.dnss.sfs.git.wdg.noise.databinding.FragmentGalleryBinding | ||||||
|  |  | ||||||
| class GalleryFragment : Fragment() { | class GalleryFragment : Fragment() { | ||||||
| @@ -31,13 +31,20 @@ class GalleryFragment : Fragment() { | |||||||
|         _binding = FragmentGalleryBinding.inflate(inflater, container, false) |         _binding = FragmentGalleryBinding.inflate(inflater, container, false) | ||||||
|         val root: View = binding.root |         val root: View = binding.root | ||||||
|  |  | ||||||
|         val textView: TextView = binding.textGallery |  | ||||||
|         galleryViewModel.text.observe(viewLifecycleOwner, Observer { |  | ||||||
|             textView.text = it |  | ||||||
|         }) |  | ||||||
|         return root |         return root | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||||||
|  |         super.onViewCreated(view, savedInstanceState) | ||||||
|  |  | ||||||
|  |         lifecycleScope.launchWhenResumed { | ||||||
|  |             val response = Apollo.apolloClient.query(getUsers()).execute() | ||||||
|  |  | ||||||
|  |             Log.d("getUsers", "Data:: ${response.data}") | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|     override fun onDestroyView() { |     override fun onDestroyView() { | ||||||
|         super.onDestroyView() |         super.onDestroyView() | ||||||
|         _binding = null |         _binding = null | ||||||
|   | |||||||
| @@ -17,20 +17,4 @@ | |||||||
|         app:layout_constraintRight_toRightOf="parent" |         app:layout_constraintRight_toRightOf="parent" | ||||||
|         app:layout_constraintTop_toTopOf="parent" |         app:layout_constraintTop_toTopOf="parent" | ||||||
|         app:navGraph="@navigation/mobile_navigation" /> |         app:navGraph="@navigation/mobile_navigation" /> | ||||||
|  |  | ||||||
|     <ScrollView |  | ||||||
|         android:layout_width="match_parent" |  | ||||||
|         android:layout_height="match_parent" |  | ||||||
|         tools:layout_editor_absoluteX="206dp" |  | ||||||
|         tools:layout_editor_absoluteY="241dp"> |  | ||||||
|  |  | ||||||
|         <LinearLayout |  | ||||||
|             android:id="@+id/linear_layout" |  | ||||||
|             android:layout_width="match_parent" |  | ||||||
|             android:layout_height="wrap_content" |  | ||||||
|             android:orientation="vertical" > |  | ||||||
|  |  | ||||||
|         </LinearLayout> |  | ||||||
|     </ScrollView> |  | ||||||
|  |  | ||||||
| </androidx.constraintlayout.widget.ConstraintLayout> | </androidx.constraintlayout.widget.ConstraintLayout> | ||||||
| @@ -7,16 +7,10 @@ | |||||||
|     tools:context=".ui.gallery.GalleryFragment"> |     tools:context=".ui.gallery.GalleryFragment"> | ||||||
|  |  | ||||||
|     <TextView |     <TextView | ||||||
|         android:id="@+id/text_gallery" |         android:id="@+id/testData" | ||||||
|         android:layout_width="match_parent" |         android:layout_width="wrap_content" | ||||||
|         android:layout_height="wrap_content" |         android:layout_height="wrap_content" | ||||||
|         android:layout_marginStart="8dp" |         android:text="TestData" | ||||||
|         android:layout_marginTop="8dp" |         tools:layout_editor_absoluteX="99dp" | ||||||
|         android:layout_marginEnd="8dp" |         tools:layout_editor_absoluteY="185dp" /> | ||||||
|         android:textAlignment="center" |  | ||||||
|         android:textSize="20sp" |  | ||||||
|         app:layout_constraintBottom_toBottomOf="parent" |  | ||||||
|         app:layout_constraintEnd_toEndOf="parent" |  | ||||||
|         app:layout_constraintStart_toStartOf="parent" |  | ||||||
|         app:layout_constraintTop_toTopOf="parent" /> |  | ||||||
| </androidx.constraintlayout.widget.ConstraintLayout> | </androidx.constraintlayout.widget.ConstraintLayout> | ||||||
		Reference in New Issue
	
	Block a user