Skip to content

Commit

Permalink
Expandable Items
Browse files Browse the repository at this point in the history
  • Loading branch information
Anni1123 committed Apr 2, 2021
1 parent 125efe6 commit 385f5df
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 22 deletions.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ dependencies {
implementation 'com.google.android.material:material:1.0.0-beta01'
implementation 'androidx.recyclerview:recyclerview:1.1.0'

compile 'com.github.armcha:SpaceNavigationView:1.6.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation "androidx.cardview:cardview:1.0.0"
implementation 'com.github.armcha:SpaceNavigationView:1.6.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ViewPdfActivity"></activity>
<activity android:name=".ExpandableNewsActivity"></activity>
<activity android:name=".ViewPdfActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
30 changes: 20 additions & 10 deletions app/src/main/java/com/anni/shareimage/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.util.Log;
import android.view.View;

import android.widget.TextView;
import android.widget.Toast;

import android.widget.Button;
Expand All @@ -25,6 +26,8 @@
import com.luseen.spacenavigation.SpaceOnClickListener;
import com.luseen.spacenavigation.SpaceOnLongClickListener;

import org.w3c.dom.Text;

import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
Expand All @@ -39,20 +42,27 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
share=findViewById(R.id.share);
imageView=findViewById(R.id.shareimage);
//initialising text field where we will enter data
share.setOnClickListener(new View.OnClickListener() {
// share=findViewById(R.id.share);
// imageView=findViewById(R.id.shareimage);
TextView text=findViewById(R.id.click);
text.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Now share image function will be called
//here we will be passing the text to share
// Getting drawbale value from iamge
BitmapDrawable bitmapDrawable=(BitmapDrawable)imageView.getDrawable();
Bitmap bitmap=bitmapDrawable.getBitmap();
shareImageandText(bitmap);
startActivity(new Intent(MainActivity.this,ExpandableNewsActivity.class));
}
});
//initialising text field where we will enter data
// share.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// //Now share image function will be called
// //here we will be passing the text to share
//// Getting drawbale value from iamge
// BitmapDrawable bitmapDrawable=(BitmapDrawable)imageView.getDrawable();
// Bitmap bitmap=bitmapDrawable.getBitmap();
// shareImageandText(bitmap);
// }
// });

}
private void shareImageandText(Bitmap bitmap) {
Expand Down
28 changes: 18 additions & 10 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,26 @@
android:gravity="center"
tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/click"
android:text="Name"
android:textSize="32sp"
android:padding="16dp"
android:textColor="#000"/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/recyclerView"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent" />-->

<com.luseen.spacenavigation.SpaceNavigationView
android:id="@+id/space"
android:layout_width="match_parent"
android:layout_gravity="bottom"
android:layout_height="wrap_content"
app:layout_behavior="com.luseen.spacenavigation.SpaceNavigationViewBehavior" />
<!-- <com.luseen.spacenavigation.SpaceNavigationView-->
<!-- android:id="@+id/space"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_gravity="bottom"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:layout_behavior="com.luseen.spacenavigation.SpaceNavigationViewBehavior" />-->
</androidx.coordinatorlayout.widget.CoordinatorLayout>

<!--<?xml version="1.0" encoding="utf-8"?>-->
Expand Down

0 comments on commit 385f5df

Please sign in to comment.