1+ import androidx .appcompat .app .AlertDialog ;
2+ import androidx .appcompat .app .AppCompatActivity ;
3+ import androidx .constraintlayout .widget .ConstraintLayout ;
4+
5+ import android .content .Intent ;
6+ import android .graphics .Bitmap ;
7+ import android .graphics .BitmapFactory ;
8+ import android .graphics .Color ;
9+ import android .os .Bundle ;
10+ import android .view .View ;
11+ import android .widget .ImageView ;
12+ import android .widget .ScrollView ;
13+ import android .widget .Toast ;
14+
15+ import com .moithepro .instatoolsandroid .R ;
16+
17+ import java .util .ArrayList ;
18+ import java .util .LinkedList ;
19+
20+ import or .nevet .goraphics .ExceptiOrn ;
21+ import or .nevet .goraphics .GOraphicViewBuilder ;
22+ import or .nevet .goraphics .GOraphics ;
23+ import or .nevet .goraphics .ListActivityGraphics ;
24+
25+
26+ public class InstagramActivity extends AppCompatActivity {
27+
28+ String userName ;
29+ String password ;
30+ private static String newUserName ;
31+ private ListActivityGraphics graphics ;
32+ private ArrayList <GOraphicViewBuilder .OrView > orViews ;
33+
34+ @ Override
35+ protected void onCreate (Bundle savedInstanceState ) {
36+ super .onCreate (savedInstanceState );
37+ setContentView (R .layout .activity_instagram );
38+ orViews = new ArrayList <>();
39+ userName = getIntent ().getStringExtra ("userName" );
40+ password = getIntent ().getStringExtra ("password" );
41+
42+ graphics = GOraphics .createDynamicVerticalListActivity (this , R .drawable .gray , GOraphics .BackgroundImageScaleType .MatchScreen , 60 );
43+ GOraphicViewBuilder .OrView orView = new GOraphicViewBuilder .OrView (this , Color .BLUE );
44+ GOraphicViewBuilder .OrView backButton = GOraphicViewBuilder .BuildSingleOrViewButton (this , 0 , "Back" , Color .WHITE , Color .BLACK , 25 , 0 , new View .OnClickListener () {
45+ @ Override
46+ public void onClick (View v ) {
47+ finish ();
48+ }
49+ });
50+ GOraphicViewBuilder .OrView newProfileButton = GOraphicViewBuilder .BuildSingleOrViewImageButtonByDrawable (this , 0 , R .drawable .plus , 25 , new View .OnClickListener () {
51+ @ Override
52+ public void onClick (View v ) {
53+ Intent intent = new Intent (InstagramActivity .this , AddProfileActivity .class );
54+ startActivity (intent );
55+ }
56+ });
57+ View v = backButton .getView ().getChildAt (0 );
58+ ((ConstraintLayout )v .getParent ()).removeView (v );
59+ orView .placeView (v , 0 );
60+
61+ View v2 = newProfileButton .getView ().getChildAt (0 );
62+ ((ConstraintLayout )v2 .getParent ()).removeView (v2 );
63+ orView .placeView (v2 , 100 );
64+ GOraphics .addOrViewFromTopOfDynamicActivity (graphics , orView );
65+
66+ GOraphicViewBuilder .OrView orView2 = new GOraphicViewBuilder .OrView (this , Color .TRANSPARENT );
67+ ScrollView scrollView = new ScrollView (this );
68+ orView2 .placeView (scrollView , 50 );
69+
70+ addProfile (userName , password );
71+ }
72+
73+ public void addProfile (String userName , String password ) {
74+ //TODO: get the profile picture url, and the text to be shown.
75+
76+ // String url = ;
77+ // String text = ;
78+
79+ String url = "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/1200px-Image_created_with_a_mobile_phone.png" ;
80+ String text = "hello" ;
81+
82+ GOraphicViewBuilder .OrView orView = GOraphicViewBuilder .AddImageButtonToOrViewPackageByUrl (GOraphicViewBuilder .AddBodyTextToOrViewPackage (GOraphicViewBuilder .BuildEmptyOrViewPackage (this , Color .DKGRAY ), text , Color .WHITE , 20 ), url , 300 , 300 , new View .OnClickListener () {
83+ @ Override
84+ public void onClick (View v ) {
85+ GOraphicViewBuilder .OrView orView1 = GOraphicViewBuilder .BuildSingleOrViewImageViewByUrl (InstagramActivity .this , 0 , url , 600 , 600 , Color .TRANSPARENT );
86+ View v3 = orView1 .getView ().getChildAt (0 );
87+ ((ConstraintLayout )v3 .getParent ()).removeView (v3 );
88+ new AlertDialog .Builder (InstagramActivity .this ).setView (v3 ).create ().show ();
89+ }
90+ });
91+ try {
92+ GOraphics .addOrViewToListOfDynamicListActivity (graphics , orView );
93+ } catch (ExceptiOrn exceptiOrn ) {
94+ exceptiOrn .printStackTrace ();
95+ }
96+ orViews .add (orView );
97+
98+ }
99+
100+ public static void setNewUserName (String userName ) {
101+ newUserName = userName ;
102+ }
103+ }
0 commit comments