How to create a URL in Java? - java

I want to make an app that shows a list of books that relate to a given keyword. I made the ListView, EditText view and a search button. The layout is given below:
activity_main.xml
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<EditText
android:id="#+id/search_query_text_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:hint="#string/hint" />
<Button
android:id="#+id/search_button1"
android:layout_width="42dp"
android:layout_height="42dp"
android:drawableLeft="#drawable/search"
/>
</LinearLayout>
<TextView
android:id="#+id/result"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Results" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp" />
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="invisible" />
</RelativeLayout>
</LinearLayout>
The XML for a single item in the list is given below.
list_layout.xml
<?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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="#dimen/list_item_height"
android:layout_margin="5dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="#dimen/list_item_height">
<ImageView
android:id="#+id/thumbnail_imageview"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/kite_runner" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="#dimen/list_item_height"
android:layout_margin="5dp">
<TextView
android:id="#+id/title_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="The Kite Runner"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/author_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/title_textview"
android:layout_marginBottom="10dp"
android:text="Khaled Hosseini"
android:textColor="#000000"
android:textSize="17sp" />
<TextView
android:id="#+id/publisher_texview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/author_textview"
android:text="Penguin Books"
android:textColor="#000000"
android:textSize="15sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
I am using the Google Books API query to access the book list.
I have the base URL and I now need to add the value in the EditText view to this URL.
The custom adapter for the list view is given below.
package com.example.shara.booklistapp;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.SearchView;
import android.widget.TextView;
import java.util.ArrayList;
/**
* Created by shara on 12/17/2017.
*/
public class ListAdapter extends ArrayAdapter<Blist> {
public ListAdapter(#NonNull Context context, ArrayList<Blist> blists) {
super(context, 0, blists);
}
public String rslt;
#NonNull
#Override
public View getView(int position, #Nullable View convertView, #NonNull ViewGroup parent) {
View listitemview = convertView;
if (listitemview == null) {
listitemview = LayoutInflater.from(getContext()).inflate(R.layout.list_layout, parent, false);
}
Blist blist = getItem(position);
EditText search_query = listitemview.findViewById(R.id.search_query_text_view);
Button search_button = listitemview.findViewById(R.id.search_button1);
search_button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String searchquery = search_query.getText().toString();
}
});
ImageView bookthumbnail = listitemview.findViewById(R.id.thumbnail_imageview);
TextView title = listitemview.findViewById(R.id.title_textview);
TextView author = listitemview.findViewById(R.id.author_textview);
TextView publisher = listitemview.findViewById(R.id.publisher_texview);
return listitemview;
}
}
I am using another class named BookQueryUtils to create the URL and to do the HTTP request and JSON parsing.
I want to access the value of EditText view from BookQueryUtils class and then append it to the base URL.
Also how can I call the AsyncTaskLoader inside the BookQueryUtils class when the button is pressed. How can I do that?

Use Volley, example:
String url = "https://example.com";
StringRequest stringRequest = new StringRequest(Request.Method.GET,
url, new Response.Listener<String>() {
#Override
public void onResponse(String response) {
Log.e("RESPONSE", response);
}
}, new Response.ErrorListener() {
#Override
public void onErrorResponse(VolleyError error) {
}
});
stringRequest.setTag("LOL");
queue.add(stringRequest);

Related

unable to transfer some data to a new page

I want to show the data I got from json in my android project in the search layout section, but the data is not visible. Can you help me?
My Code:
public void searchView (View view){
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
SearchFragment searchFragment = new SearchFragment();
fragmentTransaction.replace(R.id.frameLayout, searchFragment).commit();
enterButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
city = cityAdd.getEditText().getText().toString().trim();
String url = "https://api.openweathermap.org/data/2.5/weather?q="+city+"&appid="+apikey;
RequestQueue queue = Volley.newRequestQueue(getApplicationContext());
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null, new com.android.volley.Response.Listener<JSONObject>() {
#Override
public void onResponse(JSONObject response) {
try {
Log.d("Temperature",(url));
JSONObject temps = response.getJSONObject("main");
String temperatures = temps.getString("temp");
country.setText(city);
temp.setText(temperatures);
Intent intent = new Intent(MainActivity.this, SearchFragment.class);
intent.putExtra("city", country.getText().toString());
intent.putExtra("temp",temp.getText().toString());
startActivity(intent);
} catch (JSONException e) {
Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}, new com.android.volley.Response.ErrorListener() {
#Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(MainActivity.this, "Please check the city name", Toast.LENGTH_SHORT).show();
}
}
);
queue.add(request);
}
});
}
Search Fragment.java
package com.nisaefendioglu.weatherapp;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.SearchView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
public class SearchFragment extends Fragment {
#Nullable
#Override
public View onCreateView(#NonNull LayoutInflater inflater, #Nullable ViewGroup container, #Nullable Bundle savedInstanceState) {
ViewGroup viewGroup = (ViewGroup)inflater.inflate(R.layout.search_layout, container,false);
TextView country = viewGroup.findViewById(R.id.country);
TextView temp = viewGroup.findViewById(R.id.temp);
TextView back = viewGroup.findViewById(R.id.back);
return viewGroup;
}
}
XML
Country İtem
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardElevation="3dp"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="8dp">
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="7dp"
android:layout_marginHorizontal="15dp">
<TextView
android:id="#+id/countryName"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentStart="true"
android:layout_marginEnd="30dp"
android:textColor="#color/black"
android:text="Türkiye"
android:layout_centerVertical="true"
android:gravity="center"
android:textSize="15dp" ></TextView>
<TextView
android:id="#+id/temperature"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="30dp"
android:textColor="#color/black"
android:text="Temperature"
android:layout_centerVertical="true"
android:gravity="center"
android:textSize="15dp" ></TextView>
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
Main xml
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="12dp"
>
<EditText
android:layout_width="270dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:hint="Enter City" />
<Button
android:onClick="searchView"
android:id="#+id/enterButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="300dp"
android:text="Enter"
android:textAllCaps="false"
/>
</RelativeLayout>
<ImageView
android:id="#+id/image"
android:layout_width="match_parent"
android:layout_height="200dp"
android:src="#drawable/weather"/>
<RelativeLayout
android:id="#+id/activityRelative"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="12dp"
>
<TextView
android:id="#+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginStart="30dp"
android:textColor="#color/black"
android:text="Country Name"
android:textSize="15dp" ></TextView>
<TextView
android:id="#+id/text2"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="30dp"
android:text="Temperature"
android:textColor="#color/black"
android:textSize="15dp" ></TextView>
</RelativeLayout>
<FrameLayout
android:id="#+id/frameLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/countries"
tools:listitem="#layout/country_item_layout"
app:layoutManager="LinearLayoutManager"
/>
</FrameLayout>
</LinearLayout>
Search Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<TextView
android:id="#+id/country"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginStart="30dp"
android:textColor="#color/black"
android:text=""
android:textSize="15dp" ></TextView>
<TextView
android:id="#+id/temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginEnd="30dp"
android:text=""
android:textColor="#color/black"
android:textSize="15dp" ></TextView>
<TextView
android:onClick="tempBack"
android:id="#+id/back"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="left"
android:layout_marginLeft="20dp"
android:layout_marginTop="200dp"
android:gravity="center"
android:text="←"
android:textColor="#ff793f"
android:textSize="40dp"></TextView>
</LinearLayout>
Hello, I want to show the data I got from json in my android project in the search layout section, but the data is not visible. Can you help me?
You are retrieving your data in your main activity and sending the data through your intent
intent.putExtra("city", country.getText().toString()); intent.putExtra("temp",temp.getText().toString());
However, you are not fetching the data that you sent through intent in your fragment.
You have to fetch them according to the key values by which you sent.
In your onCreateView() in your fragment, you can fetch each data you sent through your intent in the form:
String city = getArguments().getString("city");

EditText autoscroll doesn't work after showing dialog

I'm developing an app for users to share their books. To achieve this, I'm getting different data about the book from the user. The problem is, horizontal autoscrolling of all EditTexts are working until Dialog has been shown and dismissed. Once a dialog has been dismissed on the fragment, horizontal autoscrolling of the EditText's on this layout won't work.
I added:
android:focusable="true"
android:focusableInTouchMode="true"
to parent layout of the edittext but doesn't work.
Also to make sure that autoscrolling is enabled I've added:
android:scrollHorizontally="true"
But none of above helped.
Here is XML code of the fragment layout.
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
android:orientation="vertical"
android:paddingStart="#dimen/dp25"
android:paddingEnd="#dimen/dp25"
tools:context=".UI.Fragments.SharePostFragments.Fragment1.OverViewFragment">
<LinearLayout
android:id="#+id/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<EditText
android:id="#+id/edit_text_name_of_book"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:fontFamily="#font/segoe_ui_semi_bold"
android:hint="#string/name_of_book"
android:inputType="text"
android:maxLength="50"
android:maxLines="1"
android:scrollHorizontally="true"
android:textAlignment="textStart"
android:textColor="#color/colorPrimaryDark"
android:textColorHint="#color/colorPrimaryDark"
android:textSize="#dimen/font22" />
<TextView
android:id="#+id/text_view_number_of_characters"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="#dimen/dp10"
android:fontFamily="#font/segoe_ui_light"
android:text="#string/_0_50"
android:textColor="#color/colorAccent"
android:textSize="#dimen/font16"
tools:ignore="RtlSymmetry" />
<EditText
android:id="#+id/edit_text_name_of_author"
android:layout_width="match_parent"
android:layout_height="#dimen/textBoxHeight"
android:layout_marginTop="#dimen/dp30"
android:background="#drawable/round_text_box_gray"
android:fontFamily="#font/segoe_ui_regular"
android:hint="#string/name_of_writer"
android:inputType="text"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:textColor="#color/colorPrimaryDark"
android:textColorHint="#color/colorPrimaryDark"
android:textSize="#dimen/font16" />
<RelativeLayout
android:id="#+id/constraint_layout_1"
android:layout_width="match_parent"
android:layout_height="#dimen/textBoxHeight"
android:layout_marginTop="#dimen/dp20"
android:background="#drawable/round_text_box_border_gray"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginTop="3dp"
android:fontFamily="#font/segoe_ui_regular"
android:paddingStart="#dimen/dp20"
android:paddingEnd="#dimen/dp20"
android:text="#string/price_of_book"
android:textColor="#color/colorPrimaryDark"
android:textSize="#dimen/font16" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:paddingStart="#dimen/dp20"
android:paddingEnd="#dimen/dp20"
android:text="#string/azn_sign"
android:textColor="#color/colorPrimaryDark"
android:textSize="#dimen/font16" />
<EditText
android:id="#+id/edit_text_price_of_book"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toStartOf="#+id/textView2"
android:background="#color/white"
android:clickable="false"
android:hint="#string/_0_0"
android:inputType="text|numberDecimal"
android:maxLength="6"
android:singleLine="true"
android:textColorHint="#android:color/black" />
</RelativeLayout>
<LinearLayout
android:id="#+id/constraint_layout_conditions_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/dp20"
android:background="#drawable/round_text_box_border_gray"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/linear_layout_1"
android:layout_width="match_parent"
android:layout_height="#dimen/textBoxHeight"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="9"
android:gravity="center_vertical"
android:paddingStart="#dimen/dp20"
android:paddingEnd="#dimen/dp20"
android:text="#string/book_condition_placeholder"
android:textColor="#color/colorPrimaryDark" />
<ImageButton
android:id="#+id/image_button_conditions"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginEnd="#dimen/dp10"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="#drawable/ic_spinner" />
</LinearLayout>
<LinearLayout
android:id="#+id/linear_layout_conditions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="#+id/text_view_new"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="#dimen/dp20"
android:paddingTop="#dimen/dp10"
android:paddingEnd="#dimen/dp20"
android:paddingBottom="#dimen/dp10"
android:text="#string/_new"
android:textColor="#color/dark_gray_text_color" />
<TextView
android:id="#+id/text_view_normal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="#dimen/dp20"
android:paddingTop="#dimen/dp10"
android:paddingEnd="#dimen/dp20"
android:paddingBottom="#dimen/dp10"
android:text="#string/normal"
android:textColor="#color/dark_gray_text_color" />
<TextView
android:id="#+id/text_view_old"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="#dimen/dp20"
android:paddingTop="#dimen/dp10"
android:paddingEnd="#dimen/dp20"
android:paddingBottom="#dimen/dp10"
android:text="#string/old"
android:textColor="#color/dark_gray_text_color" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/constraint_layout_languages_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/dp20"
android:background="#drawable/round_text_box_border_gray"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/linear_layout_2"
android:layout_width="match_parent"
android:layout_height="#dimen/textBoxHeight"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="9"
android:gravity="center_vertical"
android:paddingStart="#dimen/dp20"
android:paddingEnd="#dimen/dp20"
android:text="#string/language"
android:textColor="#color/colorPrimaryDark" />
<ImageButton
android:id="#+id/image_button_languages"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginEnd="#dimen/dp10"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="#drawable/ic_spinner" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recycler_view_languages"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="#dimen/dp20"
android:paddingEnd="#dimen/dp20"
android:paddingBottom="#dimen/dp10"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Fragment Java code:
package org.kitapp.UI.Fragments.SharePostFragments.Fragment1;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import org.kitapp.R;
import org.kitapp.UI.Dialogs.ConditionDialog.ConditionOfBookDialog;
import org.kitapp.UI.Dialogs.LanguageDialog.LanguageDialog;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnTextChanged;
public class OverViewFragment extends Fragment implements OverViewContractor.View {
private final String TAG = OverViewFragment.class.getSimpleName();
private Context mContext;
private OverViewCallback mListener;
private OverViewPresenter mPresenter;
#BindView(R.id.constraint_layout_conditions_root)
LinearLayout conditionRoot;
#BindView(R.id.constraint_layout_languages_root)
LinearLayout languagesRoot;
#BindView(R.id.linear_layout_conditions)
LinearLayout conditions;
#BindView(R.id.root_layout)
LinearLayout rootLayout;
#BindView(R.id.text_view_number_of_characters)
TextView numberOfChars;
#BindView(R.id.edit_text_name_of_book)
EditText nameOfBook;
public interface OverViewCallback {
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_over_view, container, false);
ButterKnife.bind(this, view);
new OverViewPresenter(this);
//rootLayout.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
return view;
}
////// CONTRACTOR METHODS //////
#Override
public void setPresenter(OverViewPresenter presenter) {
this.mPresenter = presenter;
}
////// LISTENERS //////
#Override
#OnClick(R.id.image_button_conditions)
public void showConds() {
ConditionOfBookDialog conditionOfBookDialog = new ConditionOfBookDialog(mContext);
conditionOfBookDialog.show();
}
#Override
#OnClick(R.id.image_button_languages)
public void showLangs() {
LanguageDialog languageDialog = new LanguageDialog(mContext);
languageDialog.show();
}
#Override
#SuppressLint("SetTextI18n")
#OnTextChanged(R.id.edit_text_name_of_book)
public void onNameOfBookChange() {
int len = nameOfBook.getText().toString().trim().length();
numberOfChars.setText(len + "/50");
if (len > 50) {
nameOfBook.setText(nameOfBook.getText().toString().substring(0, 50));
nameOfBook.setSelection(nameOfBook.getText().length());
}
}
////// FRAGMENT METHODS //////
#Override
public void onAttach(Context context) {
super.onAttach(context);
this.mContext = context;
if (context instanceof OverViewCallback) {
mListener = (OverViewCallback) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OverViewCallback");
}
}
#Override
public void onDetach() {
super.onDetach();
mListener = null;
}
}
UI Design and Dialog
In the image above, there are EditTexts Name Of Book and Name of Author. Before showing a dialog, both of them work like a charm. When writing something, the cursor automatically scrolls to the end. Once Dialog has been shown and dismissed, none of them works properly, and the cursor stays at the end of the EditText but still the characters are being written continues in the hidden part.
In this UI it cannot be seen because of the issue, but I've written.
Roses are red, violets are blue, Stackoverflow I love u
But only Roses are red, violets are blue, Stac can be seen.
Weird buggy layout UI image
Please, help me to solve this problem. Thanks in advance.
As a solution, I don't know the underlying reason, but the problem solved once I removed Butterknife library from my project.

choosing from an integer arraylist

Working in Android studio and as part of a bigger app. I will have an ArrayList of Integers and want to send this to a new instance/screen where each integer in the list displays a string description from which the user can pick whatever entry they want. Once they click it, I want the new instance to send back the integer corresponding to the position in the array of their choice so that I can use it for the next operation.
I made this program as a stand-alone just to get this operation down, but it fails to work (ListChooser has stopped working on load)
my MainActivity.java:
package com.example.kenn.listchooser;
import java.util.ArrayList;
import java.util.List;
import android.content.Intent;
import android.hardware.camera2.TotalCaptureResult;
import android.os.Bundle;
import android.os.Parcelable;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.app.ListActivity;
public class MainActivity extends ListActivity {
private static final String TOTAL_COUNT = "total_count";
public ArrayList<Integer> listValues;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listValues= new ArrayList<Integer>();
listValues.add(1);
listValues.add(2);
listValues.add(4);
listValues.add(5);
}
public int randomMe(View view) {
Intent randomIntent = new Intent(this, Chooser.class);
randomIntent.putExtra(TOTAL_COUNT, listValues);
startActivity(randomIntent);
int pick=getIntent().getIntExtra (TOTAL_COUNT, 2);
return pick;
}
public void action(View view) {
TextView showCountTextView = (TextView) findViewById(R.id.textViewA);
showCountTextView.setText(Integer.toString(this.randomMe(view)));
} }
my Chooser.java:
package com.example.kenn.listchooser;
import ...
public class Chooser extends ListActivity{
private String TOTAL_COUNT = "total_count";
private TextView text;
private ArrayList<Integer> listHere;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.chooser);
List<Integer> def = new ArrayList<Integer>();
listHere=getIntent().getIntegerArrayListExtra(TOTAL_COUNT);
text = (TextView) findViewById(R.id.mainText);
// initiate the listadapter
ArrayAdapter<Integer> myAdapter = new ArrayAdapter <Integer>(this,
R.layout.row_layout, R.id.listText, listHere);
// assign the list adapter
setListAdapter(myAdapter);
}
// when an item of the list is clicked
#Override
protected void onListItemClick(ListView list, View view, int position, long id) {
super.onListItemClick(list, view, position, id);
String selectedItem = (String) getListView().getItemAtPosition(position);
Intent randomIntent = new Intent(this, com.example.kenn.listchooser.MainActivity.class);
randomIntent.putExtra(TOTAL_COUNT, selectedItem);
} }
my activity main.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorPrimary"
tools:context=".MainActivity">
<Button
android:id="#+id/random_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="24dp"
android:layout_marginTop="8dp"
android:background="#color/colorPrimaryDark"
android:onClick="action"
android:text="Choose"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="#+id/textViewA"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:text="Alert Dialog"
android:textSize="35dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</android.support.constraint.ConstraintLayout>
my chooser.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/mainText"
android:text="My list" />
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/mainText"
android:id="#android:id/list"
android:background="#aaaaaa" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/mainText"
android:id="#android:id/empty"
android:text="There is no data"
android:textStyle="bold" />
</RelativeLayout>
my row_layout.xml:
<?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" >
<TextView
android:id="#+id/listText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="#ff00ff" />
</LinearLayout>

Fragments not showing content on viewPager scroll - Android

I'm new to Android..
I am trying to create a simple application with a sliding tab to scroll between 2 fragments. The fragments are populated with dummy buttons just to see if the scrolling works. However when I run all I see are the viewPager indexes on top without the fragments. I am also using these two files SlidingTabLayout.java and SlidingTabStrip.java that are given by Android. Here are my classes:
MyFragmentPagerAdapter.java
package billdozer.com.testxml;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
// Holds tab titles
private String tabTitles[] = new String[] { "Frag #1", "Frag #2"};
private Context context;
public MyFragmentPagerAdapter(FragmentManager fm, Context context) {
super(fm);
this.context = context;
}
#Override
public int getCount() {
return 2;
}
// Return the correct Fragment based on index
#Override
public Fragment getItem(int position) {
if(position == 0){
return new TabFragment1();
} else if(position == 1) {
return new TabFragment2();
}
return null;
}
#Override
public CharSequence getPageTitle(int position) {
// Return the tab title to SlidingTabLayout
return tabTitles[position];
}
}
TabFragment1.java
package billdozer.com.testxml;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class TabFragment1 extends Fragment {
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
View view = inflater.inflate(R.layout.tab_fragment_1, container, false);
return view;
}
}
TabFragment2.java
package billdozer.com.testxml;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class TabFragment2 extends Fragment {
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
View view = inflater.inflate(R.layout.tab_fragment_2, container, false);
return view;
}
}
tab_fragment_1.xml
<?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">
<TableLayout
android:id="#+id/tl"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:gravity="center" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center" >
<Button
android:id="#+id/button1"
android:layout_weight="1"
android:text="#string/_1" />
<Button
android:id="#+id/button2"
android:layout_weight="1"
android:text="#string/_2" />
<Button
android:id="#+id/button3"
android:layout_weight="1"
android:text="#string/_3" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<Button
android:id="#+id/button5"
android:layout_weight="1"
android:text="#string/_4" />
<Button
android:id="#+id/button6"
android:layout_weight="1"
android:text="#string/_5" />
<Button
android:id="#+id/button7"
android:layout_weight="1"
android:text="#string/_6" />
</TableRow>
</TableLayout>
</LinearLayout>
tab_fragment_2.xml
<?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">
<TableLayout
android:id="#+id/tl"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:gravity="center" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center" >
<Button
android:id="#+id/button1"
android:layout_weight="1"
android:text="#string/_7" />
<Button
android:id="#+id/button2"
android:layout_weight="1"
android:text="#string/_8" />
<Button
android:id="#+id/button3"
android:layout_weight="1"
android:text="#string/_9" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center" >
<Button
android:id="#+id/button5"
android:layout_weight="1"
android:text="#string/_10" />
<Button
android:id="#+id/button6"
android:layout_weight="1"
android:text="#string/_11" />
<Button
android:id="#+id/button7"
android:layout_weight="1"
android:text="#string/_12" />
</TableRow>
</TableLayout>
</LinearLayout>
MainActivity.java
package com.example.user.billdozer_ui;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import com.example.user.billdozer_ui.stab.SlidingTabLayout;
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
viewPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(),
MainActivity.this));
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
slidingTabLayout.setViewPager(viewPager);
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.user.billdozer_ui.MainActivity">
<com.example.user.billdozer_ui.stab.SlidingTabLayout
android:id="#+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0px" />
</LinearLayout>

SharedElementTransition on fragment dont work

I want to add shared element transition to items in a recyclerview which will opened on another fragment, but nothing works.
The only view that i want to share is an ImageView.
ImageViews and Textviews inside recyclerview items are loaded using Glide for images and firebase database methods for texts. In the detailed fragment, the bitmap of recyclerview item is passed and only the text is downloaded again.
the method which opens the new fragment from recyclerview items is :
homeUserAnnouncesAdapter.setOnCardAnnounceClickedListener(new OnCardAnnounceClickedListener() {
#Override
public void onCardClicked(CardRentAnnounce card, ImageView imageView, int poz) {
Log.v("TRANSITIONTEST", "CLICKED FROM HOME FRAGMENT --- RENT");
Log.v("TRANSITIONTEST", "in onClick: " + imageView.getTransitionName());
Bitmap bitmap = ((BitmapDrawable)imageView.getDrawable()).getBitmap();
OpenRentAnnounceFragment newFragment = OpenRentAnnounceFragment.newInstanceWithImage(card, bitmap, poz);
newFragment.setSharedElementEnterTransition(new DetailsTransition());
newFragment.setEnterTransition(new Fade());
newFragment.setExitTransition(new Fade());
newFragment.setSharedElementReturnTransition(new DetailsTransition());
getActivity().getSupportFragmentManager()
.beginTransaction()
.addSharedElement(imageView, imageView.getTransitionName())
.replace(R.id.content_main_without_toolbar, newFragment)
.addToBackStack(null)
.commit();
}
});
the DetailsTransition class is :
public class DetailsTransition extends TransitionSet{
public DetailsTransition() {
init();
}
/**
* This constructor allows us to use this transition in XML
*/
public DetailsTransition(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
setOrdering(ORDERING_TOGETHER);
addTransition(new ChangeBounds())
.addTransition(new ChangeTransform())
.addTransition(new ChangeImageTransform());
}
}
i'm assigning different transition names for every view, on adapter:
#Override
public void onBindViewHolder(final HomeUserAnnouncesViewHolder holder, int position) {
final CardRentAnnounce cardRentAnnounce = cardRentAnnounceArrayList.get(position);
holder.updateUI(cardRentAnnounce);
ViewCompat.setTransitionName(holder.rentImage, String.valueOf(position) + "_rent");
MaterialRippleLayout mlr = (MaterialRippleLayout)holder.itemView.findViewById(R.id.search_home_ripple);
mlr.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
if(listener != null){
listener.onCardClicked(cardRentAnnounce, holder.rentImage, holder.getAdapterPosition());
}
}
});
}
the id of image in recyclerview item is identically with the image in fragment
i have followed this tutorial to create the transition, even cloned the project to my pc, run on emulator and trying to do exactly like in the working project but still not working.
how i set the image and imageTransition name in new fragment :
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_open_rent_announce, container, false);
rootView = view;
image = (ImageView)view.findViewById(R.id.detailed_image);
image.setImageBitmap(currentImageBitmap);
image.setTransitionName(String.valueOf(pozition) + "_rent");
Log.v("TRANSITIONTEST", "in onCreateView: " + image.getTransitionName());
initViews(view);
setViews();
return view;
}
Fragment SharedElementsTransition tutorial
both images on recyclerview and detailed fragment are loaded with Glide, but i've tried with local images and still no succes.
What did i'm missing? ask for more code if needed.
Thanks.
the full adapter :
package com.minimalart.studentlife.adapters;
import android.content.Context;
import android.net.Uri;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.balysv.materialripple.MaterialRippleLayout;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget;
import com.firebase.ui.storage.images.FirebaseImageLoader;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.minimalart.studentlife.R;
import com.minimalart.studentlife.interfaces.OnCardAnnounceClickedListener;
import com.minimalart.studentlife.interfaces.OnImageReadyListener;
import com.minimalart.studentlife.models.CardRentAnnounce;
import java.util.ArrayList;
/**
* Created by ytgab on 23.01.2017.
*/
public class HomeUserAnnouncesAdapter extends RecyclerView.Adapter<HomeUserAnnouncesAdapter.HomeUserAnnouncesViewHolder>{
public OnCardAnnounceClickedListener listener;
public OnImageReadyListener imageListener;
private ArrayList<CardRentAnnounce> cardRentAnnounceArrayList;
private Context context;
public void setOnCardAnnounceClickedListener(OnCardAnnounceClickedListener listener){
this.listener = listener;
}
public void setOnImageReadyListener(OnImageReadyListener imageListener) {
this.imageListener = imageListener;
}
public HomeUserAnnouncesAdapter(ArrayList<CardRentAnnounce> cardRentAnnounceArrayList, Context context) {
this.cardRentAnnounceArrayList = cardRentAnnounceArrayList;
this.context = context;
}
#Override
public HomeUserAnnouncesViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View announceCard = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_home_user_announces, parent, false);
return new HomeUserAnnouncesAdapter.HomeUserAnnouncesViewHolder(announceCard);
}
#Override
public void onBindViewHolder(final HomeUserAnnouncesViewHolder holder, int position) {
final CardRentAnnounce cardRentAnnounce = cardRentAnnounceArrayList.get(position);
holder.updateUI(cardRentAnnounce);
ViewCompat.setTransitionName(holder.rentImage, String.valueOf(position) + "_rent");
MaterialRippleLayout mlr = (MaterialRippleLayout)holder.itemView.findViewById(R.id.search_home_ripple);
mlr.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
if(listener != null){
listener.onCardClicked(cardRentAnnounce, holder.rentImage, holder.getAdapterPosition());
}
}
});
}
public void loadNewData(ArrayList<CardRentAnnounce> list){
cardRentAnnounceArrayList = list;
}
#Override
public int getItemCount() {
return cardRentAnnounceArrayList.size();
}
public class HomeUserAnnouncesViewHolder extends RecyclerView.ViewHolder{
private TextView rentTitle;
private TextView rentRooms;
private TextView rentPrice;
private TextView rentLocation;
private ImageView rentImage;
private Uri uri;
StorageReference storageReference;
private static final String REF_RENT_IMAGES = "rent-images";
public HomeUserAnnouncesViewHolder(View itemView) {
super(itemView);
rentTitle = (TextView)itemView.findViewById(R.id.card_home_user_announces_title);
rentImage = (ImageView)itemView.findViewById(R.id.detailed_image);
}
public void updateUI(CardRentAnnounce cardRentAnnounce){
getImageURL(cardRentAnnounce.getAnnounceID());
rentTitle.setText(cardRentAnnounce.getTitle());
}
public void getImageURL(String announceID){
FirebaseStorage firebaseStorage = FirebaseStorage.getInstance();
storageReference = firebaseStorage.getReference().child(REF_RENT_IMAGES).child(announceID);
/*rentImage.setImageDrawable(context.getResources().getDrawable(R.drawable.apartment_inside, context.getTheme()));*/
Glide.with(context).using(new FirebaseImageLoader()).load(storageReference).into(new GlideDrawableImageViewTarget(rentImage){
#Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
super.onResourceReady(resource, animation);
Log.v("TRANSITIONTEST", "Image ready");
if(imageListener != null)
imageListener.onImageReady();
}
});
}
public ImageView getRentImage(){
return rentImage;
}
public Uri getUri() {
return uri;
}
public void setUri(Uri uri) {
this.uri = uri;
}
}
}
recyclerview card layout :
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card="http://schemas.android.com/apk/res-auto"
android:layout_width="100dp"
android:layout_height="match_parent"
android:id="#+id/card_home_user_announces"
card:cardElevation="#dimen/card_elevation"
card:cardCornerRadius="#dimen/card_radius">
<com.balysv.materialripple.MaterialRippleLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="#+id/search_home_ripple">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:src="#drawable/apartment_inside"
android:id="#+id/detailed_image"
android:scaleType="centerCrop"
android:adjustViewBounds="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:ellipsize="marquee"
android:id="#+id/card_home_user_announces_title"
android:text="Titlu"
android:textColor="#color/textPrincipal"
android:maxLines="1"
android:lines="1"
android:textSize="16sp"
android:textStyle="normal"/>
</LinearLayout>
</com.balysv.materialripple.MaterialRippleLayout>
</android.support.v7.widget.CardView>
detailed fragment layout :
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.minimalart.studentlife.fragments.OpenRentAnnounceFragment">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/background_light"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="#+id/rent_appbar"
android:layout_width="match_parent"
android:layout_height="300dp"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/rent_detailed_collapsing"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp"
android:descendantFocusability="blocksDescendants">
<ImageView
android:id="#+id/detailed_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
android:src="#drawable/apartment_inside"
app:layout_collapseMode="parallax"
android:transitionName="rentTransition"/>
<android.support.v7.widget.Toolbar
android:id="#+id/detailed_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin"
app:title="Titlu">
</android.support.v7.widget.Toolbar>
<ImageButton
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="left"
android:layout_marginLeft="#dimen/standard_padding"
android:layout_marginTop="#dimen/standard_padding"
android:src="#drawable/ic_arrow_back"
android:background="#color/full_alpha"
android:id="#+id/detailed_back_btn"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
app:behavior_overlapTop="30dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/standard_padding"
android:layout_marginLeft="#dimen/standard_padding"
android:layout_marginRight="#dimen/standard_padding">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/detailed_description"
android:textColor="#color/textSecondary"
android:textSize="16sp"
android:text="Descriere: "
android:padding="#dimen/activity_horizontal_margin" />
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/standard_padding"
android:layout_marginLeft="#dimen/standard_padding"
android:layout_marginRight="#dimen/standard_padding">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/detailed_rooms"
android:textColor="#color/textSecondary"
android:textSize="16sp"
android:text="Număr camere: "
android:padding="#dimen/activity_horizontal_margin" />
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/standard_padding"
android:layout_marginLeft="#dimen/standard_padding"
android:layout_marginRight="#dimen/standard_padding">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/detailed_location"
android:textColor="#color/textSecondary"
android:textSize="16sp"
android:text="Locatie: "
android:padding="#dimen/activity_horizontal_margin" />
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/standard_padding"
android:layout_marginLeft="#dimen/standard_padding"
android:layout_marginRight="#dimen/standard_padding">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/detailed_price"
android:textColor="#color/textSecondary"
android:textSize="16sp"
android:text="Pret: "
android:padding="#dimen/activity_horizontal_margin" />
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/standard_padding"
android:layout_marginLeft="#dimen/standard_padding"
android:layout_marginRight="#dimen/standard_padding"
android:layout_marginBottom="#dimen/standard_padding">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/detailed_discount"
android:textColor="#color/textSecondary"
android:textSize="16sp"
android:text="Discount studenti"
android:padding="#dimen/activity_horizontal_margin" />
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/standard_padding"
android:layout_marginRight="#dimen/standard_padding"
android:layout_marginBottom="#dimen/standard_padding">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/detailed_seller"
android:textSize="16sp"
android:text="#string/open_rent_seller"
android:padding="#dimen/activity_horizontal_margin" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="#+id/detailed_contact_user_email"
android:background="#color/full_alpha"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:text="#string/open_rent_email"
android:textStyle="bold"
android:textColor="#color/textSecondary"
android:layout_weight="1">
</Button>
<Button
android:id="#+id/detailed_contact_user_phone"
android:background="#color/full_alpha"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:text="#string/open_rent_phone"
android:textStyle="bold"
android:textColor="#color/textSecondary"
android:layout_weight="1">
</Button>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_margin="#dimen/activity_horizontal_margin"
android:id="#+id/rent_detailed_fab"
app:fabSize="normal"
android:src="#drawable/ic_favorite"
android:layout_gravity="bottom|end" />
</android.support.design.widget.CoordinatorLayout>
</FrameLayout>

Categories

Resources