Created
December 12, 2016 11:18
-
-
Save Hariofspades/a7466809f134eda2c584b6c5a1d13d52 to your computer and use it in GitHub Desktop.
MainActivity of GradientArtist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hariofspades.artist; | |
import android.os.Bundle; | |
import android.support.design.widget.FloatingActionButton; | |
import android.support.design.widget.Snackbar; | |
import android.support.v7.app.AppCompatActivity; | |
import android.support.v7.widget.Toolbar; | |
import android.view.View; | |
import android.view.Menu; | |
import android.view.MenuItem; | |
import android.widget.ImageView; | |
import com.hariofspades.gradientartist.GradientArtistBasic; | |
public class MainActivity extends AppCompatActivity { | |
GradientArtistBasic gradient; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | |
setSupportActionBar(toolbar); | |
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | |
fab.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) | |
.setAction("Action", null).show(); | |
} | |
}); | |
gradient=(GradientArtistBasic) findViewById(R.id.gradientImage); | |
gradient.setUrlImage("https://img1.etsystatic.com/002/0/6449624/il_fullxfull.382134677_so6e.jpg",R.drawable.weather, | |
R.drawable.weather, ImageView.ScaleType.CENTER_CROP); | |
// gradient.setDrawableImage(R.drawable.me,R.drawable.weather,R.drawable.weather, | |
// ImageView.ScaleType.CENTER_CROP); | |
} | |
@Override | |
public boolean onCreateOptionsMenu(Menu menu) { | |
// Inflate the menu; this adds items to the action bar if it is present. | |
getMenuInflater().inflate(R.menu.menu_main, menu); | |
return true; | |
} | |
@Override | |
public boolean onOptionsItemSelected(MenuItem item) { | |
// Handle action bar item clicks here. The action bar will | |
// automatically handle clicks on the Home/Up button, so long | |
// as you specify a parent activity in AndroidManifest.xml. | |
int id = item.getItemId(); | |
//noinspection SimplifiableIfStatement | |
if (id == R.id.action_settings) { | |
return true; | |
} | |
return super.onOptionsItemSelected(item); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment